mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r8) Fix: Automatic oil refinery generation in editor
This commit is contained in:
parent
935be05e8f
commit
4d148bf0fa
|
@ -1110,9 +1110,15 @@ static bool CheckNewIndustry_Forest(uint tile, int type)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool _ignore_restrictions;
|
||||||
|
|
||||||
static bool CheckNewIndustry_Oilwell(uint tile, int type)
|
static bool CheckNewIndustry_Oilwell(uint tile, int type)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
|
if(_ignore_restrictions && _game_mode == GM_EDITOR)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (type != IT_OIL_RIG && _game_mode == GM_EDITOR)
|
if (type != IT_OIL_RIG && _game_mode == GM_EDITOR)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -1437,6 +1437,8 @@ static bool TryBuildIndustry(TileIndex tile, int type)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
if (CreateNewIndustry(tile, type)) return true;
|
||||||
|
|
||||||
n = 100;
|
n = 100;
|
||||||
do {
|
do {
|
||||||
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true;
|
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true;
|
||||||
|
@ -1463,6 +1465,8 @@ static const byte _industry_type_list[4][16] = {
|
||||||
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
|
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool _ignore_restrictions;
|
||||||
|
|
||||||
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
|
@ -1504,10 +1508,12 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
_current_player = OWNER_NONE;
|
_current_player = OWNER_NONE;
|
||||||
_generating_world = true;
|
_generating_world = true;
|
||||||
|
_ignore_restrictions = true;
|
||||||
if (!TryBuildIndustry(e->place.tile,type)) {
|
if (!TryBuildIndustry(e->place.tile,type)) {
|
||||||
SET_DPARAM16(0, type + STR_4802_COAL_MINE);
|
SET_DPARAM16(0, type + STR_4802_COAL_MINE);
|
||||||
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y);
|
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y);
|
||||||
}
|
}
|
||||||
|
_ignore_restrictions = false;
|
||||||
_generating_world = false;
|
_generating_world = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue