Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Yahoo!

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » [Bug] Converted areas don't h...
Forum Rules | Mark all | Recent Posts

[Bug] Converted areas don't have valid datestamps on them.
< Newer Topic :: Older Topic > AFKMud 2.02

Pages:<< prev 1 next >>
Post is unread #1 Dec 16, 2007, 1:07 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Converted areas don't have valid datestamps on them.
Danger: Trivial - Mainly a cosmetic thing. Has no real impact on anything.
Discovered in: AFKMud 2.02
Found by: Ransom
Fixed by: Remcon

---

areaconvert.cpp

At the top of the includes list, add:
#include <sys/stat.h>


areaconvert.cpp, load_stock_area_file

Locate:
   area_data *tarea = NULL;
   char *word;

   if( manual )
   {
      char fname[256];

      snprintf( fname, 256, "%s%s", AREA_CONVERT_DIR, filename );
      if( !( fpArea = fopen( fname, "r" ) ) )
      {
         perror( fname );
         bug( "%s: Error locating area file for conversion. Not present in conversion directory.", __FUNCTION__ );
         return;
      }
   }
   else if( !( fpArea = fopen( filename, "r" ) ) )
   {
      perror( filename );
      bug( "%s: error loading file (can't open) %s", __FUNCTION__, filename );
      return;
   }


Change to:
   area_data *tarea = NULL;
   char *word;
   struct stat fst;
   time_t umod = 0;

   if( manual )
   {
      char fname[256];

      snprintf( fname, 256, "%s%s", AREA_CONVERT_DIR, filename );
      if( !( fpArea = fopen( fname, "r" ) ) )
      {
         perror( fname );
         bug( "%s: Error locating area file for conversion. Not present in conversion directory.", __FUNCTION__ );
         return;
      }
      if( stat( fname, &fst ) != -1 )
         umod = fst.st_mtime;
   }
   else if( !( fpArea = fopen( filename, "r" ) ) )
   {
      perror( filename );
      bug( "%s: error loading file (can't open) %s", __FUNCTION__, filename );
      return;
   }

   if( umod == 0 && stat( filename, &fst ) != -1 )
      umod = fst.st_mtime;


Locate:
      if( tarea->low_vnum < 0 || tarea->hi_vnum < 0 )
         bug( "%-20s: Bad Vnum Range", tarea->filename );
      if( !tarea->author )
         tarea->author = STRALLOC( "Unknown" );


Change to:
      if( tarea->low_vnum < 0 || tarea->hi_vnum < 0 )
         bug( "%-20s: Bad Vnum Range", tarea->filename );
      if( !tarea->author )
         tarea->author = STRALLOC( "Unknown" );
      if( !tarea->creation_date )
         tarea->creation_date = umod;
      if( !tarea->install_date )
         tarea->install_date = umod;


This is mainly an aesthetic thing. Converted areas will not carry a date/time stamp for their creation or installation since Smaug does not have these fields. Remcon's fix will use the file's last modification date to make a semi-educated guess. This is likely to result in inaccurate data, but it's still going to be marginally better than having areas show up as being created and installed in 1969.
       
Pages:<< prev 1 next >>