1
0
Fork 0

(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)
release/0.5
Darkvater 2007-02-24 16:46:36 +00:00
parent 3b2bcbf0f0
commit b3b28dced2
4 changed files with 17 additions and 13 deletions

View File

@ -1479,6 +1479,11 @@ static void SafeChangeInfo(byte *buf, int len)
uint8 numinfo; uint8 numinfo;
uint8 index; uint8 index;
if (len == 1) {
grfmsg(8, "Silently ignoring one-byte special sprite 0x00");
return;
}
check_length(len, 6, "SafeChangeInfo"); check_length(len, 6, "SafeChangeInfo");
buf++; buf++;
feature = grf_load_byte(&buf); feature = grf_load_byte(&buf);

View File

@ -1531,6 +1531,7 @@ static bool LoadOldMain(LoadgameState *ls)
SetTileType(i, MP_CLEAR); SetTileType(i, MP_CLEAR);
SetTileOwner(i, OWNER_NONE); SetTileOwner(i, OWNER_NONE);
} }
default: break;
} break; } break;
} }
} }

View File

@ -709,17 +709,17 @@ static const char *name_french_real[] = {
"Bordeaux", "Bordeaux",
"Bayonne", "Bayonne",
"Montpellier", "Montpellier",
"Montelimar", "Montélimar",
"Valence", "Valence",
"Digne", "Digne",
"Nice", "Nice",
"Cannes", "Cannes",
"St. Tropez", "St. Tropez",
"Marseilles", "Marseille",
"Narbonne", "Narbonne",
"Sète", "Sète",
"Aurillac", "Aurillac",
"Gueret", "Guéret",
"Le Creusot", "Le Creusot",
"Nevers", "Nevers",
"Auxerre", "Auxerre",
@ -731,7 +731,7 @@ static const char *name_french_real[] = {
"Chaumont", "Chaumont",
"Langres", "Langres",
"Bourg", "Bourg",
"Lyons", "Lyon",
"Vienne", "Vienne",
"Grenoble", "Grenoble",
"Toulon", "Toulon",
@ -763,7 +763,7 @@ static const char *name_french_real[] = {
"Beaujolais", "Beaujolais",
"Narbonne", "Narbonne",
"Albi", "Albi",
"St. Valery", "Paris",
"Biarritz", "Biarritz",
"Béziers", "Béziers",
"Nîmes", "Nîmes",

View File

@ -1004,13 +1004,15 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
src = GetVehicle(s); 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 nothing is selected as destination, try and find a matching vehicle to drag to.
if (d == INVALID_VEHICLE) { if (d == INVALID_VEHICLE) {
dst = IsTrainEngine(src) ? NULL : FindGoodVehiclePos(src); dst = IsTrainEngine(src) ? NULL : FindGoodVehiclePos(src);
} else { } else {
if (!IsValidVehicleID(d)) return CMD_ERROR;
dst = GetVehicle(d); 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 // if an articulated part is being handled, deal with its parent vehicle
@ -1022,17 +1024,15 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
// don't move the same vehicle.. // don't move the same vehicle..
if (src == dst) return 0; 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 */ /* locate the head of the two chains */
src_head = GetFirstVehicleInChain(src); src_head = GetFirstVehicleInChain(src);
dst_head = NULL;
if (dst != NULL) { if (dst != NULL) {
dst_head = GetFirstVehicleInChain(dst); dst_head = GetFirstVehicleInChain(dst);
if (dst_head->tile != src_head->tile) return CMD_ERROR;
// Now deal with articulated part of destination wagon // Now deal with articulated part of destination wagon
dst = GetLastEnginePart(dst); dst = GetLastEnginePart(dst);
} else {
dst_head = NULL;
} }
if (dst != NULL && IsMultiheaded(dst) && !IsTrainEngine(dst) && IsTrainWagon(src)) { if (dst != NULL && IsMultiheaded(dst) && !IsTrainEngine(dst) && IsTrainWagon(src)) {
@ -1089,8 +1089,6 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
// check if all vehicles in the dest train are stopped. // check if all vehicles in the dest train are stopped.
dst_len = CheckTrainStoppedInDepot(dst_head); dst_len = CheckTrainStoppedInDepot(dst_head);
if (dst_len < 0) return_cmd_error(STR_881A_TRAINS_CAN_ONLY_BE_ALTERED); 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 // We are moving between rows, so only count the wagons from the source