1
0
Fork 0

(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)
release/0.5
glx 2007-08-20 15:17:24 +00:00
parent 76d427fdfd
commit 68d1b29e19
7 changed files with 70 additions and 35 deletions

View File

@ -239,14 +239,6 @@ static int32 AiGetBasePrice(const Player* p)
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 AiChooseTrainToReplaceWith(const Player* p, const Vehicle* v)
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 AiHandleReplaceAircraft(Player *p)
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 AiWantAircraftRoute(Player *p)
}
}
static void AiWantShipRoute(Player *p)
{
// XXX
// error("AiWaitShipRoute");
}
static void AiStateWantNewRoute(Player *p)
@ -1517,8 +1501,7 @@ static void AiStateWantNewRoute(Player *p)
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 AiStateBuildAircraftVehicles(Player *p)
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 @@ static void AiStateSellVeh(Player *p)
}
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 */
}
}

View File

@ -1,6 +1,6 @@
##name Italian
##ownname Italiano
##isocode it
##isocode it_IT
##plural 0
##case ms mp fs fp
##gender m f

View File

@ -1,6 +1,6 @@
##name Frisian
##ownname Frysk
##isocode fy
##isocode fy_NL
##id 0x0000
STR_NULL :

View File

@ -95,7 +95,7 @@ const iso_grf iso_codes[] = {
{"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},

View File

@ -520,7 +520,7 @@ int32 CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
}
cost = 0;
money = GetAvailableMoneyForCommand();
tile = start_tile;
// Start tile is the small number.
for (;;) {
@ -551,8 +552,18 @@ int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
// 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;

View File

@ -550,6 +550,7 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
case MP_RAILWAY: {
TrackBits tracks;
Slope slope;
Vehicle *v;
if (!IsPlainRailTile(target)) break;
@ -563,6 +564,9 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
)) {
break;
}
v = FindFloodableVehicleOnTile(target);
if (v != NULL) FloodVehicle(v);
}
/* FALLTHROUGH */

41
win32.c
View File

@ -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 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
}
}
#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();