src/engine.cpp
branchgamebalance
changeset 9912 1ac8aac92385
parent 9911 0b8b245a2391
child 9913 e79cd19772dd
equal deleted inserted replaced
9911:0b8b245a2391 9912:1ac8aac92385
   176 }
   176 }
   177 
   177 
   178 static void AcceptEnginePreview(EngineID eid, PlayerID player)
   178 static void AcceptEnginePreview(EngineID eid, PlayerID player)
   179 {
   179 {
   180 	Engine *e = GetEngine(eid);
   180 	Engine *e = GetEngine(eid);
       
   181 	Player *p = GetPlayer(player);
   181 
   182 
   182 	SETBIT(e->player_avail, player);
   183 	SETBIT(e->player_avail, player);
   183 	if (e->type == VEH_TRAIN) {
   184 	if (e->type == VEH_TRAIN) {
   184 		const RailVehicleInfo *rvi = RailVehInfo(eid);
   185 		const RailVehicleInfo *rvi = RailVehInfo(eid);
   185 		Player *p = GetPlayer(player);
       
   186 
   186 
   187 		assert(rvi->railtype < RAILTYPE_END);
   187 		assert(rvi->railtype < RAILTYPE_END);
   188 		SETBIT(p->avail_railtypes, rvi->railtype);
   188 		SETBIT(p->avail_railtypes, rvi->railtype);
       
   189 	} else if (e->type == VEH_ROAD) {
       
   190 		SETBIT(p->avail_roadtypes, HASBIT(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
   189 	}
   191 	}
   190 
   192 
   191 	e->preview_player = INVALID_PLAYER;
   193 	e->preview_player = INVALID_PLAYER;
   192 	if (player == _local_player) {
   194 	if (player == _local_player) {
   193 		AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
   195 		AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
   326 		/* maybe make another rail type available */
   328 		/* maybe make another rail type available */
   327 		RailType railtype = RailVehInfo(index)->railtype;
   329 		RailType railtype = RailVehInfo(index)->railtype;
   328 		assert(railtype < RAILTYPE_END);
   330 		assert(railtype < RAILTYPE_END);
   329 		FOR_ALL_PLAYERS(p) {
   331 		FOR_ALL_PLAYERS(p) {
   330 			if (p->is_active) SETBIT(p->avail_railtypes, railtype);
   332 			if (p->is_active) SETBIT(p->avail_railtypes, railtype);
       
   333 		}
       
   334 	}
       
   335 	if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
       
   336 		/* maybe make another road type available */
       
   337 		FOR_ALL_PLAYERS(p) {
       
   338 			if (p->is_active) SETBIT(p->avail_roadtypes, HASBIT(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
   331 		}
   339 		}
   332 	}
   340 	}
   333 	AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
   341 	AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
   334 }
   342 }
   335 
   343