449 { |
449 { |
450 Window *w; |
450 Window *w; |
451 |
451 |
452 DeleteWindowById(WC_VEHICLE_REFIT, v->index); |
452 DeleteWindowById(WC_VEHICLE_REFIT, v->index); |
453 |
453 |
454 w = AllocateWindowDescFront(&_vehicle_refit_desc, v->index); |
454 w = AllocateWindowDescFront<Window>(&_vehicle_refit_desc, v->index); |
455 WP(w, refit_d).order = order; |
455 WP(w, refit_d).order = order; |
456 |
456 |
457 if (w != NULL) { |
457 if (w != NULL) { |
458 w->caption_color = v->owner; |
458 w->caption_color = v->owner; |
459 w->vscroll.cap = 8; |
459 w->vscroll.cap = 8; |
1242 * to be changed which happens in the WE_CREATE event and resizing |
1242 * to be changed which happens in the WE_CREATE event and resizing |
1243 * some of the windows to the correct size */ |
1243 * some of the windows to the correct size */ |
1244 switch (vehicle_type) { |
1244 switch (vehicle_type) { |
1245 default: NOT_REACHED(); |
1245 default: NOT_REACHED(); |
1246 case VEH_TRAIN: |
1246 case VEH_TRAIN: |
1247 w = AllocateWindowDescFront(&_player_vehicle_list_train_desc, num); |
1247 w = AllocateWindowDescFront<Window>(&_player_vehicle_list_train_desc, num); |
1248 if (w != NULL) ResizeWindow(w, 65, 38); |
1248 if (w != NULL) ResizeWindow(w, 65, 38); |
1249 break; |
1249 break; |
1250 case VEH_ROAD: |
1250 case VEH_ROAD: |
1251 w = AllocateWindowDescFront(&_player_vehicle_list_road_veh_desc, num); |
1251 w = AllocateWindowDescFront<Window>(&_player_vehicle_list_road_veh_desc, num); |
1252 if (w != NULL) ResizeWindow(w, 0, 38); |
1252 if (w != NULL) ResizeWindow(w, 0, 38); |
1253 break; |
1253 break; |
1254 case VEH_SHIP: |
1254 case VEH_SHIP: |
1255 w = AllocateWindowDescFront(&_player_vehicle_list_ship_desc, num); |
1255 w = AllocateWindowDescFront<Window>(&_player_vehicle_list_ship_desc, num); |
1256 break; |
1256 break; |
1257 case VEH_AIRCRAFT: |
1257 case VEH_AIRCRAFT: |
1258 w = AllocateWindowDescFront(&_player_vehicle_list_aircraft_desc, num); |
1258 w = AllocateWindowDescFront<Window>(&_player_vehicle_list_aircraft_desc, num); |
1259 break; |
1259 break; |
1260 } |
1260 } |
1261 |
1261 |
1262 if (w != NULL) { |
1262 if (w != NULL) { |
1263 /* Set the minimum window size to the current window size */ |
1263 /* Set the minimum window size to the current window size */ |
1669 /** Shows the vehicle details window of the given vehicle. */ |
1669 /** Shows the vehicle details window of the given vehicle. */ |
1670 static void ShowVehicleDetailsWindow(const Vehicle *v) |
1670 static void ShowVehicleDetailsWindow(const Vehicle *v) |
1671 { |
1671 { |
1672 DeleteWindowById(WC_VEHICLE_ORDERS, v->index); |
1672 DeleteWindowById(WC_VEHICLE_ORDERS, v->index); |
1673 DeleteWindowById(WC_VEHICLE_DETAILS, v->index); |
1673 DeleteWindowById(WC_VEHICLE_DETAILS, v->index); |
1674 AllocateWindowDescFront(&_vehicle_details_desc, v->index); |
1674 AllocateWindowDescFront<Window>(&_vehicle_details_desc, v->index); |
1675 } |
1675 } |
1676 |
1676 |
1677 |
1677 |
1678 /* Unified vehicle GUI - Vehicle View Window */ |
1678 /* Unified vehicle GUI - Vehicle View Window */ |
1679 |
1679 |
1745 static const int VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102; |
1745 static const int VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102; |
1746 |
1746 |
1747 /** Shows the vehicle view window of the given vehicle. */ |
1747 /** Shows the vehicle view window of the given vehicle. */ |
1748 void ShowVehicleViewWindow(const Vehicle *v) |
1748 void ShowVehicleViewWindow(const Vehicle *v) |
1749 { |
1749 { |
1750 Window *w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_train_view_desc : &_vehicle_view_desc, v->index); |
1750 Window *w = AllocateWindowDescFront<Window>((v->type == VEH_TRAIN) ? &_train_view_desc : &_vehicle_view_desc, v->index); |
1751 |
1751 |
1752 if (w != NULL) { |
1752 if (w != NULL) { |
1753 w->caption_color = v->owner; |
1753 w->caption_color = v->owner; |
1754 InitializeWindowViewport(w, VV_VIEWPORT_X, VV_VIEWPORT_Y, VV_INITIAL_VIEWPORT_WIDTH, |
1754 InitializeWindowViewport(w, VV_VIEWPORT_X, VV_VIEWPORT_Y, VV_INITIAL_VIEWPORT_WIDTH, |
1755 (v->type == VEH_TRAIN) ? VV_INITIAL_VIEWPORT_HEIGHT_TRAIN : VV_INITIAL_VIEWPORT_HEIGHT, |
1755 (v->type == VEH_TRAIN) ? VV_INITIAL_VIEWPORT_HEIGHT_TRAIN : VV_INITIAL_VIEWPORT_HEIGHT, |