mirror of https://github.com/OpenTTD/OpenTTD
(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
parent
76d427fdfd
commit
68d1b29e19
|
@ -239,14 +239,6 @@ static int32 AiGetBasePrice(const Player* p)
|
||||||
return base;
|
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)
|
static EngineID AiChooseRoadVehToReplaceWith(const Player* p, const Vehicle* v)
|
||||||
{
|
{
|
||||||
int32 avail_money = p->player_money + v->value;
|
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)
|
static EngineID AiChooseShipToReplaceWith(const Player* p, const Vehicle* v)
|
||||||
{
|
{
|
||||||
error("!AiChooseShipToReplaceWith");
|
/* Ships are not implemented in this (broken) AI */
|
||||||
|
|
||||||
/* maybe useless, but avoids compiler warning this way */
|
|
||||||
return INVALID_ENGINE;
|
return INVALID_ENGINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +390,7 @@ static void AiHandleReplaceAircraft(Player *p)
|
||||||
|
|
||||||
static void AiHandleReplaceShip(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);
|
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)
|
static void AiStateWantNewRoute(Player *p)
|
||||||
|
@ -1517,8 +1501,7 @@ static void AiStateWantNewRoute(Player *p)
|
||||||
if (_patches.ai_disable_veh_aircraft) continue;
|
if (_patches.ai_disable_veh_aircraft) continue;
|
||||||
AiWantAircraftRoute(p);
|
AiWantAircraftRoute(p);
|
||||||
} else {
|
} else {
|
||||||
if (_patches.ai_disable_veh_ship) continue;
|
/* Ships are not implemented in this (broken) AI */
|
||||||
AiWantShipRoute(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// got a route?
|
// got a route?
|
||||||
|
@ -3510,20 +3493,17 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
||||||
|
|
||||||
static void AiStateCheckShipStuff(Player *p)
|
static void AiStateCheckShipStuff(Player *p)
|
||||||
{
|
{
|
||||||
// XXX
|
/* Ships are not implemented in this (broken) AI */
|
||||||
error("!AiStateCheckShipStuff");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AiStateBuildDefaultShipBlocks(Player *p)
|
static void AiStateBuildDefaultShipBlocks(Player *p)
|
||||||
{
|
{
|
||||||
// XXX
|
/* Ships are not implemented in this (broken) AI */
|
||||||
error("!AiStateBuildDefaultShipBlocks");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AiStateDoShipStuff(Player *p)
|
static void AiStateDoShipStuff(Player *p)
|
||||||
{
|
{
|
||||||
// XXX
|
/* Ships are not implemented in this (broken) AI */
|
||||||
error("!AiStateDoShipStuff");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AiStateSellVeh(Player *p)
|
static void AiStateSellVeh(Player *p)
|
||||||
|
@ -3558,9 +3538,8 @@ static void AiStateSellVeh(Player *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
|
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
|
||||||
} else if (v->type == VEH_Ship) {
|
} else if (v->type == VEH_Ship) {
|
||||||
// XXX: not implemented
|
/* Ships are not implemented in this (broken) AI */
|
||||||
error("!v->type == VEH_Ship");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
##name Italian
|
##name Italian
|
||||||
##ownname Italiano
|
##ownname Italiano
|
||||||
##isocode it
|
##isocode it_IT
|
||||||
##plural 0
|
##plural 0
|
||||||
##case ms mp fs fp
|
##case ms mp fs fp
|
||||||
##gender m f
|
##gender m f
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
##name Frisian
|
##name Frisian
|
||||||
##ownname Frysk
|
##ownname Frysk
|
||||||
##isocode fy
|
##isocode fy_NL
|
||||||
|
|
||||||
##id 0x0000
|
##id 0x0000
|
||||||
STR_NULL :
|
STR_NULL :
|
||||||
|
|
|
@ -95,7 +95,7 @@ const iso_grf iso_codes[] = {
|
||||||
{"es_ES", GRFLX_SPANISH},
|
{"es_ES", GRFLX_SPANISH},
|
||||||
{"af_ZA", GRFLX_AFRIKAANS},
|
{"af_ZA", GRFLX_AFRIKAANS},
|
||||||
{"hr_HR", GRFLX_CROATIAN},
|
{"hr_HR", GRFLX_CROATIAN},
|
||||||
{"cs_CS", GRFLX_CZECH},
|
{"cs_CZ", GRFLX_CZECH},
|
||||||
{"ca_ES", GRFLX_CATALAN},
|
{"ca_ES", GRFLX_CATALAN},
|
||||||
{"da_DA", GRFLX_DANISH},
|
{"da_DA", GRFLX_DANISH},
|
||||||
{"nl_NL", GRFLX_DUTCH},
|
{"nl_NL", GRFLX_DUTCH},
|
||||||
|
|
17
road_cmd.c
17
road_cmd.c
|
@ -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)
|
int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
TileIndex start_tile, tile;
|
TileIndex start_tile, tile;
|
||||||
int32 cost, ret;
|
int32 cost, ret, money;
|
||||||
|
|
||||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
|
@ -541,6 +541,7 @@ int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
cost = 0;
|
cost = 0;
|
||||||
|
money = GetAvailableMoneyForCommand();
|
||||||
tile = start_tile;
|
tile = start_tile;
|
||||||
// Start tile is the small number.
|
// Start tile is the small number.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -551,8 +552,18 @@ int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
// try to remove the halves.
|
// try to remove the halves.
|
||||||
if (bits != 0) {
|
if (bits != 0) {
|
||||||
ret = DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD);
|
ret = DoCommand(tile, bits, 0, flags& ~DC_EXEC, CMD_REMOVE_ROAD);
|
||||||
if (!CmdFailed(ret)) cost += ret;
|
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;
|
if (tile == end_tile) break;
|
||||||
|
|
|
@ -550,6 +550,7 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
|
||||||
case MP_RAILWAY: {
|
case MP_RAILWAY: {
|
||||||
TrackBits tracks;
|
TrackBits tracks;
|
||||||
Slope slope;
|
Slope slope;
|
||||||
|
Vehicle *v;
|
||||||
|
|
||||||
if (!IsPlainRailTile(target)) break;
|
if (!IsPlainRailTile(target)) break;
|
||||||
|
|
||||||
|
@ -563,6 +564,9 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
|
||||||
)) {
|
)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v = FindFloodableVehicleOnTile(target);
|
||||||
|
if (v != NULL) FloodVehicle(v);
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
|
|
41
win32.c
41
win32.c
|
@ -23,6 +23,10 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#if defined(_MSC_VER) && !defined(WINCE)
|
||||||
|
#include <dbghelp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static bool _has_console;
|
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 */
|
/* Close any possible log files */
|
||||||
CloseConsoleLogIfActive();
|
CloseConsoleLogIfActive();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue