summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-10-12 16:33:19 +0000
committerfrosch <frosch@openttd.org>2013-10-12 16:33:19 +0000
commit6a0439a789fc3a5f8da55493b27d4c9c6c328b1b (patch)
tree7522f46ab9f0646d701a2803961ed400cfba338c /src
parentad8b387f9eb8185f25948651b7a34f151812c31d (diff)
downloadopenttd-6a0439a789fc3a5f8da55493b27d4c9c6c328b1b.tar.xz
(svn r25838) -Codechange: Rename HOUSE_MAX to NUM_HOUSES.
Diffstat (limited to 'src')
-rw-r--r--src/house.h6
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/newgrf.cpp28
-rw-r--r--src/newgrf_house.cpp2
-rw-r--r--src/town.h2
-rw-r--r--src/town_cmd.cpp8
6 files changed, 25 insertions, 25 deletions
diff --git a/src/house.h b/src/house.h
index 9d5d5529d..b74e13c18 100644
--- a/src/house.h
+++ b/src/house.h
@@ -26,14 +26,14 @@ static const byte TOWN_HOUSE_COMPLETED = 3;
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];
}
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 49f71e909..b77891368 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -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 Window {
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;
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index ae6c0b36f..78c662ad4 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2183,14 +2183,14 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt
{
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 bitmask)
{
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 bitmask)
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. */
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 2f03060a6..38b127f97 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -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.
diff --git a/src/town.h b/src/town.h
index 665b438ed..7251d6082 100644
--- a/src/town.h
+++ b/src/town.h
@@ -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];
};
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 1430656a9..6d469ba06 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2194,13 +2194,13 @@ static bool BuildTownHouse(Town *t, TileIndex 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_town_procs = {
};
-HouseSpec _house_specs[HOUSE_MAX];
+HouseSpec _house_specs[NUM_HOUSES];
void ResetHouses()
{