Mercurial > hg > openttd
comparison src/roadveh_cmd.cpp @ 7398:6324d82f421d draft
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
-Codechange: do not force "special" vehicles to be allocated in the low 1024 vehicle slots and non "special" vehicles in the rest of the slots.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 03 Aug 2007 19:36:00 +0000 |
parents | fba35a9abf79 |
children | 5e887e08fd59 |
comparison
equal
deleted
inserted
replaced
7397:4143cc4d4d8c | 7398:6324d82f421d |
---|---|
183 | 183 |
184 /* Allow for the front and up to 10 articulated parts. */ | 184 /* Allow for the front and up to 10 articulated parts. */ |
185 Vehicle *vl[11]; | 185 Vehicle *vl[11]; |
186 memset(&vl, 0, sizeof(vl)); | 186 memset(&vl, 0, sizeof(vl)); |
187 | 187 |
188 if (!AllocateVehicles(vl, num_vehicles)) { | 188 if (!Vehicle::AllocateList(vl, num_vehicles)) { |
189 return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); | 189 return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); |
190 } | 190 } |
191 | 191 |
192 v = vl[0]; | 192 v = vl[0]; |
193 | 193 |
370 InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); | 370 InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); |
371 RebuildVehicleLists(); | 371 RebuildVehicleLists(); |
372 InvalidateWindow(WC_COMPANY, v->owner); | 372 InvalidateWindow(WC_COMPANY, v->owner); |
373 DeleteWindowById(WC_VEHICLE_VIEW, v->index); | 373 DeleteWindowById(WC_VEHICLE_VIEW, v->index); |
374 DeleteDepotHighlightOfVehicle(v); | 374 DeleteDepotHighlightOfVehicle(v); |
375 DeleteVehicle(v); | 375 delete v; |
376 } | 376 } |
377 | 377 |
378 return CommandCost(-v->value); | 378 return CommandCost(-v->value); |
379 } | 379 } |
380 | 380 |
608 if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v); | 608 if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v); |
609 | 609 |
610 BeginVehicleMove(v); | 610 BeginVehicleMove(v); |
611 EndVehicleMove(v); | 611 EndVehicleMove(v); |
612 | 612 |
613 DeleteVehicle(v); | 613 delete v; |
614 } | 614 } |
615 | 615 |
616 static byte SetRoadVehPosition(Vehicle *v, int x, int y) | 616 static byte SetRoadVehPosition(Vehicle *v, int x, int y) |
617 { | 617 { |
618 byte new_z, old_z; | 618 byte new_z, old_z; |