(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
This commit is contained in:
@@ -36,7 +36,7 @@ bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile)
|
||||
// numtracks : in case of AI_TRAIN: tracks of station
|
||||
// direction : the direction of the station
|
||||
// flag : flag passed to DoCommand (normally 0 to get the cost or DC_EXEC to build it)
|
||||
int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag)
|
||||
CommandCost AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag)
|
||||
{
|
||||
if (type == AI_TRAIN)
|
||||
return AI_DoCommand(tile, direction + (numtracks << 8) + (length << 16), 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_STATION);
|
||||
@@ -53,7 +53,7 @@ int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte
|
||||
// tile_a : starting point
|
||||
// tile_b : end point
|
||||
// flag : flag passed to DoCommand
|
||||
int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag)
|
||||
CommandCost AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag)
|
||||
{
|
||||
int bridge_type, bridge_len, type, type2;
|
||||
|
||||
@@ -90,15 +90,15 @@ int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag)
|
||||
// part : Which part we need to build
|
||||
//
|
||||
// TODO: skip already builded road-pieces (e.g.: cityroad)
|
||||
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag)
|
||||
CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag)
|
||||
{
|
||||
int part = PathFinderInfo->position;
|
||||
byte *route_extra = PathFinderInfo->route_extra;
|
||||
TileIndex *route = PathFinderInfo->route;
|
||||
int dir;
|
||||
int old_dir = -1;
|
||||
int cost = 0;
|
||||
int res;
|
||||
CommandCost cost = 0;
|
||||
CommandCost res;
|
||||
// We need to calculate the direction with the parent of the parent.. so we skip
|
||||
// the first pieces and the last piece
|
||||
if (part < 1) part = 1;
|
||||
@@ -243,7 +243,7 @@ EngineID AiNew_PickVehicle(Player *p)
|
||||
const RoadVehicleInfo *rvi = RoadVehInfo(i);
|
||||
const Engine* e = GetEngine(i);
|
||||
int32 rating;
|
||||
int32 ret;
|
||||
CommandCost ret;
|
||||
|
||||
/* Skip vehicles which can't take our cargo type */
|
||||
if (rvi->cargo_type != p->ainew.cargo && !CanRefitTo(i, p->ainew.cargo)) continue;
|
||||
@@ -293,7 +293,7 @@ void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
|
||||
|
||||
// Builds the best vehicle possible
|
||||
int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag)
|
||||
CommandCost AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag)
|
||||
{
|
||||
EngineID i = AiNew_PickVehicle(p);
|
||||
|
||||
@@ -307,9 +307,9 @@ int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag)
|
||||
}
|
||||
}
|
||||
|
||||
int AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag)
|
||||
CommandCost AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag)
|
||||
{
|
||||
int ret, ret2;
|
||||
CommandCost ret, ret2;
|
||||
if (p->ainew.tbt == AI_TRAIN) {
|
||||
return AI_DoCommand(tile, 0, direction, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_TRAIN_DEPOT);
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ static bool TestCanBuildStationHere(TileIndex tile, byte dir)
|
||||
Player *p = GetPlayer(_current_player);
|
||||
|
||||
if (dir == TEST_STATION_NO_DIR) {
|
||||
int32 ret;
|
||||
CommandCost ret;
|
||||
// TODO: currently we only allow spots that can be access from al 4 directions...
|
||||
// should be fixed!!!
|
||||
for (dir = 0; dir < 4; dir++) {
|
||||
@@ -214,7 +214,7 @@ static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *curre
|
||||
// What tiles are around us.
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
int ret;
|
||||
CommandCost ret;
|
||||
int dir;
|
||||
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
|
||||
@@ -642,7 +642,7 @@ static void AiNew_State_FindStation(Player *p)
|
||||
|
||||
if (new_tile == 0 && p->ainew.tbt == AI_BUS) {
|
||||
uint x, y, i = 0;
|
||||
int r;
|
||||
CommandCost r;
|
||||
uint best;
|
||||
uint accepts[NUM_CARGO];
|
||||
TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
|
||||
@@ -788,7 +788,8 @@ static void AiNew_State_FindDepot(Player *p)
|
||||
// To make the depot stand in the middle of the route, we start from the center..
|
||||
// But first we walk through the route see if we can find a depot that is ours
|
||||
// this keeps things nice ;)
|
||||
int g, i, r;
|
||||
int g, i;
|
||||
CommandCost r;
|
||||
DiagDirection j;
|
||||
TileIndex tile;
|
||||
assert(p->ainew.state == AI_STATE_FIND_DEPOT);
|
||||
@@ -984,7 +985,7 @@ static void AiNew_State_VerifyRoute(Player *p)
|
||||
// Build the stations
|
||||
static void AiNew_State_BuildStation(Player *p)
|
||||
{
|
||||
int res = 0;
|
||||
CommandCost res = 0;
|
||||
assert(p->ainew.state == AI_STATE_BUILD_STATION);
|
||||
if (p->ainew.temp == 0) {
|
||||
if (!IsTileType(p->ainew.from_tile, MP_STATION))
|
||||
@@ -1037,8 +1038,8 @@ static void AiNew_State_BuildPath(Player *p)
|
||||
// We don't want that, so try building some road left or right of the station
|
||||
int dir1, dir2, dir3;
|
||||
TileIndex tile;
|
||||
int i, ret;
|
||||
for (i=0;i<2;i++) {
|
||||
CommandCost ret;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0) {
|
||||
tile = p->ainew.from_tile + TileOffsByDiagDir(p->ainew.from_direction);
|
||||
dir1 = p->ainew.from_direction - 1;
|
||||
@@ -1102,7 +1103,7 @@ static void AiNew_State_BuildPath(Player *p)
|
||||
// Builds the depot
|
||||
static void AiNew_State_BuildDepot(Player *p)
|
||||
{
|
||||
int res = 0;
|
||||
CommandCost res = 0;
|
||||
assert(p->ainew.state == AI_STATE_BUILD_DEPOT);
|
||||
|
||||
if (IsTileType(p->ainew.depot_tile, MP_STREET) && GetRoadTileType(p->ainew.depot_tile) == ROAD_TILE_DEPOT) {
|
||||
@@ -1137,7 +1138,7 @@ static void AiNew_State_BuildDepot(Player *p)
|
||||
// Build vehicles
|
||||
static void AiNew_State_BuildVehicle(Player *p)
|
||||
{
|
||||
int res;
|
||||
CommandCost res;
|
||||
assert(p->ainew.state == AI_STATE_BUILD_VEHICLE);
|
||||
|
||||
// Check if we need to build a vehicle
|
||||
@@ -1277,7 +1278,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
|
||||
|
||||
if (!AiNew_SetSpecialVehicleFlag(p, v, AI_VEHICLEFLAG_SELL)) return;
|
||||
{
|
||||
int ret = 0;
|
||||
CommandCost ret = 0;
|
||||
if (v->type == VEH_ROAD)
|
||||
ret = AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
|
||||
// This means we can not find a depot :s
|
||||
|
||||
@@ -252,11 +252,11 @@ uint AiNew_GetSpecialVehicleFlag(Player *p, Vehicle *v);
|
||||
|
||||
// ai_build.c
|
||||
bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile);
|
||||
int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag);
|
||||
int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag);
|
||||
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag);
|
||||
CommandCost AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag);
|
||||
CommandCost AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag);
|
||||
CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag);
|
||||
EngineID AiNew_PickVehicle(Player *p);
|
||||
int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag);
|
||||
int AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag);
|
||||
CommandCost AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag);
|
||||
CommandCost AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag);
|
||||
|
||||
#endif /* AI_TROLLY_H */
|
||||
|
||||
Reference in New Issue
Block a user