mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r1290) Added type to typedef struct Engine and filled in the same data as in type in vehicle
it was kind of lame that you should use AircraftVehInfo(), ShipVehInfo() etc. if you wanted to know what type the engine is
This commit is contained in:
parent
5b8c604f47
commit
c4d073a4de
23
engine.c
23
engine.c
@ -119,12 +119,12 @@ void StartupEngines()
|
||||
{
|
||||
Engine *e;
|
||||
const EngineInfo *ei;
|
||||
uint32 r;
|
||||
uint32 r, counter = 0;
|
||||
|
||||
SetupEngineNames();
|
||||
|
||||
|
||||
for(e=_engines, ei=_engine_info; e != endof(_engines); e++,ei++) {
|
||||
for(e=_engines, ei=_engine_info; e != endof(_engines); e++, ei++, counter++) {
|
||||
e->age = 0;
|
||||
e->railtype = ei->railtype_climates >> 4;
|
||||
e->flags = 0;
|
||||
@ -164,6 +164,25 @@ void StartupEngines()
|
||||
e->flags |= ENGINE_AVAILABLE;
|
||||
e->player_avail = 0;
|
||||
}
|
||||
|
||||
/* This sets up type for the engine
|
||||
It is needed if you want to ask the engine what type it is
|
||||
It should hopefully be the same as when you ask a vehicle what it is
|
||||
but using this, you can ask what type an engine number is
|
||||
even if it is not a vehicle (yet)*/
|
||||
e->type = VEH_Train;
|
||||
if (counter >= ROAD_ENGINES_INDEX) {
|
||||
e->type = VEH_Road;
|
||||
if (counter >= SHIP_ENGINES_INDEX) {
|
||||
e->type = VEH_Ship;
|
||||
if (counter >= AIRCRAFT_ENGINES_INDEX) {
|
||||
e->type = VEH_Aircraft;
|
||||
if (counter >= TOTAL_NUM_ENGINES) {
|
||||
e->type = VEH_Special;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AdjustAvailAircraft();
|
||||
|
Loading…
Reference in New Issue
Block a user