Changeset - r9938:62eb4c7cfdd7
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-08-17 13:56:11
rubidium@openttd.org
(svn r14093) -Fix [FS#2230]: don't flood a NewGRF industry when it implicitly tells that it wants to be build on water (land shape flags bit 5).
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -402,49 +402,51 @@ static void GetTileDesc_Industry(TileInd
 
	td->str = is->name;
 
	if (!IsIndustryCompleted(tile)) {
 
		SetDParamX(td->dparam, 0, td->str);
 
		td->str = STR_2058_UNDER_CONSTRUCTION;
 
	}
 

	
 
	if (is->grf_prop.grffile != NULL) {
 
		td->grf = GetGRFConfig(is->grf_prop.grffile->grfid)->name;
 
	}
 
}
 

	
 
static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
 
{
 
	Industry *i = GetIndustryByTile(tile);
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 

	
 
	/* water can destroy industries
 
	 * in editor you can bulldoze industries
 
	 * with magic_bulldozer cheat you can destroy industries
 
	 * (area around OILRIG is water, so water shouldn't flood it
 
	 */
 
	if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR &&
 
			!_cheats.magic_bulldozer.value) ||
 
			((flags & DC_AUTO) != 0) ||
 
			(_current_player == OWNER_WATER && (indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER))) {
 
			(_current_player == OWNER_WATER &&
 
				((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) ||
 
				HasBit(GetIndustryTileSpec(GetIndustryGfx(tile))->slopes_refused, 5)))) {
 
		SetDParam(0, indspec->name);
 
		return_cmd_error(STR_4800_IN_THE_WAY);
 
	}
 

	
 
	if (flags & DC_EXEC) delete i;
 
	return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
 
}
 

	
 
static void TransportIndustryGoods(TileIndex tile)
 
{
 
	Industry *i = GetIndustryByTile(tile);
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 
	bool moved_cargo = false;
 

	
 
	for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
 
		uint cw = min(i->produced_cargo_waiting[j], 255);
 
		if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) {
 
			i->produced_cargo_waiting[j] -= cw;
 

	
 
			/* fluctuating economy? */
 
			if (_economy.fluct <= 0) cw = (cw + 1) / 2;
 

	
 
			i->this_month_production[j] += cw;
 

	
0 comments (0 inline, 0 general)