diff options
author | tron <tron@openttd.org> | 2005-11-14 15:22:12 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-11-14 15:22:12 +0000 |
commit | d8b56c123eab7f7b48f2af3579130e366f6106ab (patch) | |
tree | 3e7ec4e2b0405d8a2ab70cf1e236cbd627caf9aa | |
parent | 5fa6b7eb06dd91aabde074acffab89ce00283e9e (diff) | |
download | openttd-d8b56c123eab7f7b48f2af3579130e366f6106ab.tar.xz |
(svn r3180) Replace some magic numbers by symbolic names
-rw-r--r-- | industry_cmd.c | 17 | ||||
-rw-r--r-- | station_gui.c | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index 292f0e042..21419f4c4 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1571,11 +1571,16 @@ int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2) } spec = &_industry_spec[p1]; - /* If the patch for non-raw-material industries is not on, you cannot build raw-material industries. + /* 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 industry 25, which is the lumber mill (only "raw" industry that can be built)*/ - if (!_patches.build_rawmaterial_ind && spec->accepts_cargo[0] == 255 && - spec->accepts_cargo[1] == 255 && spec->accepts_cargo[2] == 255 && p1 != 25) return CMD_ERROR; + * Exclude the lumber mill (only "raw" industry that can be built) */ + if (!_patches.build_rawmaterial_ind && + spec->accepts_cargo[0] == CT_INVALID && + spec->accepts_cargo[1] == CT_INVALID && + spec->accepts_cargo[2] == CT_INVALID && + p1 != IT_LUMBER_MILL) { + return CMD_ERROR; + } if (!_check_new_industry_procs[spec->check_proc](tile, p1)) return CMD_ERROR; @@ -1631,7 +1636,7 @@ Industry *CreateNewIndustry(TileIndex tile, int type) if ( (i = AllocateIndustry()) == NULL) return NULL; - DoCreateNewIndustry(i, tile, type, it, t, 0x10); + DoCreateNewIndustry(i, tile, type, it, t, OWNER_NONE); return i; } @@ -1697,7 +1702,7 @@ static void ExtChangeIndustryProduction(Industry *i) break; default: /* INDUSTRY_PRODUCTION */ - for (j = 0; j < 2 && i->produced_cargo[j] != 255; j++){ + for (j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){ uint32 r = Random(); int old, new, percent; int mag; diff --git a/station_gui.c b/station_gui.c index 2244386a4..48d3fdf6c 100644 --- a/station_gui.c +++ b/station_gui.c @@ -392,7 +392,7 @@ static void DrawStationViewWindow(Window *w) y += 10; } } - } while (pos > -5 && ++i != 12); + } while (pos > -5 && ++i != NUM_CARGO); if (IsWindowOfPrototype(w, _station_view_widgets)) { char *b = _userstring; |