engine.c
changeset 819 c425b7e22f6a
parent 740 ab84ecdf86a2
child 842 efc3546bc313
equal deleted inserted replaced
818:546a7894f312 819:c425b7e22f6a
   117 
   117 
   118 void StartupEngines()
   118 void StartupEngines()
   119 {
   119 {
   120 	Engine *e;
   120 	Engine *e;
   121 	const EngineInfo *ei;
   121 	const EngineInfo *ei;
   122 	uint32 r;
   122 	uint32 r, counter = 0;
   123 
   123 
   124 	SetupEngineNames();
   124 	SetupEngineNames();
   125 
   125 
   126 
   126 
   127 	for(e=_engines, ei=_engine_info; e != endof(_engines); e++,ei++) {
   127 	for(e=_engines, ei=_engine_info; e != endof(_engines); e++, ei++, counter++) {
   128 		e->age = 0;
   128 		e->age = 0;
   129 		e->railtype = ei->railtype_climates >> 4;
   129 		e->railtype = ei->railtype_climates >> 4;
   130 		e->flags = 0;
   130 		e->flags = 0;
   131 		e->player_avail = 0;
   131 		e->player_avail = 0;
   132 
   132 
   161 
   161 
   162 		// prevent certain engines from ever appearing.
   162 		// prevent certain engines from ever appearing.
   163 		if (!HASBIT(ei->railtype_climates, _opt.landscape)) {
   163 		if (!HASBIT(ei->railtype_climates, _opt.landscape)) {
   164 			e->flags |= ENGINE_AVAILABLE;
   164 			e->flags |= ENGINE_AVAILABLE;
   165 			e->player_avail = 0;
   165 			e->player_avail = 0;
       
   166 		}
       
   167 		
       
   168 		/* This sets up type for the engine
       
   169 		   It is needed if you want to ask the engine what type it is
       
   170 		   It should hopefully be the same as when you ask a vehicle what it is
       
   171 		   but using this, you can ask what type an engine number is
       
   172 		   even if it is not a vehicle (yet)*/
       
   173 		e->type = VEH_Train;
       
   174 		if 	(counter >= ROAD_ENGINES_INDEX) {
       
   175 			e->type = VEH_Road;
       
   176 			if 	(counter >= SHIP_ENGINES_INDEX) {
       
   177 				e->type = VEH_Ship;
       
   178 				if 	(counter >= AIRCRAFT_ENGINES_INDEX) {
       
   179 					e->type = VEH_Aircraft;
       
   180 					if 	(counter >= TOTAL_NUM_ENGINES) {
       
   181 						e->type = VEH_Special;
       
   182 					}
       
   183 				}
       
   184 			}
   166 		}
   185 		}
   167 	}
   186 	}
   168 
   187 
   169 	AdjustAvailAircraft();
   188 	AdjustAvailAircraft();
   170 }
   189 }