User Name:


Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Sogou, DotBot

Members: 0
Guests: 6
Newest Member
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

Black Hand
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


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 );
	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 );

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;
  terr = SECT_OCEAN;
    putterr( mapnumber, x, y, terr );
   FCLOSE( fp );

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 >>