Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
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
LoP 1.46
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl, Naver, Bing

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Overland data saved in ...
Forum Rules | Mark all | Recent Posts

[Bug] Overland data saved in invalid bitmap format
< Newer Topic :: Older Topic > AFKMud 1.63

Pages:<< prev 1 next >>
Post is unread #1 Jun 26, 2004, 3:53 pm   Last edited Nov 13, 2005, 12:15 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Overland data saved in invalid bitmap format.
Discovered in: AFKMud 1.63
Danger: Medium - Data corruption
Found by: Muerte
Fixed by: Samson

overland.c,

Find the save_map function, and replace it with:

/* As it implies, this saves the map you are currently standing on to disk.
 * Output is in graphic format, making it easily edited with most paint programs.
 * Could also be used as a method for filtering bad color data out of your source
 * image if it had any at loadup. This code should only be called from the mapedit
 * command. Using it in any other way could break something.
 */
void save_map( char *name, sh_int map )
{
   FILE *gfp;
   char graphicname[256];
   sh_int x, y, terr;

   name = strlower( name ); /* Forces filename into lowercase */

   snprintf( graphicname, 256, "%s%s.raw", MAP_DIR, name );

   if( ( gfp = fopen( graphicname, "w" ) ) == NULL )
   {
	bug( "%s", "save_map: fopen" );
	perror( graphicname );
   }
   else
   {
	for( y = 0; y < MAX_Y; y++ )
	{
    for( x = 0; x = SECT_MAX || terr < 0 )
       {
     bug( "save_map: Terrain data out of bounds!!! Value found: %hd - replacing with Ocean.", terr );
     terr = SECT_OCEAN;
       }
  fputc( sect_show[terr].graph1, gfp );
  fputc( sect_show[terr].graph2, gfp );
  fputc( sect_show[terr].graph3, gfp );
    }
	}
	FCLOSE( gfp );
   }
   return;
}


Then find the load_mapfile function and replace it with:

/* As it implies, loads the map from the graphic file */
void load_mapfile( char *mapfile, sh_int mapnumber )
{
   FILE *fp;
   char filename[256];
   sh_int graph1, graph2, graph3, x, y, z;
   sh_int terr = SECT_OCEAN;

   log_printf( "Loading continent of %s.....", map_names[mapnumber] );

   snprintf( filename, 256, "%s%s", MAP_DIR, mapfile );

   if( !( fp = fopen( filename, "r" ) ) )
   {
	bug( "load_continent: Missing graphical map file %s for continent!", mapfile );
	shutdown_mud( "Missing map file" );
	exit( 1 );
   }

   for( y = 0; y < MAX_Y; y++ )
   {
  	for( x = 0; x < MAX_X; x++ )
	{
    graph1 = getc( fp );
    graph2 = getc( fp );
    graph3 = getc( fp );

         for( z = 0; z < SECT_MAX; z++ )
    {
  if( sect_show[z].graph1 == graph1
   && sect_show[z].graph2 == graph2
   && sect_show[z].graph3 == graph3 )
  {
     terr = z;
     break;
  }
  terr = SECT_OCEAN;
    }
    putterr( mapnumber, x, y, terr );
	}
   }
   FCLOSE( fp );
   return;
}


Then near the top of overland.c, find the map_filenames array and replace it with:

char *const map_filenames[] =
{
   "alsherok.raw", "eletar.raw", "alatia.raw"
};


Be sure to watch out you don't wipe out an existing filename doing this if you've already made changes to the system.

This change needed to be made because the bitmap support supplied by Eos was improperly done. The correct method is not known at this time and thus it was decided to return to the .raw files which worked properly before. The problem arises from saving a map file in game, and then trying to load the .bmp into Windows paint, which is sadly the most common way people would be trying to do this. Sometimes the file would load, but then saving it would create a bitmap with header data that didn't match up and would cause the mud to be unable to load the file. This defeated the entire purpose in switching formats. It was also later found that Paintshop Pro 8 is better able to handle editing .raw files directly anyway.
       
Pages:<< prev 1 next >>