Changeset - r6757:21bf9e5dc6b5
[Not reviewed]
master
0 3 0
belugas - 17 years ago 2007-05-30 20:20:58
belugas@openttd.org
(svn r9992) -Codechange: Remove some hardcoded references to Industry IDs.
A few more to go
3 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -1472,25 +1472,25 @@ int32 CmdBuildIndustry(TileIndex tile, u
 
	/* Check if the to-be built/founded industry is available for this climate. */
 
	if (!indspec->enabled) {
 
		return CMD_ERROR;
 
	}
 

	
 
	/* If the patch for raw-material industries is not on, you cannot build raw-material industries.
 
	 * Raw material industries are industries that do not accept cargo (at least for now)
 
	 * Exclude the lumber mill (only "raw" industry that can be built) */
 
	if (!_patches.build_rawmaterial_ind &&
 
			indspec->accepts_cargo[0] == CT_INVALID &&
 
			indspec->accepts_cargo[1] == CT_INVALID &&
 
			indspec->accepts_cargo[2] == CT_INVALID &&
 
			p1 != IT_LUMBER_MILL) {
 
			!(ind_spc->behaviour & INDUSTRYBEH_CUT_TREES) {
 
		return CMD_ERROR;
 
	}
 

	
 
	num = indspec->num_table;
 
	itt = indspec->table;
 

	
 
	do {
 
		if (--num < 0) return_cmd_error(STR_0239_SITE_UNSUITABLE);
 
	} while (!CheckIfIndustryTilesAreFree(tile, it = itt[num], p1));
 

	
 
	if (CreateNewIndustryHelper(tile, p1, flags, indspec, it) == NULL) return CMD_ERROR;
 

	
 
@@ -1513,27 +1513,28 @@ static const byte _numof_industry_table[
 
	{0, 1, 1, 1, 2, 2, 3, 3,  4,  4,  5},   //low
 
	{0, 1, 2, 3, 4, 5, 6, 7,  8,  9, 10},   //normal
 
	{0, 2, 3, 4, 6, 7, 8, 9, 10, 10, 10},   //high
 
};
 

	
 
/** This function is the one who really do the creation work
 
 * of random industries during game creation
 
 * @param type IndustryType of the desired industry
 
 * @param amount of industries that need to be built */
 
static void PlaceInitialIndustry(IndustryType type, int amount)
 
{
 
	int num = _numof_industry_table[_opt.diff.number_industries][amount];
 
	const IndustrySpec *ind_spc = GetIndustrySpec(type);
 

	
 
	/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 
	num = (type == IT_OIL_REFINERY || type == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 
	num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 

	
 
	if (_opt.diff.number_industries != 0) {
 
		PlayerID old_player = _current_player;
 
		_current_player = OWNER_NONE;
 
		assert(num > 0);
 

	
 
		do {
 
			uint i;
 

	
 
			IncreaseGeneratingWorldProgress(GWP_INDUSTRY);
 

	
 
			for (i = 0; i < 2000; i++) {
 
@@ -1558,25 +1559,25 @@ void GenerateIndustries()
 
	for (it = IT_COAL_MINE; it < NUM_INDUSTRYTYPES; it++) {
 

	
 
		ind_spc = GetIndustrySpec(it);
 
		if (ind_spc->enabled) {
 
			chance = ind_spc->appear_creation[_opt.landscape];
 
			if (chance > 0) {
 
				/* once the chance of appearance is determind, it have to be scaled by
 
				 * the difficulty level. The "chance" in question is more an index into
 
				 * the _numof_industry_table,in fact */
 
				int num = _numof_industry_table[_opt.diff.number_industries][chance];
 

	
 
				/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 
				num = (it == IT_OIL_REFINERY || it == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 
				num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 
				i += num;
 
			}
 
		}
 
	}
 

	
 
	SetGeneratingWorldProgress(GWP_INDUSTRY, i);
 

	
 
	for (it = IT_COAL_MINE; it < NUM_INDUSTRYTYPES; it++) {
 
		/* Once the number of industries has been determined, let's really create them.
 
		 * The test for chance allows us to try create industries that are available only
 
		 * for this landscape.
 
		 * @todo :  Do we really have to pass chance as un-scaled value, since we've already
src/openttd.cpp
Show inline comments
 
@@ -1772,25 +1772,25 @@ bool AfterLoadGame()
 
	if (CheckSavegameVersion(32)) {
 
		Industry *i;
 

	
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			if (IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_FIELDS)) {
 
				MakeClear(t, CLEAR_GRASS, 3);
 
			}
 
		}
 

	
 
		FOR_ALL_INDUSTRIES(i) {
 
			uint j;
 

	
 
			if (i->type == IT_FARM || i->type == IT_FARM_2) {
 
			if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
 
				for (j = 0; j != 50; j++) PlantRandomFarmField(i);
 
			}
 
		}
 
	}
 

	
 
	/* Setting no refit flags to all orders in savegames from before refit in orders were added */
 
	if (CheckSavegameVersion(36)) {
 
		Order *order;
 
		Vehicle *v;
 

	
 
		FOR_ALL_ORDERS(order) {
 
			order->refit_cargo   = CT_NO_REFIT;
src/smallmap_gui.cpp
Show inline comments
 
@@ -421,25 +421,25 @@ static inline uint32 GetSmallMapVegetati
 
	uint32 bits;
 

	
 
	switch (t) {
 
		case MP_CLEAR:
 
			if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) < 3) {
 
				bits = MKCOLOR(0x37373737);
 
			} else {
 
				bits = _vegetation_clear_bits[GetClearGround(tile)];
 
			}
 
			break;
 

	
 
		case MP_INDUSTRY:
 
			bits = GetIndustryType(tile) == IT_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
 
			bits = GetIndustrySpec(GetIndustryByTile(tile)->type)->check_proc == CHECK_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
 
			break;
 

	
 
		case MP_TREES:
 
			if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) {
 
				bits = (_opt.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
 
			} else {
 
				bits = MKCOLOR(0x54575754);
 
			}
 
			break;
 

	
 
		default:
 
			bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]);
0 comments (0 inline, 0 general)