1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 05:29:11 +00:00

(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)
This commit is contained in:
rubidium
2007-06-22 20:01:02 +00:00
parent 95adb04eae
commit 141da0127f
7 changed files with 101 additions and 51 deletions

View File

@@ -1325,6 +1325,7 @@ int32 CmdStartStopTrain(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/
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 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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);