Changeset - r9450:4c97b7e77fa9
[Not reviewed]
master
0 4 0
belugas - 16 years ago 2008-06-03 03:06:16
belugas@openttd.org
(svn r13368) -Codechange: give house's min/max_date a better name, as it is really year, not date
4 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -1401,25 +1401,25 @@ static bool TownHouseChangeInfo(uint hid
 

	
 
				/**
 
				 * New houses do not (currently) expect to have a default start
 
				 * date before 1930, as this breaks the build date stuff.
 
				 * @see FinaliseHouseArray() for more details.
 
				 */
 
				if (housespec->min_date < 1930) housespec->min_date = 1930;
 
				if (housespec->min_year < 1930) housespec->min_year = 1930;
 

	
 
				_loaded_newgrf_features.has_newhouses = true;
 
			} break;
 

	
 
			case 0x09: // Building flags
 
				housespec->building_flags = (BuildingFlags)grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0A: { // Availability years
 
				uint16 years = grf_load_word(&buf);
 
				housespec->min_date = GB(years, 0, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 0, 8);
 
				housespec->max_date = GB(years, 8, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 8, 8);
 
				housespec->min_year = GB(years, 0, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 0, 8);
 
				housespec->max_year = GB(years, 8, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 8, 8);
 
			} break;
 

	
 
			case 0x0B: // Population
 
				housespec->population = grf_load_byte(&buf);
 
				break;
 

	
 
@@ -5582,31 +5582,31 @@ static void FinaliseHouseArray()
 
	 * 1930 and the date is before 1930, the game pretends that this is 1930.
 
	 * If there have been any houses defined with start dates before 1930 then
 
	 * the dates are left alone.
 
	 * On the other hand, why 1930? Just 'fix' the houses with the lowest
 
	 * minimum introduction date to 0.
 
	 */
 
	Year min_date = MAX_YEAR;
 
	Year min_year = MAX_YEAR;
 

	
 
	for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
 
		if (file->housespec == NULL) continue;
 

	
 
		for (int i = 0; i < HOUSE_MAX; i++) {
 
			HouseSpec *hs = file->housespec[i];
 
			if (hs != NULL) {
 
				_house_mngr.SetEntitySpec(hs);
 
				if (hs->min_date < min_date) min_date = hs->min_date;
 
				if (hs->min_year < min_year) min_year = hs->min_year;
 
			}
 
		}
 
	}
 

	
 
	if (min_date != 0) {
 
	if (min_year != 0) {
 
		for (int i = 0; i < HOUSE_MAX; i++) {
 
			HouseSpec *hs = GetHouseSpecs(i);
 

	
 
			if (hs->enabled && hs->min_date == min_date) hs->min_date = 0;
 
			if (hs->enabled && hs->min_year == min_year) hs->min_year = 0;
 
		}
 
	}
 
}
 

	
 
/** Add all new industries to the industry array. Industry properties can be set at any
 
 * time in the GRF file, so we can only add a industry spec to the industry array
src/table/town_land.h
Show inline comments
 
@@ -1806,14 +1806,14 @@ assert_compile(lengthof(_town_draw_tile_
 
	 0, NULL, 0, 0, {0, 0, 0, 0}, 16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, 0, 2, 0, 0, 0, NULL}
 
/** House specifications from original data */
 
static const HouseSpec _original_house_specs[] = {
 
	/**
 
	 *                                                              remove_rating_decrease
 
	 *                                                               |    mail_generation
 
	 *     min_date                                                  |    |    1st CargoID acceptance
 
	 *     |         max_date                                        |    |    |    2nd CargoID acceptance
 
	 *     min_year                                                  |    |    1st CargoID acceptance
 
	 *     |         max_year                                        |    |    |    2nd CargoID acceptance
 
	 *     |         |    population                                 |    |    |    |    3th CargoID acceptance
 
	 *     |         |    |    removal_cost                          |    |    |    |    |
 
	 *     |         |    |    |    building_name                    |    |    |    |    |
 
	 *     |         |    |    |    |                                |    |    |    |    |
 
	 *     |         |    |    |    |                                |    |    |    |    |
 
	 * +-building_flags   |    |    |                                |    |    |    |    |
src/town.h
Show inline comments
 
@@ -209,14 +209,14 @@ inline TownLayout Town::GetActiveLayout(
 
{
 
	return (_settings_game.economy.town_layout == TL_RANDOM) ? this->layout : _settings_game.economy.town_layout;
 
}
 

	
 
struct HouseSpec {
 
	/* Standard properties */
 
	Year min_date;                     ///< introduction year of the house
 
	Year max_date;                     ///< last year it can be built
 
	Year min_year;                     ///< introduction year of the house
 
	Year max_year;                     ///< last year it can be built
 
	byte population;                   ///< population (Zero on other tiles in multi tile house.)
 
	byte removal_cost;                 ///< cost multiplier for removing it
 
	StringID building_name;            ///< building name
 
	uint16 remove_rating_decrease;     ///< rating decrease if removed
 
	byte mail_generation;              ///< mail generation multiplier (tile based, as the acceptances below)
 
	byte cargo_acceptance[3];          ///< acceptance level for the cargo slots
src/town_cmd.cpp
Show inline comments
 
@@ -1928,13 +1928,13 @@ static bool BuildTownHouse(Town *t, Tile
 
			if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
 
				uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile);
 
				if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue;
 
			}
 
		}
 

	
 
		if (_cur_year < hs->min_date || _cur_year > hs->max_date) continue;
 
		if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue;
 

	
 
		/* Special houses that there can be only one of. */
 
		uint oneof = 0;
 

	
 
		if (hs->building_flags & BUILDING_IS_CHURCH) {
 
			SetBit(oneof, TOWN_HAS_CHURCH);
0 comments (0 inline, 0 general)