Changeset - r7478:b042567bfb18
[Not reviewed]
master
0 11 0
rubidium - 17 years ago 2007-08-26 21:21:59
rubidium@openttd.org
(svn r10985) -Codechange: unify/remove duplicate CcClone(Aircraft|RoadVeh|Ship|Train) in favour of CcCloneVehicle.
11 files changed with 23 insertions and 58 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -82,15 +82,6 @@ uint16 AircraftDefaultCargoCapacity(Carg
 
 */
 
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/**
 
 * This is the Callback method after the cloning attempt of an aircraft
 
 * @param success indicates completion (or not) of the operation
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/** Handle Aircraft specific tasks when a an Aircraft enters a hangar
 
 * @param *v Vehicle that enters the hangar
 
 */
src/aircraft_gui.cpp
Show inline comments
 
@@ -57,18 +57,6 @@ void CcBuildAircraft(bool success, TileI
 
	}
 
}
 

	
 
/**
 
 * This is the Callback method after the cloning attempt of an aircraft
 
 * @param success indicates completion (or not) of the operation
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) ShowAircraftViewWindow(GetVehicle(_new_vehicle_id));
 
}
 

	
 
static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
@@ -343,7 +331,7 @@ static void AircraftViewWndProc(Window *
 
			break;
 
		case 11:
 
			/* clone vehicle */
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneAircraft, CMD_CLONE_VEHICLE | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneVehicle, CMD_CLONE_VEHICLE | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
 
			break;
 
		}
 
	} break;
src/callback_table.cpp
Show inline comments
 
@@ -13,7 +13,6 @@
 

	
 
/* aircraft_gui.cpp */
 
CommandCallback CcBuildAircraft;
 
CommandCallback CcCloneAircraft;
 

	
 
/* airport_gui.cpp */
 
CommandCallback CcBuildAirport;
 
@@ -48,16 +47,13 @@ CommandCallback CcRoadDepot;
 

	
 
/* roadveh_gui.cpp */
 
CommandCallback CcBuildRoadVeh;
 
CommandCallback CcCloneRoadVeh;
 

	
 
/* ship_gui.cpp */
 
CommandCallback CcBuildShip;
 
CommandCallback CcCloneShip;
 

	
 
/* train_gui.cpp */
 
CommandCallback CcBuildWagon;
 
CommandCallback CcBuildLoco;
 
CommandCallback CcCloneTrain;
 

	
 
CommandCallback CcAI;
 

	
 
@@ -83,13 +79,9 @@ CommandCallback *_callback_table[] = {
 
	/* 0x12 */ CcPlaySound1E,
 
	/* 0x13 */ CcStation,
 
	/* 0x14 */ CcTerraform,
 
	/* 0x15 */ CcCloneAircraft,
 
	/* 0x16 */ CcCloneRoadVeh,
 
	/* 0x17 */ CcCloneShip,
 
	/* 0x18 */ CcCloneTrain,
 
	/* 0x19 */ CcAI,
 
	/* 0x1A */ CcCloneVehicle,
 
	/* 0x1B */ CcGiveMoney,
 
	/* 0x15 */ CcAI,
 
	/* 0x16 */ CcCloneVehicle,
 
	/* 0x17 */ CcGiveMoney,
 
};
 

	
 
const int _callback_table_count = lengthof(_callback_table);
src/depot_gui.cpp
Show inline comments
 
@@ -130,14 +130,24 @@ static const WindowDesc _aircraft_depot_
 

	
 
extern int WagonLengthToPixels(int len);
 

	
 
/**
 
 * This is the Callback method after the cloning attempt of a vehicle
 
 * @param success indicates completion (or not) of the operation
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (!success) return;
 

	
 
	Vehicle *v = GetVehicle(_new_vehicle_id);
 

	
 
	switch(GetVehicle(p1)->type) {
 
		case VEH_TRAIN:    CcCloneTrain(   true, tile, p1, p2); break;
 
		case VEH_ROAD:     CcCloneRoadVeh( true, tile, p1, p2); break;
 
		case VEH_SHIP:     CcCloneShip(    true, tile, p1, p2); break;
 
		case VEH_AIRCRAFT: CcCloneAircraft(true, tile, p1, p2); break;
 
		case VEH_TRAIN:    ShowTrainViewWindow(v);    break;
 
		case VEH_ROAD:     ShowRoadVehViewWindow(v);  break;
 
		case VEH_SHIP:     ShowShipViewWindow(v);     break;
 
		case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
 
		default: NOT_REACHED();
 
	}
 
}
src/roadveh.h
Show inline comments
 
@@ -56,7 +56,6 @@ static inline bool IsRoadVehInDepotStopp
 
}
 

	
 
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 

	
 
/**
src/roadveh_gui.cpp
Show inline comments
 
@@ -263,11 +263,6 @@ static void ShowRoadVehDetailsWindow(con
 
	w->caption_color = v->owner;
 
}
 

	
 
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) ShowRoadVehViewWindow(GetVehicle(_new_vehicle_id));
 
}
 

	
 
static void RoadVehViewWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
@@ -357,7 +352,7 @@ static void RoadVehViewWndProc(Window *w
 
			ShowRoadVehDetailsWindow(v);
 
			break;
 
		case 11: /* clone vehicle */
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneRoadVeh, CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneVehicle, CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
 
			break;
 
		case 12: /* Refit vehicle */
 
			ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID);
src/ship.h
Show inline comments
 
@@ -8,7 +8,6 @@
 
#include "vehicle.h"
 

	
 
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void RecalcShipStuff(Vehicle *v);
 
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
 

	
src/ship_gui.cpp
Show inline comments
 
@@ -187,11 +187,6 @@ void CcBuildShip(bool success, TileIndex
 
	ShowShipViewWindow(v);
 
}
 

	
 
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) ShowShipViewWindow(GetVehicle(_new_vehicle_id));
 
}
 

	
 
static void ShipViewWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
@@ -280,7 +275,7 @@ static void ShipViewWndProc(Window *w, W
 
					break;
 
				case 11: {
 
					/* clone vehicle */
 
					DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneShip, CMD_CLONE_VEHICLE | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
 
					DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneVehicle, CMD_CLONE_VEHICLE | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
 
				} break;
 
			}
 
		} break;
src/train.h
Show inline comments
 
@@ -245,7 +245,6 @@ uint CountArticulatedParts(EngineID engi
 
int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
 
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
byte FreightWagonMult(CargoID cargo);
 

	
src/train_gui.cpp
Show inline comments
 
@@ -59,11 +59,6 @@ void CcBuildLoco(bool success, TileIndex
 
	ShowTrainViewWindow(v);
 
}
 

	
 
void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) ShowTrainViewWindow(GetVehicle(_new_vehicle_id));
 
}
 

	
 
/**
 
 * Get the number of pixels for the given wagon length.
 
 * @param len Length measured in 1/8ths of a standard wagon.
 
@@ -268,7 +263,7 @@ static void TrainViewWndProc(Window *w, 
 
			ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID);
 
			break;
 
		case 13:
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, NULL, CMD_CLONE_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
 
			DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneVehicle, CMD_CLONE_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
 
			break;
 
		}
 
	} break;
src/vehicle.h
Show inline comments
 
@@ -572,6 +572,8 @@ void InvalidateAutoreplaceWindow(EngineI
 
CommandCost MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs);
 
bool CanBuildVehicleInfrastructure(VehicleType type);
 

	
 
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/* Flags to add to p2 for goto depot commands */
 
/* Note: bits 8-10 are used for VLW flags */
 
enum {
0 comments (0 inline, 0 general)