Changeset - r20794:ace4f2fce9a6
[Not reviewed]
master
0 6 0
frosch - 11 years ago 2013-10-12 16:33:19
frosch@openttd.org
(svn r25838) -Codechange: Rename HOUSE_MAX to NUM_HOUSES.
6 files changed with 25 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/house.h
Show inline comments
 
@@ -26,14 +26,14 @@ static const byte TOWN_HOUSE_COMPLETED =
 

	
 
static const uint HOUSE_NO_CLASS      = 0;
 
static const HouseID NEW_HOUSE_OFFSET = 110;
 
static const HouseID HOUSE_MAX        = 512;
 
static const HouseID NUM_HOUSES       = 512;
 
static const HouseID INVALID_HOUSE_ID = 0xFFFF;
 

	
 
/**
 
 * There can only be as many classes as there are new houses, plus one for
 
 * NO_CLASS, as the original houses don't have classes.
 
 */
 
static const uint HOUSE_CLASS_MAX  = HOUSE_MAX - NEW_HOUSE_OFFSET + 1;
 
static const uint HOUSE_CLASS_MAX  = NUM_HOUSES - NEW_HOUSE_OFFSET + 1;
 

	
 
enum BuildingFlags {
 
	TILE_NO_FLAG         =       0,
 
@@ -124,7 +124,7 @@ struct HouseSpec {
 

	
 
	static inline HouseSpec *Get(size_t house_id)
 
	{
 
		assert(house_id < HOUSE_MAX);
 
		assert(house_id < NUM_HOUSES);
 
		extern HouseSpec _house_specs[];
 
		return &_house_specs[house_id];
 
	}
src/industry_gui.cpp
Show inline comments
 
@@ -1996,7 +1996,7 @@ struct CargoesRow {
 
		} else {
 
			/* Houses only display what is demanded. */
 
			for (uint i = 0; i < cargo_fld->u.cargo.num_cargoes; i++) {
 
				for (uint h = 0; h < HOUSE_MAX; h++) {
 
				for (uint h = 0; h < NUM_HOUSES; h++) {
 
					HouseSpec *hs = HouseSpec::Get(h);
 
					if (!hs->enabled) continue;
 

	
 
@@ -2188,7 +2188,7 @@ struct IndustryCargoesWindow : public Wi
 
		for (uint i = 0; i < length; i++) {
 
			if (cargoes[i] == INVALID_CARGO) continue;
 

	
 
			for (uint h = 0; h < HOUSE_MAX; h++) {
 
			for (uint h = 0; h < NUM_HOUSES; h++) {
 
				HouseSpec *hs = HouseSpec::Get(h);
 
				if (!hs->enabled || !(hs->building_availability & climate_mask)) continue;
 

	
src/newgrf.cpp
Show inline comments
 
@@ -2183,14 +2183,14 @@ static ChangeInfoResult TownHouseChangeI
 
{
 
	ChangeInfoResult ret = CIR_SUCCESS;
 

	
 
	if (hid + numinfo > HOUSE_MAX) {
 
		grfmsg(1, "TownHouseChangeInfo: Too many houses loaded (%u), max (%u). Ignoring.", hid + numinfo, HOUSE_MAX);
 
	if (hid + numinfo > NUM_HOUSES) {
 
		grfmsg(1, "TownHouseChangeInfo: Too many houses loaded (%u), max (%u). Ignoring.", hid + numinfo, NUM_HOUSES);
 
		return CIR_INVALID_ID;
 
	}
 

	
 
	/* Allocate house specs if they haven't been allocated already. */
 
	if (_cur.grffile->housespec == NULL) {
 
		_cur.grffile->housespec = CallocT<HouseSpec*>(HOUSE_MAX);
 
		_cur.grffile->housespec = CallocT<HouseSpec*>(NUM_HOUSES);
 
	}
 

	
 
	for (int i = 0; i < numinfo; i++) {
 
@@ -7789,7 +7789,7 @@ static void ResetCustomHouses()
 
	for (GRFFile **file = _grf_files.Begin(); file != end; file++) {
 
		HouseSpec **&housespec = (*file)->housespec;
 
		if (housespec == NULL) continue;
 
		for (uint i = 0; i < HOUSE_MAX; i++) {
 
		for (uint i = 0; i < NUM_HOUSES; i++) {
 
			free(housespec[i]);
 
		}
 

	
 
@@ -8380,7 +8380,7 @@ static void EnsureEarlyHouse(HouseZones 
 
{
 
	Year min_year = MAX_YEAR;
 

	
 
	for (int i = 0; i < HOUSE_MAX; i++) {
 
	for (int i = 0; i < NUM_HOUSES; i++) {
 
		HouseSpec *hs = HouseSpec::Get(i);
 
		if (hs == NULL || !hs->enabled) continue;
 
		if ((hs->building_availability & bitmask) != bitmask) continue;
 
@@ -8389,7 +8389,7 @@ static void EnsureEarlyHouse(HouseZones 
 

	
 
	if (min_year == 0) return;
 

	
 
	for (int i = 0; i < HOUSE_MAX; i++) {
 
	for (int i = 0; i < NUM_HOUSES; i++) {
 
		HouseSpec *hs = HouseSpec::Get(i);
 
		if (hs == NULL || !hs->enabled) continue;
 
		if ((hs->building_availability & bitmask) != bitmask) continue;
 
@@ -8419,14 +8419,14 @@ static void FinaliseHouseArray()
 
		HouseSpec **&housespec = (*file)->housespec;
 
		if (housespec == NULL) continue;
 

	
 
		for (int i = 0; i < HOUSE_MAX; i++) {
 
		for (int i = 0; i < NUM_HOUSES; i++) {
 
			HouseSpec *hs = housespec[i];
 

	
 
			if (hs == NULL) continue;
 

	
 
			const HouseSpec *next1 = (i + 1 < HOUSE_MAX ? housespec[i + 1] : NULL);
 
			const HouseSpec *next2 = (i + 2 < HOUSE_MAX ? housespec[i + 2] : NULL);
 
			const HouseSpec *next3 = (i + 3 < HOUSE_MAX ? housespec[i + 3] : NULL);
 
			const HouseSpec *next1 = (i + 1 < NUM_HOUSES ? housespec[i + 1] : NULL);
 
			const HouseSpec *next2 = (i + 2 < NUM_HOUSES ? housespec[i + 2] : NULL);
 
			const HouseSpec *next3 = (i + 3 < NUM_HOUSES ? housespec[i + 3] : NULL);
 

	
 
			if (!IsHouseSpecValid(hs, next1, next2, next3, (*file)->filename)) continue;
 

	
 
@@ -8434,11 +8434,11 @@ static void FinaliseHouseArray()
 
		}
 
	}
 

	
 
	for (int i = 0; i < HOUSE_MAX; i++) {
 
	for (int i = 0; i < NUM_HOUSES; i++) {
 
		HouseSpec *hs = HouseSpec::Get(i);
 
		const HouseSpec *next1 = (i + 1 < HOUSE_MAX ? HouseSpec::Get(i + 1) : NULL);
 
		const HouseSpec *next2 = (i + 2 < HOUSE_MAX ? HouseSpec::Get(i + 2) : NULL);
 
		const HouseSpec *next3 = (i + 3 < HOUSE_MAX ? HouseSpec::Get(i + 3) : NULL);
 
		const HouseSpec *next1 = (i + 1 < NUM_HOUSES ? HouseSpec::Get(i + 1) : NULL);
 
		const HouseSpec *next2 = (i + 2 < NUM_HOUSES ? HouseSpec::Get(i + 2) : NULL);
 
		const HouseSpec *next3 = (i + 3 < NUM_HOUSES ? HouseSpec::Get(i + 3) : NULL);
 

	
 
		/* We need to check all houses again to we are sure that multitile houses
 
		 * did get consecutive IDs and none of the parts are missing. */
src/newgrf_house.cpp
Show inline comments
 
@@ -27,7 +27,7 @@
 
static BuildingCounts<uint32> _building_counts;
 
static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
 

	
 
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, HOUSE_MAX, INVALID_HOUSE_ID);
 
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, NUM_HOUSES, INVALID_HOUSE_ID);
 

	
 
/**
 
 * Constructor of a house scope resolver.
src/town.h
Show inline comments
 
@@ -22,7 +22,7 @@
 

	
 
template <typename T>
 
struct BuildingCounts {
 
	T id_count[HOUSE_MAX];
 
	T id_count[NUM_HOUSES];
 
	T class_count[HOUSE_CLASS_MAX];
 
};
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -2194,13 +2194,13 @@ static bool BuildTownHouse(Town *t, Tile
 
	/* bits 0-4 are used
 
	 * bits 11-15 are used
 
	 * bits 5-10 are not used. */
 
	HouseID houses[HOUSE_MAX];
 
	HouseID houses[NUM_HOUSES];
 
	uint num = 0;
 
	uint probs[HOUSE_MAX];
 
	uint probs[NUM_HOUSES];
 
	uint probability_max = 0;
 

	
 
	/* Generate a list of all possible houses that can be built. */
 
	for (uint i = 0; i < HOUSE_MAX; i++) {
 
	for (uint i = 0; i < NUM_HOUSES; i++) {
 
		const HouseSpec *hs = HouseSpec::Get(i);
 

	
 
		/* Verify that the candidate house spec matches the current tile status */
 
@@ -3378,7 +3378,7 @@ extern const TileTypeProcs _tile_type_to
 
};
 

	
 

	
 
HouseSpec _house_specs[HOUSE_MAX];
 
HouseSpec _house_specs[NUM_HOUSES];
 

	
 
void ResetHouses()
 
{
0 comments (0 inline, 0 general)