Permalink
Browse files

Merge branch 'bugfixes'

  • Loading branch information...
2 parents c701e27 + 0de0c41 commit d2f0082cebad05a516e80989c3b781fb774c0219 automerge committed with cybersphinx Apr 26, 2012
Showing with 66 additions and 9 deletions.
  1. +10 −0 ChangeLog
  2. +17 −0 po/generate-statistics-html.py
  3. +2 −0 src/frontend.cpp
  4. +20 −7 src/game.cpp
  5. +17 −2 src/template.cpp
View
@@ -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
* General:
* Change: Make screen shake not shake on walls, and the duration depend on what was destroyed (commit:33842677af6b6cb591c5a3a677849eb600e10e2f)
@@ -1,5 +1,22 @@
#!/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 os
import re
View
@@ -274,6 +274,8 @@ static void SPinit(void)
{
uint8_t playercolor;
+ // clear out the skDiff array
+ memset(game.skDiff, 0x0, sizeof(game.skDiff));
NetPlay.bComms = false;
bMultiPlayer = false;
bMultiMessages = false;
View
@@ -3729,7 +3729,7 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)
PHYSFS_file* fileHandle = openSaveFile(fileName);
if (!fileHandle)
{
- debug(LOG_ERROR, "writeGameFile: openSaveFile(\"%s\") failed", fileName);
+ debug(LOG_ERROR, "openSaveFile(\"%s\") failed", fileName);
return false;
}
@@ -3744,15 +3744,14 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)
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);
return false;
}
- ASSERT( saveType == GTYPE_SAVE_START ||
- saveType == GTYPE_SAVE_MIDMISSION,
- "writeGameFile: invalid save type" );
-
+ ASSERT( saveType == GTYPE_SAVE_START || saveType == GTYPE_SAVE_MIDMISSION, "invalid save type" );
+ // clear out structure
+ memset(&saveGame, 0x0, sizeof(SAVE_GAME));
// saveKeymissionIsOffworld
saveGame.saveKey = getCampaignNumber();
if (missionIsOffworld())
@@ -3902,7 +3901,21 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)
//version 38
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);
// Close the file
View
@@ -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.
// FIXME: Why are we doing this here, and not on demmand ?
- localTemplates.push_front(design);
- localTemplates.front().pName = strdup(localTemplates.front().pName);
+ // Only add unique designs to the UI list (Note, perhaps better to use std::map instead?)
+ 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
{

0 comments on commit d2f0082

Please sign in to comment.