src/order_gui.cpp
changeset 8302 ed068d41cf1e
parent 8264 b1e85998c7d3
child 8424 c3477565c975
equal deleted inserted replaced
8301:9f8d82ea6667 8302:ed068d41cf1e
   213 						SetDParam(2, order->dest);
   213 						SetDParam(2, order->dest);
   214 					} else {
   214 					} else {
   215 						SetDParam(2, GetDepot(order->dest)->town_index);
   215 						SetDParam(2, GetDepot(order->dest)->town_index);
   216 
   216 
   217 						switch (v->type) {
   217 						switch (v->type) {
   218 							case VEH_TRAIN: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
   218 							case VEH_TRAIN: s = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
   219 							case VEH_ROAD:  s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
   219 							case VEH_ROAD:  s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
   220 							case VEH_SHIP:  s = STR_GO_TO_SHIP_DEPOT; break;
   220 							case VEH_SHIP:  s = STR_GO_TO_SHIP_DEPOT; break;
   221 							default: break;
   221 							default: break;
   222 						}
   222 						}
   223 					}
   223 					}
   224 
   224 
   225 					if (order->flags & OF_FULL_LOAD) s++; /* service at */
   225 					if (order->flags & OFB_FULL_LOAD) s++; /* service at */
   226 
   226 
   227 					SetDParam(1, s);
   227 					SetDParam(1, s);
   228 					if (order->refit_cargo < NUM_CARGO) {
   228 					if (order->refit_cargo < NUM_CARGO) {
   229 						SetDParam(3, STR_REFIT_ORDER);
   229 						SetDParam(3, STR_REFIT_ORDER);
   230 						SetDParam(4, GetCargo(order->refit_cargo)->name);
   230 						SetDParam(4, GetCargo(order->refit_cargo)->name);
   233 					}
   233 					}
   234 					break;
   234 					break;
   235 				}
   235 				}
   236 
   236 
   237 				case OT_GOTO_WAYPOINT:
   237 				case OT_GOTO_WAYPOINT:
   238 					SetDParam(1, (order->flags & OF_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
   238 					SetDParam(1, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
   239 					SetDParam(2, order->dest);
   239 					SetDParam(2, order->dest);
   240 					break;
   240 					break;
   241 
   241 
   242 				default: break;
   242 				default: break;
   243 			}
   243 			}
   271 		switch (GetTileType(tile)) {
   271 		switch (GetTileType(tile)) {
   272 		case MP_RAILWAY:
   272 		case MP_RAILWAY:
   273 			if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
   273 			if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
   274 				if (IsRailDepot(tile)) {
   274 				if (IsRailDepot(tile)) {
   275 					order.type = OT_GOTO_DEPOT;
   275 					order.type = OT_GOTO_DEPOT;
   276 					order.flags = OF_PART_OF_ORDERS;
   276 					order.flags = OFB_PART_OF_ORDERS;
   277 					order.dest = GetDepotByTile(tile)->index;
   277 					order.dest = GetDepotByTile(tile)->index;
   278 					return order;
   278 					return order;
   279 				}
   279 				}
   280 			}
   280 			}
   281 			break;
   281 			break;
   282 
   282 
   283 		case MP_ROAD:
   283 		case MP_ROAD:
   284 			if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
   284 			if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
   285 				order.type = OT_GOTO_DEPOT;
   285 				order.type = OT_GOTO_DEPOT;
   286 				order.flags = OF_PART_OF_ORDERS;
   286 				order.flags = OFB_PART_OF_ORDERS;
   287 				order.dest = GetDepotByTile(tile)->index;
   287 				order.dest = GetDepotByTile(tile)->index;
   288 				return order;
   288 				return order;
   289 			}
   289 			}
   290 			break;
   290 			break;
   291 
   291 
   292 		case MP_STATION:
   292 		case MP_STATION:
   293 			if (v->type != VEH_AIRCRAFT) break;
   293 			if (v->type != VEH_AIRCRAFT) break;
   294 			if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
   294 			if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
   295 				order.type = OT_GOTO_DEPOT;
   295 				order.type = OT_GOTO_DEPOT;
   296 				order.flags = OF_PART_OF_ORDERS;
   296 				order.flags = OFB_PART_OF_ORDERS;
   297 				order.dest = GetStationIndex(tile);
   297 				order.dest = GetStationIndex(tile);
   298 				return order;
   298 				return order;
   299 			}
   299 			}
   300 			break;
   300 			break;
   301 
   301 
   304 			if (IsTileDepotType(tile, TRANSPORT_WATER) &&
   304 			if (IsTileDepotType(tile, TRANSPORT_WATER) &&
   305 					IsTileOwner(tile, _local_player)) {
   305 					IsTileOwner(tile, _local_player)) {
   306 				TileIndex tile2 = GetOtherShipDepotTile(tile);
   306 				TileIndex tile2 = GetOtherShipDepotTile(tile);
   307 
   307 
   308 				order.type = OT_GOTO_DEPOT;
   308 				order.type = OT_GOTO_DEPOT;
   309 				order.flags = OF_PART_OF_ORDERS;
   309 				order.flags = OFB_PART_OF_ORDERS;
   310 				order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index;
   310 				order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index;
   311 				return order;
   311 				return order;
   312 			}
   312 			}
   313 
   313 
   314 			default:
   314 			default:
   417  * @param w current window
   417  * @param w current window
   418  * @param v current vehicle
   418  * @param v current vehicle
   419  */
   419  */
   420 static void OrderClick_FullLoad(Window *w, const Vehicle *v)
   420 static void OrderClick_FullLoad(Window *w, const Vehicle *v)
   421 {
   421 {
   422 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   422 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   423 }
   423 }
   424 
   424 
   425 /**
   425 /**
   426  * Handle the click on the unload button.
   426  * Handle the click on the unload button.
   427  *
   427  *
   428  * @param w current window
   428  * @param w current window
   429  * @param v current vehicle
   429  * @param v current vehicle
   430  */
   430  */
   431 static void OrderClick_Unload(Window *w, const Vehicle *v)
   431 static void OrderClick_Unload(Window *w, const Vehicle *v)
   432 {
   432 {
   433 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_UNLOAD,    NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   433 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_UNLOAD,    NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   434 }
   434 }
   435 
   435 
   436 /**
   436 /**
   437  * Handle the click on the nonstop button.
   437  * Handle the click on the nonstop button.
   438  *
   438  *
   439  * @param w current window
   439  * @param w current window
   440  * @param v current vehicle
   440  * @param v current vehicle
   441  */
   441  */
   442 static void OrderClick_Nonstop(Window *w, const Vehicle *v)
   442 static void OrderClick_Nonstop(Window *w, const Vehicle *v)
   443 {
   443 {
   444 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP,  NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   444 	DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_NON_STOP,  NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   445 }
   445 }
   446 
   446 
   447 /**
   447 /**
   448  * Handle the click on the transfer button.
   448  * Handle the click on the transfer button.
   449  *
   449  *
   450  * @param w current window
   450  * @param w current window
   451  * @param v current vehicle
   451  * @param v current vehicle
   452  */
   452  */
   453 static void OrderClick_Transfer(Window* w, const Vehicle* v)
   453 static void OrderClick_Transfer(Window* w, const Vehicle* v)
   454 {
   454 {
   455 	DoCommandP(v->tile, v->index + (OrderGetSel(w) <<  16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   455 	DoCommandP(v->tile, v->index + (OrderGetSel(w) <<  16), OF_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
   456 }
   456 }
   457 
   457 
   458 /**
   458 /**
   459  * Handle the click on the skip button.
   459  * Handle the click on the skip button.
   460  * If ctrl is pressed skip to selected order.
   460  * If ctrl is pressed skip to selected order.