engine.c
changeset 819 02e9296ccdca
parent 740 c1d06749846b
child 842 ebfd36603ab9
equal deleted inserted replaced
818:906f21e653b2 819:02e9296ccdca
   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 }