Changeset - r7:220f9421806f
[Not reviewed]
master
0 2 0
dominik - 20 years ago 2004-08-10 16:12:40
dominik@openttd.org
(svn r8) Fix: Automatic oil refinery generation in editor
2 files changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
industry_cmd.c
Show inline comments
 
@@ -1107,15 +1107,21 @@ static bool CheckNewIndustry_Forest(uint
 
			return false;
 
		}
 
	}
 
	return true;
 
}
 

	
 
extern bool _ignore_restrictions;
 

	
 
static bool CheckNewIndustry_Oilwell(uint tile, int type)
 
{
 
	int x,y;
 
	
 
	if(_ignore_restrictions && _game_mode == GM_EDITOR)
 
		return true;
 

	
 
	if (type != IT_OIL_RIG && _game_mode == GM_EDITOR)
 
		return true;
 

	
 
	x = GET_TILE_X(tile);
 
	y = GET_TILE_Y(tile);
 

	
main_gui.c
Show inline comments
 
@@ -1434,12 +1434,14 @@ static bool AnyTownExists() {
 
extern Industry *CreateNewIndustry(uint tile, int type);
 

	
 
static bool TryBuildIndustry(TileIndex tile, int type)
 
{
 
	int n;
 

	
 
	if (CreateNewIndustry(tile, type)) return true;
 

	
 
	n = 100;
 
	do {
 
		if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true;
 
	} while (--n);
 

	
 
	n = 200;
 
@@ -1460,12 +1462,14 @@ static const byte _industry_type_list[4]
 
	{0, 1, 2, 3, 4, 5, 6, 8, 9, 18, 11, 12},
 
	{0, 1, 14, 3, 4, 13, 7, 15, 9, 16, 11, 12},
 
	{25, 19, 20, 4, 13, 23, 21, 24, 22, 11, 16, 17, 10},
 
	{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
 
};
 

	
 
bool _ignore_restrictions;
 

	
 
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
 
{
 
	int button;
 

	
 
	switch(e->event) {
 
	case WE_PAINT:
 
@@ -1501,16 +1505,18 @@ static void ScenEditIndustryWndProc(Wind
 
			ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST,STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y);
 
			return;
 
		}
 

	
 
		_current_player = OWNER_NONE;
 
		_generating_world = true;
 
		_ignore_restrictions = true;
 
		if (!TryBuildIndustry(e->place.tile,type)) {
 
			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);
 
		}
 
		_ignore_restrictions = false;
 
		_generating_world = false;
 
		break;
 
	}
 
	case WE_ABORT_PLACE_OBJ:
 
		w->click_state = 0;
 
		SetWindowDirty(w);
0 comments (0 inline, 0 general)