roadveh_gui.c
changeset 919 b0d6c7642f99
parent 893 d9e69e5060ba
child 968 9c47631d62dc
--- a/roadveh_gui.c	Thu Jan 06 19:40:44 2005 +0000
+++ b/roadveh_gui.c	Thu Jan 06 22:31:58 2005 +0000
@@ -45,7 +45,7 @@
 
 static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
 {
-	Vehicle *v = &_vehicles[w->window_number];
+	Vehicle *v = GetVehicle(w->window_number);
 	StringID str;
 	int mod;
 
@@ -204,7 +204,7 @@
 {
 	switch(e->event) {
 	case WE_PAINT: {
-		Vehicle *v = &_vehicles[w->window_number];
+		Vehicle *v = GetVehicle(w->window_number);
 		StringID str;
 
 		w->disabled_state = (v->owner != _local_player) ? (1<<8 | 1<<7) : 0;
@@ -258,7 +258,7 @@
 	} break;
 
 	case WE_CLICK: {
-		Vehicle *v = &_vehicles[w->window_number];
+		Vehicle *v = GetVehicle(w->window_number);
 
 		switch(e->click.widget) {
 		case 5: /* start stop */
@@ -380,7 +380,7 @@
 
 	if (!success) return;
 
-	v = &_vehicles[_new_roadveh_id];
+	v = GetVehicle(_new_roadveh_id);
 	if (v->tile == _backup_orders_tile) {
 		_backup_orders_tile = 0;
 		RestoreVehicleOrders(v, _backup_orders_data);
@@ -665,7 +665,7 @@
 
 				HandleButtonClick(w, 5);
 
-				v = &_vehicles[WP(w,traindepot_d).sel];
+				v = GetVehicle(WP(w,traindepot_d).sel);
 				WP(w,traindepot_d).sel = INVALID_VEHICLE;
 
 				_backup_orders_tile = v->tile;
@@ -800,7 +800,7 @@
 				w->widget[1].unkA = STR_9001_ROAD_VEHICLES;
 			} else {
 				/* Station Name -- (###) Road vehicles */
-				SetDParam(0, DEREF_STATION(station)->index);
+				SetDParam(0, GetStation(station)->index);
 				SetDParam(1, w->vscroll.count);
 				w->widget[1].unkA = STR_SCHEDULED_ROAD_VEHICLES;
 			}
@@ -814,7 +814,7 @@
 
 		max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length);
 		for (i = w->vscroll.pos; i < max; ++i) {
-			Vehicle *v = DEREF_VEHICLE(vl->sort_list[i].index);
+			Vehicle *v = GetVehicle(vl->sort_list[i].index);
 			StringID str;
 
 			assert(v->type == VEH_Road && v->owner == owner);
@@ -865,7 +865,7 @@
 
 				if (id_v >= vl->list_length) return; // click out of list bound
 
-				v	= DEREF_VEHICLE(vl->sort_list[id_v].index);
+				v	= GetVehicle(vl->sort_list[id_v].index);
 
 				assert(v->type == VEH_Road && v->owner == owner);