(svn r8883) [0.5] -Backport from trunk (r8740, r8793, r8865, r8878): 0.5
authorDarkvater
Sat, 24 Feb 2007 16:46:36 +0000
branch0.5
changeset 5447 fdd232ac18d0
parent 5446 68d042c57e9e
child 5448 2788f297717e
(svn r8883) [0.5] -Backport from trunk (r8740, r8793, r8865, r8878):
- GCC warnings for r8738 (r8740)
- Correct spelling of real french townnames and 'remove' a duplicate (r8793)
- (NewGRF) Ignore 1 byte action 0s during safety check (r8865)
- Stricter checks for CmdMoveRailVehicle() parameters (r8878)
newgrf.c
oldloader.c
table/namegen.h
train_cmd.c
--- a/newgrf.c	Sat Feb 24 01:47:26 2007 +0000
+++ b/newgrf.c	Sat Feb 24 16:46:36 2007 +0000
@@ -1479,6 +1479,11 @@
 	uint8 numinfo;
 	uint8 index;
 
+	if (len == 1) {
+		grfmsg(8, "Silently ignoring one-byte special sprite 0x00");
+		return;
+	}
+
 	check_length(len, 6, "SafeChangeInfo");
 	buf++;
 	feature  = grf_load_byte(&buf);
--- a/oldloader.c	Sat Feb 24 01:47:26 2007 +0000
+++ b/oldloader.c	Sat Feb 24 16:46:36 2007 +0000
@@ -1531,6 +1531,7 @@
 					SetTileType(i, MP_CLEAR);
 					SetTileOwner(i, OWNER_NONE);
 				}
+			default: break;
 			} break;
 		}
 	}
--- a/table/namegen.h	Sat Feb 24 01:47:26 2007 +0000
+++ b/table/namegen.h	Sat Feb 24 16:46:36 2007 +0000
@@ -709,17 +709,17 @@
 	"Bordeaux",
 	"Bayonne",
 	"Montpellier",
-	"Montelimar",
+	"Montélimar",
 	"Valence",
 	"Digne",
 	"Nice",
 	"Cannes",
 	"St. Tropez",
-	"Marseilles",
+	"Marseille",
 	"Narbonne",
 	"Sète",
 	"Aurillac",
-	"Gueret",
+	"Guéret",
 	"Le Creusot",
 	"Nevers",
 	"Auxerre",
@@ -731,7 +731,7 @@
 	"Chaumont",
 	"Langres",
 	"Bourg",
-	"Lyons",
+	"Lyon",
 	"Vienne",
 	"Grenoble",
 	"Toulon",
@@ -763,7 +763,7 @@
 	"Beaujolais",
 	"Narbonne",
 	"Albi",
-	"St. Valery",
+	"Paris",
 	"Biarritz",
 	"Béziers",
 	"Nîmes",
--- a/train_cmd.c	Sat Feb 24 01:47:26 2007 +0000
+++ b/train_cmd.c	Sat Feb 24 16:46:36 2007 +0000
@@ -1004,13 +1004,15 @@
 
 	src = GetVehicle(s);
 
-	if (src->type != VEH_Train) return CMD_ERROR;
+	if (src->type != VEH_Train || !CheckOwnership(src->owner)) return CMD_ERROR;
 
 	// if nothing is selected as destination, try and find a matching vehicle to drag to.
 	if (d == INVALID_VEHICLE) {
 		dst = IsTrainEngine(src) ? NULL : FindGoodVehiclePos(src);
 	} else {
+		if (!IsValidVehicleID(d)) return CMD_ERROR;
 		dst = GetVehicle(d);
+		if (dst->type != VEH_Train || !CheckOwnership(dst->owner)) return CMD_ERROR;
 	}
 
 	// if an articulated part is being handled, deal with its parent vehicle
@@ -1022,17 +1024,15 @@
 	// don't move the same vehicle..
 	if (src == dst) return 0;
 
-	/* the player must be the owner */
-	if (!CheckOwnership(src->owner) || (dst != NULL && !CheckOwnership(dst->owner)))
-		return CMD_ERROR;
-
 	/* locate the head of the two chains */
 	src_head = GetFirstVehicleInChain(src);
-	dst_head = NULL;
 	if (dst != NULL) {
 		dst_head = GetFirstVehicleInChain(dst);
+		if (dst_head->tile != src_head->tile) return CMD_ERROR;
 		// Now deal with articulated part of destination wagon
 		dst = GetLastEnginePart(dst);
+	} else {
+		dst_head = NULL;
 	}
 
 	if (dst != NULL && IsMultiheaded(dst) && !IsTrainEngine(dst) && IsTrainWagon(src)) {
@@ -1089,8 +1089,6 @@
 				// check if all vehicles in the dest train are stopped.
 				dst_len = CheckTrainStoppedInDepot(dst_head);
 				if (dst_len < 0) return_cmd_error(STR_881A_TRAINS_CAN_ONLY_BE_ALTERED);
-
-				assert(dst_head->tile == src_head->tile);
 			}
 
 			// We are moving between rows, so only count the wagons from the source