(svn r10952) [0.5] -Backport from trunk (r10877, r10890, r10892, r10942, r10948):
- Fix: Some isocodes were wrong (r10877)
- Fix: Removing road with the road removal tool would also work with a negative bank account, making the bank account even more negative than it was [FS#1125] (r10890)
- Fix: Trains would not get flooded when they are at the lower part of a tile that would become a coast tile after flooding [FS#1127] (r10892)
- Fix: Make the AI not crash when it has ships as the AI does not support them [FS#1133] (r10942)
- Add: [Windows] crash.dmp support for MSVC release builds (r10948)
--- a/ai/default/default.c Fri Aug 10 22:03:12 2007 +0000
+++ b/ai/default/default.c Mon Aug 20 15:17:24 2007 +0000
@@ -239,14 +239,6 @@
return base;
}
-#if 0
-static EngineID AiChooseShipToBuild(byte cargo, int32 money)
-{
- // XXX: not done
- return INVALID_ENGINE;
-}
-#endif
-
static EngineID AiChooseRoadVehToReplaceWith(const Player* p, const Vehicle* v)
{
int32 avail_money = p->player_money + v->value;
@@ -277,9 +269,7 @@
static EngineID AiChooseShipToReplaceWith(const Player* p, const Vehicle* v)
{
- error("!AiChooseShipToReplaceWith");
-
- /* maybe useless, but avoids compiler warning this way */
+ /* Ships are not implemented in this (broken) AI */
return INVALID_ENGINE;
}
@@ -400,7 +390,7 @@
static void AiHandleReplaceShip(Player *p)
{
- error("!AiHandleReplaceShip");
+ /* Ships are not implemented in this (broken) AI */
}
typedef EngineID CheckReplaceProc(const Player* p, const Vehicle* v);
@@ -1478,12 +1468,6 @@
}
}
-static void AiWantShipRoute(Player *p)
-{
- // XXX
-// error("AiWaitShipRoute");
-}
-
static void AiStateWantNewRoute(Player *p)
@@ -1517,8 +1501,7 @@
if (_patches.ai_disable_veh_aircraft) continue;
AiWantAircraftRoute(p);
} else {
- if (_patches.ai_disable_veh_ship) continue;
- AiWantShipRoute(p);
+ /* Ships are not implemented in this (broken) AI */
}
// got a route?
@@ -3510,20 +3493,17 @@
static void AiStateCheckShipStuff(Player *p)
{
- // XXX
- error("!AiStateCheckShipStuff");
+ /* Ships are not implemented in this (broken) AI */
}
static void AiStateBuildDefaultShipBlocks(Player *p)
{
- // XXX
- error("!AiStateBuildDefaultShipBlocks");
+ /* Ships are not implemented in this (broken) AI */
}
static void AiStateDoShipStuff(Player *p)
{
- // XXX
- error("!AiStateDoShipStuff");
+ /* Ships are not implemented in this (broken) AI */
}
static void AiStateSellVeh(Player *p)
@@ -3558,9 +3538,8 @@
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
- } else if (v->type == VEH_Ship) {
- // XXX: not implemented
- error("!v->type == VEH_Ship");
+ } else if (v->type == VEH_Ship) {
+ /* Ships are not implemented in this (broken) AI */
}
}
--- a/lang/italian.txt Fri Aug 10 22:03:12 2007 +0000
+++ b/lang/italian.txt Mon Aug 20 15:17:24 2007 +0000
@@ -1,6 +1,6 @@
##name Italian
##ownname Italiano
-##isocode it
+##isocode it_IT
##plural 0
##case ms mp fs fp
##gender m f
--- a/lang/unfinished/frisian.txt Fri Aug 10 22:03:12 2007 +0000
+++ b/lang/unfinished/frisian.txt Mon Aug 20 15:17:24 2007 +0000
@@ -1,6 +1,6 @@
##name Frisian
##ownname Frysk
-##isocode fy
+##isocode fy_NL
##id 0x0000
STR_NULL :
--- a/newgrf_text.c Fri Aug 10 22:03:12 2007 +0000
+++ b/newgrf_text.c Mon Aug 20 15:17:24 2007 +0000
@@ -95,7 +95,7 @@
{"es_ES", GRFLX_SPANISH},
{"af_ZA", GRFLX_AFRIKAANS},
{"hr_HR", GRFLX_CROATIAN},
- {"cs_CS", GRFLX_CZECH},
+ {"cs_CZ", GRFLX_CZECH},
{"ca_ES", GRFLX_CATALAN},
{"da_DA", GRFLX_DANISH},
{"nl_NL", GRFLX_DUTCH},
--- a/road_cmd.c Fri Aug 10 22:03:12 2007 +0000
+++ b/road_cmd.c Mon Aug 20 15:17:24 2007 +0000
@@ -520,7 +520,7 @@
int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
{
TileIndex start_tile, tile;
- int32 cost, ret;
+ int32 cost, ret, money;
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
@@ -541,6 +541,7 @@
}
cost = 0;
+ money = GetAvailableMoneyForCommand();
tile = start_tile;
// Start tile is the small number.
for (;;) {
@@ -551,8 +552,18 @@
// try to remove the halves.
if (bits != 0) {
- ret = DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD);
- if (!CmdFailed(ret)) cost += ret;
+ ret = DoCommand(tile, bits, 0, flags& ~DC_EXEC, CMD_REMOVE_ROAD);
+ if (!CmdFailed(ret)) {
+ if (flags & DC_EXEC) {
+ money -= ret;
+ if (money < 0) {
+ _additional_cash_required = DoCommand(end_tile, start_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD);
+ return cost;
+ }
+ DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD);
+ }
+ cost += ret;
+ }
}
if (tile == end_tile) break;
--- a/water_cmd.c Fri Aug 10 22:03:12 2007 +0000
+++ b/water_cmd.c Mon Aug 20 15:17:24 2007 +0000
@@ -550,6 +550,7 @@
case MP_RAILWAY: {
TrackBits tracks;
Slope slope;
+ Vehicle *v;
if (!IsPlainRailTile(target)) break;
@@ -563,6 +564,9 @@
)) {
break;
}
+
+ v = FindFloodableVehicleOnTile(target);
+ if (v != NULL) FloodVehicle(v);
}
/* FALLTHROUGH */
--- a/win32.c Fri Aug 10 22:03:12 2007 +0000
+++ b/win32.c Mon Aug 20 15:17:24 2007 +0000
@@ -23,6 +23,10 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#if defined(_MSC_VER) && !defined(WINCE)
+ #include <dbghelp.h>
+#endif
+
static bool _has_console;
@@ -584,6 +588,43 @@
}
}
+#if !defined(_DEBUG)
+ {
+ HMODULE dbghelp = LoadLibrary(_T("dbghelp.dll"));
+ if (dbghelp != NULL) {
+ typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,
+ MINIDUMP_TYPE,
+ CONST PMINIDUMP_EXCEPTION_INFORMATION,
+ CONST PMINIDUMP_USER_STREAM_INFORMATION,
+ CONST PMINIDUMP_CALLBACK_INFORMATION);
+ MiniDumpWriteDump_t funcMiniDumpWriteDump = (MiniDumpWriteDump_t)GetProcAddress(dbghelp, "MiniDumpWriteDump");
+ if (funcMiniDumpWriteDump != NULL) {
+ HANDLE file = CreateFile(_T("crash.dmp"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ HANDLE proc = GetCurrentProcess();
+ DWORD procid = GetCurrentProcessId();
+ MINIDUMP_EXCEPTION_INFORMATION mdei;
+ MINIDUMP_USER_STREAM userstream;
+ MINIDUMP_USER_STREAM_INFORMATION musi;
+ char msg[] = "****** Built on " __DATE__ " " __TIME__ ". ******";
+
+ userstream.Type = LastReservedStream + 1;
+ userstream.Buffer = msg;
+ userstream.BufferSize = sizeof(msg);
+
+ musi.UserStreamCount = 1;
+ musi.UserStreamArray = &userstream;
+
+ mdei.ThreadId = GetCurrentThreadId();
+ mdei.ExceptionPointers = ep;
+ mdei.ClientPointers = false;
+
+ funcMiniDumpWriteDump(proc, procid, file, MiniDumpWithDataSegs, &mdei, &musi, NULL);
+ }
+ FreeLibrary(dbghelp);
+ }
+ }
+#endif
+
/* Close any possible log files */
CloseConsoleLogIfActive();