Permalink
Browse files

Merge branch 'bugfixes' into 3.1

  • Loading branch information...
2 parents 70a4169 + 74c153c commit 7c76d4eaff71258bb94d4c5cd86d8d4ffef53ccb automerge committed with cybersphinx Aug 3, 2012
View
2 .gitignore
@@ -213,7 +213,7 @@ tools/qwzm/ui_qwzm.h
macosx/Warzone.xcodeproj/xcuserdata/*
macosx/Warzone.xcodeproj/project.xcworkspace/xcuserdata/*
macosx/Warzone.xcworkspace/xcuserdata/*
-macosx/configs/codeident
+macosx/configs/CS-ID.xcconfig
# build folders
/macosx/build/
View
16 ChangeLog
@@ -1,3 +1,19 @@
+2012-08-05: Version 3.1 rc1
+ * General:
+ * Change: Allow multiple AIs with similar names (commit:ee95d785bdfd72a490863d7cdb3f504f88f9eecd)
+ * Change: Increase the maximum number of terrain tiles (commit:ab44eafb7bd1daa2d0f4efe367673b4c2985a05d)
+ * Change: No longer save last map played (ticket:3618)
+ * Fix: Saving the game might crash it (ticket:3620, commit:fdb1c0b52153d3368ae79e8f0befdd2744b43692)
+ * Fix: Qt backend compatibility with Qt 4.8.2 (ticket:3562, commit:df32833ab8b17e6db5815b7eca9f5fe01a5b7f8f)
+ * Fix: Scavengers in challenges were always disabled (ticket:3630, commit:95677b02b9959b05372e7dc10286fe184bfd6cdd)
+ * Fix: Moving repair delivery points (ticket:3581, commit:caabd96741fb3113dc96127ae32826ada643992a)
+ * Fix: Destroyed research lab can no longer block research (ticket:3570, commit:6a04b6ad677678e1d824209dda45a70f85b64a96)
+ * Fix: Do not halt production on template becoming redundant (commit:7621581c8f76f3b7a774182cd3b5eee8e26b7954)
+ * Fix: Do not require texture_env_crossbar for shaders (ticket:3575, ticket:3629, commit:64a3cc13deda9a59aae2cf0705c68dbe3eadeaa8)
+ * Fix: Various memory issues (commit:032956e649e69aa51edd80787c9c94bf2c08d164, commit:88e94391669e54808b2d6f40cba994d3501efb08)
+ * Fix: Possible crash when delivery points are removed (commit:6382bbb08ea7e6ca93a0ba83fdb65952778c962a, ticket:2041)
+ * Fix: Fix loading of campaign savegames (commit:1461b3a5a81b72381bc3cc3dbc57bbd2f5ce22a7, commit:9784c655af2a66bd541268e2c9e6f19fcd1ac200)
+
2012-06-20: Version 3.1 beta11
* General:
* Change: CB sensor also defends allies (commit:313738ed235c69c64c83eb9b987d63efc95d8782)
View
0 data/mp/multiplay/skirmish/nullbot-ge.inc.js → ...multiplay/skirmish/nullbot-generic.js.inc
File renamed without changes.
View
0 ...mp/multiplay/skirmish/nullbot-head.inc.js → .../multiplay/skirmish/nullbot-header.js.inc
File renamed without changes.
View
0 ...mp/multiplay/skirmish/nullbot-tail.inc.js → ...mp/multiplay/skirmish/nullbot-main.js.inc
File renamed without changes.
View
6 data/mp/multiplay/skirmish/nullbot.js
@@ -1,8 +1,8 @@
const DEF_LIGHT = 0; // change 0 to 1 to get a weaker AI with lower CPU usage
-include("multiplay/skirmish/nullbot-head.inc.js");
+include("multiplay/skirmish/nullbot-header.js.inc");
-include("multiplay/skirmish/nullbot-ge.inc.js");
+include("multiplay/skirmish/nullbot-generic.js.inc");
-include("multiplay/skirmish/nullbot-tail.inc.js");
+include("multiplay/skirmish/nullbot-main.js.inc");
View
4 lib/framework/frameresource.cpp
@@ -419,6 +419,7 @@ bool resLoadFile(const char *pType, const char *pFile)
{
if (psT->HashedType == HashedType)
{
+ ASSERT(strcmp(psT->aType, pType) == 0, "Hash collision \"%s\" vs \"%s\"", psT->aType, pType);
break;
}
}
@@ -435,7 +436,8 @@ bool resLoadFile(const char *pType, const char *pFile)
{
if(psRes->HashedID == HashedName)
{
- debug(LOG_WZ, "resLoadFile: Duplicate file name: %s (hash %x) for type %s",
+ ASSERT(strcasecmp(psRes->aID, pFile) == 0, "Hash collision \"%s\" vs \"%s\"", psRes->aID, pFile);
+ debug(LOG_WZ, "Duplicate file name: %s (hash %x) for type %s",
pFile, HashedName, psT->aType);
// assume that they are actually both the same and silently fail
// lovely little hack to allow some files to be loaded from disk (believe it or not!).
View
6 lib/netplay/netplay.cpp
@@ -1989,7 +1989,7 @@ UBYTE NETrecvFile(NETQUEUE queue)
}
NetPlay.pMapFileHandle = PHYSFS_openWrite(fileName); // create a new file.
- NetPlay.mapFileName = fileName;
+ sstrcpy(NetPlay.mapFileName, fileName);
}
debug(LOG_NET, "New file position is %d", currPos);
@@ -2022,10 +2022,10 @@ UBYTE NETrecvFile(NETQUEUE queue)
debug(LOG_ERROR, "Could not close file handle after trying to save map: %s", PHYSFS_getLastError());
}
NetPlay.pMapFileHandle = NULL;
- PHYSFS_File *file = PHYSFS_openRead(NetPlay.mapFileName.c_str());
+ PHYSFS_File *file = PHYSFS_openRead(NetPlay.mapFileName);
int actualFileSize = PHYSFS_fileLength(file);
PHYSFS_close(file);
- NetPlay.mapFileName.clear();
+ NetPlay.mapFileName[0] = '\0';
ASSERT(actualFileSize == fileSize, "Downloaded map too small! Got %d, expected %d!", actualFileSize, fileSize);
}
View
2 lib/netplay/netplay.h
@@ -273,7 +273,7 @@ struct NETPLAY
bool isUPNP; // if we want the UPnP detection routines to run
bool isHostAlive; /// if the host is still alive
PHYSFS_file * pMapFileHandle; ///< Only non-NULL during map download.
- std::string mapFileName; ///< Only valid during map download.
+ char mapFileName[255]; ///< Only valid during map download.
char gamePassword[password_string_size]; //
bool GamePassworded; // if we have a password or not.
bool ShowedMOTD; // only want to show this once
View
14 lib/qtgame/wzapp_qt.cpp
@@ -22,7 +22,7 @@
* Qt-related functions.
*/
-#include <QtGui/QImageReader>
+#include <QtGui/QImage>
#include <QtGui/QBitmap>
#include <QtGui/QPainter>
#include <QtGui/QMouseEvent>
@@ -112,11 +112,9 @@ unsigned screenHeight = 0; // Declared in frameint.h.
static void inputAddBuffer(UDWORD key, utf_32_char unicode);
static int WZkeyToQtKey(int code);
-void WzMainWindow::loadCursor(CURSOR cursor, int x, int y, QImageReader &buffer)
+void WzMainWindow::loadCursor(CURSOR cursor, int x, int y, QImage const &buffer)
{
- buffer.device()->reset();
- buffer.setClipRect(QRect(x, y, 32, 32));
- cursors[cursor] = new QCursor(QPixmap::fromImage(buffer.read()));
+ cursors[cursor] = new QCursor(QPixmap::fromImage(buffer.copy(x, y, 32, 32)));
}
WzMainWindow::WzMainWindow(QSize resolution, const QGLFormat &format, QWidget *parent) : QtGameWidget(resolution, format, parent)
@@ -135,10 +133,10 @@ WzMainWindow::WzMainWindow(QSize resolution, const QGLFormat &format, QWidget *p
#endif
setWindowTitle(PACKAGE_NAME);
- QImageReader buffer("wz::images/intfac5.png", "PNG");
- if (!buffer.canRead())
+ QImage buffer("wz::images/intfac5.png", "PNG");
+ if (buffer.isNull())
{
- debug(LOG_ERROR, "Failed to read cursor image: %s", buffer.errorString().toAscii().constData());
+ debug(LOG_ERROR, "Failed to read cursor image.");
}
loadCursor(CURSOR_EMBARK, 0, 128, buffer);
loadCursor(CURSOR_DEST, 32, 128, buffer);
View
4 lib/qtgame/wzapp_qt.h
@@ -21,7 +21,7 @@
#define WZAPP_H
#include <QtGui/QApplication>
-#include <QtGui/QImageReader>
+#include <QtGui/QImage>
#include <QtOpenGL/QGLWidget>
#include <QtCore/QBuffer>
#include <QtCore/QTime>
@@ -44,7 +44,7 @@ class WzMainWindow : public QtGameWidget
Q_OBJECT
private:
- void loadCursor(CURSOR cursor, int x, int y, QImageReader &buffer);
+ void loadCursor(CURSOR cursor, int x, int y, QImage const &buffer);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
View
88 macosx/Warzone.xcodeproj/project.pbxproj
@@ -23,6 +23,7 @@
438B0C101377317F008184FC /* Gettext - Fetch source */,
);
dependencies = (
+ 43D670EA15C8506A000AD02A /* PBXTargetDependency */,
);
name = "Fetch Third Party Sources";
productName = "Fetch Third Party Sources";
@@ -38,6 +39,17 @@
name = Autorevision;
productName = Autorevision;
};
+ 43D670E515C85038000AD02A /* CS-ID */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 43D670ED15C85090000AD02A /* Build configuration list for PBXAggregateTarget "CS-ID" */;
+ buildPhases = (
+ 43D670E415C85038000AD02A /* Make CS-ID */,
+ );
+ dependencies = (
+ );
+ name = "CS-ID";
+ productName = "CS-ID";
+ };
43F77C7710F0125E00E04615 /* Make DMGs for Release */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 43F77C8A10F0126F00E04615 /* Build configuration list for PBXAggregateTarget "Make DMGs for Release" */;
@@ -939,6 +951,20 @@
remoteGlobalIDString = 43D180771336B6BF001906EB;
remoteInfo = Autorevision;
};
+ 43D670E915C8506A000AD02A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 02356D660BD3BB2600E9A019 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 43D670E515C85038000AD02A;
+ remoteInfo = "CS-ID";
+ };
+ 43D670EB15C85072000AD02A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 02356D660BD3BB2600E9A019 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 43D670E515C85038000AD02A;
+ remoteInfo = "CS-ID";
+ };
43FA571210FF8EE90074E914 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 02356D660BD3BB2600E9A019 /* Project object */;
@@ -1600,6 +1626,7 @@
4333612111A07FB900380F5E /* QtOpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QtOpenGL.framework; path = external/QT/QtOpenGL.framework; sourceTree = SOURCE_ROOT; };
4336D8A8111DDF0F0012E8E4 /* random.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = random.cpp; path = ../src/random.cpp; sourceTree = SOURCE_ROOT; };
4336D8A9111DDF0F0012E8E4 /* random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = random.h; path = ../src/random.h; sourceTree = SOURCE_ROOT; };
+ 433A44F715C6CA4000D1856A /* CS-ID.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "CS-ID.xcconfig"; path = "configs/CS-ID.xcconfig"; sourceTree = SOURCE_ROOT; };
434117201495024C003F06FF /* wzconfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wzconfig.cpp; path = ../lib/framework/wzconfig.cpp; sourceTree = SOURCE_ROOT; };
434117211495024C003F06FF /* wzconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wzconfig.h; path = ../lib/framework/wzconfig.h; sourceTree = SOURCE_ROOT; };
4343651C149EA04800527137 /* template.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = template.cpp; path = ../src/template.cpp; sourceTree = SOURCE_ROOT; };
@@ -2765,6 +2792,7 @@
43025DEC1120A4B6006C49B1 /* Configurations */ = {
isa = PBXGroup;
children = (
+ 433A44F715C6CA4000D1856A /* CS-ID.xcconfig */,
43CCDD9414BA502600B21363 /* Fribidi-All.xcconfig */,
43CCDD9514BA502600B21363 /* Fribidi-Debug.xcconfig */,
43CCDD9614BA502600B21363 /* Fribidi-Release.xcconfig */,
@@ -3791,6 +3819,7 @@
buildRules = (
);
dependencies = (
+ 43D670EC15C85072000AD02A /* PBXTargetDependency */,
);
name = MiniUPnPc;
productName = MiniUPnPc;
@@ -3941,6 +3970,7 @@
targets = (
02356D740BD3BB3400E9A019 /* Warzone */,
43D180771336B6BF001906EB /* Autorevision */,
+ 43D670E515C85038000AD02A /* CS-ID */,
43FA570C10FF8E9B0074E914 /* Setup Prebuilt Components */,
438B0C05137730FE008184FC /* Fetch Third Party Sources */,
4318434A1363942200BA2BC5 /* MiniUPnPc */,
@@ -4445,6 +4475,20 @@
shellPath = /bin/sh;
shellScript = "# Config\nexport PATH=$PATH:/sw/bin:/opt/local/bin\nsauto=\"src/autorevision.h\"\ntauto=\"${OBJROOT}/autorev/autorevision.h\"\nfunction hfilter {\n\trm -f \"${OBJROOT}/autorevision.h\"\n\tsed -e 's:refs/heads/:branch/:' -e 's:refs/remotes/:remote/:' -e 's:branch/master:Master:' -e 's:\tv:\t:' -e 's:v/::' \"${sauto}\" | sed -e 's:_beta: Beta :' -e 's:_rc: RC :' > \"${OBJROOT}/autorevision.h\"\n}\nfunction bauto {\n\tif ! ./build_tools/autorevision.sh \"${tauto}\"; then\n\t\techo \"error: Could not run Autorevision\"\n\t\texit 1\n\tfi\n}\n\ncd ..\n\nif [[ ! -d \".git\" ]] && [[ ! -d \".hg\" ]] && [[ -f \"${sauto}\" ]]; then\n\t# Do not run if we will not get useful information\n\techo \"Not a repo.\"\n\thfilter\n\texit 0\nelif [ -d \"${OBJROOT}/autorev/\" ]; then\n\t# Only update src/autorevision.h if something has changed\n\tbauto\n\tmdck1=`md5 -q \"${sauto}\"`\n\tmdck2=`md5 -q \"${tauto}\"`\n\tif [ \"${mdck1}\" = \"${mdck2}\" ]; then\n\t\texit 0\n\tfi\nelse\n\tmkdir \"${OBJROOT}/autorev/\"\n\tbauto\nfi\n\ncp -a \"${tauto}\" \"${sauto}\"\nhfilter\nexit 0\n";
};
+ 43D670E415C85038000AD02A /* Make CS-ID */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Make CS-ID";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = ". configs/fetchscripts/SetupPrebuiltComponents-CS-ID.sh";
+ };
43F77C7610F0125E00E04615 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -5055,6 +5099,16 @@
target = 43D180771336B6BF001906EB /* Autorevision */;
targetProxy = 43D1808A1336B74E001906EB /* PBXContainerItemProxy */;
};
+ 43D670EA15C8506A000AD02A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 43D670E515C85038000AD02A /* CS-ID */;
+ targetProxy = 43D670E915C8506A000AD02A /* PBXContainerItemProxy */;
+ };
+ 43D670EC15C85072000AD02A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 43D670E515C85038000AD02A /* CS-ID */;
+ targetProxy = 43D670EB15C85072000AD02A /* PBXContainerItemProxy */;
+ };
43FA571310FF8EE90074E914 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 43FA570C10FF8E9B0074E914 /* Setup Prebuilt Components */;
@@ -5386,6 +5440,7 @@
};
4389DBE5111B0A0700B98DEF /* StaticAnalyzer */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 433A44F715C6CA4000D1856A /* CS-ID.xcconfig */;
buildSettings = {
PRODUCT_NAME = "Make DMGs for Release";
};
@@ -5454,15 +5509,38 @@
};
name = Release;
};
+ 43D670E615C85039000AD02A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "CS-ID";
+ };
+ name = Debug;
+ };
+ 43D670E715C85039000AD02A /* StaticAnalyzer */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "CS-ID";
+ };
+ name = StaticAnalyzer;
+ };
+ 43D670E815C85039000AD02A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "CS-ID";
+ };
+ name = Release;
+ };
43F77C8110F0125F00E04615 /* Debug */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 433A44F715C6CA4000D1856A /* CS-ID.xcconfig */;
buildSettings = {
PRODUCT_NAME = "Make DMGs for Release";
};
name = Debug;
};
43F77C8210F0125F00E04615 /* Release */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 433A44F715C6CA4000D1856A /* CS-ID.xcconfig */;
buildSettings = {
PRODUCT_NAME = "Make DMGs for Release";
};
@@ -5639,6 +5717,16 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
+ 43D670ED15C85090000AD02A /* Build configuration list for PBXAggregateTarget "CS-ID" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 43D670E615C85039000AD02A /* Debug */,
+ 43D670E715C85039000AD02A /* StaticAnalyzer */,
+ 43D670E815C85039000AD02A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
43F77C8A10F0126F00E04615 /* Build configuration list for PBXAggregateTarget "Make DMGs for Release" */ = {
isa = XCConfigurationList;
buildConfigurations = (
View
2 macosx/configs/Base-Framework.xcconfig
@@ -1,5 +1,7 @@
// Global settings for all Framework configurations
+#include "CS-ID.xcconfig"
+
INSTALL_PATH = @rpath
DYLIB_COMPATIBILITY_VERSION = 1
View
22 macosx/configs/codesignrules.plist → macosx/configs/ResourceRules.plist
@@ -4,6 +4,8 @@
<dict>
<key>rules</key>
<dict>
+ <key>^Frameworks/</key>
+ <false/>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
@@ -32,15 +34,27 @@
<key>weight</key>
<real>10</real>
</dict>
- <key>^Resources/data/sequences.wz$</key>
+ <key>^Resources/data/sequences\.wz$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>30</real>
+ </dict>
+ <key>^Resources/WarzoneHelp/</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>30</real>
+ </dict>
+ <key>^Resources/data/music/music\.wpl$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>30</real>
</dict>
- <key>^info.plist$</key>
- <true/>
</dict>
</dict>
-</plist>
+</plist>
View
2 macosx/configs/Warzone-All.xcconfig
@@ -1,6 +1,8 @@
// Warzone settings for all configurations
+// CODE_SIGN_RESOURCE_RULES_PATH = "$(SRCROOT)/configs/ResourceRules.plist"
+
INSTALL_PATH = $(HOME)/Applications
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
PREBINDING = NO
View
10 macosx/configs/fetchscripts/SetupPrebuiltComponents-CS-ID.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ ! -f configs/CS-ID.xcconfig ]; then
+ cat <<EOF > configs/CS-ID.xcconfig
+// Global settings for Code Signing
+
+CODE_SIGN_IDENTITY =
+
+EOF
+fi
View
18 macosx/configs/mkdmgs.sh
@@ -12,7 +12,6 @@ sequencelonme="sequences-lo.wz"
sequencelomd5="ab2bbc28cef2a3f2ea3c186e18158acd"
relbuild="${CONFIGURATION_BUILD_DIR}/"
dmgout="build/dmgout"
-coident="${SRCROOT}/configs/codeident"
# Fail if not release
if [ ! "${CONFIGURATION}" = "Release" ]; then
@@ -22,24 +21,27 @@ fi
# codesign setup
signd () {
- if [ -f "${coident}" ]; then
+ if [ ! -z "${CODE_SIGN_IDENTITY}" ]; then
# Local Config
- local idetd=`cat ${coident}`
- local resrul="${SRCROOT}/configs/codesignrules.plist"
+ local idetd="${CODE_SIGN_IDENTITY}"
+ local resrul="${SRCROOT}/configs/ResourceRules.plist"
local appth="/Volumes/Warzone 2100/Warzone.app"
# Sign app
- codesign -vfs "${idetd}" --keychain "CodeSign" --verify --resource-rules="${resrul}" "${appth}"
+ cp -a "${resrul}" "${appth}/"
+ /usr/bin/codesign -f -s "${idetd}" --resource-rules="${appth}/ResourceRules.plist" -vvv "${appth}"
+ rm "${appth}/ResourceRules.plist"
+ /usr/bin/codesign -vvv --verify "${appth}"
- # Sign the frameworks
+ # Verify the frameworks
local framelst=`\ls -1 "${appth}/Contents/Frameworks" | sed -n 's:.framework$:&:p'`
for fsignd in ${framelst}; do
if [ -d "${appth}/Contents/Frameworks/${fsignd}/Versions/A" ]; then
- codesign -vfs "${idetd}" --keychain "CodeSign" --verify "${appth}/Contents/Frameworks/${fsignd}/Versions/A"
+ /usr/bin/codesign -vvv --verify "${appth}/Contents/Frameworks/${fsignd}/Versions/A"
fi
done
else
- echo "warning: No codeident file found; code will not be signed."
+ echo "warning: No code signing identity configured; code will not be signed."
fi
}
View
40 src/configuration.cpp
@@ -95,19 +95,12 @@ bool loadConfig()
war_setMPcolour(ini.value("colourMP", -1).toInt()); // default is random (-1)
sstrcpy(game.name, ini.value("gameName", _("My Game")).toString().toUtf8().constData());
sstrcpy(sPlayer, ini.value("playerName", _("Player")).toString().toUtf8().constData());
- if (ini.contains("mapName") && ini.contains("maxPlayers"))
- {
- sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
- game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
- game.maxPlayers = ini.value("maxPlayers").toInt(); // FIXME: horrible kluge, MUST match map above
- }
- else
- {
- // Set a default map to prevent hosting games without a map.
- sstrcpy(game.map, "Sk-Rush");
- game.hash.setZero();
- game.maxPlayers = 4;
- }
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
game.power = ini.value("power", LEV_MED).toInt();
game.base = ini.value("base", CAMP_BASE).toInt();
game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
@@ -268,9 +261,12 @@ bool reloadMPConfig(void)
sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
}
}
- ini.setValue("mapName", game.map); // map name
- ini.setValue("mapHash", game.hash.toString().c_str()); // map hash
- ini.setValue("maxPlayers", game.maxPlayers); // maxPlayers
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
ini.setValue("power", game.power); // power
ini.setValue("base", game.base); // size of base
ini.setValue("alliance", game.alliance); // allow alliances
@@ -284,12 +280,12 @@ bool reloadMPConfig(void)
{
sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
}
- if (ini.contains("mapName") && ini.contains("maxPlayers"))
- {
- sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
- game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
- game.maxPlayers = ini.value("maxPlayers").toInt(); // FIXME: horrible kluge, MUST match map above
- }
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
game.power = ini.value("power", LEV_MED).toInt();
game.base = ini.value("base", CAMP_BASE).toInt();
game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
View
215 src/display.cpp
@@ -24,7 +24,6 @@
*
*/
-
#include "lib/framework/frame.h"
#include "lib/framework/input.h"
#include "lib/framework/strres.h"
@@ -215,7 +214,6 @@ void setRightClickOrders( bool val )
bRightClickOrders = val;
}
-
bool getMiddleClickRotate( void )
{
return bMiddleClickRotate;
@@ -226,7 +224,6 @@ void setMiddleClickRotate( bool val )
bMiddleClickRotate = val;
}
-
bool getDrawShadows( void )
{
return(bDrawShadows);
@@ -237,13 +234,11 @@ void setDrawShadows( bool val )
bDrawShadows = val;
}
-
void setShakeStatus( bool val )
{
bShakingPermitted = val;
}
-
void shakeStart(unsigned int length)
{
if(bShakingPermitted)
@@ -257,14 +252,12 @@ void shakeStart(unsigned int length)
}
}
-
void shakeStop(void)
{
bScreenShakeActive = false;
player.r.z = 0;
}
-
static void shakeUpdate(void)
{
UDWORD screenShakePercentage;
@@ -324,22 +317,16 @@ void ProcessRadarInput()
} else {
/* If we're tracking a droid, then cancel that */
-// if(getWarCamStatus() == true)
-// {
-// camToggleStatus();
-// }
CalcRadarPosition(x, y, &PosX, &PosY);
if(mouseOverRadar)
{
- // requestRadarTrack(PosX*TILE_UNITS,PosY*TILE_UNITS);
// MARKER
// Send all droids to that location
orderSelectedLoc(selectedPlayer, (PosX*TILE_UNITS)+TILE_UNITS/2,
(PosY*TILE_UNITS)+TILE_UNITS/2, ctrlShiftDown()); // ctrlShiftDown() = ctrl clicked a destination, add an order
}
- // setViewPos(PosX,PosY);
CheckScrollLimits();
audio_PlayTrack( ID_SOUND_MESSAGEEND );
}
@@ -390,7 +377,6 @@ void ProcessRadarInput()
}
}
-
// reset the input state
void resetInput(void)
{
@@ -399,7 +385,6 @@ void resetInput(void)
wallDrag.status = DRAG_INACTIVE;
}
-
/* Process the user input. This just processes the key input and jumping around the radar*/
void processInput(void)
{
@@ -482,13 +467,11 @@ void processInput(void)
}
}
-
static bool OverRadarAndNotDragging(void)
{
return mouseOverRadar && dragBox3D.status != DRAG_DRAGGING && radarPermitted && wallDrag.status != DRAG_DRAGGING;
}
-
static void CheckFinishedDrag(void)
{
if(driveModeActive()) {
@@ -621,7 +604,6 @@ static bool CheckFinishedFindPosition(void)
return false;
}
-
static void HandleDrag(void)
{
UDWORD dragX, dragY;
@@ -681,9 +663,6 @@ void processMouseClickInput(void)
MOUSE_TARGET item=MT_NOTARGET;
bool OverRadar = OverRadarAndNotDragging();
- // These four functions were embedded in this function but I moved them out for readability. In the
- // absense of any comments I had a guess as to there use and named them accordingly PD 28/05/98.
- //ignoreOrder = CheckFinishedWallDrag(); - this name is misleading since called for all Structures AB
ignoreOrder = CheckFinishedFindPosition();
CheckStartWallDrag();
@@ -801,13 +780,6 @@ void processMouseClickInput(void)
item = itemUnderMouse(&ObjUnderMouse);
ASSERT( item<POSSIBLE_TARGETS,"Weirdy target!" );
- // alliance override. If in alli then just use the move icon. - but not if its the same player
- //in single player, the genexp script defaults to setting an alliance between player 0 and selectedPlayer
- /* if(ObjUnderMouse && (selectedPlayer != ObjUnderMouse->player) &&
- aiCheckAlliances(selectedPlayer,ObjUnderMouse->player))
- {
- item = MT_NOTARGET;
- } */
ObjAllied = (ObjUnderMouse && selectedPlayer != ObjUnderMouse->player && aiCheckAlliances(selectedPlayer,ObjUnderMouse->player));
if(item != MT_NOTARGET)
@@ -1031,7 +1003,6 @@ void processMouseClickInput(void)
CurrentItemUnderMouse = item;
}
-
static void calcScroll(float *y, float *dydt, float accel, float decel, float targetVelocity, float dt)
{
double tMid;
@@ -1156,31 +1127,6 @@ bool CheckInScrollLimits(SDWORD *xPos,SDWORD *zPos)
bool EdgeHit = false;
SDWORD minX,minY,maxX,maxY;
- //always view that little bit more than the scroll limits...
- /*minX = scrollMinX * TILE_UNITS;
- minY = scrollMinY * TILE_UNITS;
- maxX = (((scrollMaxX-1) - visibleXTiles) * TILE_UNITS);
- maxY = (((scrollMaxY-1) - visibleYTiles) * TILE_UNITS);
-
- if(scrollMinX==0)
- {
- minX = ((0 - visibleXTiles/2) * TILE_UNITS);
- }
-
- if((UDWORD)scrollMaxX == mapWidth)
- {
- maxX = ((mapWidth-1-(visibleXTiles/2)) * TILE_UNITS);
- }
-
- if(scrollMinY==0)
- {
- minY = ((0 - visibleYTiles/2) * TILE_UNITS);
- }
-
- if((UDWORD)scrollMaxY == mapHeight)
- {
- maxY = ((mapHeight-1-(visibleYTiles/2)) * TILE_UNITS);
- }*/
minX = world_coord(scrollMinX);
maxX = world_coord(scrollMaxX - 1);
minY = world_coord(scrollMinY);
@@ -1215,7 +1161,6 @@ bool CheckInScrollLimits(SDWORD *xPos,SDWORD *zPos)
return EdgeHit;
}
-
// Check the view is within the scroll limits,
// Returns true if edge hit.
//
@@ -1231,8 +1176,6 @@ bool CheckScrollLimits(void)
return ret;
}
-
-
/* Do the 3D display */
void displayWorld(void)
{
@@ -1320,7 +1263,6 @@ bool DrawnInLastFrame(int32_t frame)
on MOUSE_LMB. We aren't concerned here with setting selection flags - just what it
actually was
*/
-
BASE_OBJECT *mouseTarget( void )
{
UDWORD i;
@@ -1336,7 +1278,6 @@ UDWORD dispX,dispY,dispR;
return(NULL);
}
-
/* We haven't found anything yet */
psReturn = NULL;
@@ -1353,10 +1294,8 @@ UDWORD dispX,dispY,dispR;
dispR = psDroid->sDisplay.screenR;
/* Only check droids that're on screen */
-
-// Has the droid been drawn since the start of the last frame
+ // Has the droid been drawn since the start of the last frame
if (psDroid->visible[selectedPlayer] && DrawnInLastFrame(psDroid->sDisplay.frameNumber)==true)
-// if(psDroid->sDisplay.frameNumber+1 == currentFrame)
{
if (mouseInBox(dispX-dispR, dispY-dispR, dispX+dispR, dispY+dispR))
{
@@ -1382,7 +1321,6 @@ UDWORD dispX,dispY,dispR;
return(psReturn);
}
-
void StartTacticalScrollObj(WZ_DECL_UNUSED bool driveActive, WZ_DECL_UNUSED BASE_OBJECT* psObj)
{
}
@@ -1436,7 +1374,6 @@ void startDeliveryPosition(FLAG_POSITION *psFlag)
}
}
-
// Finished repositioning a delivery point.
//
void finishDeliveryPosition()
@@ -1467,9 +1404,7 @@ void finishDeliveryPosition()
flagReposFinished = true;
}
-
// Is there a valid delivery point repositioning going on.
-
bool deliveryReposValid(void)
{
if (!flagReposVarsValid)
@@ -1557,7 +1492,6 @@ static bool droidHasLeader(DROID *psDroid)
if (psLeader != NULL)
{
-// psLeader->selected = true;
if (psLeader->type == OBJ_DROID)
{
SelectDroid((DROID *)psLeader);
@@ -1609,7 +1543,6 @@ void dealWithDroidSelect(DROID *psDroid, bool bDragBox)
}
}
-
static void FeedbackOrderGiven(void)
{
static UDWORD LastFrame = 0;
@@ -1628,7 +1561,6 @@ bool ctrlShiftDown(void)
return keyDown(KEY_LCTRL) || keyDown(KEY_RCTRL) || keyDown(KEY_LSHIFT) || keyDown(KEY_RSHIFT);
}
-
void AddDerrickBurningMessage(void)
{
addConsoleMessage(_("Cannot Build. Oil Resource Burning."),DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
@@ -1663,7 +1595,6 @@ static void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
FeedbackOrderGiven();
driveDisableTactical();
-
return;
}
@@ -1842,13 +1773,10 @@ static void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
FeedbackOrderGiven();
}
-
-
}
static void dealWithLMBStructure(STRUCTURE* psStructure, SELECTION_TYPE selection)
{
-// clearSelection(); // Clear droid selection.
bool ownStruct = (psStructure->player == selectedPlayer);
if (!aiCheckAlliances(psStructure->player, selectedPlayer))
@@ -2000,7 +1928,6 @@ static void dealWithLMBFeature(FEATURE* psFeature)
}
}
}
-
}
else
{
@@ -2068,7 +1995,6 @@ void dealWithLMB( void )
OBJECT_POSITION *psLocation;
STRUCTURE *psStructure;
-
/* Don't process if in game options are on screen */
if (mouseOverRadar ||
InGameOpUp == true || widgGetFromID(psWScreen,INTINGAMEOP))
@@ -2150,38 +2076,13 @@ void dealWithLMB( void )
{
startDeliveryPosition((FLAG_POSITION *)psLocation);
}
-#if 0
- /* We've clicked on one of our own DP */
- addConsoleMessage("Clicked on your delivery point",DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
-
- /* clear the selection */
- clearSelection();
-
- //set this object position to be highlighted
- psLocation->selected = true;
- }
- else
- {
- /* We've clicked on somebody else's DP - remove this sometime?*/
- addConsoleMessage("Clicked on another player's delivery point",DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
-#endif
}
break;
-
-#if 0
- case POS_PROX:
- if(psLocation->player == selectedPlayer)
- {
- displayProximityMessage((PROXIMITY_DISPLAY *)psLocation);
- }
- break;
-#endif
default:
ASSERT(!"unknown object position type", "Unknown type from checkMouseLoc" );
}
}
-
bool getRotActive( void )
{
return(rotActive);
@@ -2252,13 +2153,11 @@ static void dealWithLMBDClick(void)
}
}
-
/*This checks to see if the mouse was over a delivery point or a proximity message
when the mouse button was pressed */
static OBJECT_POSITION * checkMouseLoc(void)
{
FLAG_POSITION *psPoint;
- //PROXIMITY_DISPLAY *psProxDisp;
UDWORD i;
UDWORD dispX,dispY,dispR;
@@ -2281,27 +2180,9 @@ static OBJECT_POSITION * checkMouseLoc(void)
}
}
}
- //now check for Proximity Message
- /*for(psProxDisp = apsProxDisp[selectedPlayer]; psProxDisp; psProxDisp =
- psProxDisp->psNext)
- {
- dispX = psProxDisp->screenX;
- dispY = psProxDisp->screenY;
- dispR = psProxDisp->screenR;
- // Only check DP's that are on screen
- if (DrawnInLastFrame(psProxDisp->frameNumber)==true)
- {
- if (mouseInBox(dispX-dispR, dispY-dispR, dispX+dispR, dispY+dispR))
- {
- // We HAVE clicked on Proximity Message!
- return psProxDisp;
- }
- }
- }*/
return NULL;
}
-
static void dealWithRMB( void )
{
BASE_OBJECT *psClickedOn;
@@ -2326,9 +2207,6 @@ static void dealWithRMB( void )
psDroid = (DROID *) psClickedOn;
if (psDroid->player == selectedPlayer)
{
-// addGameMessage("Right clicked on own droid",1000,true);
-// addConsoleMessage("Right click detected on own droid",DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
-
if (bRightClickOrders && ctrlShiftDown())
{
dealWithDroidSelect(psDroid, false);
@@ -2432,9 +2310,6 @@ static void dealWithRMB( void )
if (psStructure->player == selectedPlayer)
{
/* We've clicked on our own building */
-// addGameMessage("Right clicked on own building",1000,true);
-// addConsoleMessage("Right clicked on own building",DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
-
if (bRightClickOrders && intDemolishSelectMode())
{
orderSelectedObjAdd(selectedPlayer, psClickedOn, ctrlShiftDown());
@@ -2531,44 +2406,13 @@ static void dealWithRMB( void )
}
else
{
- /* Transporter orders disabled */
-#if 0
- /* We've just clicked on an area of terrain. A 'send to' operation
- for Transporter in multiPlay mode*/
- if (bMultiPlayer && !bLeftClickOrders)
- {
- //there may be more than one Transporter selected
- for (psDroid = apsDroidLists[selectedPlayer]; psDroid != NULL;
- psDroid = psDroid->psNext)
- {
- if (psDroid->selected)
- {
- if (psDroid->droidType == DROID_TRANSPORTER || psDroid->droidType == DROID_SUPERTRANSPORTER)
- {
- orderDroidLoc(psDroid, DORDER_DISEMBARK, mouseTileX *
- TILE_UNITS + TILE_UNITS/2, mouseTileY * TILE_UNITS +
- TILE_UNITS/2);
- }
- else
- {
- //de-select any other units
- psDroid->selected = false;
- }
- }
- }
- }
- else
-#endif
- {
- clearSelection();
- intObjectSelected(NULL);
- memset(DROIDDOING, 0x0 , sizeof(DROIDDOING)); // clear string when deselected
- }
+ clearSelection();
+ intObjectSelected(NULL);
+ memset(DROIDDOING, 0x0 , sizeof(DROIDDOING)); // clear string when deselected
}
}
}
-
/* if there is a valid object under the mouse this routine returns not only the type of the object in the
return code, but also a pointer to the BASE_OBJECT) ... well if your going to be "object orientated" you might as well do it right
- it sets it to null if we don't find anything
@@ -2775,12 +2619,6 @@ STRUCTURE *psStructure;
{
retVal = MT_OWNSTRINCOMP;
}
-
- // standard buildings.
- //else if(buildingDamaged(psStructure))
- //{
- // retVal = MT_OWNSTRDAM;
- //}
else
{
/* All the different stages of construction */
@@ -2794,7 +2632,6 @@ STRUCTURE *psStructure;
}
}
-
/* Send the result back - if it's null then we clicked on an area of terrain */
/* make unseen objects just look like terrain. */
if(retVal == MT_NOTARGET || !(psNotDroid->visible[selectedPlayer]) )
@@ -2804,14 +2641,12 @@ STRUCTURE *psStructure;
return(retVal);
}
-
// Indicates the priority given to any given droid
// type in a multiple droid selection, the larger the
// number, the lower the priority. The order of entries
// corresponds to the order of droid types in the DROID_TYPE
// enum in DroidDef.h
//
-//#define NUM_DROID_WEIGHTS (10)
#define NUM_DROID_WEIGHTS (14)
UBYTE DroidSelectionWeights[NUM_DROID_WEIGHTS] = {
3, //DROID_WEAPON,
@@ -2830,16 +2665,13 @@ UBYTE DroidSelectionWeights[NUM_DROID_WEIGHTS] = {
10, //DROID_SUPERTRANSPORTER
};
-
/* Only deals with one type of droid being selected!!!! */
/* We'll have to make it assesss which selection is to be dominant in the case
of multiple selections */
static SELECTION_TYPE establishSelection(UDWORD selectedPlayer)
{
DROID *psDroid,*psDominant=NULL;
UBYTE CurrWeight;
-//bool gotWeapon = false;
-//DROID *psWeapDroid = NULL;
bool atLeastOne;
SELECTION_TYPE selectionClass;
@@ -2850,23 +2682,6 @@ SELECTION_TYPE selectionClass;
for(psDroid = apsDroidLists[selectedPlayer];
psDroid /*&& !atLeastOne*/; psDroid = psDroid->psNext)
{
- // This code dos'nt work, what about the case of a selection of DROID_WEAPON types with a
- // DROID_CONSTRUCT type grouped with them,claims to handle this but dos'nt.
-//PD if(psDroid->selected)
-//PD {
-//PD atLeastOne = true;
-//PD if(psDroid->type == DROID_WEAPON)
-//PD {
-//PD gotWeapon = true;
-//PD psWeapDroid = psDroid;
-//PD }
-//PD if (psDroid->droidType == DROID_COMMAND ||
-//PD psDominant == NULL)
-//PD {
-//PD psDominant = psDroid;
-//PD }
-//PD }
-
// This works, uses the DroidSelectionWeights[] table to priorities the different
// droid types and find the dominant selection.
if(psDroid->selected) {
@@ -2881,16 +2696,6 @@ SELECTION_TYPE selectionClass;
}
}
-// /* Weapon droids in a selection will override all others */
-// if(psWeapDroid)
-// {
-// psDominant = psWeapDroid;
-// }
-
-// if(psDominant) {
-// DBPRINTF(("Dominant selection type == %d\n",psDominant->droidType));
-// }
-
if(atLeastOne)
{
psDominantSelected = psDominant;
@@ -2979,7 +2784,6 @@ bool repairDroidSelected(UDWORD player)
//didn't find one...
return false;
-
}
/*Looks through the list of selected players droids to see if one is a VTOL droid*/
@@ -2999,7 +2803,6 @@ bool vtolDroidSelected(UDWORD player)
//didn't find one...
return false;
-
}
/*Looks through the list of selected players droids to see if any is selected*/
@@ -3017,7 +2820,6 @@ bool anyDroidSelected(UDWORD player)
//didn't find one...
return false;
-
}
/*Looks through the list of selected players droids to see if one is a cyborg droid*/
@@ -3035,7 +2837,6 @@ bool cyborgDroidSelected(UDWORD player)
//didn't find one...
return false;
-
}
/* Clear the selection flag for a player */
@@ -3057,12 +2858,6 @@ void clearSel(void)
psStruct->selected = false;
}
bLasSatStruct = false;
- //can a feature ever be selected?
- /*for(psFeat = apsFeatureLists[0]; psFeat;
- psFeat = psFeat->psNext)
- {
- psFeat->selected = false;
- }*/
//clear the Deliv Point if one
for (psFlagPos = apsFlagPosLists[selectedPlayer]; psFlagPos;
psFlagPos = psFlagPos->psNext)
@@ -3075,7 +2870,6 @@ void clearSel(void)
intRefreshScreen();
}
-
// Clear the selection and stop driver mode.
//
void clearSelection(void)
@@ -3096,4 +2890,3 @@ bool dispInitialise(void)
flagReposVarsValid = false;
return true;
}
-
View
1 src/frontend.cpp
@@ -300,6 +300,7 @@ static void SPinit(void)
playercolor = 0; // default is green
}
setPlayerColour(0, playercolor);
+ game.hash.setZero(); // must reset this to zero
}
bool runSinglePlayerMenu(void)

0 comments on commit 7c76d4e

Please sign in to comment.