diff --git a/src/rail.cpp b/src/rail.cpp index 08670e4fd7..8fefaa399f 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file rail.cpp */ + #include "stdafx.h" #include "openttd.h" #include "bridge_map.h" diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 1c5f3603c7..0abf832e5a 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file rail_cmd.cpp */ + #include "stdafx.h" #include "openttd.h" #include "bridge_map.h" diff --git a/src/rail_map.h b/src/rail_map.h index 230bb0348b..b09bccf888 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file rail_map.h Hides the direct accesses to the map array with map accessors */ + #ifndef RAIL_MAP_H #define RAIL_MAP_H diff --git a/src/railtypes.h b/src/railtypes.h index e21c1250df..6695a661c1 100644 --- a/src/railtypes.h +++ b/src/railtypes.h @@ -1,12 +1,12 @@ /* $Id$ */ -#ifndef RAILTYPES_H -#define RAILTYPES_H - /** @file railtypes.h * All the railtype-specific information is stored here. */ +#ifndef RAILTYPES_H +#define RAILTYPES_H + /** Global Railtype definition */ RailtypeInfo _railtypes[] = { diff --git a/src/resource.h b/src/resource.h index 41ff821b5f..0cb727e17e 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file resource.h */ + //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by ttd.rc diff --git a/src/road.h b/src/road.h index 249c8f7882..035ec8089f 100644 --- a/src/road.h +++ b/src/road.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road.h */ + #ifndef ROAD_H #define ROAD_H diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 8ffb07aba3..b054968be0 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road_cmd.cpp */ + #include "stdafx.h" #include "openttd.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; - // Only do the special processing for actual players. + /* Only do the special processing for actual players. */ if (!IsValidPlayer(_current_player)) return true; - // Only do the special processing if the road is owned - // by a town + /* Only do the special processing if the road is owned + * by a town */ if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner); 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; present = GetAnyRoadBits(tile); 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_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, - // then allow it + /* If 0 or 1 bits are set in n, or if no bits that match the bits to remove, + * then allow it */ if ((n & (n - 1)) != 0 && (n & remove) != 0) { Town *t; *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; 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) { - // cost for removing inner/edge -roads + /* cost for removing inner/edge -roads */ static const uint16 road_remove_cost[2] = {50, 18}; Owner owner; @@ -120,8 +122,8 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!EnsureNoVehicle(tile)) return CMD_ERROR; - // check if you're allowed to remove the street owned by a town - // removal allowance depends on difficulty setting + /* check if you're allowed to remove the street owned by a town + * removal allowance depends on difficulty setting */ if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR; switch (GetRoadTileType(tile)) { @@ -137,7 +139,7 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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; 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] = { - // set of normal ones + /* set of normal ones */ { ROAD_ALL, ROAD_NONE, ROAD_NONE, 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_X, ROAD_NONE, ROAD_NONE }, - // allowed road for an evenly raised platform + /* allowed road for an evenly raised platform */ { ROAD_NONE, ROAD_SW | ROAD_NW, @@ -216,7 +218,7 @@ static uint32 CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existing) if (IsSteepSlope(tileh)) { if (existing == 0) { - // force full pieces. + /* force full pieces. */ *pieces |= (RoadBits)((*pieces & 0xC) >> 2); *pieces |= (RoadBits)((*pieces & 0x3) << 2); 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; - // no special foundation + /* no special foundation */ 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]; 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) { 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)) { - // force full pieces. + /* force full pieces. */ *pieces |= (RoadBits)((*pieces & 0xC) >> 2); *pieces |= (RoadBits)((*pieces & 0x3) << 2); if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform; @@ -349,7 +351,7 @@ do_clear:; cost += ret; if (IsTileType(tile, MP_STREET)) { - // Don't put the pieces that already exist + /* Don't put the pieces that already exist */ pieces &= ComplementRoadBits(existing); } @@ -377,15 +379,15 @@ do_clear:; */ int32 DoConvertStreetRail(TileIndex tile, RailType totype, bool exec) { - // not a railroad crossing? + /* not a railroad crossing? */ if (!IsLevelCrossing(tile)) return CMD_ERROR; - // not owned by me? + /* not owned by me? */ if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) 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 (exec) { @@ -431,7 +433,7 @@ int32 CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2) cost = 0; tile = start_tile; - // Start tile is the small number. + /* Start tile is the small number. */ for (;;) { 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; tile = start_tile; - // Start tile is the small number. + /* Start tile is the small number. */ for (;;) { RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X; if (tile == end_tile && !HASBIT(p2, 1)) bits &= ROAD_NW | ROAD_NE; 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) { ret = DoCommand(tile, bits, 0, flags, CMD_REMOVE_ROAD); if (!CmdFailed(ret)) cost += ret; @@ -621,13 +623,13 @@ uint GetRoadFoundation(Slope tileh, RoadBits bits) { uint i; - // normal level sloped building + /* normal level sloped building */ if (!IsSteepSlope(tileh) && (~_valid_tileh_slopes_road[1][tileh] & bits) == 0) { return tileh; } - // inclined sloped building + /* inclined sloped building */ switch (bits) { case ROAD_X: i = 0; break; case ROAD_Y: i = 1; break; @@ -672,8 +674,8 @@ static void DrawRoadBits(TileInfo* ti) if (foundation != 0) DrawFoundation(ti, foundation); - // DrawFoundation() modifies ti. - // Default sloped sprites.. + /* DrawFoundation() modifies ti. + * Default sloped sprites.. */ 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); if (HasRoadWorks(ti->tile)) { - // Road works + /* Road works */ DrawGroundSprite(road & ROAD_X ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y, PAL_NONE); 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; - // Draw extra details. + /* Draw extra details. */ for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) { int x = ti->x | drts->subcoord_x; int y = ti->y | drts->subcoord_y; @@ -896,7 +898,7 @@ static void TileLoop_Road(TileIndex tile) if (t != NULL) { grp = GetTownRadiusGroup(t, tile); - // Show an animation to indicate road work + /* Show an animation to indicate road work */ if (t->road_build_months != 0 && (DistanceManhattan(t->xy, tile) < 8 || grp != 0) && GetRoadTileType(tile) == ROAD_TILE_NORMAL && (GetRoadBits(tile) == ROAD_X || GetRoadBits(tile) == ROAD_Y)) { diff --git a/src/road_cmd.h b/src/road_cmd.h index 436ecd9001..c6fb9f5afd 100644 --- a/src/road_cmd.h +++ b/src/road_cmd.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road_cmd.h */ + #ifndef ROAD_CMD_H #define ROAD_CMD_H diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 633962a1d1..ec34dd48f1 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road_gui.cpp */ + #include "stdafx.h" #include "openttd.h" #include "road_cmd.h" diff --git a/src/road_map.cpp b/src/road_map.cpp index 704d7de3ea..2c7e6dfbf2 100644 --- a/src/road_map.cpp +++ b/src/road_map.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road_map.cpp */ + #include "stdafx.h" #include "openttd.h" #include "bridge_map.h" diff --git a/src/road_map.h b/src/road_map.h index 599eeffd97..6385b0cc89 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file road_map.h */ + #ifndef ROAD_MAP_H #define ROAD_MAP_H diff --git a/src/roadveh.h b/src/roadveh.h index abed18f050..b5d8a1096b 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file roadveh.h */ + #ifndef ROADVEH_H #define ROADVEH_H diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index fe118bbaae..ede670d0a4 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file roadveh_cmd.cpp */ + #include "stdafx.h" #include "openttd.h" #include "debug.h" @@ -533,7 +535,7 @@ static byte SetRoadVehPosition(Vehicle *v, int x, int y) { 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->y_pos = y; new_z = GetSlopeZ(x, y); @@ -663,7 +665,7 @@ static void ProcessRoadVehOrder(Vehicle *v) switch (v->current_order.type) { 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_SERVICE_IF_NEEDED && !VehicleNeedsService(v)) { @@ -723,7 +725,7 @@ static void ProcessRoadVehOrder(Vehicle *v) } v->dest_tile = dest; } 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->dest_tile = 0; } @@ -828,10 +830,10 @@ static Vehicle* RoadVehFindCloseTo(Vehicle* v, int x, int y, Direction dir) rvf.veh = v; u = (Vehicle*)VehicleFromPos(TileVirtXY(x, y), &rvf, EnumCheckRoadVehClose); - // This code protects a roadvehicle from being blocked for ever - // If more than 1480 / 74 days a road vehicle is blocked, it will - // drive just through it. The ultimate backup-code of TTD. - // It can be disabled. + /* This code protects a roadvehicle from being blocked for ever + * If more than 1480 / 74 days a road vehicle is blocked, it will + * drive just through it. The ultimate backup-code of TTD. + * It can be disabled. */ if (u == NULL) { v->u.road.blocked_ctr = 0; return NULL; @@ -881,13 +883,13 @@ static bool RoadVehAccelerate(Vehicle *v) uint spd = v->cur_speed + 1 + (v->u.road.overtaking != 0 ? 1 : 0); byte t; - // Clamp + /* Clamp */ spd = min(spd, v->max_speed); if (v->u.road.state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) { 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) { v->cur_speed = spd; 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 (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); if (ftd.best_trackdir == INVALID_TRACKDIR) { - /* We are already at our target. Just do something */ - //TODO: maybe display error? - //TODO: go straight ahead if possible? + /* We are already at our target. Just do something + * @todo: maybe display error? + * @todo: go straight ahead if possible? */ return_track(FindFirstBit2x64(trackdirs)); } else { /* 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; if (_patches.yapf.road_use_yapf) { - // use YAPF + /* use YAPF */ dist = YapfRoadVehDistanceToTile(v, tile); } else { - // use NPF + /* use NPF */ NPFFindStationOrTileData fstd; Trackdir trackdir = GetVehicleTrackdir(v); 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 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) dist = (dist + NPF_TILE_LENGTH - 1) / NPF_TILE_LENGTH; } @@ -1277,11 +1279,11 @@ static void RoadVehController(Vehicle *v) int x,y; uint32 r; - // decrease counters + /* decrease counters */ v->tick_counter++; if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--; - // handle crashed + /* handle crashed */ if (v->u.road.crashed_ctr != 0) { RoadVehIsCrashed(v); return; @@ -1289,7 +1291,7 @@ static void RoadVehController(Vehicle *v) RoadVehCheckTrainCrash(v); - // road vehicle has broken down? + /* road vehicle has broken down? */ if (v->breakdown_ctr != 0) { if (v->breakdown_ctr <= 2) { HandleBrokenRoadVeh(v); @@ -1628,9 +1630,9 @@ again: /* We are leaving the correct station */ ClearSlot(v); } else if (v->u.road.slot != NULL) { - /* We are leaving the wrong station */ - //XXX The question is .. what to do? Actually we shouldn't be here - //but I guess we need to clear the slot + /* We are leaving the wrong station + * XXX The question is .. what to do? Actually we shouldn't be here + * but I guess we need to clear the slot */ DEBUG(ms, 0, "Vehicle %d (index %d) arrived at wrong stop", v->unitnumber, v->index); 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); @@ -1692,13 +1694,13 @@ static void CheckIfRoadVehNeedsService(Vehicle *v) if (v->vehstatus & VS_STOPPED) return; if (_patches.gotodepot && VehicleHasDepotOrders(v)) return; - // Don't interfere with a depot visit scheduled by the user, or a - // depot visit by the order list. + /* Don't interfere with a depot visit scheduled by the user, or a + * depot visit by the order list. */ if (v->current_order.type == OT_GOTO_DEPOT && (v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0) 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 (IsRoadVehInDepot(v)) { @@ -1706,7 +1708,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v) 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); if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { @@ -1743,7 +1745,7 @@ void OnNewDay_RoadVeh(Vehicle *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) { DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X", v->unitnumber, v->index, v->u.road.slot->xy); diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index f5bb924f85..81f7f84fa9 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file roadveh_gui.cpp */ + #include "stdafx.h" #include "openttd.h" #include "debug.h" @@ -34,7 +36,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e) StringID str; 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, 6, !_patches.servint_roadveh);