diff options
author | peter1138 <peter1138@openttd.org> | 2006-01-02 19:55:09 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-01-02 19:55:09 +0000 |
commit | eeeebf9f6dd42b522c47f09e81fec6b9a033ec42 (patch) | |
tree | 481553efefffad348e1ffe91ecbebbd467ab67c4 | |
parent | 5353d05865379a2da772449a40bdbeb87ba241d1 (diff) | |
download | openttd-eeeebf9f6dd42b522c47f09e81fec6b9a033ec42.tar.xz |
(svn r3359) - Autoreplace GUI: When starting or stopping a replacement, redraw the replace window after the command has completed, rather than after calling the command.
-rw-r--r-- | players.c | 9 | ||||
-rw-r--r-- | vehicle_gui.c | 2 |
2 files changed, 7 insertions, 4 deletions
@@ -710,6 +710,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) case 3: { EngineID old_engine_type = GB(p2, 0, 16); EngineID new_engine_type = GB(p2, 16, 16); + int32 cost; if (new_engine_type != INVALID_ENGINE) { /* First we make sure that it's a valid type the user requested @@ -729,10 +730,14 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (!HASBIT(GetEngine(new_engine_type)->player_avail, _current_player)) return CMD_ERROR; - return AddEngineReplacement(p, old_engine_type, new_engine_type, flags); + cost = AddEngineReplacement(p, old_engine_type, new_engine_type, flags); } else { - return RemoveEngineReplacement(p, old_engine_type, flags); + cost = RemoveEngineReplacement(p, old_engine_type, flags); } + + if (IsLocalPlayer()) InvalidateWindow(WC_REPLACE_VEHICLE, GetEngine(old_engine_type)->type); + + return cost; } case 4: diff --git a/vehicle_gui.c b/vehicle_gui.c index c8e184c13..fdaa7fa4f 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -940,14 +940,12 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) EngineID veh_from = WP(w, replaceveh_d).sel_engine[0]; EngineID veh_to = WP(w, replaceveh_d).sel_engine[1]; DoCommandP(0, 3, veh_from + (veh_to << 16), NULL, CMD_REPLACE_VEHICLE); - SetWindowDirty(w); break; } case 6: { /* Stop replacing */ EngineID veh_from = WP(w, replaceveh_d).sel_engine[0]; DoCommandP(0, 3, veh_from + (INVALID_ENGINE << 16), NULL, CMD_REPLACE_VEHICLE); - SetWindowDirty(w); break; } |