(svn r10274) [0.5] -Backport from trunk (r9961, r10023, r10028, r10030, r10038, r10147): 0.5
authorrubidium
Fri, 22 Jun 2007 20:01:02 +0000
branch0.5
changeset 5509 0b111f4e6dc9
parent 5508 f84e84891954
child 5510 d4b8e7933d5e
(svn r10274) [0.5] -Backport from trunk (r9961, r10023, r10028, r10030, r10038, r10147):
- Fix: Some bits were unset when loading old TTD savegames when they shouldn't be unset (r10147)
- Fix: Sprite resulting from '?' substitution was reloaded into the cache entry for SPR_IMG_QUERY instead of the original sprite cache entry. This resulted in unaccounted missing sprite cache memory, and was exacerbated because the original missing sprite was not cached, so it did it again and again and again. Slowdowns and boom (r10038)
- Fix: One could build on (some) slopes when building on slopes was disabled [FS#823] (r10030)
- Fix: When deleting the first engine of a train with multiple engines, only reopen the train window if the player had the original train window open. This fixes 'random' windows opening for multiple players of the same company (r10028)
- Fix: When selling trains, if there were no wagons between multiheaded engines the rear part could be checked despite having already been deleted (10023)
- Fix: Some files were still in iso8859-15 instead of UTF-8 (r9961)
changelog.txt
gfxinit.c
openttd.c
rail_cmd.c
spritecache.c
table/sprites.h
train_cmd.c
--- a/changelog.txt	Wed Jun 13 20:48:11 2007 +0000
+++ b/changelog.txt	Fri Jun 22 20:01:02 2007 +0000
@@ -1,3 +1,36 @@
+0.5.3-RC1 (2007-06-??)
+------------------------------------------------------------------------
+- Feature: console command to get the current game date (r10137)
+- Fix: Remove invalid characters (for the file system) from savegame names [FS#916, FS#850] (r10272, r10116)
+- Fix: Some old savegames could have the wrong bits unset (r10268, r10147)
+- Fix: Do not look in every direction for tunnels when building one, one direction is enough (r10258)
+- Fix: [Windows] Do not mess desktop when using ALT-TAB [FS#876] (r10251, r10186)
+- Fix: Take the age of the front vehicle for station rating (r10246)
+- Fix: Terraforming wipes out canals. Now you always have to remove the canal before terraforming, instead of "just" removing the canal [FS#594] (r10240)
+- Fix: Only 2 trains could crash at one time as collision checking stopped on the first hit. This could technically cause desyncs in network games as the collision hash order is not guaranteed [FS#892] (r10222)
+- Fix: Land under foundations was terraform when it shouldn't be terraformed [FS#882, FS#890] (r10219)
+- Fix: Do not make a 270 degree turn on the international airport when a 90 degree turn is enough (r10187)
+- Fix: Crash when trying to get the aircraft movement state of an aircraft going to a just deleted airport [FS#874] (r10165)
+- Fix: Airports did not flood when there are aircraft on the airport [FS#601] (r10155)
+- Fix: Some vehicles were not drawn when having a high resolution and a high zoom-out level [FS#870] (r10154)
+- Fix: Vehicles disappear when crossing certain tiles [FS#869] (r10153)
+- Fix: Train disconnects in some old TTD savegames [FS#862] (10151)
+- Fix: OpenTTD assumes that the resolution is at least 1 by 1, so force the resolution to be always at least 1 by 1 (r10139)
+- Fix: When you got a sufficiently small resolution, there is a possibility for a division by zero when a sound is played (r10138)
+- Fix: When removing a dock, a ship will always try to reach the old location of the dock even when it cannot anymore because it the old location of the dock is now land instead of water [FS#810] (r10131)
+- Fix: SetCurrentGrfLangID returned the wrong language ids for most languages (r10130)
+- Fix: Some NewGRFs use the same (unused in the "current" climate) sprite IDs. Normally this gives some artefacts, but when one NewGRF expects it to be a sprite and another NewGRF overwrites it with a non-sprite nasty things happen (drawing a non-sprite crashes OTTD) [FS#838] (r10109)
+- Fix: Multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once, or tell you paid money when you did not [FS#834, FS#839] (r10087, r10085)
+- Fix: "Deactivate Electrified Railways" did not work [FS#836] (10083)
+- Fix: Memory leaks in the networking code [FS#846, FS#844] (r10082, r10075)
+- Fix: Coverage area highlight was still show when it was turned off for docks [FS#835] (r10068)
+- Fix: Do not use override engine type for articulated wagon parts (r10048)
+- Fix: Sprite resulting from '?' substitution was reloaded into the cache entry for SPR_IMG_QUERY instead of the original sprite cache entry. This resulted in unaccounted missing sprite cache memory, and was exacerbated because the original missing sprite was not cached, so it did it again and again and again. Slowdowns and boom (r10038)
+- Fix: One could build on (some) slopes when building on slopes was disabled [FS#823] (r10030)
+- Fix: When deleting the first engine of a train with multiple engines, only reopen the train window if the player had the original train window open. This fixes 'random' windows opening for multiple players of the same company (r10028)
+- Fix: When selling trains, if there were no wagons between multiheaded engines the rear part could be checked despite having already been deleted (10023)
+
+
 0.5.2 (2007-05-29)
 ------------------------------------------------------------------------
 - Feature: Add threading support for MorphOS (r9759)
--- a/gfxinit.c	Wed Jun 13 20:48:11 2007 +0000
+++ b/gfxinit.c	Fri Jun 22 20:01:02 2007 +0000
@@ -206,7 +206,7 @@
 /* Medium font */
 	   2,   92, // ' ' till 'z'
 	SKIP,   36,
-	 160,  160, // Move  to the correct position
+	 160,  160, // Move Ÿ to the correct position
 	  98,   98, // Up arrow
 	 131,  133,
 	SKIP,    1, // skip currency sign
@@ -231,7 +231,7 @@
 /* Small font */
 	 226,  316, // ' ' till 'z'
 	SKIP,   36,
-	 384,  384, // Move  to the correct position
+	 384,  384, // Move Ÿ to the correct position
 	 322,  322, // Up arrow
 	 355,  357,
 	SKIP,    1, // skip currency sign
@@ -253,7 +253,7 @@
 /* Big font */
 	 450,  540, // ' ' till 'z'
 	SKIP,   36,
-	 608,  608, // Move  to the correct position
+	 608,  608, // Move Ÿ to the correct position
 	SKIP,    1,
 	 579,  581,
 	SKIP,    1,
@@ -292,47 +292,47 @@
 	582, 582,  // euro symbol large size
 	358, 358,  // euro symbol tiny
 	SPR_CURSOR_CANAL, SPR_IMG_FASTFORWARD, // more icons
-	648, 648, // nordic char: 
-	616, 616, // nordic char: 
-	666, 666, // nordic char: 
-	634, 634, // nordic char: 
+	648, 648, // nordic char: æ
+	616, 616, // nordic char: Æ
+	666, 666, // nordic char: ø
+	634, 634, // nordic char: Ø
 	SPR_PIN_UP, SPR_CURSOR_CLONE_TRAIN, // more icons
-	382, 383, //   tiny
-	158, 159, //   medium
-	606, 607, //   large
-	360, 360, //  tiny
-	362, 362, //  tiny
-	136, 136, //  medium
-	138, 138, //  medium
-	584, 584, //  large
-	586, 586, //  large
-	626, 626, //  large
-	658, 658, //  large
-	374, 374, //  tiny
-	378, 378, //  tiny
-	150, 150, //  medium
-	154, 154, //  medium
-	598, 598, //  large
-	602, 602, //  large
-	640, 640, //  large
-	672, 672, //  large
-	380, 380, //  tiny
-	156, 156, //  medium
-	604, 604, //  large
+	382, 383, // Œ œ tiny
+	158, 159, // Œ œ medium
+	606, 607, // Œ œ large
+	360, 360, // Š tiny
+	362, 362, // š tiny
+	136, 136, // Š medium
+	138, 138, // š medium
+	584, 584, // Š large
+	586, 586, // š large
+	626, 626, // Ð large
+	658, 658, // ð large
+	374, 374, // Ž tiny
+	378, 378, // ž tiny
+	150, 150, // Ž medium
+	154, 154, // ž medium
+	598, 598, // Ž large
+	602, 602, // ž large
+	640, 640, // Þ large
+	672, 672, // þ large
+	380, 380, // º tiny
+	156, 156, // º medium
+	604, 604, // º large
 	317, 320, // { | } ~ tiny
 	 93,  96, // { | } ~ medium
 	541, 544, // { | } ~ large
 	SPR_HOUSE_ICON, SPR_HOUSE_ICON,
-	585, 585, //  large
-	587, 587, //  large
-	592, 592, //  large
-	594, 597, //     large
-	633, 633, //  large
-	665, 665, //  large
+	585, 585, // § large
+	587, 587, // © large
+	592, 592, // ® large
+	594, 597, // ° ± ² ³ large
+	633, 633, // × large
+	665, 665, // ÷ large
 	SPR_SELL_TRAIN, SPR_SHARED_ORDERS_ICON,
-	377, 377, //  small
-	153, 153, //  medium
-	601, 601, //  large
+	377, 377, // · small
+	153, 153, // · medium
+	601, 601, // · large
 	END
 };
 
--- a/openttd.c	Wed Jun 13 20:48:11 2007 +0000
+++ b/openttd.c	Fri Jun 22 20:01:02 2007 +0000
@@ -1611,6 +1611,13 @@
 		}
 	}
 
+	{
+		Vehicle *v;
+		FOR_ALL_VEHICLES(v) {
+			if (v->type == VEH_Road && v->u.road.state >= 250) SETBIT(v->u.road.state, 2);
+		}
+	}
+
 	return true;
 }
 
--- a/rail_cmd.c	Wed Jun 13 20:48:11 2007 +0000
+++ b/rail_cmd.c	Fri Jun 22 20:01:02 2007 +0000
@@ -201,20 +201,17 @@
 		}
 
 		// no special foundation
-		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0)
+		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0) {
 			return 0;
+		} else if (!_patches.build_on_slopes || _is_old_ai_player) {
+			return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
+		}
 
 		if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
 					(rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
 					(tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)
 				)) { // partly up
-			if (existing != 0) {
-				return 0;
-			} else if (!_patches.build_on_slopes || _is_old_ai_player) {
-				return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
-			} else {
-				return _price.terraform;
-			}
+			return (existing != 0) ? 0 : _price.terraform;
 		}
 	}
 	return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
--- a/spritecache.c	Wed Jun 13 20:48:11 2007 +0000
+++ b/spritecache.c	Fri Jun 22 20:01:02 2007 +0000
@@ -88,6 +88,7 @@
 {
 	uint num;
 	byte type;
+	uint32 filepos = _sprite_file_pos[id];
 
 	DEBUG(spritecache, 9) ("load sprite %d", id);
 
@@ -95,10 +96,10 @@
 		DEBUG(spritecache, 1) ("Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
 
 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
-		id = SPR_IMG_QUERY;
+		filepos = _sprite_file_pos[SPR_IMG_QUERY];
 	}
 
-	FioSeekToFile(_sprite_file_pos[id]);
+	FioSeekToFile(filepos);
 
 	num  = FioReadWord();
 	type = FioReadByte();
--- a/table/sprites.h	Wed Jun 13 20:48:11 2007 +0000
+++ b/table/sprites.h	Fri Jun 22 20:01:02 2007 +0000
@@ -25,7 +25,7 @@
  * All sprites which are described here are referenced only one to a handful of times
  * throughout the code. When introducing new sprite enums, use meaningful names.
  * Don't be lazy and typing, and only use abbrevations when their meaning is clear or
- * the length of the enum would get out of hand. In that case EXPLAIN THE ABBREVATION
+ * the length of the enum would get out of hand. In that case EXPLAIN THE ABBREVATION
  * IN THIS FILE, and perhaps add some comments in the code where it is used.
  * Now, don't whine about this being too much typing work if the enums are like
  * 30 characters in length. If your editor doen't help you simplifying your work,
--- a/train_cmd.c	Wed Jun 13 20:48:11 2007 +0000
+++ b/train_cmd.c	Fri Jun 22 20:01:02 2007 +0000
@@ -1325,6 +1325,7 @@
  */
 int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
+	Window *w = NULL;
 	Vehicle *v, *tmp, *first;
 	Vehicle *new_f = NULL;
 	int32 cost = 0;
@@ -1349,7 +1350,8 @@
 
 	if (flags & DC_EXEC) {
 		if (v == first && IsFrontEngine(first)) {
-			DeleteWindowById(WC_VEHICLE_VIEW, first->index);
+			w = FindWindowById(WC_VEHICLE_VIEW, first->index);
+			if (w != NULL) DeleteWindow(w);
 		}
 		if (IsLocalPlayer() && (p1 == 1 || !(RailVehInfo(v->engine_type)->flags & RVI_WAGON))) {
 			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
@@ -1416,7 +1418,8 @@
 					first->prev_shared = NULL;
 					first->next_shared = NULL;
 
-					if (IsLocalPlayer()) ShowTrainViewWindow(new_f);
+					/* If we deleted a window then open a new one for the 'new' train */
+					if (IsLocalPlayer() && w != NULL) ShowTrainViewWindow(new_f);
 				}
 			}
 
@@ -1469,6 +1472,15 @@
 
 						if (rear != NULL) {
 							cost -= rear->value;
+
+							/* If this is a multiheaded vehicle with nothing
+							 * between the parts, tmp will be pointing to the
+							 * rear part, which is unlinked from the train and
+							 * deleted here. However, because tmp has already
+							 * been set it needs to be updated now so that the
+							 * loop never sees the rear part. */
+							if (tmp == rear) tmp = GetNextVehicle(tmp);
+
 							if (flags & DC_EXEC) {
 								first = UnlinkWagon(rear, first);
 								DeleteDepotHighlightOfVehicle(rear);