Skip to content

Commit

Permalink
Merge branch 'bugfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
automerge authored and cybersphinx committed Apr 26, 2012
2 parents c701e27 + 0de0c41 commit d2f0082
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 9 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
@@ -1,3 +1,13 @@
2012-04-25: Version 3.1_beta9
* General:
* Change: Save campaign and skirmish games separately (ticket:3377, commit:d8789661fbffe2f648a06a0689de3a9350bbe8b0)
* Fix: Don't confuse different unit templates (ticket:3146, ticket:3369, commit:28c10b00a8f3bf6d87176e3aba8fba65993cedba)
* Multiplayer:
* Fix: Don't desync after picking up oil barrels (ticket:3396, ticket:3413, commit:b6834d18cb7a42a60675379ca99ae241cb65374e)
* Campaign:
* Change: Disable the save option between campaign missions and the autosave, since the resulting savegames don't always work correctly (ticket:3377, commit:62da559ebe7fbb0ede9592b4b5d9382fecd9ef09)
* Fix: Don't slow the game down by spamming asserts (ticket:3403, commit:9775d0c4f66f80d6378cee0dc9ea31d3cdfe5708)

2012-04-22: Version 3.1_beta8 2012-04-22: Version 3.1_beta8
* General: * General:
* Change: Make screen shake not shake on walls, and the duration depend on what was destroyed (commit:33842677af6b6cb591c5a3a677849eb600e10e2f) * Change: Make screen shake not shake on walls, and the duration depend on what was destroyed (commit:33842677af6b6cb591c5a3a677849eb600e10e2f)
Expand Down
17 changes: 17 additions & 0 deletions po/generate-statistics-html.py
@@ -1,5 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python


# Warzone 2100 Translation Status Generator
# Copyright (C) 2012 Michal Dutkiewicz aka Emdek <emdeck@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

import glob import glob
import os import os
import re import re
Expand Down
2 changes: 2 additions & 0 deletions src/frontend.cpp
Expand Up @@ -274,6 +274,8 @@ static void SPinit(void)
{ {
uint8_t playercolor; uint8_t playercolor;


// clear out the skDiff array
memset(game.skDiff, 0x0, sizeof(game.skDiff));
NetPlay.bComms = false; NetPlay.bComms = false;
bMultiPlayer = false; bMultiPlayer = false;
bMultiMessages = false; bMultiMessages = false;
Expand Down
27 changes: 20 additions & 7 deletions src/game.cpp
Expand Up @@ -3729,7 +3729,7 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)
PHYSFS_file* fileHandle = openSaveFile(fileName); PHYSFS_file* fileHandle = openSaveFile(fileName);
if (!fileHandle) if (!fileHandle)
{ {
debug(LOG_ERROR, "writeGameFile: openSaveFile(\"%s\") failed", fileName); debug(LOG_ERROR, "openSaveFile(\"%s\") failed", fileName);
return false; return false;
} }


Expand All @@ -3744,15 +3744,14 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)


if (!serializeSaveGameHeader(fileHandle, &fileHeader)) if (!serializeSaveGameHeader(fileHandle, &fileHeader))
{ {
debug(LOG_ERROR, "game.c:writeGameFile: could not write header to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError()); debug(LOG_ERROR, "could not write header to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle); PHYSFS_close(fileHandle);
return false; return false;
} }


ASSERT( saveType == GTYPE_SAVE_START || ASSERT( saveType == GTYPE_SAVE_START || saveType == GTYPE_SAVE_MIDMISSION, "invalid save type" );
saveType == GTYPE_SAVE_MIDMISSION, // clear out structure
"writeGameFile: invalid save type" ); memset(&saveGame, 0x0, sizeof(SAVE_GAME));

// saveKeymissionIsOffworld // saveKeymissionIsOffworld
saveGame.saveKey = getCampaignNumber(); saveGame.saveKey = getCampaignNumber();
if (missionIsOffworld()) if (missionIsOffworld())
Expand Down Expand Up @@ -3902,7 +3901,21 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)


//version 38 //version 38
sstrcpy(saveGame.modList, getModList()); sstrcpy(saveGame.modList, getModList());

// Attempt to see if we have a corrupted game structure in campaigns.
if (saveGame.sGame.type == CAMPAIGN)
{
// player 0 is always a human in campaign games
for (int i=1; i < MAX_PLAYERS; i++)
{
if (saveGame.sGame.skDiff[i] == UBYTE_MAX)
{
ASSERT(!"savegame corruption!","savegame corruption!");
debug(LOG_ERROR, "Savegame corruption detected, trying to salvage. Please Report this issue @ wz2100.net");
debug(LOG_ERROR, "skDiff[i] was %d, level %s / %s, ", (int)saveGame.sGame.skDiff[i], saveGame.levelName, saveGame.sGame.map);
saveGame.sGame.skDiff[i] = 0;
}
}
}
status = serializeSaveGameData(fileHandle, &saveGame); status = serializeSaveGameData(fileHandle, &saveGame);


// Close the file // Close the file
Expand Down
19 changes: 17 additions & 2 deletions src/template.cpp
Expand Up @@ -355,8 +355,23 @@ bool loadDroidTemplates(const char *pDroidData, UDWORD bufferSize)


// This sets up the UI templates for display purposes ONLY--we still only use apsDroidTemplates for making them. // This sets up the UI templates for display purposes ONLY--we still only use apsDroidTemplates for making them.
// FIXME: Why are we doing this here, and not on demmand ? // FIXME: Why are we doing this here, and not on demmand ?
localTemplates.push_front(design); // Only add unique designs to the UI list (Note, perhaps better to use std::map instead?)
localTemplates.front().pName = strdup(localTemplates.front().pName); std::list<DROID_TEMPLATE>::iterator it;
for (it = localTemplates.begin(); it != localTemplates.end(); ++it)
{
DROID_TEMPLATE *psCurr = &*it;
if (psCurr->multiPlayerID == design.multiPlayerID)
{
debug(LOG_NEVER, "Design id:%d (%s) *NOT* added to UI list (duplicate), player= %d", design.multiPlayerID, design.aName, i);
break;
}
}
if (it == localTemplates.end())
{
debug(LOG_NEVER, "Design id:%d (%s) added to UI list, player =%d", design.multiPlayerID, design.aName, i);
localTemplates.push_front(design);
localTemplates.front().pName = strdup(localTemplates.front().pName);
}
} }
else if (NetPlay.players[i].allocated) //skip the ones not meant for puny humans else if (NetPlay.players[i].allocated) //skip the ones not meant for puny humans
{ {
Expand Down

0 comments on commit d2f0082

Please sign in to comment.