(svn r9523) -Cleanup: doxygen changes. Time to take care of "R"

This commit is contained in:
belugas 2007-03-28 20:41:35 +00:00
parent 3ca9788213
commit 386e298acd
14 changed files with 91 additions and 65 deletions

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file rail.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "bridge_map.h" #include "bridge_map.h"

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file rail_cmd.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "bridge_map.h" #include "bridge_map.h"

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file rail_map.h Hides the direct accesses to the map array with map accessors */
#ifndef RAIL_MAP_H #ifndef RAIL_MAP_H
#define RAIL_MAP_H #define RAIL_MAP_H

View File

@ -1,12 +1,12 @@
/* $Id$ */ /* $Id$ */
#ifndef RAILTYPES_H
#define RAILTYPES_H
/** @file railtypes.h /** @file railtypes.h
* All the railtype-specific information is stored here. * All the railtype-specific information is stored here.
*/ */
#ifndef RAILTYPES_H
#define RAILTYPES_H
/** Global Railtype definition /** Global Railtype definition
*/ */
RailtypeInfo _railtypes[] = { RailtypeInfo _railtypes[] = {

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file resource.h */
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by ttd.rc // Used by ttd.rc

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road.h */
#ifndef ROAD_H #ifndef ROAD_H
#define ROAD_H #define ROAD_H

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road_cmd.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "bridge_map.h" #include "bridge_map.h"
@ -46,16 +48,16 @@ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, bool *ed
if (_game_mode == GM_EDITOR) return true; if (_game_mode == GM_EDITOR) return true;
// Only do the special processing for actual players. /* Only do the special processing for actual players. */
if (!IsValidPlayer(_current_player)) return true; if (!IsValidPlayer(_current_player)) return true;
// Only do the special processing if the road is owned /* Only do the special processing if the road is owned
// by a town * by a town */
if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner); if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner);
if (_cheats.magic_bulldozer.value) return true; if (_cheats.magic_bulldozer.value) return true;
// Get a bitmask of which neighbouring roads has a tile /* Get a bitmask of which neighbouring roads has a tile */
n = ROAD_NONE; n = ROAD_NONE;
present = GetAnyRoadBits(tile); present = GetAnyRoadBits(tile);
if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile,-1, 0)) & ROAD_SW) n |= ROAD_NE; if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile,-1, 0)) & ROAD_SW) n |= ROAD_NE;
@ -63,12 +65,12 @@ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, bool *ed
if (present & ROAD_SW && GetAnyRoadBits(TILE_ADDXY(tile, 1, 0)) & ROAD_NE) n |= ROAD_SW; if (present & ROAD_SW && GetAnyRoadBits(TILE_ADDXY(tile, 1, 0)) & ROAD_NE) n |= ROAD_SW;
if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0,-1)) & ROAD_SE) n |= ROAD_NW; if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0,-1)) & ROAD_SE) n |= ROAD_NW;
// If 0 or 1 bits are set in n, or if no bits that match the bits to remove, /* If 0 or 1 bits are set in n, or if no bits that match the bits to remove,
// then allow it * then allow it */
if ((n & (n - 1)) != 0 && (n & remove) != 0) { if ((n & (n - 1)) != 0 && (n & remove) != 0) {
Town *t; Town *t;
*edge_road = false; *edge_road = false;
// you can remove all kind of roads with extra dynamite /* you can remove all kind of roads with extra dynamite */
if (_patches.extra_dynamite) return true; if (_patches.extra_dynamite) return true;
t = ClosestTownFromTile(tile, (uint)-1); t = ClosestTownFromTile(tile, (uint)-1);
@ -93,7 +95,7 @@ static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool *edge_roa
*/ */
int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{ {
// cost for removing inner/edge -roads /* cost for removing inner/edge -roads */
static const uint16 road_remove_cost[2] = {50, 18}; static const uint16 road_remove_cost[2] = {50, 18};
Owner owner; Owner owner;
@ -120,8 +122,8 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!EnsureNoVehicle(tile)) return CMD_ERROR; if (!EnsureNoVehicle(tile)) return CMD_ERROR;
// check if you're allowed to remove the street owned by a town /* check if you're allowed to remove the street owned by a town
// removal allowance depends on difficulty setting * removal allowance depends on difficulty setting */
if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR; if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR;
switch (GetRoadTileType(tile)) { switch (GetRoadTileType(tile)) {
@ -137,7 +139,7 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
c |= (RoadBits)((c & 0x3) << 2); c |= (RoadBits)((c & 0x3) << 2);
} }
// limit the bits to delete to the existing bits. /* limit the bits to delete to the existing bits. */
c &= present; c &= present;
if (c == 0) return CMD_ERROR; if (c == 0) return CMD_ERROR;
@ -178,7 +180,7 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
static const RoadBits _valid_tileh_slopes_road[][15] = { static const RoadBits _valid_tileh_slopes_road[][15] = {
// set of normal ones /* set of normal ones */
{ {
ROAD_ALL, ROAD_NONE, ROAD_NONE, ROAD_ALL, ROAD_NONE, ROAD_NONE,
ROAD_X, ROAD_NONE, ROAD_NONE, // 3, 4, 5 ROAD_X, ROAD_NONE, ROAD_NONE, // 3, 4, 5
@ -186,7 +188,7 @@ static const RoadBits _valid_tileh_slopes_road[][15] = {
ROAD_Y, ROAD_NONE, ROAD_NONE, // 9, 10, 11 ROAD_Y, ROAD_NONE, ROAD_NONE, // 9, 10, 11
ROAD_X, ROAD_NONE, ROAD_NONE ROAD_X, ROAD_NONE, ROAD_NONE
}, },
// allowed road for an evenly raised platform /* allowed road for an evenly raised platform */
{ {
ROAD_NONE, ROAD_NONE,
ROAD_SW | ROAD_NW, ROAD_SW | ROAD_NW,
@ -216,7 +218,7 @@ static uint32 CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existing)
if (IsSteepSlope(tileh)) { if (IsSteepSlope(tileh)) {
if (existing == 0) { if (existing == 0) {
// force full pieces. /* force full pieces. */
*pieces |= (RoadBits)((*pieces & 0xC) >> 2); *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
*pieces |= (RoadBits)((*pieces & 0x3) << 2); *pieces |= (RoadBits)((*pieces & 0x3) << 2);
if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform; if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform;
@ -225,21 +227,21 @@ static uint32 CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existing)
} }
road_bits = *pieces | existing; road_bits = *pieces | existing;
// no special foundation /* no special foundation */
if ((~_valid_tileh_slopes_road[0][tileh] & road_bits) == 0) { if ((~_valid_tileh_slopes_road[0][tileh] & road_bits) == 0) {
// force that all bits are set when we have slopes /* force that all bits are set when we have slopes */
if (tileh != SLOPE_FLAT) *pieces |= _valid_tileh_slopes_road[0][tileh]; if (tileh != SLOPE_FLAT) *pieces |= _valid_tileh_slopes_road[0][tileh];
return 0; // no extra cost return 0; // no extra cost
} }
// foundation is used. Whole tile is leveled up /* foundation is used. Whole tile is leveled up */
if ((~_valid_tileh_slopes_road[1][tileh] & road_bits) == 0) { if ((~_valid_tileh_slopes_road[1][tileh] & road_bits) == 0) {
return existing != 0 ? 0 : _price.terraform; return existing != 0 ? 0 : _price.terraform;
} }
// partly leveled up tile, only if there's no road on that tile /* partly leveled up tile, only if there's no road on that tile */
if (existing == 0 && (tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)) { if (existing == 0 && (tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)) {
// force full pieces. /* force full pieces. */
*pieces |= (RoadBits)((*pieces & 0xC) >> 2); *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
*pieces |= (RoadBits)((*pieces & 0x3) << 2); *pieces |= (RoadBits)((*pieces & 0x3) << 2);
if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform; if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform;
@ -349,7 +351,7 @@ do_clear:;
cost += ret; cost += ret;
if (IsTileType(tile, MP_STREET)) { if (IsTileType(tile, MP_STREET)) {
// Don't put the pieces that already exist /* Don't put the pieces that already exist */
pieces &= ComplementRoadBits(existing); pieces &= ComplementRoadBits(existing);
} }
@ -377,15 +379,15 @@ do_clear:;
*/ */
int32 DoConvertStreetRail(TileIndex tile, RailType totype, bool exec) int32 DoConvertStreetRail(TileIndex tile, RailType totype, bool exec)
{ {
// not a railroad crossing? /* not a railroad crossing? */
if (!IsLevelCrossing(tile)) return CMD_ERROR; if (!IsLevelCrossing(tile)) return CMD_ERROR;
// not owned by me? /* not owned by me? */
if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR; if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR;
if (GetRailType(tile) == totype) return CMD_ERROR; if (GetRailType(tile) == totype) return CMD_ERROR;
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled /* 'hidden' elrails can't be downgraded to normal rail when elrails are disabled */
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR; if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
if (exec) { if (exec) {
@ -431,7 +433,7 @@ int32 CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
cost = 0; cost = 0;
tile = start_tile; tile = start_tile;
// Start tile is the small number. /* Start tile is the small number. */
for (;;) { for (;;) {
RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X; RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X;
@ -487,14 +489,14 @@ int32 CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
cost = 0; cost = 0;
tile = start_tile; tile = start_tile;
// Start tile is the small number. /* Start tile is the small number. */
for (;;) { for (;;) {
RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X; RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X;
if (tile == end_tile && !HASBIT(p2, 1)) bits &= ROAD_NW | ROAD_NE; if (tile == end_tile && !HASBIT(p2, 1)) bits &= ROAD_NW | ROAD_NE;
if (tile == start_tile && HASBIT(p2, 0)) bits &= ROAD_SE | ROAD_SW; if (tile == start_tile && HASBIT(p2, 0)) bits &= ROAD_SE | ROAD_SW;
// try to remove the halves. /* try to remove the halves. */
if (bits != 0) { if (bits != 0) {
ret = DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD); ret = DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD);
if (!CmdFailed(ret)) cost += ret; if (!CmdFailed(ret)) cost += ret;
@ -621,13 +623,13 @@ uint GetRoadFoundation(Slope tileh, RoadBits bits)
{ {
uint i; uint i;
// normal level sloped building /* normal level sloped building */
if (!IsSteepSlope(tileh) && if (!IsSteepSlope(tileh) &&
(~_valid_tileh_slopes_road[1][tileh] & bits) == 0) { (~_valid_tileh_slopes_road[1][tileh] & bits) == 0) {
return tileh; return tileh;
} }
// inclined sloped building /* inclined sloped building */
switch (bits) { switch (bits) {
case ROAD_X: i = 0; break; case ROAD_X: i = 0; break;
case ROAD_Y: i = 1; break; case ROAD_Y: i = 1; break;
@ -672,8 +674,8 @@ static void DrawRoadBits(TileInfo* ti)
if (foundation != 0) DrawFoundation(ti, foundation); if (foundation != 0) DrawFoundation(ti, foundation);
// DrawFoundation() modifies ti. /* DrawFoundation() modifies ti.
// Default sloped sprites.. * Default sloped sprites.. */
if (ti->tileh != SLOPE_FLAT) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F; if (ti->tileh != SLOPE_FLAT) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
} }
@ -695,15 +697,15 @@ static void DrawRoadBits(TileInfo* ti)
DrawGroundSprite(image, pal); DrawGroundSprite(image, pal);
if (HasRoadWorks(ti->tile)) { if (HasRoadWorks(ti->tile)) {
// Road works /* Road works */
DrawGroundSprite(road & ROAD_X ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y, PAL_NONE); DrawGroundSprite(road & ROAD_X ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y, PAL_NONE);
return; return;
} }
// Return if full detail is disabled, or we are zoomed fully out. /* Return if full detail is disabled, or we are zoomed fully out. */
if (!(_display_opt & DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return; if (!(_display_opt & DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return;
// Draw extra details. /* Draw extra details. */
for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) { for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) {
int x = ti->x | drts->subcoord_x; int x = ti->x | drts->subcoord_x;
int y = ti->y | drts->subcoord_y; int y = ti->y | drts->subcoord_y;
@ -896,7 +898,7 @@ static void TileLoop_Road(TileIndex tile)
if (t != NULL) { if (t != NULL) {
grp = GetTownRadiusGroup(t, tile); grp = GetTownRadiusGroup(t, tile);
// Show an animation to indicate road work /* Show an animation to indicate road work */
if (t->road_build_months != 0 && if (t->road_build_months != 0 &&
(DistanceManhattan(t->xy, tile) < 8 || grp != 0) && (DistanceManhattan(t->xy, tile) < 8 || grp != 0) &&
GetRoadTileType(tile) == ROAD_TILE_NORMAL && (GetRoadBits(tile) == ROAD_X || GetRoadBits(tile) == ROAD_Y)) { GetRoadTileType(tile) == ROAD_TILE_NORMAL && (GetRoadBits(tile) == ROAD_X || GetRoadBits(tile) == ROAD_Y)) {

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road_cmd.h */
#ifndef ROAD_CMD_H #ifndef ROAD_CMD_H
#define ROAD_CMD_H #define ROAD_CMD_H

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road_gui.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "road_cmd.h" #include "road_cmd.h"

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road_map.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "bridge_map.h" #include "bridge_map.h"

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file road_map.h */
#ifndef ROAD_MAP_H #ifndef ROAD_MAP_H
#define ROAD_MAP_H #define ROAD_MAP_H

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file roadveh.h */
#ifndef ROADVEH_H #ifndef ROADVEH_H
#define ROADVEH_H #define ROADVEH_H

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file roadveh_cmd.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "debug.h" #include "debug.h"
@ -533,7 +535,7 @@ static byte SetRoadVehPosition(Vehicle *v, int x, int y)
{ {
byte new_z, old_z; byte new_z, old_z;
// need this hint so it returns the right z coordinate on bridges. /* need this hint so it returns the right z coordinate on bridges. */
v->x_pos = x; v->x_pos = x;
v->y_pos = y; v->y_pos = y;
new_z = GetSlopeZ(x, y); new_z = GetSlopeZ(x, y);
@ -663,7 +665,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
switch (v->current_order.type) { switch (v->current_order.type) {
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
// Let a depot order in the orderlist interrupt. /* Let a depot order in the orderlist interrupt. */
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return; if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
if (v->current_order.flags & OF_SERVICE_IF_NEEDED && if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
!VehicleNeedsService(v)) { !VehicleNeedsService(v)) {
@ -723,7 +725,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
} }
v->dest_tile = dest; v->dest_tile = dest;
} else { } else {
// There is no stop left at the station, so don't even TRY to go there /* There is no stop left at the station, so don't even TRY to go there */
v->cur_order_index++; v->cur_order_index++;
v->dest_tile = 0; v->dest_tile = 0;
} }
@ -828,10 +830,10 @@ static Vehicle* RoadVehFindCloseTo(Vehicle* v, int x, int y, Direction dir)
rvf.veh = v; rvf.veh = v;
u = (Vehicle*)VehicleFromPos(TileVirtXY(x, y), &rvf, EnumCheckRoadVehClose); u = (Vehicle*)VehicleFromPos(TileVirtXY(x, y), &rvf, EnumCheckRoadVehClose);
// This code protects a roadvehicle from being blocked for ever /* This code protects a roadvehicle from being blocked for ever
// If more than 1480 / 74 days a road vehicle is blocked, it will * If more than 1480 / 74 days a road vehicle is blocked, it will
// drive just through it. The ultimate backup-code of TTD. * drive just through it. The ultimate backup-code of TTD.
// It can be disabled. * It can be disabled. */
if (u == NULL) { if (u == NULL) {
v->u.road.blocked_ctr = 0; v->u.road.blocked_ctr = 0;
return NULL; return NULL;
@ -881,13 +883,13 @@ static bool RoadVehAccelerate(Vehicle *v)
uint spd = v->cur_speed + 1 + (v->u.road.overtaking != 0 ? 1 : 0); uint spd = v->cur_speed + 1 + (v->u.road.overtaking != 0 ? 1 : 0);
byte t; byte t;
// Clamp /* Clamp */
spd = min(spd, v->max_speed); spd = min(spd, v->max_speed);
if (v->u.road.state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) { if (v->u.road.state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) {
spd = min(spd, GetBridge(GetBridgeType(v->tile))->speed * 2); spd = min(spd, GetBridge(GetBridgeType(v->tile))->speed * 2);
} }
//updates statusbar only if speed have changed to save CPU time /* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) { if (_patches.vehicle_speed) {
@ -895,7 +897,7 @@ static bool RoadVehAccelerate(Vehicle *v)
} }
} }
// Decrease somewhat when turning /* Decrease somewhat when turning */
if (!(v->direction & 1)) spd = spd * 3 >> 2; if (!(v->direction & 1)) spd = spd * 3 >> 2;
if (spd == 0) return false; if (spd == 0) return false;
@ -1153,9 +1155,9 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
ftd = PerfNPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE); ftd = PerfNPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE);
if (ftd.best_trackdir == INVALID_TRACKDIR) { if (ftd.best_trackdir == INVALID_TRACKDIR) {
/* We are already at our target. Just do something */ /* We are already at our target. Just do something
//TODO: maybe display error? * @todo: maybe display error?
//TODO: go straight ahead if possible? * @todo: go straight ahead if possible? */
return_track(FindFirstBit2x64(trackdirs)); return_track(FindFirstBit2x64(trackdirs));
} else { } else {
/* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains /* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains
@ -1223,10 +1225,10 @@ static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
{ {
uint dist; uint dist;
if (_patches.yapf.road_use_yapf) { if (_patches.yapf.road_use_yapf) {
// use YAPF /* use YAPF */
dist = YapfRoadVehDistanceToTile(v, tile); dist = YapfRoadVehDistanceToTile(v, tile);
} else { } else {
// use NPF /* use NPF */
NPFFindStationOrTileData fstd; NPFFindStationOrTileData fstd;
Trackdir trackdir = GetVehicleTrackdir(v); Trackdir trackdir = GetVehicleTrackdir(v);
assert(trackdir != INVALID_TRACKDIR); assert(trackdir != INVALID_TRACKDIR);
@ -1235,7 +1237,7 @@ static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
fstd.station_index = INVALID_STATION; // indicates that the destination is a tile, not a station fstd.station_index = INVALID_STATION; // indicates that the destination is a tile, not a station
dist = NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE).best_path_dist; dist = NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE).best_path_dist;
// change units from NPF_TILE_LENGTH to # of tiles /* change units from NPF_TILE_LENGTH to # of tiles */
if (dist != UINT_MAX) if (dist != UINT_MAX)
dist = (dist + NPF_TILE_LENGTH - 1) / NPF_TILE_LENGTH; dist = (dist + NPF_TILE_LENGTH - 1) / NPF_TILE_LENGTH;
} }
@ -1277,11 +1279,11 @@ static void RoadVehController(Vehicle *v)
int x,y; int x,y;
uint32 r; uint32 r;
// decrease counters /* decrease counters */
v->tick_counter++; v->tick_counter++;
if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--; if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--;
// handle crashed /* handle crashed */
if (v->u.road.crashed_ctr != 0) { if (v->u.road.crashed_ctr != 0) {
RoadVehIsCrashed(v); RoadVehIsCrashed(v);
return; return;
@ -1289,7 +1291,7 @@ static void RoadVehController(Vehicle *v)
RoadVehCheckTrainCrash(v); RoadVehCheckTrainCrash(v);
// road vehicle has broken down? /* road vehicle has broken down? */
if (v->breakdown_ctr != 0) { if (v->breakdown_ctr != 0) {
if (v->breakdown_ctr <= 2) { if (v->breakdown_ctr <= 2) {
HandleBrokenRoadVeh(v); HandleBrokenRoadVeh(v);
@ -1628,9 +1630,9 @@ again:
/* We are leaving the correct station */ /* We are leaving the correct station */
ClearSlot(v); ClearSlot(v);
} else if (v->u.road.slot != NULL) { } else if (v->u.road.slot != NULL) {
/* We are leaving the wrong station */ /* We are leaving the wrong station
//XXX The question is .. what to do? Actually we shouldn't be here * XXX The question is .. what to do? Actually we shouldn't be here
//but I guess we need to clear the slot * but I guess we need to clear the slot */
DEBUG(ms, 0, "Vehicle %d (index %d) arrived at wrong stop", v->unitnumber, v->index); DEBUG(ms, 0, "Vehicle %d (index %d) arrived at wrong stop", v->unitnumber, v->index);
if (v->tile != v->dest_tile) { if (v->tile != v->dest_tile) {
DEBUG(ms, 2, " current tile 0x%X is not destination tile 0x%X. Route problem", v->tile, v->dest_tile); DEBUG(ms, 2, " current tile 0x%X is not destination tile 0x%X. Route problem", v->tile, v->dest_tile);
@ -1692,13 +1694,13 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
if (v->vehstatus & VS_STOPPED) return; if (v->vehstatus & VS_STOPPED) return;
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return; if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
// Don't interfere with a depot visit scheduled by the user, or a /* Don't interfere with a depot visit scheduled by the user, or a
// depot visit by the order list. * depot visit by the order list. */
if (v->current_order.type == OT_GOTO_DEPOT && if (v->current_order.type == OT_GOTO_DEPOT &&
(v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0) (v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
return; return;
// If we already got a slot at a stop, use that FIRST, and go to a depot later /* If we already got a slot at a stop, use that FIRST, and go to a depot later */
if (v->u.road.slot != NULL) return; if (v->u.road.slot != NULL) return;
if (IsRoadVehInDepot(v)) { if (IsRoadVehInDepot(v)) {
@ -1706,7 +1708,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
return; return;
} }
// XXX If we already have a depot order, WHY do we search over and over? /* XXX If we already have a depot order, WHY do we search over and over? */
depot = FindClosestRoadDepot(v); depot = FindClosestRoadDepot(v);
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
@ -1743,7 +1745,7 @@ void OnNewDay_RoadVeh(Vehicle *v)
CheckOrders(v); CheckOrders(v);
//Current slot has expired /* Current slot has expired */
if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot != NULL && v->u.road.slot_age-- == 0) { if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot != NULL && v->u.road.slot_age-- == 0) {
DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X", DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X",
v->unitnumber, v->index, v->u.road.slot->xy); v->unitnumber, v->index, v->u.road.slot->xy);

View File

@ -1,5 +1,7 @@
/* $Id$ */ /* $Id$ */
/** @file roadveh_gui.cpp */
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "debug.h" #include "debug.h"
@ -34,7 +36,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
StringID str; StringID str;
SetWindowWidgetDisabledState(w, 2, v->owner != _local_player); SetWindowWidgetDisabledState(w, 2, v->owner != _local_player);
// disable service-scroller when interval is set to disabled /* disable service-scroller when interval is set to disabled */
SetWindowWidgetDisabledState(w, 5, !_patches.servint_roadveh); SetWindowWidgetDisabledState(w, 5, !_patches.servint_roadveh);
SetWindowWidgetDisabledState(w, 6, !_patches.servint_roadveh); SetWindowWidgetDisabledState(w, 6, !_patches.servint_roadveh);