--- a/Makefile.in Thu Apr 24 12:05:36 2008 +0000
+++ b/Makefile.in Thu Apr 24 12:15:24 2008 +0000
@@ -22,7 +22,6 @@
INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!!
INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
-INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!!
TTD = !!TTD!!
TTDS = $(SRC_DIRS:%=%/$(TTD))
OS = !!OS!!
@@ -271,10 +270,5 @@
$(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data"
$(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs"
$(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)"
-ifdef INSTALL_PERSONAL_DIR
- $(Q)mkdir -p ~/"$(INSTALL_PERSONAL_DIR)"
- $(Q)cp -R "$(BUNDLE_DIR)/scenario" ~/"$(INSTALL_PERSONAL_DIR)"
-else
$(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)"
-endif # INSTALL_PERSONAL_DIR
endif # OSXAPP
--- a/src/core/math_func.hpp Thu Apr 24 12:05:36 2008 +0000
+++ b/src/core/math_func.hpp Thu Apr 24 12:15:24 2008 +0000
@@ -177,7 +177,7 @@
*/
static inline uint16 ClampToU16(const uint64 a)
{
- return min(a, 0xFFFF);
+ return (uint16)(a <= 0xFFFFU ? a : 0xFFFFU);
}
/**
--- a/src/oldloader.cpp Thu Apr 24 12:05:36 2008 +0000
+++ b/src/oldloader.cpp Thu Apr 24 12:15:24 2008 +0000
@@ -1694,6 +1694,12 @@
fclose(ls.file);
+ /* Some old TTDP savegames could have buoys at tile 0
+ * (without assigned station struct)
+ * MakeWater() can be used as long as sea has the same
+ * format as old savegames (eg. everything is zeroed) */
+ MakeWater(0);
+
_pause_game = 2;
return true;
--- a/src/road_cmd.cpp Thu Apr 24 12:05:36 2008 +0000
+++ b/src/road_cmd.cpp Thu Apr 24 12:15:24 2008 +0000
@@ -865,13 +865,14 @@
/* Must iterate over the roadtypes in a reverse manner because
* tram tracks must be removed before the road bits. */
- for (RoadType rt = ROADTYPE_HWAY; rt >= ROADTYPE_ROAD; rt--) {
+ RoadType rt = ROADTYPE_HWAY;
+ do {
if (HasBit(rts, rt)) {
CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rt, false);
if (CmdFailed(tmp_ret)) return tmp_ret;
ret.AddCost(tmp_ret);
}
- }
+ } while (rt-- != ROADTYPE_ROAD);
if (flags & DC_EXEC) {
DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
--- a/src/saveload.cpp Thu Apr 24 12:05:36 2008 +0000
+++ b/src/saveload.cpp Thu Apr 24 12:15:24 2008 +0000
@@ -76,13 +76,24 @@
enum NeedLengthValues {NL_NONE = 0, NL_WANTLENGTH = 1, NL_CALCLENGTH = 2};
+/** Error handler, calls longjmp to simulate an exception.
+ * @todo this was used to have a central place to handle errors, but it is
+ * pretty ugly, and seriously interferes with any multithreaded approaches */
+static void NORETURN SlError(StringID string, const char *extra_msg = NULL)
+{
+ _sl.error_str = string;
+ free(_sl.extra_msg);
+ _sl.extra_msg = (extra_msg == NULL) ? NULL : strdup(extra_msg);
+ throw std::exception();
+}
+
/**
* Fill the input buffer by reading from the file with the given reader
*/
static void SlReadFill()
{
uint len = _sl.read_bytes();
- assert(len != 0);
+ if (len == 0) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected end of chunk");
_sl.bufp = _sl.buf;
_sl.bufe = _sl.buf + len;
@@ -137,17 +148,6 @@
_sl.bufe = _sl.buf + _sl.bufsize;
}
-/** Error handler, calls longjmp to simulate an exception.
- * @todo this was used to have a central place to handle errors, but it is
- * pretty ugly, and seriously interferes with any multithreaded approaches */
-static void NORETURN SlError(StringID string, const char *extra_msg = NULL)
-{
- _sl.error_str = string;
- free(_sl.extra_msg);
- _sl.extra_msg = (extra_msg == NULL) ? NULL : strdup(extra_msg);
- throw std::exception();
-}
-
/** Read in a single byte from file. If the temporary buffer is full,
* flush it to its final destination
* @return return the read byte from file
@@ -1524,7 +1524,7 @@
uint i;
uint count = 1 << Savegame_POOL_BLOCK_SIZE_BITS;
- assert(_ts.count == _sl.offs_base);
+ if (_ts.count != _sl.offs_base) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected size of chunk");
for (i = 0; i != _Savegame_pool.GetBlockCount() - 1; i++) {
_sl.buf = _Savegame_pool.blocks[i];
fmt->writer(count);
@@ -1537,7 +1537,7 @@
}
fmt->uninit_write();
- assert(_ts.count == _sl.offs_base);
+ if (_ts.count != _sl.offs_base) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected size of chunk");
GetSavegameFormat("memory")->uninit_write(); // clean the memorypool
fclose(_sl.fh);