summaryrefslogtreecommitdiff
path: root/subsidy_gui.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-01-06 22:31:58 +0000
committertruelight <truelight@openttd.org>2005-01-06 22:31:58 +0000
commit63e97754fbf907cfefd277087bfbac5e0d4434e8 (patch)
tree254702245ba43d006f4823111d0c2c592fb701ca /subsidy_gui.c
parenta4111363c0def2ccec66ef28b5e8169e8a2df2f0 (diff)
downloadopenttd-63e97754fbf907cfefd277087bfbac5e0d4434e8.tar.xz
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
(in prepare of dynamic arrays): - DEREF_XXX is changed into GetXXX - All direct call are directed via GetXXX - struct Industry has now an index-field - ENUM'd some stuff - Replaced home built loops with FOR_ALL_XXX - Added _stations_size, _vehicles_size, ... which gives the length of the array (which will be dynamic in the near future) - Changed lengtof(XXX) to _XXX_size (e.g. _stations_size) - Removed all endof(XXX) (because mostly it was part of a FOR_ALL_XXX) - Made the sort-functions of all 4 dynamic - Made all 4 Initialize functions more of the same - Some minor tab-fixing and stuff (tnx to Tron for proof-reading my 100kb patch ;)) Note for all: please do NOT directly call _stations, _vehicles, _towns and _industries, but use the right wrapper to access them. Thank you. Ps: please also do not use 'v++', where v is of type Vehicle *.
Diffstat (limited to 'subsidy_gui.c')
-rw-r--r--subsidy_gui.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/subsidy_gui.c b/subsidy_gui.c
index 2a8bbf080..e2b822eb2 100644
--- a/subsidy_gui.c
+++ b/subsidy_gui.c
@@ -49,22 +49,22 @@ handle_click:
/* determine from coordinate for subsidy and try to scroll to it */
offs = s->from;
if (s->age >= 12) {
- xy = DEREF_STATION(offs)->xy;
+ xy = GetStation(offs)->xy;
} else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL) {
- xy = DEREF_TOWN(offs)->xy;
+ xy = GetTown(offs)->xy;
} else {
- xy = _industries[offs].xy;
+ xy = GetIndustry(offs)->xy;
}
if (!ScrollMainWindowToTile(xy)) {
/* otherwise determine to coordinate for subsidy and scroll to it */
offs = s->to;
if (s->age >= 12) {
- xy = DEREF_STATION(offs)->xy;
+ xy = GetStation(offs)->xy;
} else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL || s->cargo_type == CT_GOODS || s->cargo_type == CT_FOOD) {
- xy = DEREF_TOWN(offs)->xy;
+ xy = GetTown(offs)->xy;
} else {
- xy = _industries[offs].xy;
+ xy = GetIndustry(offs)->xy;
}
ScrollMainWindowToTile(xy);
}
@@ -112,7 +112,7 @@ static void DrawSubsidiesWindow(Window *w)
if (s->cargo_type != 0xFF && s->age >= 12) {
SetupSubsidyDecodeParam(s, 1);
- p = DEREF_PLAYER(DEREF_STATION(s->to)->owner);
+ p = DEREF_PLAYER(GetStation(s->to)->owner);
SetDParam(3, p->name_1);
SetDParam(4, p->name_2);