(svn r6249) -Fix: fixed assert when pressing goto depot in an empty list (forgot to disable the button in this condition)
-Code cleanup r6246: simplified SendAllVehiclesToDepot() and moved an { in PlayerVehWndProc()
This commit is contained in:
@@ -1268,6 +1268,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, w->vscroll.count);
|
||||
if (vl->list_length == 0) SETBIT(w->disabled_state, 9);
|
||||
if (vehicle_type == VEH_Aircraft) {
|
||||
w->widget[9].unkA = STR_SEND_TO_HANGARS;
|
||||
w->widget[9].tooltips = STR_SEND_TO_HANGARS_TIP;
|
||||
@@ -1404,35 +1405,34 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
} break;
|
||||
|
||||
case 9: /* Left button */
|
||||
case 9: { /* Left button */
|
||||
uint16 window_type = w->window_number & VLW_FLAGS;
|
||||
if (GB(w->window_number, 0, 8) /* OwnerID */ != _local_player) break;
|
||||
{
|
||||
uint16 window_type = w->window_number & VLW_FLAGS;
|
||||
switch (window_type) {
|
||||
case VLW_STANDARD:
|
||||
case VLW_SHARED_ORDERS: {
|
||||
/* Send to depot */
|
||||
const Vehicle *v;
|
||||
assert(vl->list_length != 0);
|
||||
v = vl->sort_list[0];
|
||||
DoCommandP(v->tile, v->index, window_type | _ctrl_pressed ? 3 : 2, NULL, CMD_SEND_TO_DEPOT(vehicle_type));
|
||||
break;
|
||||
}
|
||||
|
||||
case VLW_STATION_LIST:
|
||||
/* Build new Vehicle */
|
||||
switch (vehicle_type) {
|
||||
case VEH_Train: ShowBuildTrainWindow(0); break;
|
||||
case VEH_Road: ShowBuildRoadVehWindow(0); break;
|
||||
case VEH_Ship: ShowBuildShipWindow(0); break;
|
||||
case VEH_Aircraft: ShowBuildAircraftWindow(0); break;
|
||||
default: NOT_REACHED(); break;
|
||||
}
|
||||
break;
|
||||
default: NOT_REACHED(); break;
|
||||
switch (window_type) {
|
||||
case VLW_STANDARD:
|
||||
case VLW_SHARED_ORDERS: {
|
||||
/* Send to depot */
|
||||
const Vehicle *v;
|
||||
assert(vl->list_length != 0);
|
||||
v = vl->sort_list[0];
|
||||
DoCommandP(v->tile, v->index, window_type | _ctrl_pressed ? 3 : 2, NULL, CMD_SEND_TO_DEPOT(vehicle_type));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case VLW_STATION_LIST:
|
||||
/* Build new Vehicle */
|
||||
switch (vehicle_type) {
|
||||
case VEH_Train: ShowBuildTrainWindow(0); break;
|
||||
case VEH_Road: ShowBuildRoadVehWindow(0); break;
|
||||
case VEH_Ship: ShowBuildShipWindow(0); break;
|
||||
case VEH_Aircraft: ShowBuildAircraftWindow(0); break;
|
||||
default: NOT_REACHED(); break;
|
||||
}
|
||||
break;
|
||||
default: NOT_REACHED(); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 10: /* Right button */
|
||||
ShowReplaceVehicleWindow(vehicle_type);
|
||||
|
||||
Reference in New Issue
Block a user