Skip to content

Commit

Permalink
Fix indentation; add a comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel committed Apr 2, 2011
1 parent 2083b1f commit a3cff87
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
8 changes: 4 additions & 4 deletions src/game.cpp
Expand Up @@ -4330,10 +4330,10 @@ bool gameLoadV(PHYSFS_file* fileHandle, unsigned int version)
if (version >= VERSION_38)
{
setOverrideMods(saveGameData.modList);
if (saveGameData.sGame.map[0]) // there is a map here
{
setOverrideMap(saveGameData.sGame.map, saveGameData.sGame.maxPlayers);
}
if (saveGameData.sGame.map[0])
{
setOverrideMap(saveGameData.sGame.map, saveGameData.sGame.maxPlayers);
}
}

// All savegames from version 34 or before are little endian so swap them. All
Expand Down
53 changes: 27 additions & 26 deletions src/main.cpp
Expand Up @@ -261,25 +261,26 @@ void setOverrideMods(char * modlist)
}
void setOverrideMap(char* map, int maxPlayers)
{
override_map[0] = (char*)malloc(strlen(map)+1+6);
override_map[0][0] = '0' + maxPlayers;
override_map[0][1] = '\0';
strcat(override_map[0],"c-");
if (strncmp(map, "Sk-", 3) == 0)
{
strcat(override_map[0],map+3);
}
else
{
strcat(override_map[0],map);
}
if (strncmp(override_map[0]+strlen(override_map[0])-3,"-T",2) == 0)
{
override_map[0][strlen(override_map[0])-3] = '\0';
}
strcat(override_map[0],".wz");
override_map[1] = NULL;
use_override_map = true;
// Transform "Sk-Rush-T2" into "4c-Rush.wz" so it can be matched by the map loader
override_map[0] = (char*)malloc(strlen(map)+1+6);
override_map[0][0] = '0' + maxPlayers;
override_map[0][1] = '\0';
strcat(override_map[0],"c-");
if (strncmp(map, "Sk-", 3) == 0)
{
strcat(override_map[0],map+3);
}
else
{
strcat(override_map[0],map);
}
if (strncmp(override_map[0]+strlen(override_map[0])-3,"-T",2) == 0)
{
override_map[0][strlen(override_map[0])-3] = '\0';
}
strcat(override_map[0],".wz");
override_map[1] = NULL;
use_override_map = true;
}
void clearOverrides(void)
{
Expand All @@ -292,12 +293,12 @@ void clearOverrides(void)
override_mods[0] = NULL;
override_mod_list = NULL;

if (override_map[0])
{
free(override_map[0]);
override_map[0] = NULL;
}
use_override_map = false;
if (override_map[0])
{
free(override_map[0]);
override_map[0] = NULL;
}
use_override_map = false;
}

void addLoadedMod(const char * modname)
Expand Down Expand Up @@ -762,7 +763,7 @@ static void startGameLoop(void)
{
SetGameMode(GS_NORMAL);

if (!levLoadData(aLevelName, NULL, GTYPE_SCENARIO_START))
if (!levLoadData(aLevelName, NULL, GTYPE_SCENARIO_START))
{
debug( LOG_FATAL, "Shutting down after failure" );
exit(EXIT_FAILURE);
Expand Down

0 comments on commit a3cff87

Please sign in to comment.