diff options
author | truelight <truelight@openttd.org> | 2005-01-06 22:31:58 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-06 22:31:58 +0000 |
commit | 63e97754fbf907cfefd277087bfbac5e0d4434e8 (patch) | |
tree | 254702245ba43d006f4823111d0c2c592fb701ca /order_gui.c | |
parent | a4111363c0def2ccec66ef28b5e8169e8a2df2f0 (diff) | |
download | openttd-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 'order_gui.c')
-rw-r--r-- | order_gui.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/order_gui.c b/order_gui.c index 6f3dd3962..ac97db175 100644 --- a/order_gui.c +++ b/order_gui.c @@ -13,7 +13,7 @@ static int OrderGetSel(Window *w) { - Vehicle *v = &_vehicles[w->window_number]; + Vehicle *v = GetVehicle(w->window_number); const Order *sched = v->schedule_ptr; int num = WP(w,order_d).sel; int count = 0; @@ -41,7 +41,7 @@ static void DrawOrdersWindow(Window *w) StringID str; bool shared_schedule; - v = &_vehicles[w->window_number]; + v = GetVehicle(w->window_number); w->disabled_state = (v->owner == _local_player) ? 0 : 0x3F0; @@ -237,7 +237,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile) } if (IS_TILETYPE(tile, MP_STATION)) { - st = DEREF_STATION(st_index = _map2[tile]); + st = GetStation(st_index = _map2[tile]); if (st->owner == _current_player || st->owner == OWNER_NONE) { byte facil; @@ -314,7 +314,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) break; case WE_CLICK: { - Vehicle *v = &_vehicles[w->window_number]; + Vehicle *v = GetVehicle(w->window_number); int mode; switch(e->click.widget) { case 2: {/* orders list */ @@ -331,7 +331,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) int xy = 0; switch (ord.type) { case OT_GOTO_STATION: /* station order */ - xy = _stations[ord.station].xy ; + xy = GetStation(ord.station)->xy ; break; case OT_GOTO_DEPOT: /* goto depot order */ xy = _depots[ord.station].xy; @@ -389,7 +389,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) case WE_RCLICK: { - Vehicle *v = &_vehicles[w->window_number]; + Vehicle *v = GetVehicle(w->window_number); if (e->click.widget != 8) break; if (v->schedule_ptr[OrderGetSel(w)].type == OT_GOTO_DEPOT) GuiShowTooltips(STR_SERVICE_HINT); @@ -403,7 +403,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) } break; case WE_PLACE_OBJ: { - OrdersPlaceObj(&_vehicles[w->window_number], e->place.tile, w); + OrdersPlaceObj(GetVehicle(w->window_number), e->place.tile, w); } break; case WE_ABORT_PLACE_OBJ: { @@ -424,7 +424,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) */ if (v && HASBIT(w->click_state, 7)) { _place_clicked_vehicle = NULL; - HandleOrderVehClick(&_vehicles[w->window_number], v, w); + HandleOrderVehClick(GetVehicle(w->window_number), v, w); } } break; |