openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: industry_cmd.cpp 26328 2014-02-10 17:13:54Z frosch $ */
|
||||
/* $Id: industry_cmd.cpp 26879 2014-09-21 11:24:51Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -40,11 +40,14 @@
|
||||
#include "core/backup_type.hpp"
|
||||
#include "object_base.h"
|
||||
#include "game/game.hpp"
|
||||
#include "error.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/industry_land.h"
|
||||
#include "table/build_industry.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
IndustryPool _industry_pool("Industry");
|
||||
INSTANTIATE_POOL_METHODS(Industry)
|
||||
|
||||
@@ -518,7 +521,7 @@ static void TransportIndustryGoods(TileIndex tile)
|
||||
|
||||
if (newgfx != INDUSTRYTILE_NOANIM) {
|
||||
ResetIndustryConstructionStage(tile);
|
||||
SetIndustryCompleted(tile, true);
|
||||
SetIndustryCompleted(tile);
|
||||
SetIndustryGfx(tile, newgfx);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
@@ -718,7 +721,7 @@ static void MakeIndustryTileBigger(TileIndex tile)
|
||||
SetIndustryConstructionCounter(tile, 0);
|
||||
SetIndustryConstructionStage(tile, stage);
|
||||
StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
|
||||
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile, true);
|
||||
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile);
|
||||
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
||||
@@ -854,7 +857,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
case GFX_GOLD_MINE_TOWER_ANIMATED: gfx = GFX_GOLD_MINE_TOWER_NOT_ANIMATED; break;
|
||||
}
|
||||
SetIndustryGfx(tile, gfx);
|
||||
SetIndustryCompleted(tile, true);
|
||||
SetIndustryCompleted(tile);
|
||||
SetIndustryConstructionStage(tile, 3);
|
||||
DeleteAnimatedTile(tile);
|
||||
}
|
||||
@@ -1387,7 +1390,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||
} else {
|
||||
CommandCost ret = EnsureNoVehicleOnGround(cur_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
if (MayHaveBridgeAbove(cur_tile) && IsBridgeAbove(cur_tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
if (IsBridgeAbove(cur_tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
|
||||
const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
|
||||
|
||||
@@ -2739,6 +2742,26 @@ void InitializeIndustries()
|
||||
_industry_builder.Reset();
|
||||
}
|
||||
|
||||
/** Verify whether the generated industries are complete, and warn the user if not. */
|
||||
void CheckIndustries()
|
||||
{
|
||||
int count = 0;
|
||||
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
|
||||
if (Industry::GetIndustryTypeCount(it) > 0) continue; // Types of existing industries can be skipped.
|
||||
|
||||
bool force_at_least_one;
|
||||
uint32 chance = GetScaledIndustryGenerationProbability(it, &force_at_least_one);
|
||||
if (chance == 0 || !force_at_least_one) continue; // Types that are not available can be skipped.
|
||||
|
||||
const IndustrySpec *is = GetIndustrySpec(it);
|
||||
SetDParam(0, is->name);
|
||||
ShowErrorMessage(STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES, STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION, WL_WARNING);
|
||||
|
||||
count++;
|
||||
if (count >= 3) break; // Don't swamp the user with errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is an industry with the spec a raw industry?
|
||||
* @return true if it should be handled as a raw industry
|
||||
|
||||
Reference in New Issue
Block a user