diff options
author | bjarni <bjarni@openttd.org> | 2005-01-23 22:01:51 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-01-23 22:01:51 +0000 |
commit | cf862380fcf8b3bd83b338fdecb3126bec8b2d4f (patch) | |
tree | 7af224941eb94f777a9d568f72669a0e333a159e /vehicle.c | |
parent | 3554e28ad87374427d20c16a97764f6d90087e3b (diff) | |
download | openttd-cf862380fcf8b3bd83b338fdecb3126bec8b2d4f.tar.xz |
(svn r1629) added a counter to tell how many engines you have of each type to the autoreplace vehicle windows and made them show only the vehicles you actually have in the left list.
this also fixes some window updates issues when autoreplacing
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1449,6 +1449,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) byte capacity = rvi->capacity; Vehicle *first = GetFirstVehicleInChain(v); + //if (v->owner == _local_player) InvalidateWindowClasses(WC_TRAINS_LIST); /* rvi->image_index is the new sprite for the engine. Adding +1 makes the engine head the other way if it is a multiheaded engine (rear engine) (rvi->flags & RVI_MULTIHEAD && sprite - rvi2->image_index) is true if the engine is heading the other way, otherwise 0*/ @@ -1507,7 +1508,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) veh->u.rail.first_engine = new_engine_type; } while ( (veh=veh->next) != NULL ); } - + InvalidateWindowClasses(WC_TRAINS_LIST); break; } case VEH_Road: @@ -1518,6 +1519,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) v->cargo_type = rvi->cargo_type; v->cargo_cap = rvi->capacity; v->max_speed = rvi->max_speed; + InvalidateWindowClasses(WC_ROADVEH_LIST); break; } case VEH_Ship: @@ -1533,6 +1535,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) // since we do not stop it for autorefitting if (v->cargo_type != cargo_type) CmdRefitShip(v->x_pos, v->y_pos, DC_EXEC, v->index , cargo_type + 0x0100 ); + InvalidateWindowClasses(WC_SHIPS_LIST); break; } case VEH_Aircraft: @@ -1553,6 +1556,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) // since we do not stop it for autorefitting CmdRefitAircraft(v->x_pos, v->y_pos, DC_EXEC, v->index , cargo_type + 0x0100 ); } + InvalidateWindowClasses(WC_AIRCRAFT_LIST); break; } default: return CMD_ERROR; @@ -1565,6 +1569,8 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) v->cargo_count = v->cargo_cap; } } + InvalidateWindow(WC_REPLACE_VEHICLE, v->type); + ResortVehicleLists(); } //needs to be down here because refitting will change SET_EXPENSES_TYPE if called SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); |