(svn r13352) [0.6] -Backport from trunk (r13348, r13222, r13221, r13217): 0.6 0.6.1
authorrubidium
Sun, 01 Jun 2008 16:45:32 +0000
branch0.6
changeset 10801 3ad9dfb5430d
parent 10659 2d983c15a049
child 11127 5e9620220703
(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
os/debian/changelog
os/win32/installer/install.nsi
readme.txt
src/ai/default/default.cpp
src/industry_cmd.cpp
src/table/ai_rail.h
--- a/changelog.txt	Tue May 20 22:05:25 2008 +0000
+++ b/changelog.txt	Sun Jun 01 16:45:32 2008 +0000
@@ -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)
--- a/os/debian/changelog	Tue May 20 22:05:25 2008 +0000
+++ b/os/debian/changelog	Sun Jun 01 16:45:32 2008 +0000
@@ -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 <m.kooijman@student.utwente.nl>  Sun, 01 Jun 2008 15:35:00 +0200
+
+openttd (0.6.1~RC2-1) unstable; urgency=low
 
   * New upstream release.
 
  -- Matthijs Kooijman <m.kooijman@student.utwente.nl>  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 <m.kooijman@student.utwente.nl>  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 <m.kooijman@student.utwente.nl>  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.
 
--- a/os/win32/installer/install.nsi	Tue May 20 22:05:25 2008 +0000
+++ b/os/win32/installer/install.nsi	Sun Jun 01 16:45:32 2008 +0000
@@ -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}"
--- a/readme.txt	Tue May 20 22:05:25 2008 +0000
+++ b/readme.txt	Sun Jun 01 16:45:32 2008 +0000
@@ -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
 ------------------------------------------------------------------------
 
 
--- a/src/ai/default/default.cpp	Tue May 20 22:05:25 2008 +0000
+++ b/src/ai/default/default.cpp	Sun Jun 01 16:45:32 2008 +0000
@@ -3377,7 +3377,8 @@
 
 			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 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))
--- a/src/industry_cmd.cpp	Tue May 20 22:05:25 2008 +0000
+++ b/src/industry_cmd.cpp	Sun Jun 01 16:45:32 2008 +0000
@@ -330,6 +330,20 @@
 
 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);
 }
 
--- a/src/table/ai_rail.h	Tue May 20 22:05:25 2008 +0000
+++ b/src/table/ai_rail.h	Sun Jun 01 16:45:32 2008 +0000
@@ -591,15 +591,27 @@
 	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