When doing a map preview, no need to process stuff that is only useful in-game.
This speeds up the preview screen back to 2.x speeds. (cherry picked from commit 5f42d0032a9c8dc0b4de60cbef7f9bba8b0b70f0) Conflicts: src/game.c src/map.cmaster
parent
f8517a7716
commit
03914be31b
|
@ -2794,7 +2794,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
//load in the map file
|
||||
aFileName[fileExten] = '\0';
|
||||
strcat(aFileName, "mission.map");
|
||||
if (!mapLoad(aFileName))
|
||||
if (!mapLoad(aFileName, false))
|
||||
{
|
||||
debug(LOG_ERROR, "Failed to load map");
|
||||
return false;
|
||||
|
@ -2942,7 +2942,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
//load in the map file
|
||||
aFileName[fileExten] = '\0';
|
||||
strcat(aFileName, "game.map");
|
||||
if (!mapLoad(aFileName))
|
||||
if (!mapLoad(aFileName, false))
|
||||
{
|
||||
debug( LOG_NEVER, "loadgame: Fail7\n" );
|
||||
return(false);
|
||||
|
|
10
src/map.c
10
src/map.c
|
@ -750,7 +750,7 @@ static BOOL mapSetGroundTypes(void)
|
|||
}
|
||||
|
||||
/* Initialise the map structure */
|
||||
BOOL mapLoad(char *filename)
|
||||
BOOL mapLoad(char *filename, BOOL preview)
|
||||
{
|
||||
UDWORD numGw, width, height;
|
||||
char aFileType[4];
|
||||
|
@ -842,6 +842,12 @@ BOOL mapLoad(char *filename)
|
|||
psMapTiles[i].tileExploredBits = 0;
|
||||
}
|
||||
|
||||
if (preview)
|
||||
{
|
||||
// no need to do anything else for the map preview
|
||||
goto ok;
|
||||
}
|
||||
|
||||
if (!PHYSFS_readULE32(fp, &version) || !PHYSFS_readULE32(fp, &numGw) || version != 1)
|
||||
{
|
||||
debug(LOG_ERROR, "Bad gateway in %s", filename);
|
||||
|
@ -924,7 +930,7 @@ BOOL mapLoad(char *filename)
|
|||
|
||||
/* Set continents. This should ideally be done in advance by the map editor. */
|
||||
mapFloodFillContinents();
|
||||
|
||||
ok:
|
||||
PHYSFS_close(fp);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ extern BOOL mapShutdown(void);
|
|||
extern BOOL mapNew(UDWORD width, UDWORD height);
|
||||
|
||||
/* Load the map data */
|
||||
extern BOOL mapLoad(char *filename);
|
||||
extern BOOL mapLoad(char *filename, BOOL preview);
|
||||
|
||||
/* Save the map data */
|
||||
extern BOOL mapSave(char **ppFileData, UDWORD *pFileSize);
|
||||
|
|
|
@ -278,7 +278,7 @@ void loadMapPreview(bool hideInterface)
|
|||
ptr = strrchr(aFileName, '/');
|
||||
ASSERT(ptr, "this string was supposed to contain a /");
|
||||
strcpy(ptr, "/game.map");
|
||||
if (!mapLoad(aFileName))
|
||||
if (!mapLoad(aFileName, true))
|
||||
{
|
||||
debug(LOG_ERROR, "loadMapPreview: Failed to load map");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue