From 808f15e43ffe2c516ae0bf13fa36d139482d48e0 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 1 Jun 2008 16:45:32 +0000 Subject: [PATCH] (svn r13352) [0.6] -Backport from trunk (r13348, r13222, r13221, r13217): - Fix: Industry tiles would sometimes tell they need a 'level' slope when they do not want the slope (r13348) - Fix: Attempts to make the old AI perform better (r13217, r13221, r13222) --- changelog.txt | 6 ++++++ os/debian/changelog | 14 ++++++++++---- os/win32/installer/install.nsi | 2 +- readme.txt | 4 ++-- src/ai/default/default.cpp | 30 ++++++++++++++++++++++++------ src/industry_cmd.cpp | 14 ++++++++++++++ src/table/ai_rail.h | 12 ++++++++++++ 7 files changed, 69 insertions(+), 13 deletions(-) diff --git a/changelog.txt b/changelog.txt index 505725fb3a..7be11836f0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +0.6.1 (2008-06-01) +------------------------------------------------------------------------ +- Fix: Industry tiles would sometimes tell they need a 'level' slope when they do not want the slope (r13348) +- Fix: Attempts to make the old AI perform better (r13217, r13221, r13222) + + 0.6.1-RC2 (2008-05-21) ------------------------------------------------------------------------ - Fix: Do not send rcon commands of the server to the first client but do directly execute those on the server (r13137) diff --git a/os/debian/changelog b/os/debian/changelog index 4358cf6396..2ae9359557 100644 --- a/os/debian/changelog +++ b/os/debian/changelog @@ -1,22 +1,28 @@ -openttd (0.6.1~RC2) unstable; urgency=low +openttd (0.6.1-1) unstable; urgency=low + + * New upstream release. + + -- Matthijs Kooijman Sun, 01 Jun 2008 15:35:00 +0200 + +openttd (0.6.1~RC2-1) unstable; urgency=low * New upstream release. -- Matthijs Kooijman Wed, 21 May 2008 00:05:00 +0200 -openttd (0.6.1~RC1) unstable; urgency=low +openttd (0.6.1~RC1-1) unstable; urgency=low * New upstream release. -- Matthijs Kooijman Sat, 26 Apr 2008 22:55:00 +0200 -openttd (0.6.0) unstable; urgency=low +openttd (0.6.0-1) unstable; urgency=low * New upstream release. -- Matthijs Kooijman Tue, 01 Apr 2008 13:33:37 +0100 -openttd (0.6.0~RC1) unstable; urgency=low +openttd (0.6.0~RC1-1) unstable; urgency=low * New upstream release. diff --git a/os/win32/installer/install.nsi b/os/win32/installer/install.nsi index 013fbd3fd8..a31b8a9cf1 100644 --- a/os/win32/installer/install.nsi +++ b/os/win32/installer/install.nsi @@ -1,6 +1,6 @@ !define APPNAME "OpenTTD" ; Define application name !define APPVERSION "0.6.1" ; Define application version -!define INSTALLERVERSION 47 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!! +!define INSTALLERVERSION 48 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!! !define APPURLLINK "http://www.openttd.org" !define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}" diff --git a/readme.txt b/readme.txt index 36c6f736f1..49e314c7a3 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ OpenTTD README -Last updated: 2008-04-01 -Release version: 0.6.0 +Last updated: 2008-06-01 +Release version: 0.6.1 ------------------------------------------------------------------------ diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 4a160de5ac..a4aa44d1ad 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -3377,7 +3377,8 @@ static void AiStateAirportStuff(Player *p) AirportFTAClass::Flags flags = st->Airport()->flags; - if (!(flags & (_players_ai[p->index].build_kind == 1 && i == 0 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES))) { + /* if airport doesn't accept our kind of plane, dismiss it */ + if (!(flags & (_players_ai[p->index].build_kind == 1 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES))) { continue; } @@ -3463,12 +3464,29 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p, static int AiFindBestDefaultAirportBlock(TileIndex tile, byte cargo, byte heli, CommandCost *cost) { const AiDefaultBlockData *p; - uint i; - for (i = 0; (p = _airport_default_block_data[i]) != NULL; i++) { - // If we are doing a helicopter service, avoid building - // airports where they can't land. - if (heli && !(GetAirport(p->attr)->flags & AirportFTAClass::HELICOPTERS)) continue; + bool no_small = false; + + if (!heli) { + /* do not build small airport if we have large available and we are not building heli route */ + uint valid = GetValidAirports(); + for (uint i = 0; (p = _airport_default_block_data[i]) != NULL; i++) { + uint flags = GetAirport(p->attr)->flags; + if (HasBit(valid, p->attr) && (flags & AirportFTAClass::AIRPLANES) && !(flags & AirportFTAClass::SHORT_STRIP)) { + no_small = true; + break; + } + } + } + + for (uint i = 0; (p = _airport_default_block_data[i]) != NULL; i++) { + uint flags = GetAirport(p->attr)->flags; + /* If we are doing a helicopter service, avoid building airports where they can't land */ + if (heli && !(flags & AirportFTAClass::HELICOPTERS)) continue; + /* Similiar with aircraft ... */ + if (!heli && !(flags & AirportFTAClass::AIRPLANES)) continue; + /* Do not build small airport if we prefer large */ + if (no_small && (flags & AirportFTAClass::SHORT_STRIP)) continue; *cost = AiDoBuildDefaultAirportBlock(tile, p, 0); if (CmdSucceeded(*cost) && AiCheckAirportResources(tile, p, cargo)) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index ccc268b30d..0941b6a4ce 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -330,6 +330,20 @@ static uint GetSlopeZ_Industry(TileIndex tile, uint x, uint y) static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) { + IndustryGfx gfx = GetIndustryGfx(tile); + + /* For NewGRF industry tiles we might not be drawing a foundation. We need to + * account for this, otherwise we might be applying a FOUNDATION_LEVELED + * on a steep slope which is not allowed. Furthermore other structures should + * draw the wall of the foundation in this case. + */ + if (gfx >= NEW_INDUSTRYTILEOFFSET) { + const IndustryTileSpec *indts = GetIndustryTileSpec(gfx); + if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) { + uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, GetIndustryByTile(tile), tile); + if (callback_res == 0) return FOUNDATION_NONE; + } + } return FlatteningFoundation(tileh); } diff --git a/src/table/ai_rail.h b/src/table/ai_rail.h index c95ccfb6fe..28118baa60 100644 --- a/src/table/ai_rail.h +++ b/src/table/ai_rail.h @@ -591,15 +591,27 @@ static const AiDefaultBlockData _airportdata_ai_5[] = { MKEND(), }; +static const AiDefaultBlockData _airportdata_ai_6[] = { + MKAIR(6, 0, 0), + MKEND(), +}; + static const AiDefaultBlockData _airportdata_ai_7[] = { MKAIR(7, 0, 0), MKEND(), }; +static const AiDefaultBlockData _airportdata_ai_8[] = { + MKAIR(8, 0, 0), + MKEND(), +}; + #undef MKAIR #undef MDEND static const AiDefaultBlockData * const _airport_default_block_data[] = { + _airportdata_ai_8, // helistation + _airportdata_ai_6, // helidepot _airportdata_ai_7, // intercontinental airport _airportdata_ai_4, // international airport _airportdata_ai_3, // metropolitan airport