From 63687763e9680663e68754b47ee9f1511641faf8 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 4 Sep 2006 20:40:33 +0000 Subject: [PATCH] (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform. -Cleanup: whitespace alignment of a few tables. --- aircraft_cmd.c | 20 +++--- depot.h | 2 +- economy.c | 4 +- elrail.c | 132 ++++++++++++++++++------------------- engine.c | 8 +-- engine.h | 7 +- heightmap.c | 2 +- news_gui.c | 26 ++++---- oldloader.c | 2 +- openttd.c | 14 ++-- order.h | 3 +- order_cmd.c | 18 ++--- player.h | 3 +- players.c | 4 +- rail.h | 4 +- rail_cmd.c | 17 +++-- roadveh_cmd.c | 4 +- saveload.c | 10 +-- settings.c | 2 +- settings_gui.c | 43 ++++++------ smallmap_gui.c | 4 +- station_cmd.c | 75 +++++++++++---------- station_gui.c | 2 +- table/autorail.h | 12 ++-- table/bridge_land.h | 42 ++++++------ table/elrail_data.h | 58 ++++++++-------- table/engines.h | 26 ++++---- table/sprites.h | 97 ++++++++++++++------------- table/town_land.h | 79 +++++++++++----------- tgp.c | 50 +++++++------- town_cmd.c | 2 +- train_cmd.c | 14 ++-- tunnelbridge_cmd.c | 32 ++++----- variables.h | 14 ++-- vehicle.c | 60 ++++++++--------- vehicle_gui.c | 8 +-- video/cocoa_v.m | 2 +- window.c | 6 +- yapf/array.hpp | 2 +- yapf/autocopyptr.hpp | 20 +++--- yapf/binaryheap.hpp | 44 ++++++------- yapf/blob.hpp | 20 +++--- yapf/countedptr.hpp | 18 ++--- yapf/fixedsizearray.hpp | 8 +-- yapf/follow_track.hpp | 6 +- yapf/hashtable.hpp | 42 ++++++------ yapf/nodelist.hpp | 4 +- yapf/unittest/test_yapf.h | 10 +-- yapf/unittest/unittest.cpp | 34 +++++----- yapf/yapf.h | 86 ++++++++++++------------ yapf/yapf_base.hpp | 78 +++++++++++----------- yapf/yapf_common.hpp | 8 +-- yapf/yapf_costcache.hpp | 50 +++++++------- yapf/yapf_costrail.hpp | 4 +- yapf/yapf_destrail.hpp | 4 +- yapf/yapf_rail.cpp | 8 +-- yapf/yapf_road.cpp | 12 ++-- yapf/yapf_settings.h | 18 ++--- yapf/yapf_ship.cpp | 12 ++-- 59 files changed, 695 insertions(+), 701 deletions(-) diff --git a/aircraft_cmd.c b/aircraft_cmd.c index d58ae4bb49..bac16b5256 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -515,7 +515,7 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) { /* We called with a different DEPOT_SERVICE setting. * Now we change the setting to apply the new one and let the vehicle head for the same hangar. - * Note: the if is (true for requesting service == true for ordered to stop in hangar) */ + * Note: the if is (true for requesting service == true for ordered to stop in hangar) */ if (flags & DC_EXEC) { TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); @@ -1915,15 +1915,15 @@ static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport) Station *st; /* example of more terminalgroups - {0,HANGAR,NOTHING_block,1}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER_block,1}, {0,0,N,1}, - Heading 255 denotes a group. We see 2 groups here: - 1. group 0 -- TERM_GROUP1_block (check block) - 2. group 1 -- TERM_GROUP2_ENTER_block (check block) - First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it - looks at the corresponding terminals of that group. If no free ones are found, other - possible groups are checked (in this case group 1, since that is after group 0). If that - fails, then attempt fails and plane waits - */ + * {0,HANGAR,NOTHING_block,1}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER_block,1}, {0,0,N,1}, + * Heading 255 denotes a group. We see 2 groups here: + * 1. group 0 -- TERM_GROUP1_block (check block) + * 2. group 1 -- TERM_GROUP2_ENTER_block (check block) + * First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it + * looks at the corresponding terminals of that group. If no free ones are found, other + * possible groups are checked (in this case group 1, since that is after group 0). If that + * fails, then attempt fails and plane waits + */ if (Airport->terminals[0] > 1) { st = GetStation(v->u.air.targetairport); temp = Airport->layout[v->u.air.pos].next_in_chain; diff --git a/depot.h b/depot.h index 45b97f503e..6d61a8883e 100644 --- a/depot.h +++ b/depot.h @@ -4,7 +4,7 @@ #define DEPOT_H /** @file depot.h Header files for depots (not hangars) - * @see depot.c */ + * @see depot.c */ #include "direction.h" #include "pool.h" diff --git a/economy.c b/economy.c index ec71ccdc4f..a9a6eb8090 100644 --- a/economy.c +++ b/economy.c @@ -246,8 +246,8 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) _current_player = old_player; /* Temporarily increase the player's money, to be sure that - * removing his/her property doesn't fail because of lack of money. - * Not too drastically though, because it could overflow */ + * removing his/her property doesn't fail because of lack of money. + * Not too drastically though, because it could overflow */ if (new_player == OWNER_SPECTATOR) { GetPlayer(old_player)->money64 = MAX_UVALUE(uint64) >>2; // jackpot ;p UpdatePlayerMoney32(GetPlayer(old_player)); diff --git a/elrail.c b/elrail.c index e3b99b6d23..6e6a02311a 100644 --- a/elrail.c +++ b/elrail.c @@ -1,49 +1,49 @@ /* $Id$ */ /** @file elrail.c - This file deals with displaying wires and pylons for electric railways. -

Basics

- -

Tile Types

- -We have two different types of tiles in the drawing code: -Normal Railway Tiles (NRTs) which can have more than one track on it, and -Special Railways tiles (SRTs) which have only one track (like crossings, depots -stations, etc). - -

Location Categories

- -All tiles are categorized into three location groups (TLG): -Group 0: Tiles with both an even X coordinate and an even Y coordinate -Group 1: Tiles with an even X and an odd Y coordinate -Group 2: Tiles with an odd X and an even Y coordinate -Group 3: Tiles with both an odd X and Y coordnate. - -

Pylon Points

-

Control Points

-A Pylon Control Point (PCP) is a position where a wire (or rather two) -is mounted onto a pylon. -Each NRT does contain 4 PCPs which are bitmapped to a byte -variable and are represented by the DiagDirection enum - -Each track ends on two PCPs and thus requires one pylon on each end. However, -there is one exception: Straight-and-level tracks only have one pylon every -other tile. - -Now on each edge there are two PCPs: One from each adjacent tile. Both PCPs -are merged using an OR operation (i. e. if one tile needs a PCP at the postion -in question, both tiles get it). - -

Position Points

-A Pylon Position Point (PPP) is a position where a pylon is located on the -ground. Each PCP owns 8 in (45 degree steps) PPPs that are located around -it. PPPs are represented using the Direction enum. Each track bit has PPPs -that are impossible (because the pylon would be situated on the track) and -some that are preferred (because the pylon would be rectangular to the track). - - - - - */ + * This file deals with displaying wires and pylons for electric railways. + *

Basics

+ * + *

Tile Types

+ * + * We have two different types of tiles in the drawing code: + * Normal Railway Tiles (NRTs) which can have more than one track on it, and + * Special Railways tiles (SRTs) which have only one track (like crossings, depots + * stations, etc). + * + *

Location Categories

+ * + * All tiles are categorized into three location groups (TLG): + * Group 0: Tiles with both an even X coordinate and an even Y coordinate + * Group 1: Tiles with an even X and an odd Y coordinate + * Group 2: Tiles with an odd X and an even Y coordinate + * Group 3: Tiles with both an odd X and Y coordnate. + * + *

Pylon Points

+ *

Control Points

+ * A Pylon Control Point (PCP) is a position where a wire (or rather two) + * is mounted onto a pylon. + * Each NRT does contain 4 PCPs which are bitmapped to a byte + * variable and are represented by the DiagDirection enum + * + * Each track ends on two PCPs and thus requires one pylon on each end. However, + * there is one exception: Straight-and-level tracks only have one pylon every + * other tile. + * + * Now on each edge there are two PCPs: One from each adjacent tile. Both PCPs + * are merged using an OR operation (i. e. if one tile needs a PCP at the postion + * in question, both tiles get it). + * + *

Position Points

+ * A Pylon Position Point (PPP) is a position where a pylon is located on the + * ground. Each PCP owns 8 in (45 degree steps) PPPs that are located around + * it. PPPs are represented using the Direction enum. Each track bit has PPPs + * that are impossible (because the pylon would be situated on the track) and + * some that are preferred (because the pylon would be rectangular to the track). + * + * + * + * + */ #include "stdafx.h" #include "openttd.h" @@ -68,8 +68,8 @@ static inline TLG GetTLG(TileIndex t) } /** Finds which Rail Bits are present on a given tile. For bridge tiles, - * returns track bits under the bridge - */ + * returns track bits under the bridge + */ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) { switch (GetTileType(t)) { @@ -123,9 +123,9 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) } /** Corrects the tileh for certain tile types. Returns an effective tileh for the track on the tile. - * @param tile The tile to analyse - * @param *tileh the tileh - */ + * @param tile The tile to analyse + * @param *tileh the tileh + */ static void AdjustTileh(TileIndex tile, Slope *tileh) { if (IsTileType(tile, MP_TUNNELBRIDGE)) { @@ -150,13 +150,13 @@ static void AdjustTileh(TileIndex tile, Slope *tileh) } /** Draws wires and, if required, pylons on a given tile - * @param ti The Tileinfo to draw the tile for - */ + * @param ti The Tileinfo to draw the tile for + */ static void DrawCatenaryRailway(const TileInfo *ti) { /* Pylons are placed on a tile edge, so we need to take into account - the track configuration of 2 adjacent tiles. trackconfig[0] stores the - current tile (home tile) while [1] holds the neighbour */ + * the track configuration of 2 adjacent tiles. trackconfig[0] stores the + * current tile (home tile) while [1] holds the neighbour */ TrackBits trackconfig[TS_END]; bool isflat[TS_END]; /* Note that ti->tileh has already been adjusted for Foundations */ @@ -171,11 +171,11 @@ static void DrawCatenaryRailway(const TileInfo *ti) Track t; /* Find which rail bits are present, and select the override points. - We don't draw a pylon: - 1) INSIDE a tunnel (we wouldn't see it anyway) - 2) on the "far" end of a bridge head (the one that connects to bridge middle), - because that one is drawn on the bridge. Exception is for length 0 bridges - which have no middle tiles */ + * We don't draw a pylon: + * 1) INSIDE a tunnel (we wouldn't see it anyway) + * 2) on the "far" end of a bridge head (the one that connects to bridge middle), + * because that one is drawn on the bridge. Exception is for length 0 bridges + * which have no middle tiles */ trackconfig[TS_HOME] = GetRailTrackBitsUniversal(ti->tile, &OverridePCP); /* If a track bit is present that is not in the main direction, the track is level */ isflat[TS_HOME] = trackconfig[TS_HOME] & (TRACK_BIT_HORZ | TRACK_BIT_VERT); @@ -188,7 +188,7 @@ static void DrawCatenaryRailway(const TileInfo *ti) int k; /* Here's one of the main headaches. GetTileSlope does not correct for possibly - existing foundataions, so we do have to do that manually later on.*/ + * existing foundataions, so we do have to do that manually later on.*/ tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour, NULL); trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL); if (IsTunnelTile(neighbour) && i != GetTunnelDirection(neighbour)) trackconfig[TS_NEIGHBOUR] = 0; @@ -198,7 +198,7 @@ static void DrawCatenaryRailway(const TileInfo *ti) PPPallowed[i] = AllowedPPPonPCP[i]; /* We cycle through all the existing tracks at a PCP and see what - PPPs we want to have, or may not have at all */ + * PPPs we want to have, or may not have at all */ for (k = 0; k < NUM_TRACKS_AT_PCP; k++) { /* Next to us, we have a bridge head, don't worry about that one, if it shows away from us */ if (TrackSourceTile[i][k] == TS_NEIGHBOUR && @@ -208,10 +208,10 @@ static void DrawCatenaryRailway(const TileInfo *ti) } /* We check whether the track in question (k) is present in the tile - (TrackSourceTile) */ + * (TrackSourceTile) */ if (HASBIT(trackconfig[TrackSourceTile[i][k]], TracksAtPCP[i][k])) { /* track found, if track is in the neighbour tile, adjust the number - of the PCP for preferred/allowed determination*/ + * of the PCP for preferred/allowed determination*/ DiagDirection PCPpos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i); SETBIT(PCPstatus, i); /* This PCP is in use */ @@ -244,7 +244,7 @@ static void DrawCatenaryRailway(const TileInfo *ti) AdjustTileh(neighbour, &tileh[TS_NEIGHBOUR]); /* If we have a straight (and level) track, we want a pylon only every 2 tiles - Delete the PCP if this is the case. */ + * Delete the PCP if this is the case. */ /* Level means that the slope is the same, or the track is flat */ if (tileh[TS_HOME] == tileh[TS_NEIGHBOUR] || (isflat[TS_HOME] && isflat[TS_NEIGHBOUR])) { for (k = 0; k < NUM_IGNORE_GROUPS; k++) @@ -252,9 +252,9 @@ static void DrawCatenaryRailway(const TileInfo *ti) } /* Now decide where we draw our pylons. First try the preferred PPPs, but they may not exist. - In that case, we try the any of the allowed ones. if they don't exist either, don't draw - anything. Note that the preferred PPPs still contain the end-of-line markers. - Remove those (simply by ANDing with allowed, since these markers are never allowed) */ + * In that case, we try the any of the allowed ones. if they don't exist either, don't draw + * anything. Note that the preferred PPPs still contain the end-of-line markers. + * Remove those (simply by ANDing with allowed, since these markers are never allowed) */ if ((PPPallowed[i] & PPPpreferred[i]) != 0) PPPallowed[i] &= PPPpreferred[i]; if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) { diff --git a/engine.c b/engine.c index d5f9c9a85b..cb546c44e0 100644 --- a/engine.c +++ b/engine.c @@ -191,10 +191,10 @@ void StartupEngines(void) } /* This sets up type for the engine - It is needed if you want to ask the engine what type it is - It should hopefully be the same as when you ask a vehicle what it is - but using this, you can ask what type an engine number is - even if it is not a vehicle (yet)*/ + * It is needed if you want to ask the engine what type it is + * It should hopefully be the same as when you ask a vehicle what it is + * but using this, you can ask what type an engine number is + * even if it is not a vehicle (yet)*/ } AdjustAvailAircraft(); diff --git a/engine.h b/engine.h index 4e17f5d360..0847bd4245 100644 --- a/engine.h +++ b/engine.h @@ -3,8 +3,7 @@ #ifndef ENGINE_H #define ENGINE_H -/** @file engine.h - */ +/** @file engine.h */ #include "pool.h" @@ -71,8 +70,8 @@ typedef struct RoadVehicleInfo { } RoadVehicleInfo; /** Information about a vehicle - * @see table/engines.h - */ + * @see table/engines.h + */ typedef struct EngineInfo { Date base_intro; byte unk2; ///< Carriages have the highest bit set in this one diff --git a/heightmap.c b/heightmap.c index 8bc3f63a5c..ddcc50ccdd 100644 --- a/heightmap.c +++ b/heightmap.c @@ -121,7 +121,7 @@ static bool ReadHeightmapPNG(char *filename, uint *x, uint *y, byte **map) png_init_io(png_ptr, fp); /* Allocate memory and read image, without alpha or 16-bit samples - * (result is either 8-bit indexed/grayscale or 24-bit RGB) */ + * (result is either 8-bit indexed/grayscale or 24-bit RGB) */ png_set_packing(png_ptr); png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_PACKING | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_STRIP_16, NULL); diff --git a/news_gui.c b/news_gui.c index 1af6193392..a426b7d4f2 100644 --- a/news_gui.c +++ b/news_gui.c @@ -17,18 +17,18 @@ #include "date.h" /* News system -News system is realized as a FIFO queue (in an array) -The positions in the queue can't be rearranged, we only access -the array elements through pointers to the elements. Once the -array is full, the oldest entry (_oldest_news) is being overwritten -by the newest (_latest news). - -oldest current lastest - | | | -[O------------F-------------C---------L ] - | - forced -*/ + * News system is realized as a FIFO queue (in an array) + * The positions in the queue can't be rearranged, we only access + * the array elements through pointers to the elements. Once the + * array is full, the oldest entry (_oldest_news) is being overwritten + * by the newest (_latest news). + * + * oldest current lastest + * | | | + * [O------------F-------------C---------L ] + * | + * forced + */ #define MAX_NEWS 30 @@ -524,7 +524,7 @@ void ShowLastNewsMessage(void) /* return news by number, with 0 being the most -recent news. Returns INVALID_NEWS if end of queue reached. */ + * recent news. Returns INVALID_NEWS if end of queue reached. */ static byte getNews(byte i) { if (i >= _total_news) return INVALID_NEWS; diff --git a/oldloader.c b/oldloader.c index 4f66c6c6d9..71a9f764ce 100644 --- a/oldloader.c +++ b/oldloader.c @@ -1519,7 +1519,7 @@ static bool LoadOldMain(LoadgameState *ls) _m[i].m4 = (_m[i].m4 >> 1) & 7; } /* TTDPatch stores PBS things in L6 and all elsewhere; so we'll just - * clear it for ourselves and let OTTD's rebuild PBS itself */ + * clear it for ourselves and let OTTD's rebuild PBS itself */ _m[i].m4 &= 0xF; /* Only keep the lower four bits; upper four is PBS */ } } diff --git a/openttd.c b/openttd.c index 447c5ce89d..a138e0e021 100644 --- a/openttd.c +++ b/openttd.c @@ -1068,13 +1068,13 @@ static void UpdateExclusiveRights(void) } /* FIXME old exclusive rights status is not being imported (stored in s->blocked_months_obsolete) - could be implemented this way: - 1.) Go through all stations - Build an array town_blocked[ town_id ][ player_id ] - that stores if at least one station in that town is blocked for a player - 2.) Go through that array, if you find a town that is not blocked for - one player, but for all others, then give him exclusivity. - */ + * could be implemented this way: + * 1.) Go through all stations + * Build an array town_blocked[ town_id ][ player_id ] + * that stores if at least one station in that town is blocked for a player + * 2.) Go through that array, if you find a town that is not blocked for + * one player, but for all others, then give him exclusivity. + */ } static const byte convert_currency[] = { diff --git a/order.h b/order.h index 1763f59e03..e3c2d1d9df 100644 --- a/order.h +++ b/order.h @@ -1,7 +1,6 @@ /* $Id$ */ -/** @file order.h - */ +/** @file order.h */ #ifndef ORDER_H #define ORDER_H diff --git a/order_cmd.c b/order_cmd.c index c7596b1829..2641c7c936 100644 --- a/order_cmd.c +++ b/order_cmd.c @@ -817,9 +817,9 @@ void RestoreVehicleOrders(const Vehicle* v, const BackuppedOrders* bak) } /* CMD_NO_TEST_IF_IN_NETWORK is used here, because CMD_INSERT_ORDER checks if the - order number is one more than the current amount of orders, and because - in network the commands are queued before send, the second insert always - fails in test mode. By bypassing the test-mode, that no longer is a problem. */ + * order number is one more than the current amount of orders, and because + * in network the commands are queued before send, the second insert always + * fails in test mode. By bypassing the test-mode, that no longer is a problem. */ for (i = 0; bak->order[i].type != OT_NOTHING; i++) { if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK)) break; @@ -1055,10 +1055,10 @@ void DeleteVehicleOrders(Vehicle *v) v->next_shared = NULL; /* We only need to update this-one, because if there is a third - vehicle which shares the same order-list, nothing will change. If - this is the last vehicle, the last line of the order-window - will change from Shared order list, to Order list, so it needs - an update */ + * vehicle which shares the same order-list, nothing will change. If + * this is the last vehicle, the last line of the order-window + * will change from Shared order list, to Order list, so it needs + * an update */ InvalidateVehicleOrder(u); return; } @@ -1175,8 +1175,8 @@ static void Load_ORDR(void) /* Update all the next pointer */ for (i = 1; i < len; ++i) { /* The orders were built like this: - Vehicle one had order[0], and as long as order++.type was not - OT_NOTHING, it was part of the order-list of that vehicle */ + * Vehicle one had order[0], and as long as order++.type was not + * OT_NOTHING, it was part of the order-list of that vehicle */ if (GetOrder(i)->type != OT_NOTHING) GetOrder(i - 1)->next = GetOrder(i); } diff --git a/player.h b/player.h index c7bd73dda9..f02c801c79 100644 --- a/player.h +++ b/player.h @@ -229,8 +229,7 @@ static inline bool IsLocalPlayer(void) void DeletePlayerWindows(PlayerID pi); byte GetPlayerRailtypes(PlayerID p); -/** Finds out if a Player has a certain railtype available - */ +/** Finds out if a Player has a certain railtype available */ static inline bool HasRailtypeAvail(const Player *p, RailType Railtype) { return HASBIT(p->avail_railtypes, Railtype); diff --git a/players.c b/players.c index 74047d2aa8..27d8b3329c 100644 --- a/players.c +++ b/players.c @@ -1,8 +1,8 @@ /* $Id$ */ /** @file players.c - * @todo Cleanup the messy DrawPlayerFace function asap - */ + * @todo Cleanup the messy DrawPlayerFace function asap + */ #include "stdafx.h" #include "openttd.h" #include "engine.h" diff --git a/rail.h b/rail.h index 77bbe54559..5cfc7340c6 100644 --- a/rail.h +++ b/rail.h @@ -82,7 +82,7 @@ static inline TrackBits AxisToTrackBits(Axis a) /** These are a combination of tracks and directions. Values are 0-5 in one -direction (corresponding to the Track enum) and 8-13 in the other direction. */ + * direction (corresponding to the Track enum) and 8-13 in the other direction. */ typedef enum Trackdirs { TRACKDIR_X_NE = 0, TRACKDIR_Y_SE = 1, @@ -103,7 +103,7 @@ typedef enum Trackdirs { } Trackdir; /** These are a combination of tracks and directions. Values are 0-5 in one -direction (corresponding to the Track enum) and 8-13 in the other direction. */ + * direction (corresponding to the Track enum) and 8-13 in the other direction. */ typedef enum TrackdirBits { TRACKDIR_BIT_NONE = 0x0000, TRACKDIR_BIT_X_NE = 0x0001, diff --git a/rail_cmd.c b/rail_cmd.c index dad84f79bc..056578601d 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -586,13 +586,12 @@ int32 CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) tileh = GetTileSlope(tile, NULL); /* Prohibit construction if - The tile is non-flat AND - 1) The AI is "old-school" - 2) build-on-slopes is disabled - 3) the tile is steep i.e. spans two height levels - 4) the exit points in the wrong direction - - */ + * The tile is non-flat AND + * 1) The AI is "old-school" + * 2) build-on-slopes is disabled + * 3) the tile is steep i.e. spans two height levels + * 4) the exit points in the wrong direction + */ if (tileh != SLOPE_FLAT && ( _is_old_ai_player || @@ -753,7 +752,7 @@ static int32 CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint3 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); /* for vertical/horizontal tracks, double the given signals density - * since the original amount will be too dense (shorter tracks) */ + * since the original amount will be too dense (shorter tracks) */ if (!IsDiagonalTrack(track)) signal_density *= 2; if (CmdFailed(ValidateAutoDrag(&trackdir, tile, end_tile))) return CMD_ERROR; @@ -777,7 +776,7 @@ static int32 CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint3 * trackdir - trackdir to build with autorail * semaphores - semaphores or signals * signals - is there a signal/semaphore on the first tile, copy its style (two-way/single-way) - and convert all others to semaphore/signal + * and convert all others to semaphore/signal * mode - 1 remove signals, 0 build signals */ signal_ctr = total_cost = 0; for (;;) { diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 202720fc6a..dbbdd8dd4f 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -386,8 +386,8 @@ int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->current_order.type == OT_GOTO_DEPOT) { if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) { /* We called with a different DEPOT_SERVICE setting. - * Now we change the setting to apply the new one and let the vehicle head for the same depot. - * Note: the if is (true for requesting service == true for ordered to stop in depot) */ + * Now we change the setting to apply the new one and let the vehicle head for the same depot. + * Note: the if is (true for requesting service == true for ordered to stop in depot) */ if (flags & DC_EXEC) { TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); diff --git a/saveload.c b/saveload.c index 9687e73095..d4db229924 100644 --- a/saveload.c +++ b/saveload.c @@ -688,10 +688,10 @@ bool SlObjectMember(void *ptr, const SaveLoad *sld) break; /* SL_WRITEBYTE translates a value of a variable to another one upon - * saving or loading. - * XXX - variable renaming abuse - * game_value: the value of the variable ingame is abused by sld->version_from - * file_value: the value of the variable in the savegame is abused by sld->version_to */ + * saving or loading. + * XXX - variable renaming abuse + * game_value: the value of the variable ingame is abused by sld->version_from + * file_value: the value of the variable in the savegame is abused by sld->version_to */ case SL_WRITEBYTE: if (_sl.save) { SlWriteByte(sld->version_to); @@ -1606,7 +1606,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode) fclose(_sl.fh); /* After loading fix up savegame for any internal changes that - * might've occured since then. If it fails, load back the old game */ + * might've occured since then. If it fails, load back the old game */ if (!AfterLoadGame()) return SL_REINIT; } diff --git a/settings.c b/settings.c index d402b1aebc..7e36d6dfc6 100644 --- a/settings.c +++ b/settings.c @@ -768,7 +768,7 @@ static void ini_save_settings(IniFile *ini, const SettingDesc *sd, const char *g const void *p = string_to_val(sdb, item->value); /* The main type of a variable/setting is in bytes 8-15 - * The subtype (what kind of numbers do we have there) is in 0-7 */ + * The subtype (what kind of numbers do we have there) is in 0-7 */ switch (sdb->cmd) { case SDT_BOOLX: case SDT_NUMX: diff --git a/settings_gui.c b/settings_gui.c index 50952c4678..adecd78305 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -328,25 +328,25 @@ static inline bool GetBitAndShift(uint32 *b) } /* - A: competitors - B: start time in months / 3 - C: town count (2 = high, 0 = low) - D: industry count (3 = high, 0 = none) - E: inital loan / 1000 (in GBP) - F: interest rate - G: running costs (0 = low, 2 = high) - H: construction speed of competitors (0 = very slow, 4 = very fast) - I: intelligence (0-2) - J: breakdowns(0 = off, 2 = normal) - K: subsidy multiplier (0 = 1.5, 3 = 4.0) - L: construction cost (0-2) - M: terrain type (0 = very flat, 3 = mountainous) - N: amount of water (0 = very low, 3 = high) - O: economy (0 = steady, 1 = fluctuating) - P: Train reversing (0 = end of line + stations, 1 = end of line) - Q: disasters - R: area restructuring (0 = permissive, 2 = hostile) -*/ + * A: competitors + * B: start time in months / 3 + * C: town count (2 = high, 0 = low) + * D: industry count (3 = high, 0 = none) + * E: inital loan / 1000 (in GBP) + * F: interest rate + * G: running costs (0 = low, 2 = high) + * H: construction speed of competitors (0 = very slow, 4 = very fast) + * I: intelligence (0-2) + * J: breakdowns (0 = off, 2 = normal) + * K: subsidy multiplier (0 = 1.5, 3 = 4.0) + * L: construction cost (0-2) + * M: terrain type (0 = very flat, 3 = mountainous) + * N: amount of water (0 = very low, 3 = high) + * O: economy (0 = steady, 1 = fluctuating) + * P: Train reversing (0 = end of line + stations, 1 = end of line) + * Q: disasters + * R: area restructuring (0 = permissive, 2 = hostile) + */ static const int16 _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ {2, 2, 1, 3, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, //easy @@ -987,7 +987,7 @@ static void NewgrfWndProc(Window *w, WindowEvent *e) break; } break; -/* Parameter edit box not used yet +#if 0 /* Parameter edit box not used yet */ case WE_TIMEOUT: WP(w,def_d).data_2 = 0; SetWindowDirty(w); @@ -999,7 +999,8 @@ static void NewgrfWndProc(Window *w, WindowEvent *e) } break; } -*/ +#endif + case WE_DESTROY: _sel_grffile = NULL; DeleteWindowById(WC_QUERY_STRING, 0); diff --git a/smallmap_gui.c b/smallmap_gui.c index 6f9be989f4..e52ca7ca25 100644 --- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -230,8 +230,8 @@ static const uint16 * const _legend_table[] = { # endif } #else -# define WRITE_PIXELS(dst, val) *(uint32*)(dst) = (val); -# define WRITE_PIXELS_OR(dst,val) *(uint32*)(dst) |= (val); +# define WRITE_PIXELS(dst, val) *(uint32*)(dst) = (val); +# define WRITE_PIXELS_OR(dst,val) *(uint32*)(dst) |= (val); #endif #define MKCOLOR(x) TO_LE32X(x) diff --git a/station_cmd.c b/station_cmd.c index 0acc48864b..6ba147164b 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1,7 +1,6 @@ /* $Id$ */ -/** @file station_cmd.c - */ +/** @file station_cmd.c */ #include "stdafx.h" #include "openttd.h" @@ -169,7 +168,7 @@ RoadStop *AllocateRoadStop(void) } /* Calculate the radius of the station. Basicly it is the biggest - radius that is available within the station */ + * radius that is available within the station */ static uint FindCatchmentRadius(const Station* st) { uint ret = 0; @@ -783,13 +782,13 @@ int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invali tileh = GetTileSlope(tile_cur, &z); /* Prohibit building if - 1) The tile is "steep" (i.e. stretches two height levels) - -OR- - 2) The tile is non-flat if - a) the player building is an "old-school" AI - -OR- - b) the build_on_slopes switch is disabled - */ + * 1) The tile is "steep" (i.e. stretches two height levels) + * -OR- + * 2) The tile is non-flat if + * a) the player building is an "old-school" AI + * -OR- + * b) the build_on_slopes switch is disabled + */ if (IsSteepSlope(tileh) || ((_is_old_ai_player || !_patches.build_on_slopes) && tileh != SLOPE_FLAT)) { return_cmd_error(STR_0007_FLAT_LAND_REQUIRED); @@ -1252,11 +1251,11 @@ uint GetStationPlatforms(const Station *st, TileIndex tile) } /** Determines the REMAINING length of a platform, starting at (and including) - * the given tile. - * @param tile the tile from which to start searching. Must be a railway station tile - * @param dir The direction in which to search. - * @return The platform length - */ + * the given tile. + * @param tile the tile from which to start searching. Must be a railway station tile + * @param dir The direction in which to search. + * @return The platform length + */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) { TileIndex start_tile = tile; @@ -1353,23 +1352,23 @@ int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec) } /** Heavy wizardry used to add a roadstop to a station. - * To understand the function, lets first look at what is passed around, - * especially the last two parameters. CmdBuildRoadStop allocates a road - * stop and needs to put that stop into the linked list of road stops. - * It (CmdBuildRoadStop) has a **currstop pointer which points to element - * in the linked list of stops (each element in this list being a pointer - * in itself, hence the double pointer). We (FindRoadStopSpot) need to - * modify this pointer (**currstop) thus we need to pass by reference, - * obtaining a triple pointer (***currstop). When finished, **currstop - * in CmdBuildRoadStop will contain the address of the pointer which will - * then point into the global roadstop array. *prev (in CmdBuildRoadStop) - * is the pointer tino the global roadstop array which has *currstop in - * its ->next element. - * @param[in] truck_station Determines whether a stop is RS_BUS or RS_TRUCK - * @param[in] station The station to do the whole procedure for - * @param[out] currstop See the detailed function description - * @param prev See the detailed function description - */ + * To understand the function, lets first look at what is passed around, + * especially the last two parameters. CmdBuildRoadStop allocates a road + * stop and needs to put that stop into the linked list of road stops. + * It (CmdBuildRoadStop) has a **currstop pointer which points to element + * in the linked list of stops (each element in this list being a pointer + * in itself, hence the double pointer). We (FindRoadStopSpot) need to + * modify this pointer (**currstop) thus we need to pass by reference, + * obtaining a triple pointer (***currstop). When finished, **currstop + * in CmdBuildRoadStop will contain the address of the pointer which will + * then point into the global roadstop array. *prev (in CmdBuildRoadStop) + * is the pointer tino the global roadstop array which has *currstop in + * its ->next element. + * @param[in] truck_station Determines whether a stop is RS_BUS or RS_TRUCK + * @param[in] station The station to do the whole procedure for + * @param[out] currstop See the detailed function description + * @param prev See the detailed function description + */ static void FindRoadStopSpot(bool truck_station, Station* st, RoadStop*** currstop, RoadStop** prev) { RoadStop **primary_stop = (truck_station) ? &st->truck_stops : &st->bus_stops; @@ -2367,12 +2366,12 @@ void DestroyRoadStop(RoadStop* rs) } /** - * Clean up a station by clearing vehicle orders and invalidating windows. - * Aircraft-Hangar orders need special treatment here, as the hangars are - * actually part of a station (tiletype is STATION), but the order type - * is OT_GOTO_DEPOT. - * @param st Station to be deleted - */ + * Clean up a station by clearing vehicle orders and invalidating windows. + * Aircraft-Hangar orders need special treatment here, as the hangars are + * actually part of a station (tiletype is STATION), but the order type + * is OT_GOTO_DEPOT. + * @param st Station to be deleted + */ void DestroyStation(Station *st) { StationID index; diff --git a/station_gui.c b/station_gui.c index 5d76f020c2..2b2fad1e0d 100644 --- a/station_gui.c +++ b/station_gui.c @@ -247,7 +247,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: { /* Set up cargo click-states. Toggle the all-vehicle and all-cargo types button - * depending on if all types are clicked or not */ + * depending on if all types are clicked or not */ SB(w->click_state, 6, 5, facilities); SB(w->click_state, 26, 1, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); SB(w->click_state, 12, NUM_CARGO + 1, cargo_filter); diff --git a/table/autorail.h b/table/autorail.h index bc5a9cbbd0..d94747ec13 100644 --- a/table/autorail.h +++ b/table/autorail.h @@ -1,12 +1,12 @@ /* $Id$ */ /* Rail selection types (directions): - / \ / \ / \ / \ / \ / \ -/ /\ /\ \ /===\ / \ /| \ / |\ -\/ / \ \/ \ / \===/ \| / \ |/ - \ / \ / \ / \ / \ / \ / - 0 1 2 3 4 5 -*/ + * / \ / \ / \ / \ / \ / \ + * / /\ /\ \ /===\ / \ /| \ / |\ + * \/ / \ \/ \ / \===/ \| / \ |/ + * \ / \ / \ / \ / \ / \ / + * 0 1 2 3 4 5 + */ // mark invalid tiles red #define RED(c) c | PALETTE_SEL_TILE_RED diff --git a/table/bridge_land.h b/table/bridge_land.h index 7374ad390a..8589c6e207 100644 --- a/table/bridge_land.h +++ b/table/bridge_land.h @@ -1,27 +1,27 @@ /* $Id$ */ /** @file bridge_land.h This file contains all the sprites for bridges - * It consists of a number of arrays. - * - */ + * It consists of a number of arrays. + * + */ static const PalSpriteID _bridge_sprite_table_2_0[] = { 0x9C3, 0x9C7, 0x9C9, 0x0, 0x9C4, 0x9C8, 0x9CA, 0x0, diff --git a/table/elrail_data.h b/table/elrail_data.h index a14f08c744..63e803f8ea 100644 --- a/table/elrail_data.h +++ b/table/elrail_data.h @@ -1,12 +1,12 @@ /* $Id */ /** @file elrail_data.h Stores all the data for overhead wire and pylon drawing. - @see elrail.c */ + * @see elrail.c */ #ifndef ELRAIL_DATA_H #define ELRAIL_DATA_H /** Tile Location group. - This defines whether the X and or Y coordinate of a tile is even */ + * This defines whether the X and or Y coordinate of a tile is even */ typedef enum TLG { XEVEN_YEVEN = 0, XEVEN_YODD = 1, @@ -16,8 +16,8 @@ typedef enum TLG { } TLG; /** When determining the pylon configuration on the edge, two tiles are taken - into account: the tile being drawn itself (the home tile, the one in - ti->tile), and the neighbouring tile */ + * into account: the tile being drawn itself (the home tile, the one in + * ti->tile), and the neighbouring tile */ typedef enum { TS_HOME = 0, TS_NEIGHBOUR = 1, @@ -38,8 +38,8 @@ static byte AllowedPPPonPCP[DIAGDIR_END] = { }; /** Which of the PPPs are inside the tile. For the two PPPs on the tile border - the following system is used: if you rotate the PCP so that it is in the - north, the eastern PPP belongs to the tile. */ + * the following system is used: if you rotate the PCP so that it is in the + * north, the eastern PPP belongs to the tile. */ static byte OwnedPPPonPCP[DIAGDIR_END] = { 1 << DIR_SE | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W, 1 << DIR_N | 1 << DIR_SW | 1 << DIR_W | 1 << DIR_NW, @@ -59,9 +59,9 @@ static const DiagDirection PCPpositions[TRACK_END][2] = { #define PCP_NOT_ON_TRACK 0xFF /** Preferred points of each trackbit. Those are the ones perpendicular to the - track, plus the point in extension of the track (to mark end-of-track). PCPs - which are not on either end of the track are fully preferred. - @see PCPpositions */ + * track, plus the point in extension of the track (to mark end-of-track). PCPs + * which are not on either end of the track are fully preferred. + * @see PCPpositions */ static byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { { /* X */ 1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, /* NE */ @@ -101,8 +101,8 @@ static byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { #define NUM_IGNORE_GROUPS 3 #define IGNORE_NONE 0xFF /** In case we have a staight line, we place pylon only every two tiles, - so there are certain tiles which we ignore. A straight line is found if - we have exactly two PPPs. */ + * so there are certain tiles which we ignore. A straight line is found if + * we have exactly two PPPs. */ static byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { { /* Ignore group 1, X and Y tracks */ { /* X even, Y even */ @@ -196,7 +196,7 @@ static const Track TracksAtPCP[DIAGDIR_END][NUM_TRACKS_AT_PCP] = { }; /* takes each of the 6 track bits from the array above and - assigns it to the home tile or neighbour tile */ + * assigns it to the home tile or neighbour tile */ static const TileSource TrackSourceTile[DIAGDIR_END][NUM_TRACKS_AT_PCP] = { {TS_HOME, TS_NEIGHBOUR, TS_HOME , TS_NEIGHBOUR, TS_NEIGHBOUR, TS_HOME }, {TS_HOME, TS_NEIGHBOUR, TS_NEIGHBOUR, TS_HOME , TS_NEIGHBOUR, TS_HOME }, @@ -232,8 +232,8 @@ static const Direction PPPorder[DIAGDIR_END][TLG_END][DIR_END] = { /* X - static const int8 x_pcp_offsets[DIAGDIR_END] = {0, 8, 15, 8}; static const int8 y_pcp_offsets[DIAGDIR_END] = {8, 15, 8, 0}; /* Geometric placement of the PPP relative to the PCP*/ -static const int8 x_ppp_offsets[DIR_END] = {-3, -4, -3, 0, +3, +4, +3, 0}; -static const int8 y_ppp_offsets[DIR_END] = {-3, 0, +3, +4, +3, 0, -3, -4}; +static const int8 x_ppp_offsets[DIR_END] = {-3, -4, -3, 0, 3, 4, 3, 0}; +static const int8 y_ppp_offsets[DIR_END] = {-3, 0, 3, 4, 3, 0, -3, -4}; /* The type of pylon to draw at each PPP */ static const SpriteID pylons_normal[] = { SPR_PYLON_EW_N, @@ -341,16 +341,16 @@ static const SortableSpriteStruct CatenarySpriteData_Depot[] = { }; /** Refers to a certain element of the catenary. - * Identifiers for Wires: - *
  1. Direction of the wire
  2. - *
  3. Slope of the tile for diagonals, placement inside the track for horiz/vertical pieces
  4. - *
  5. Place where a pylon shoule be
- * Identifiers for Pylons: - *
  1. Direction of the wire
  2. - *
  3. Slope of the tile
  4. - *
  5. Position of the Pylon relative to the track
  6. - *
  7. Position of the Pylon inside the tile
- */ + * Identifiers for Wires: + *
  1. Direction of the wire
  2. + *
  3. Slope of the tile for diagonals, placement inside the track for horiz/vertical pieces
  4. + *
  5. Place where a pylon shoule be
+ * Identifiers for Pylons: + *
  1. Direction of the wire
  2. + *
  3. Slope of the tile
  4. + *
  5. Position of the Pylon relative to the track
  6. + *
  7. Position of the Pylon inside the tile
+ */ typedef enum { WIRE_X_FLAT_SW, WIRE_X_FLAT_NE, @@ -398,11 +398,11 @@ typedef enum { } CatenarySprite; /* Selects a Wire (with white and grey ends) depending on whether: - a) none (should never happen) - b) the first - c) the second - d) both - PCP exists.*/ + * a) none (should never happen) + * b) the first + * c) the second + * d) both + * PCP exists.*/ static const CatenarySprite Wires[5][TRACK_END][4] = { { /* Tileh == 0 */ {INVALID_CATENARY, WIRE_X_FLAT_NE, WIRE_X_FLAT_SW, WIRE_X_FLAT_BOTH}, diff --git a/table/engines.h b/table/engines.h index f468f00298..7cde8d9f10 100644 --- a/table/engines.h +++ b/table/engines.h @@ -4,25 +4,25 @@ #define ENGINES_H /** @file table/engines.h - * This file contains all the data for vehicles - */ + * This file contains all the data for vehicles + */ #include "../sound.h" /** Writes the properties of a vehicle into the EngineInfo struct. - * @see EngineInfo - * @param a Introduction date - * @param e Rail Type of the vehicle - * @param f Bitmask of the climates - */ + * @see EngineInfo + * @param a Introduction date + * @param e Rail Type of the vehicle + * @param f Bitmask of the climates + */ #define MK(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, b, c, d, e, f, 0, 8, 0, 0 } /** Writes the properties of a train carriage into the EngineInfo struct. - * @see EngineInfo - * @param a Introduction date - * @param e Rail Type of the vehicle - * @param f Bitmask of the climates - * @note the 0x80 in parameter b sets the "is carriage bit" - */ + * @see EngineInfo + * @param a Introduction date + * @param e Rail Type of the vehicle + * @param f Bitmask of the climates + * @note the 0x80 in parameter b sets the "is carriage bit" + */ #define MW(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, b | 0x80, c, d, e, f, 0, 8, 0, 0 } // Rail types diff --git a/table/sprites.h b/table/sprites.h index f081fbec6d..6aa982f378 100644 --- a/table/sprites.h +++ b/table/sprites.h @@ -4,36 +4,36 @@ #define SPRITES_H /** @file sprites.h - This file contails all sprite-related enums and defines. These consist mainly of - the sprite numbers and a bunch of masks and macros to handle sprites and to get - rid of all the magic numbers in the code. - -@NOTE: - ALL SPRITE NUMBERS BELOW 5126 are in the main files - SPR_CANALS_BASE is in canalsw.grf - SPR_SLOPES_BASE is in trkfoundw.grf - SPR_OPENTTD_BASE is in openttd.grf - - All elements which consist of two elements should - have the same name and then suffixes - _GROUND and _BUILD for building-type sprites - _REAR and _FRONT for transport-type sprites (tiles where vehicles are on) - These sprites are split because of the Z order of the elements - (like some parts of a bridge are behind the vehicle, while others are before) - - - All sprites which are described here are referenced only one to a handful of times - throughout the code. When introducing new sprite enums, use meaningful names. - Don't be lazy and typing, and only use abbrevations when their meaning is clear or - the length of the enum would get out of hand. In that case EXPLAIN THE ABBREVATION - IN THIS FILE, and perhaps add some comments in the code where it is used. - Now, don't whine about this being too much typing work if the enums are like - 30 characters in length. If your editor doen't help you simplifying your work, - get a proper editor. If your Operating Systems don't have any decent editors, - get a proper Operating System. - - @todo Split the "Sprites" enum into smaller chunks and document them -*/ + * This file contails all sprite-related enums and defines. These consist mainly of + * the sprite numbers and a bunch of masks and macros to handle sprites and to get + * rid of all the magic numbers in the code. + * + * @NOTE: + * ALL SPRITE NUMBERS BELOW 5126 are in the main files + * SPR_CANALS_BASE is in canalsw.grf + * SPR_SLOPES_BASE is in trkfoundw.grf + * SPR_OPENTTD_BASE is in openttd.grf + * + * All elements which consist of two elements should + * have the same name and then suffixes + * _GROUND and _BUILD for building-type sprites + * _REAR and _FRONT for transport-type sprites (tiles where vehicles are on) + * These sprites are split because of the Z order of the elements + * (like some parts of a bridge are behind the vehicle, while others are before) + * + * + * All sprites which are described here are referenced only one to a handful of times + * throughout the code. When introducing new sprite enums, use meaningful names. + * Don't be lazy and typing, and only use abbrevations when their meaning is clear or + * the length of the enum would get out of hand. In that case EXPLAIN THE ABBREVATION + * IN THIS FILE, and perhaps add some comments in the code where it is used. + * Now, don't whine about this being too much typing work if the enums are like + * 30 characters in length. If your editor doen't help you simplifying your work, + * get a proper editor. If your Operating Systems don't have any decent editors, + * get a proper Operating System. + * + * @todo Split the "Sprites" enum into smaller chunks and document them + */ enum Sprites { @@ -226,8 +226,8 @@ enum Sprites { /* Elrail stuff */ /* Wires. First identifier is the direction of the track, second is the required placement of the pylon. - "short" denotes a wire that requires a pylon on each end. Third identifier is the direction of the slope - (in positive coordinate direction) */ + * "short" denotes a wire that requires a pylon on each end. Third identifier is the direction of the slope + * (in positive coordinate direction) */ SPR_WIRE_X_SHORT = SPR_ELRAIL_BASE + 3, SPR_WIRE_Y_SHORT = SPR_ELRAIL_BASE + 4, SPR_WIRE_EW_SHORT = SPR_ELRAIL_BASE + 5, @@ -561,19 +561,18 @@ enum Sprites { /* BTSUS == Suspension bridge */ /* TILE_* denotes the different tiles a suspension bridge - can have - TILE_A and TILE_B are the "beginnings" and "ends" of the - suspension system. they have small rectangluar endcaps - TILE_C and TILE_D look almost identical to TILE_A and - TILE_B, but they do not have the "endcaps". They form the - middle part - TILE_E is a condensed configuration of two pillars. while they - are usually 2 pillars apart, they only have 1 pillar separation - here - TILE_F is an extended configuration of pillars. they are - plugged in when pillars should be 3 tiles apart - - */ + * can have + * TILE_A and TILE_B are the "beginnings" and "ends" of the + * suspension system. they have small rectangluar endcaps + * TILE_C and TILE_D look almost identical to TILE_A and + * TILE_B, but they do not have the "endcaps". They form the + * middle part + * TILE_E is a condensed configuration of two pillars. while they + * are usually 2 pillars apart, they only have 1 pillar separation + * here + * TILE_F is an extended configuration of pillars. they are + * plugged in when pillars should be 3 tiles apart + */ SPR_BTSUS_ROAD_Y_REAR_TILE_A = 2453, SPR_BTSUS_ROAD_Y_REAR_TILE_B = 2454, SPR_BTSUS_Y_FRONT_TILE_A = 2455, @@ -713,10 +712,10 @@ enum Sprites { /* tubular bridges */ /* tubular bridges have 3 kinds of tiles: - a start tile (with only half a tube on the far side, marked _BEG - a middle tile (full tunnel), marked _MID - and an end tile (half a tube on the near side, maked _END - */ + * a start tile (with only half a tube on the far side, marked _BEG + * a middle tile (full tunnel), marked _MID + * and an end tile (half a tube on the near side, maked _END + */ SPR_BTTUB_X_FRONT_BEG = 2559, SPR_BTTUB_X_FRONT_MID = 2660, SPR_BTTUB_X_FRONT_END = 2561, diff --git a/table/town_land.h b/table/town_land.h index 06658ecd31..da158304c9 100644 --- a/table/town_land.h +++ b/table/town_land.h @@ -1,7 +1,6 @@ /* $Id$ */ -/** @file town_land.h - */ +/** @file town_land.h */ enum { HOUSE_TEMP_CHURCH = 0x03, @@ -16,16 +15,16 @@ enum { }; /** Writes the data into the Town Tile Drawing Struct - * @param s1 The first sprite of the building, mostly the ground sprite - * @param s2 The second sprite of the building. - * @param sx The x-position of the sprite within the tile - * @param xy the y-position of the sprite within the tile - * @param w the width of the sprite - * @param h the height of the sprite - * @param dz the virtual height of the sprite - * @param p set to 1 if a lift is present - * @see DrawTownTileStruct - */ + * @param s1 The first sprite of the building, mostly the ground sprite + * @param s2 The second sprite of the building. + * @param sx The x-position of the sprite within the tile + * @param xy the y-position of the sprite within the tile + * @param w the width of the sprite + * @param h the height of the sprite + * @param dz the virtual height of the sprite + * @param p set to 1 if a lift is present + * @see DrawTownTileStruct + */ #define M(s1, s2, sx, sy, w, h, dz, p) {s1, s2, sx, sy, w - 1, h - 1, dz, p} static const DrawBuildingsTileStruct _town_draw_tile_data[] = { @@ -1928,20 +1927,20 @@ static const uint16 _housetype_flags[] = { assert_compile(lengthof(_housetype_flags) == HOUSE_MAX); static const byte _housetype_extra_flags[] = { - 0, 0, 0, 0,32,32, 0, 8, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,16, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 8, 0, 0, 0, - 0, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32, 32, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 8, 0, 0, 0, + 0, 0, 4, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, }; assert_compile(lengthof(_housetype_extra_flags) == HOUSE_MAX); @@ -2137,20 +2136,20 @@ static const HousetypeYear _housetype_years[] = { assert_compile(lengthof(_housetype_years) == HOUSE_MAX); static const byte _housetype_cargo_passengers[] = { - 8, 8, 8, 2, 10,10,4, 6, - 6, 2, 2, 2, 2, 8, 6, 6, - 6, 10,6, 6, 4, 4, 4, 4, - 3, 3, 3, 7, 8, 6, 8, 8, - 4, 4, 4, 4, 8, 3, 3, 8, - 8, 8, 8, 8, 5, 5, 3, 3, - 3, 3, 8, 8, 9, 9,10, 10, - 2, 2, 3, 3, 2, 2, 3, 3, - 6, 6, 6, 6, 6, 6, 7, 7, - 9, 9, 7, 7, 7, 7, 3, 3, - 3, 3, 6, 2, 3, 6, 6, 8, - 8, 6, 8, 2, 6, 3, 3, 3, - 3, 3, 8, 4, 4, 8, 3, 3, - 8, 8, 8, 4, 3, 3, + 8, 8, 8, 2, 10, 10, 4, 6, + 6, 2, 2, 2, 2, 8, 6, 6, + 6, 10, 6, 6, 4, 4, 4, 4, + 3, 3, 3, 7, 8, 6, 8, 8, + 4, 4, 4, 4, 8, 3, 3, 8, + 8, 8, 8, 8, 5, 5, 3, 3, + 3, 3, 8, 8, 9, 9, 10, 10, + 2, 2, 3, 3, 2, 2, 3, 3, + 6, 6, 6, 6, 6, 6, 7, 7, + 9, 9, 7, 7, 7, 7, 3, 3, + 3, 3, 6, 2, 3, 6, 6, 8, + 8, 6, 8, 2, 6, 3, 3, 3, + 3, 3, 8, 4, 4, 8, 3, 3, + 8, 8, 8, 4, 3, 3, }; assert_compile(lengthof(_housetype_cargo_passengers) == HOUSE_MAX); diff --git a/tgp.c b/tgp.c index 005098ae45..8c99856f6c 100644 --- a/tgp.c +++ b/tgp.c @@ -505,25 +505,25 @@ static void HeightMapAdjustWaterLevel(amplitude_t water_percent, height_t h_max_ static double perlin_coast_noise_2D(const double x, const double y, const double p, const int prime); /** -* This routine sculpts in from the edge a random amount, again a Perlin -* sequence, to avoid the rigid flat-edge slopes that were present before. The -* Perlin noise map doesnt know where we are going to slice across, and so we -* often cut straight through high terrain. the smoothing routine makes it -* legal, gradually increasing up from the edge to the original terrain height. -* By cutting parts of this away, it gives a far more irregular edge to the -* map-edge. Sometimes it works beautifully with the existing sea & lakes, and -* creates a very realistic coastline. Other times the variation is less, and -* the map-edge shows its cliff-like roots. -* -* This routine may be extended to randomly sculpt the height of the terrain -* near the edge. This will have the coast edge at low level (1-3), rising in -* smoothed steps inland to about 15 tiles in. This should make it look as -* though the map has been built for the map size, rather than a slice through -* a larger map. -* -* Please note that all the small numbers; 53, 101, 167, etc. are small primes -* to help give the perlin noise a bit more of a random feel. -*/ + * This routine sculpts in from the edge a random amount, again a Perlin + * sequence, to avoid the rigid flat-edge slopes that were present before. The + * Perlin noise map doesnt know where we are going to slice across, and so we + * often cut straight through high terrain. the smoothing routine makes it + * legal, gradually increasing up from the edge to the original terrain height. + * By cutting parts of this away, it gives a far more irregular edge to the + * map-edge. Sometimes it works beautifully with the existing sea & lakes, and + * creates a very realistic coastline. Other times the variation is less, and + * the map-edge shows its cliff-like roots. + * + * This routine may be extended to randomly sculpt the height of the terrain + * near the edge. This will have the coast edge at low level (1-3), rising in + * smoothed steps inland to about 15 tiles in. This should make it look as + * though the map has been built for the map size, rather than a slice through + * a larger map. + * + * Please note that all the small numbers; 53, 101, 167, etc. are small primes + * to help give the perlin noise a bit more of a random feel. + */ static void HeightMapCoastLines(void) { int smallest_size = min(_patches.map_x, _patches.map_y); @@ -626,12 +626,12 @@ static void HeightMapSmoothCoasts(void) } /** -* This routine provides the essential cleanup necessary before OTTD can -* display the terrain. When generated, the terrain heights can jump more than -* one level between tiles. This routine smooths out those differences so that -* the most it can change is one level. When OTTD can support cliffs, this -* routine may not be necessary. -*/ + * This routine provides the essential cleanup necessary before OTTD can + * display the terrain. When generated, the terrain heights can jump more than + * one level between tiles. This routine smooths out those differences so that + * the most it can change is one level. When OTTD can support cliffs, this + * routine may not be necessary. + */ static void HeightMapSmoothSlopes(height_t dh_max) { int x, y; diff --git a/town_cmd.c b/town_cmd.c index 9f3e2eecee..90771d4698 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -738,7 +738,7 @@ static int GrowTownAtRoad(Town *t, TileIndex tile) _grow_town_result = -1; } else if (_game_mode == GM_EDITOR) { /* If we are in the SE, and this road-piece has no town owner yet, it just found an - * owner :) (happy happy happy road now) */ + * owner :) (happy happy happy road now) */ SetTileOwner(tile, OWNER_TOWN); SetTownIndex(tile, t->index); } diff --git a/train_cmd.c b/train_cmd.c index 2f49981fcc..70ba474990 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1343,8 +1343,8 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) for (tmp = first; tmp != NULL; tmp = tmp->next) tmp->first = NULL; /* 2.2 If there are wagons present after the deleted front engine, check - * if the second wagon (which will be first) is an engine. If it is one, - * promote it as a new train, retaining the unitnumber, orders */ + * if the second wagon (which will be first) is an engine. If it is one, + * promote it as a new train, retaining the unitnumber, orders */ if (new_f != NULL) { if (IsTrainEngine(new_f)) { switch_engine = true; @@ -1902,9 +1902,9 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance) /* Found target */ tfdd.tile = ftd.node.tile; /* Our caller expects a number of tiles, so we just approximate that - * number by this. It might not be completely what we want, but it will - * work for now :-) We can possibly change this when the old pathfinder - * is removed. */ + * number by this. It might not be completely what we want, but it will + * work for now :-) We can possibly change this when the old pathfinder + * is removed. */ tfdd.best_length = ftd.best_path_dist / NPF_TILE_LENGTH; if (NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE)) tfdd.reverse = true; } @@ -1960,8 +1960,8 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->current_order.type == OT_GOTO_DEPOT) { if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) { /* We called with a different DEPOT_SERVICE setting. - * Now we change the setting to apply the new one and let the vehicle head for the same depot. - * Note: the if is (true for requesting service == true for ordered to stop in depot) */ + * Now we change the setting to apply the new one and let the vehicle head for the same depot. + * Note: the if is (true for requesting service == true for ordered to stop in depot) */ if (flags & DC_EXEC) { TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 6d8a421528..828210f2c3 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -918,22 +918,22 @@ uint GetBridgeFoundation(Slope tileh, Axis axis) } /** - * Draws a tunnel of bridge tile. - * For tunnels, this is rather simple, as you only needa draw the entrance. - * Bridges are a bit more complex. base_offset is where the sprite selection comes into play - * and it works a bit like a bitmask.

For bridge heads: - *

- * For middle parts: - * - * Please note that in this code, "roads" are treated as railtype 1, whilst the real railtypes are 0, 2 and 3 - */ + * Draws a tunnel of bridge tile. + * For tunnels, this is rather simple, as you only needa draw the entrance. + * Bridges are a bit more complex. base_offset is where the sprite selection comes into play + * and it works a bit like a bitmask.

For bridge heads: + *

+ * For middle parts: + * + * Please note that in this code, "roads" are treated as railtype 1, whilst the real railtypes are 0, 2 and 3 + */ static void DrawTile_TunnelBridge(TileInfo *ti) { uint32 image; diff --git a/variables.h b/variables.h index 44b3750d9b..209bf134bd 100644 --- a/variables.h +++ b/variables.h @@ -184,16 +184,16 @@ typedef struct Patches { bool ai_in_multiplayer; // Do we allow AIs in multiplayer /* - * New Path Finding - */ + * New Path Finding + */ bool new_pathfinding_all; /* Use the newest pathfinding algorithm for all */ /** - * The maximum amount of search nodes a single NPF run should take. This - * limit should make sure performance stays at acceptable levels at the cost - * of not being perfect anymore. This will probably be fixed in a more - * sophisticated way sometime soon - */ + * The maximum amount of search nodes a single NPF run should take. This + * limit should make sure performance stays at acceptable levels at the cost + * of not being perfect anymore. This will probably be fixed in a more + * sophisticated way sometime soon + */ uint32 npf_max_search_nodes; uint32 npf_rail_firstred_penalty; /* The penalty for when the first signal is red (and it is not an exit or combo signal) */ diff --git a/vehicle.c b/vehicle.c index f53635dbf8..2bd474fd9d 100644 --- a/vehicle.c +++ b/vehicle.c @@ -344,10 +344,10 @@ Vehicle *AllocateVehicle(void) /** Allocates a lot of vehicles and frees them again -* @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only) -* @param num number of vehicles to allocate room for -* @return true if there is room to allocate all the vehicles -*/ + * @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only) + * @param num number of vehicles to allocate room for + * @return true if there is room to allocate all the vehicles + */ bool AllocateVehicles(Vehicle **vl, int num) { int i; @@ -514,9 +514,9 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v) } /* It is the fact (currently) that newly built vehicles do not have - * their ->first pointer set. When this is the case, go up to the - * first engine and set the pointers correctly. Also the first pointer - * is not saved in a savegame, so this has to be fixed up after loading */ + * their ->first pointer set. When this is the case, go up to the + * first engine and set the pointers correctly. Also the first pointer + * is not saved in a savegame, so this has to be fixed up after loading */ /* Find the 'locomotive' or the first wagon in a chain */ while ((u = GetPrevVehicleInChain_bruteforce(v)) != NULL) v = u; @@ -574,8 +574,8 @@ static void MaybeReplaceVehicle(Vehicle *v); static Vehicle* _first_veh_in_depot_list; /** Adds a vehicle to the list of vehicles, that visited a depot this tick -* @param *v vehicle to add -*/ + * @param *v vehicle to add + */ void VehicleEnteredDepotThisTick(Vehicle *v) { // we need to set v->leave_depot_instantly as we have no control of it's contents at this time @@ -1537,10 +1537,10 @@ void AgeVehicle(Vehicle *v) } /** Clone a vehicle. If it is a train, it will clone all the cars too -* @param tile tile of the depot where the cloned vehicle is build -* @param p1 the original vehicle's index -* @param p2 1 = shared orders, else copied orders -*/ + * @param tile tile of the depot where the cloned vehicle is build + * @param p1 the original vehicle's index + * @param p2 1 = shared orders, else copied orders + */ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v_front, *v; @@ -1919,14 +1919,14 @@ static void MaybeReplaceVehicle(Vehicle *v) } /** -* @param sort_list list to store the list in. Note: it's presumed that it is big enough to store all vehicles in the game (worst case) and it will not check size -* @param type type of vehicle -* @param owner PlayerID of owner to generate a list for -* @param station index of station to generate a list for. INVALID_STATION when not used -* @param order index of oder to generate a list for. INVALID_ORDER when not used -* @param window_type tells what kind of window the list is for. Use the VLW flags in vehicle_gui.h -* @return the number of vehicles added to the list -*/ + * @param sort_list list to store the list in. Note: it's presumed that it is big enough to store all vehicles in the game (worst case) and it will not check size + * @param type type of vehicle + * @param owner PlayerID of owner to generate a list for + * @param station index of station to generate a list for. INVALID_STATION when not used + * @param order index of oder to generate a list for. INVALID_ORDER when not used + * @param window_type tells what kind of window the list is for. Use the VLW flags in vehicle_gui.h + * @return the number of vehicles added to the list + */ uint GenerateVehicleSortList(const Vehicle** sort_list, byte type, PlayerID owner, StationID station, OrderID order, uint16 window_type) { const uint subtype = (type != VEH_Aircraft) ? Train_Front : 2; @@ -1985,13 +1985,13 @@ uint GenerateVehicleSortList(const Vehicle** sort_list, byte type, PlayerID owne } /** send all vehicles of type to depots -* @param type type of vehicle -* @param flags the flags used for DoCommand() -* @param service should the vehicles only get service in the depots -* @param owner PlayerID of owner of the vehicles to send -* @param VLW_flag tells what kind of list requested the goto depot -* @return 0 for success and CMD_ERROR if no vehicle is able to go to depot -*/ + * @param type type of vehicle + * @param flags the flags used for DoCommand() + * @param service should the vehicles only get service in the depots + * @param owner PlayerID of owner of the vehicles to send + * @param VLW_flag tells what kind of list requested the goto depot + * @return 0 for success and CMD_ERROR if no vehicle is able to go to depot + */ int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id) { const Vehicle** sort_list; @@ -2544,7 +2544,7 @@ static void Load_VEHS(void) if (CheckSavegameVersion(5)) { /* Convert the current_order.type (which is a mix of type and flags, because - in those versions, they both were 4 bits big) to type and flags */ + * in those versions, they both were 4 bits big) to type and flags */ v->current_order.flags = (v->current_order.type & 0xF0) >> 4; v->current_order.type = v->current_order.type & 0x0F; } @@ -2557,7 +2557,7 @@ static void Load_VEHS(void) FOR_ALL_VEHICLES_FROM(u, v->index + 1) { /* If a vehicle has the same orders, add the link to eachother - in both vehicles */ + * in both vehicles */ if (v->orders == u->orders) { v->next_shared = u; u->prev_shared = v; diff --git a/vehicle_gui.c b/vehicle_gui.c index 625a2814de..c120056937 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -625,10 +625,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int /* draw sorting criteria string */ /* Ensure that custom engines which substituted wagons - * are sorted correctly. - * XXX - DO NOT EVER DO THIS EVER AGAIN! GRRR hacking in wagons as - * engines to get more types.. Stays here until we have our own format - * then it is exit!!! */ + * are sorted correctly. + * XXX - DO NOT EVER DO THIS EVER AGAIN! GRRR hacking in wagons as + * engines to get more types.. Stays here until we have our own format + * then it is exit!!! */ if (WP(w,replaceveh_d).wagon_btnstate) { train_engine_drawing_loop(&x, &y, &pos, &sel[0], &selected_id[0], railtype, w->vscroll.cap, true, false, true, true); // True engines train_engine_drawing_loop(&x2, &y2, &pos2, &sel[1], &selected_id[1], railtype, w->vscroll.cap, true, false, false, false); // True engines diff --git a/video/cocoa_v.m b/video/cocoa_v.m index 2db610282d..e8792a9153 100644 --- a/video/cocoa_v.m +++ b/video/cocoa_v.m @@ -1177,7 +1177,7 @@ static const char* QZ_SetVideoWindowed(uint width, uint height) /* _cocoa_video_data.realpixels now points to the window's pixels * We want it to point to the *view's* pixels - */ + */ { int vOffset = [ _cocoa_video_data.window frame ].size.height - [ _cocoa_video_data.qdview frame ].size.height - [ _cocoa_video_data.qdview frame ].origin.y; int hOffset = [ _cocoa_video_data.qdview frame ].origin.x; diff --git a/window.c b/window.c index f32bde3d7a..1d9f504fe5 100644 --- a/window.c +++ b/window.c @@ -1271,9 +1271,9 @@ static void HandleKeypress(uint32 key) { Window *w; WindowEvent we; - /* Stores if a window with a textfield for typing is open - * If this is the case, keypress events are only passed to windows with text fields and - * to thein this main toolbar. */ + /* Stores if a window with a textfield for typing is open + * If this is the case, keypress events are only passed to windows with text fields and + * to thein this main toolbar. */ bool query_open = false; // Setup event diff --git a/yapf/array.hpp b/yapf/array.hpp index cfee3c3e62..0d330aeed7 100644 --- a/yapf/array.hpp +++ b/yapf/array.hpp @@ -6,7 +6,7 @@ #include "fixedsizearray.hpp" /** Flexible array with size limit. Implemented as fixed size - array of fixed size arrays */ + * array of fixed size arrays */ template class CArrayT { public: diff --git a/yapf/autocopyptr.hpp b/yapf/autocopyptr.hpp index 46c727789f..42822c3247 100644 --- a/yapf/autocopyptr.hpp +++ b/yapf/autocopyptr.hpp @@ -4,16 +4,16 @@ #define AUTOCOPYPTR_HPP /** CAutoCopyPtrT - kind of CoW (Copy on Write) pointer. - It is non-invasive smart pointer (reference counter is held outside - of Tdata). - When copied, its new copy shares the same underlaying structure Tdata. - When dereferenced, its behavior depends on 2 factors: - - whether the data is shared (used by more than one pointer) - - type of access (read/write) - When shared pointer is dereferenced for write, new clone of Tdata - is made first. - Can't be used for polymorphic data types (interfaces). -*/ + * It is non-invasive smart pointer (reference counter is held outside + * of Tdata). + * When copied, its new copy shares the same underlaying structure Tdata. + * When dereferenced, its behavior depends on 2 factors: + * - whether the data is shared (used by more than one pointer) + * - type of access (read/write) + * When shared pointer is dereferenced for write, new clone of Tdata + * is made first. + * Can't be used for polymorphic data types (interfaces). + */ template class CAutoCopyPtrT { protected: diff --git a/yapf/binaryheap.hpp b/yapf/binaryheap.hpp index 9537dff630..7b72a25af3 100644 --- a/yapf/binaryheap.hpp +++ b/yapf/binaryheap.hpp @@ -10,22 +10,22 @@ /** -* Binary Heap as C++ template. -* -* For information about Binary Heap algotithm, -* see: http://www.policyalmanac.org/games/binaryHeaps.htm -* -* Implementation specific notes: -* -* 1) It allocates space for item pointers (array). Items are allocated elsewhere. -* -* 2) ItemPtr [0] is never used. Total array size is max_items + 1, because we -* use indices 1..max_items instead of zero based C indexing. -* -* 3) Item of the binary heap should support these public members: -* - 'lower-then' operator '<' - used for comparing items before moving -* -*/ + * Binary Heap as C++ template. + * + * For information about Binary Heap algotithm, + * see: http://www.policyalmanac.org/games/binaryHeaps.htm + * + * Implementation specific notes: + * + * 1) It allocates space for item pointers (array). Items are allocated elsewhere. + * + * 2) ItemPtr [0] is never used. Total array size is max_items + 1, because we + * use indices 1..max_items instead of zero based C indexing. + * + * 3) Item of the binary heap should support these public members: + * - 'lower-then' operator '<' - used for comparing items before moving + * + */ template class CBinaryHeapT { @@ -53,23 +53,23 @@ public: public: /** Return the number of items stored in the priority queue. - * @return number of items in the queue */ + * @return number of items in the queue */ FORCEINLINE int Size() const {return m_size;}; /** Test if the priority queue is empty. - * @return true if empty */ + * @return true if empty */ FORCEINLINE bool IsEmpty() const {return (m_size == 0);}; /** Test if the priority queue is full. - * @return true if full. */ + * @return true if full. */ FORCEINLINE bool IsFull() const {return (m_size >= m_max_size);}; /** Find the smallest item in the priority queue. - * Return the smallest item, or throw assert if empty. */ + * Return the smallest item, or throw assert if empty. */ FORCEINLINE Titem_& GetHead() {assert(!IsEmpty()); return *m_items[1];} /** Insert new item into the priority queue, maintaining heap order. - * @return false if the queue is full. */ + * @return false if the queue is full. */ bool Push(Titem_& new_item); /** Remove and return the smallest item from the priority queue. */ @@ -85,7 +85,7 @@ public: int FindLinear(const Titem_& item) const; /** Make the priority queue empty. - * All remaining items will remain untouched. */ + * All remaining items will remain untouched. */ void Clear() {m_size = 0;}; /** verifies the heap consistency (added during first YAPF debug phase) */ diff --git a/yapf/blob.hpp b/yapf/blob.hpp index 6cc460e41f..8c2da84a46 100644 --- a/yapf/blob.hpp +++ b/yapf/blob.hpp @@ -11,14 +11,14 @@ FORCEINLINE void MemCpyT(Titem_* d, const Titem_* s, int num_items = 1) /** Base class for simple binary blobs. - Item is byte. - The word 'simple' means: - - no configurable allocator type (always made from heap) - - no smart deallocation - deallocation must be called from the same - module (DLL) where the blob was allocated - - no configurable allocation policy (how big blocks should be allocated) - - no extra ownership policy (i.e. 'copy on write') when blob is copied - - no thread synchronization at all */ + * Item is byte. + * The word 'simple' means: + * - no configurable allocator type (always made from heap) + * - no smart deallocation - deallocation must be called from the same + * module (DLL) where the blob was allocated + * - no configurable allocation policy (how big blocks should be allocated) + * - no extra ownership policy (i.e. 'copy on write') when blob is copied + * - no thread synchronization at all */ class CBlobBaseSimple { protected: struct CHdr { @@ -78,7 +78,7 @@ public: } /** Reallocate if there is no free space for num_bytes bytes. - @return pointer to the new data to be added */ + * @return pointer to the new data to be added */ FORCEINLINE int8* MakeRawFreeSpace(int num_bytes) { assert(num_bytes >= 0); @@ -89,7 +89,7 @@ public: } /** Increase RawSize() by num_bytes. - @return pointer to the new data added */ + * @return pointer to the new data added */ FORCEINLINE int8* GrowRawSize(int num_bytes) { int8* pNewData = MakeRawFreeSpace(num_bytes); diff --git a/yapf/countedptr.hpp b/yapf/countedptr.hpp index 1ac986cf55..c1bb48e062 100644 --- a/yapf/countedptr.hpp +++ b/yapf/countedptr.hpp @@ -6,15 +6,15 @@ /** @file CCountedPtr - smart pointer implementation */ /** CCountedPtr - simple reference counting smart pointer. -* -* One of the standard ways how to maintain object's lifetime. -* -* See http://ootips.org/yonat/4dev/smart-pointers.html for more -* general info about smart pointers. -* -* This class implements ref-counted pointer for objects/interfaces that -* support AddRef() and Release() methods. -*/ + * + * One of the standard ways how to maintain object's lifetime. + * + * See http://ootips.org/yonat/4dev/smart-pointers.html for more + * general info about smart pointers. + * + * This class implements ref-counted pointer for objects/interfaces that + * support AddRef() and Release() methods. + */ template class CCountedPtr { /** redefine the template argument to make it visible for derived classes */ diff --git a/yapf/fixedsizearray.hpp b/yapf/fixedsizearray.hpp index 9d67c6877e..06ff0703f5 100644 --- a/yapf/fixedsizearray.hpp +++ b/yapf/fixedsizearray.hpp @@ -5,13 +5,13 @@ /** fixed size array - Upon construction it preallocates fixed size block of memory - for all items, but doesn't construct them. Item's construction - is delayed. */ + * Upon construction it preallocates fixed size block of memory + * for all items, but doesn't construct them. Item's construction + * is delayed. */ template struct CFixedSizeArrayT { /** the only member of fixed size array is pointer to the block - of C array of items. Header can be found on the offset -sizeof(CHdr). */ + * of C array of items. Header can be found on the offset -sizeof(CHdr). */ Titem_ *m_items; /** header for fixed size array */ diff --git a/yapf/follow_track.hpp b/yapf/follow_track.hpp index 5bb3ad8ace..218de53b46 100644 --- a/yapf/follow_track.hpp +++ b/yapf/follow_track.hpp @@ -6,8 +6,8 @@ #include "yapf.hpp" /** Track follower helper template class (can serve pathfinders and vehicle - controllers). See 6 different typedefs below for 3 different transport - types w/ of w/o 90-deg turns allowed */ + * controllers). See 6 different typedefs below for 3 different transport + * types w/ of w/o 90-deg turns allowed */ template struct CFollowTrackT : public FollowTrack_t { @@ -38,7 +38,7 @@ struct CFollowTrackT : public FollowTrack_t FORCEINLINE static bool Allow90degTurns() {return T90deg_turns_allowed_;} /** main follower routine. Fills all members and return true on success. - Otherwise returns false if track can't be followed. */ + * Otherwise returns false if track can't be followed. */ FORCEINLINE bool Follow(TileIndex old_tile, Trackdir old_td) { m_old_tile = old_tile; diff --git a/yapf/hashtable.hpp b/yapf/hashtable.hpp index bab5bccfcc..3933eb8f10 100644 --- a/yapf/hashtable.hpp +++ b/yapf/hashtable.hpp @@ -95,26 +95,26 @@ struct CHashTableSlotT }; /** @class CHashTableT - simple hash table - of pointers allocated elsewhere. - - Supports: Add/Find/Remove of Titems. - - Your Titem must meet some extra requirements to be CHashTableT - compliant: - - its constructor/destructor (if any) must be public - - if the copying of item requires an extra resource management, - you must define also copy constructor - - must support nested type (struct, class or typedef) Titem::Key - that defines the type of key class for that item - - must support public method: - const Key& GetKey() const; // return the item's key object - - In addition, the Titem::Key class must support: - - public method that calculates key's hash: - int CalcHash() const; - - public 'equality' operator to compare the key with another one - bool operator == (const Key& other) const; -*/ + * of pointers allocated elsewhere. + * + * Supports: Add/Find/Remove of Titems. + * + * Your Titem must meet some extra requirements to be CHashTableT + * compliant: + * - its constructor/destructor (if any) must be public + * - if the copying of item requires an extra resource management, + * you must define also copy constructor + * - must support nested type (struct, class or typedef) Titem::Key + * that defines the type of key class for that item + * - must support public method: + * const Key& GetKey() const; // return the item's key object + * + * In addition, the Titem::Key class must support: + * - public method that calculates key's hash: + * int CalcHash() const; + * - public 'equality' operator to compare the key with another one + * bool operator == (const Key& other) const; + */ template class CHashTableT { public: @@ -125,7 +125,7 @@ public: protected: /** each slot contains pointer to the first item in the list, - Titem contains pointer to the next item - GetHashNext(), SetHashNext() */ + * Titem contains pointer to the next item - GetHashNext(), SetHashNext() */ typedef CHashTableSlotT Slot; Slot* m_slots; // here we store our data (array of blobs) diff --git a/yapf/nodelist.hpp b/yapf/nodelist.hpp index 204282e93d..5dc8170af0 100644 --- a/yapf/nodelist.hpp +++ b/yapf/nodelist.hpp @@ -8,8 +8,8 @@ #include "binaryheap.hpp" /** Hash table based node list multi-container class. - Implements open list, closed list and priority queue for A-star - path finder. */ + * Implements open list, closed list and priority queue for A-star + * path finder. */ template class CNodeList_HashTableT { public: diff --git a/yapf/unittest/test_yapf.h b/yapf/unittest/test_yapf.h index 4e2f2c0e5c..952040faaa 100644 --- a/yapf/unittest/test_yapf.h +++ b/yapf/unittest/test_yapf.h @@ -160,8 +160,8 @@ struct CYapfTestBaseT FORCEINLINE char TransportTypeChar() const {return 'T';} /** Called by YAPF to move from the given node to the next tile. For each - * reachable trackdir on the new tile creates new node, initializes it - * and adds it to the open list by calling Yapf().AddNewNode(n) */ + * reachable trackdir on the new tile creates new node, initializes it + * and adds it to the open list by calling Yapf().AddNewNode(n) */ FORCEINLINE void PfFollowNode(Node& org) { int x_org = org.m_key.m_x; @@ -207,8 +207,8 @@ struct CYapfTestBaseT } /** Called by YAPF to calculate the cost from the origin to the given node. - * Calculates only the cost of given node, adds it to the parent node cost - * and stores the result into Node::m_cost member */ + * Calculates only the cost of given node, adds it to the parent node cost + * and stores the result into Node::m_cost member */ FORCEINLINE bool PfCalcCost(Node& n) { // base tile cost depending on distance @@ -225,7 +225,7 @@ struct CYapfTestBaseT } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ FORCEINLINE bool PfCalcEstimate(Node& n) { int dx = abs(n.m_key.m_x - m_x2); diff --git a/yapf/unittest/unittest.cpp b/yapf/unittest/unittest.cpp index 099862bee9..33d3f30656 100644 --- a/yapf/unittest/unittest.cpp +++ b/yapf/unittest/unittest.cpp @@ -109,23 +109,23 @@ const TileIndexDiffC _tileoffs_by_dir[] = { extern "C" const byte _ffb_64[128] = { - 0,0,1,0,2,0,1,0, - 3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0, - 3,0,1,0,2,0,1,0, - 5,0,1,0,2,0,1,0, - 3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0, - 3,0,1,0,2,0,1,0, - - 0,0,0,2,0,4,4,6, - 0,8,8,10,8,12,12,14, - 0,16,16,18,16,20,20,22, - 16,24,24,26,24,28,28,30, - 0,32,32,34,32,36,36,38, - 32,40,40,42,40,44,44,46, - 32,48,48,50,48,52,52,54, - 48,56,56,58,56,60,60,62, + 0, 0, 1, 0, 2, 0, 1, 0, + 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, + 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, + 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, + 3, 0, 1, 0, 2, 0, 1, 0, + + 0, 0, 0, 2, 0, 4, 4, 6, + 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, + 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, + 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, + 48, 56, 56, 58, 56, 60, 60, 62, }; /* Maps a trackdir to the (4-way) direction the tile is exited when following diff --git a/yapf/yapf.h b/yapf/yapf.h index 20a2e89ee1..55b9f73ca7 100644 --- a/yapf/yapf.h +++ b/yapf/yapf.h @@ -6,54 +6,54 @@ #include "../debug.h" /** Finds the best path for given ship. - @param v - the ship that needs to find a path - @param tile - the tile to find the path from (should be next tile the ship is about to enter) - @param enterdir - diagonal direction which the ship will enter this new tile from - @param tracks - available tracks on the new tile (to choose from) - @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found + * @param v the ship that needs to find a path + * @param tile the tile to find the path from (should be next tile the ship is about to enter) + * @param enterdir diagonal direction which the ship will enter this new tile from + * @param tracks available tracks on the new tile (to choose from) + * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found */ Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks); /** Finds the best path for given road vehicle. - @param v - the RV that needs to find a path - @param tile - the tile to find the path from (should be next tile the RV is about to enter) - @param enterdir - diagonal direction which the RV will enter this new tile from - @param tracks - available tracks on the new tile (to choose from) - @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found -*/ + * @param v the RV that needs to find a path + * @param tile the tile to find the path from (should be next tile the RV is about to enter) + * @param enterdir diagonal direction which the RV will enter this new tile from + * @param tracks available tracks on the new tile (to choose from) + * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found + */ Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir); /** Finds the best path for given train. - @param v - the train that needs to find a path - @param tile - the tile to find the path from (should be next tile the train is about to enter) - @param enterdir - diagonal direction which the RV will enter this new tile from - @param tracks - available tracks on the new tile (to choose from) - @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found -*/ + * @param v the train that needs to find a path + * @param tile the tile to find the path from (should be next tile the train is about to enter) + * @param enterdir diagonal direction which the RV will enter this new tile from + * @param tracks available tracks on the new tile (to choose from) + * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found + */ Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs); /** Used by RV multistop feature to find the nearest road stop that has a free slot. - @param v - RV (its current tile will be the origin) - @param tile - destination tile - @return - distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found -*/ + * @param v RV (its current tile will be the origin) + * @param tile destination tile + * @return distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found + */ uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile); /** Used when user sends RV to the nearest depot or if RV needs servicing. - Returns the nearest depot (or NULL if depot was not found). -*/ + * Returns the nearest depot (or NULL if depot was not found). + */ Depot* YapfFindNearestRoadDepot(const Vehicle *v); /** Used when user sends train to the nearest depot or if train needs servicing. - @v - train that needs to go to some depot - @max_distance - max distance (number of track tiles) from the current train position - (used also as optimization - the pathfinder can stop path finding if max_distance - was reached and no depot was seen) - @reverse_penalty - penalty that should be added for the path that requires reversing the train first - @depot_tile - receives the depot tile if depot was found - @reversed - receives true if train needs to reversed first - @return - the true if depot was found. -*/ + * @v train that needs to go to some depot + * @max_distance max distance (number of track tiles) from the current train position + * (used also as optimization - the pathfinder can stop path finding if max_distance + * was reached and no depot was seen) + * @reverse_penalty penalty that should be added for the path that requires reversing the train first + * @depot_tile receives the depot tile if depot was found + * @reversed receives true if train needs to reversed first + * @return the true if depot was found. + */ bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed); /** Returns true if it is better to reverse the train before leaving station */ @@ -72,17 +72,17 @@ extern int _aystar_stats_closed_size; /** Track followers. They should help whenever any new code will need to walk through -tracks, road or water tiles (pathfinders, signal controllers, vehicle controllers). -It is an attempt to introduce API that should simplify tasks listed above. -If you will need to use it: - 1. allocate/declare FollowTrack_t structure; - 2. call FollowTrackInit() and provide vehicle (if relevant) - 3. call one of 6 FollowTrackXxxx() APIs below - 4. check return value (if true then continue else stop) - 5. look at FollowTrack_t structure for the result - 6. optionally repeat steps 3..5 - 7. in case of troubles contact KUDr -*/ + * tracks, road or water tiles (pathfinders, signal controllers, vehicle controllers). + * It is an attempt to introduce API that should simplify tasks listed above. + * If you will need to use it: + * 1. allocate/declare FollowTrack_t structure; + * 2. call FollowTrackInit() and provide vehicle (if relevant) + * 3. call one of 6 FollowTrackXxxx() APIs below + * 4. check return value (if true then continue else stop) + * 5. look at FollowTrack_t structure for the result + * 6. optionally repeat steps 3..5 + * 7. in case of troubles contact KUDr + */ /** Base struct for track followers. */ typedef struct FollowTrack_t diff --git a/yapf/yapf_base.hpp b/yapf/yapf_base.hpp index 96893b39d5..98ca6ba9c9 100644 --- a/yapf/yapf_base.hpp +++ b/yapf/yapf_base.hpp @@ -14,34 +14,34 @@ EXTERN_C_END extern int _total_pf_time_us; /** CYapfBaseT - A-star type path finder base class. - Derive your own pathfinder from it. You must provide the following template argument: - Types - used as collection of local types used in pathfinder - - Requirements for the Types struct: - ---------------------------------- - The following types must be defined in the 'Types' argument: - - Types::Tpf - your pathfinder derived from CYapfBaseT - - Types::NodeList - open/closed node list (look at CNodeList_HashTableT) - NodeList needs to have defined local type Titem - defines the pathfinder node type. - Node needs to define local type Key - the node key in the collection () - - For node list you can use template class CNodeList_HashTableT, for which - you need to declare only your node type. Look at test_yapf.h for an example. - - - Requrements to your pathfinder class derived from CYapfBaseT: - ------------------------------------------------------------- - Your pathfinder derived class needs to implement following methods: - FORCEINLINE void PfSetStartupNodes() - FORCEINLINE void PfFollowNode(Node& org) - FORCEINLINE bool PfCalcCost(Node& n) - FORCEINLINE bool PfCalcEstimate(Node& n) - FORCEINLINE bool PfDetectDestination(Node& n) - - For more details about those methods, look at the end of CYapfBaseT - declaration. There are some examples. For another example look at - test_yapf.h (part or unittest project). -*/ + * Derive your own pathfinder from it. You must provide the following template argument: + * Types - used as collection of local types used in pathfinder + * + * Requirements for the Types struct: + * ---------------------------------- + * The following types must be defined in the 'Types' argument: + * - Types::Tpf - your pathfinder derived from CYapfBaseT + * - Types::NodeList - open/closed node list (look at CNodeList_HashTableT) + * NodeList needs to have defined local type Titem - defines the pathfinder node type. + * Node needs to define local type Key - the node key in the collection () + * + * For node list you can use template class CNodeList_HashTableT, for which + * you need to declare only your node type. Look at test_yapf.h for an example. + * + * + * Requrements to your pathfinder class derived from CYapfBaseT: + * ------------------------------------------------------------- + * Your pathfinder derived class needs to implement following methods: + * FORCEINLINE void PfSetStartupNodes() + * FORCEINLINE void PfFollowNode(Node& org) + * FORCEINLINE bool PfCalcCost(Node& n) + * FORCEINLINE bool PfCalcEstimate(Node& n) + * FORCEINLINE bool PfDetectDestination(Node& n) + * + * For more details about those methods, look at the end of CYapfBaseT + * declaration. There are some examples. For another example look at + * test_yapf.h (part or unittest project). + */ template class CYapfBaseT { public: @@ -105,12 +105,12 @@ public: } /** Main pathfinder routine: - - set startup node(s) - - main loop that stops if: - - the destination was found - - or the open list is empty (no route to destination). - - or the maximum amount of loops reached - m_max_search_nodes (default = 10000) - @return true if the path was found */ + * - set startup node(s) + * - main loop that stops if: + * - the destination was found + * - or the open list is empty (no route to destination). + * - or the maximum amount of loops reached - m_max_search_nodes (default = 10000) + * @return true if the path was found */ inline bool FindPath(const Vehicle* v) { m_veh = v; @@ -160,16 +160,16 @@ public: } /** If path was found return the best node that has reached the destination. Otherwise - return the best visited node (which was nearest to the destination). - */ + * return the best visited node (which was nearest to the destination). + */ FORCEINLINE Node& GetBestNode() { return (m_pBestDestNode != NULL) ? *m_pBestDestNode : *m_pBestIntermediateNode; } /** Calls NodeList::CreateNewNode() - allocates new node that can be filled and used - as argument for AddStartupNode() or AddNewNode() - */ + * as argument for AddStartupNode() or AddNewNode() + */ FORCEINLINE Node& CreateNewNode() { Node& node = *m_nodes.CreateNewNode(); @@ -203,7 +203,7 @@ public: } /** AddNewNode() - called by Tderived::PfFollowNode() for each child node. - Nodes are evaluated here and added into open list */ + * Nodes are evaluated here and added into open list */ void AddNewNode(Node& n) { // evaluate the node diff --git a/yapf/yapf_common.hpp b/yapf/yapf_common.hpp index e9e8273237..869bc820c1 100644 --- a/yapf/yapf_common.hpp +++ b/yapf/yapf_common.hpp @@ -129,7 +129,7 @@ public: } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ inline bool PfCalcEstimate(Node& n) { int dx = abs(TileX(n.GetTile()) - TileX(m_destTile)); @@ -144,9 +144,9 @@ public: }; /** YAPF template that uses Ttypes template argument to determine all YAPF -* components (base classes) from which the actual YAPF is composed. -* For example classes consult: CYapfRail_TypesT template and its instantiations: -* CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */ + * components (base classes) from which the actual YAPF is composed. + * For example classes consult: CYapfRail_TypesT template and its instantiations: + * CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */ template class CYapfT : public Ttypes::PfBase ///< Instance of CYapfBaseT - main YAPF loop and support base class diff --git a/yapf/yapf_costcache.hpp b/yapf/yapf_costcache.hpp index 5ad6f8cdc1..e1f635e680 100644 --- a/yapf/yapf_costcache.hpp +++ b/yapf/yapf_costcache.hpp @@ -4,9 +4,9 @@ /** CYapfSegmentCostCacheNoneT - the formal only yapf cost cache provider that implements -PfNodeCacheFetch() and PfNodeCacheFlush() callbacks. Used when nodes don't have CachedData -defined (they don't count with any segment cost caching). -*/ + * PfNodeCacheFetch() and PfNodeCacheFlush() callbacks. Used when nodes don't have CachedData + * defined (they don't count with any segment cost caching). + */ template class CYapfSegmentCostCacheNoneT { @@ -15,14 +15,14 @@ public: typedef typename Types::NodeList::Titem Node; ///< this will be our node type /** Called by YAPF to attach cached or local segment cost data to the given node. - * @return true if globally cached data were used or false if local data was used */ + * @return true if globally cached data were used or false if local data was used */ FORCEINLINE bool PfNodeCacheFetch(Node& n) { return false; }; /** Called by YAPF to flush the cached segment cost data back into cache storage. - * Current cache implementation doesn't use that. */ + * Current cache implementation doesn't use that. */ FORCEINLINE void PfNodeCacheFlush(Node& n) { }; @@ -30,9 +30,9 @@ public: /** CYapfSegmentCostCacheLocalT - the yapf cost cache provider that implements fake segment -cost caching functionality for yapf. Used when node needs caching, but you don't want to -cache the segment costs. -*/ + * cost caching functionality for yapf. Used when node needs caching, but you don't want to + * cache the segment costs. + */ template class CYapfSegmentCostCacheLocalT { @@ -52,7 +52,7 @@ protected: public: /** Called by YAPF to attach cached or local segment cost data to the given node. - * @return true if globally cached data were used or false if local data was used */ + * @return true if globally cached data were used or false if local data was used */ FORCEINLINE bool PfNodeCacheFetch(Node& n) { CacheKey key(n.GetKey()); @@ -61,7 +61,7 @@ public: }; /** Called by YAPF to flush the cached segment cost data back into cache storage. - * Current cache implementation doesn't use that. */ + * Current cache implementation doesn't use that. */ FORCEINLINE void PfNodeCacheFlush(Node& n) { }; @@ -69,10 +69,10 @@ public: /** Base class for segment cost cache providers. Contains global counter -* of track layout changes and static notification function called whenever -* the track layout changes. It is implemented as base class because it needs -* to be shared between all rail YAPF types (one shared counter, one notification -* function. */ + * of track layout changes and static notification function called whenever + * the track layout changes. It is implemented as base class because it needs + * to be shared between all rail YAPF types (one shared counter, one notification + * function. */ struct CSegmentCostCacheBase { static int s_rail_change_counter; @@ -82,13 +82,13 @@ struct CSegmentCostCacheBase /** CSegmentCostCacheT - template class providing hash-map and storage (heap) - of Tsegment structures. Each rail node contains pointer to the segment - that contains cached (or non-cached) segment cost information. Nodes can - differ by key type, but they use the same segment type. Segment key should - be always the same (TileIndex + DiagDirection) that represent the beginning - of the segment (origin tile and exit-dir from this tile). - Different CYapfCachedCostT types can share the same type of CSegmentCostCacheT. - Look at CYapfRailSegment (yapf_node_rail.hpp) for the segment example */ + * of Tsegment structures. Each rail node contains pointer to the segment + * that contains cached (or non-cached) segment cost information. Nodes can + * differ by key type, but they use the same segment type. Segment key should + * be always the same (TileIndex + DiagDirection) that represent the beginning + * of the segment (origin tile and exit-dir from this tile). + * Different CYapfCachedCostT types can share the same type of CSegmentCostCacheT. + * Look at CYapfRailSegment (yapf_node_rail.hpp) for the segment example */ template struct CSegmentCostCacheT : public CSegmentCostCacheBase @@ -119,8 +119,8 @@ struct CSegmentCostCacheT }; /** CYapfSegmentCostCacheGlobalT - the yapf cost cache provider that adds the segment cost - caching functionality to yapf. Using this class as base of your will provide the global - segment cost caching services for your Nodes. + * caching functionality to yapf. Using this class as base of your will provide the global + * segment cost caching services for your Nodes. */ template class CYapfSegmentCostCacheGlobalT @@ -173,7 +173,7 @@ protected: public: /** Called by YAPF to attach cached or local segment cost data to the given node. - * @return true if globally cached data were used or false if local data was used */ + * @return true if globally cached data were used or false if local data was used */ FORCEINLINE bool PfNodeCacheFetch(Node& n) { if (!Yapf().CanUseGlobalCache(n)) { @@ -187,7 +187,7 @@ public: }; /** Called by YAPF to flush the cached segment cost data back into cache storage. - * Current cache implementation doesn't use that. */ + * Current cache implementation doesn't use that. */ FORCEINLINE void PfNodeCacheFlush(Node& n) { }; diff --git a/yapf/yapf_costrail.hpp b/yapf/yapf_costrail.hpp index b87793c60f..c19e296d84 100644 --- a/yapf/yapf_costrail.hpp +++ b/yapf/yapf_costrail.hpp @@ -160,8 +160,8 @@ public: FORCEINLINE void SetMaxCost(int max_cost) {m_max_cost = max_cost;} /** Called by YAPF to calculate the cost from the origin to the given node. - * Calculates only the cost of given node, adds it to the parent node cost - * and stores the result into Node::m_cost member */ + * Calculates only the cost of given node, adds it to the parent node cost + * and stores the result into Node::m_cost member */ FORCEINLINE bool PfCalcCost(Node& n) { assert(!n.flags_u.flags_s.m_targed_seen); diff --git a/yapf/yapf_destrail.hpp b/yapf/yapf_destrail.hpp index f221668401..9a5bd05362 100644 --- a/yapf/yapf_destrail.hpp +++ b/yapf/yapf_destrail.hpp @@ -46,7 +46,7 @@ public: } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ FORCEINLINE bool PfCalcEstimate(Node& n) { n.m_estimate = n.m_cost; @@ -118,7 +118,7 @@ public: } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ FORCEINLINE bool PfCalcEstimate(Node& n) { static int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; diff --git a/yapf/yapf_rail.cpp b/yapf/yapf_rail.cpp index 72cfe3fad9..c830d2b44a 100644 --- a/yapf/yapf_rail.cpp +++ b/yapf/yapf_rail.cpp @@ -28,8 +28,8 @@ protected: public: /** Called by YAPF to move from the given node to the next tile. For each - * reachable trackdir on the new tile creates new node, initializes it - * and adds it to the open list by calling Yapf().AddNewNode(n) */ + * reachable trackdir on the new tile creates new node, initializes it + * and adds it to the open list by calling Yapf().AddNewNode(n) */ inline void PfFollowNode(Node& old_node) { TrackFollower F(Yapf().GetVehicle()); @@ -91,8 +91,8 @@ protected: public: /** Called by YAPF to move from the given node to the next tile. For each - * reachable trackdir on the new tile creates new node, initializes it - * and adds it to the open list by calling Yapf().AddNewNode(n) */ + * reachable trackdir on the new tile creates new node, initializes it + * and adds it to the open list by calling Yapf().AddNewNode(n) */ inline void PfFollowNode(Node& old_node) { TrackFollower F(Yapf().GetVehicle()); diff --git a/yapf/yapf_road.cpp b/yapf/yapf_road.cpp index 1b9000f136..2a4680b8cd 100644 --- a/yapf/yapf_road.cpp +++ b/yapf/yapf_road.cpp @@ -64,8 +64,8 @@ protected: public: /** Called by YAPF to calculate the cost from the origin to the given node. - * Calculates only the cost of given node, adds it to the parent node cost - * and stores the result into Node::m_cost member */ + * Calculates only the cost of given node, adds it to the parent node cost + * and stores the result into Node::m_cost member */ FORCEINLINE bool PfCalcCost(Node& n) { int segment_cost = 0; @@ -144,7 +144,7 @@ public: } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ FORCEINLINE bool PfCalcEstimate(Node& n) { n.m_estimate = n.m_cost; @@ -186,7 +186,7 @@ public: } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination - * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ + * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ inline bool PfCalcEstimate(Node& n) { static int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; @@ -231,8 +231,8 @@ protected: public: /** Called by YAPF to move from the given node to the next tile. For each - * reachable trackdir on the new tile creates new node, initializes it - * and adds it to the open list by calling Yapf().AddNewNode(n) */ + * reachable trackdir on the new tile creates new node, initializes it + * and adds it to the open list by calling Yapf().AddNewNode(n) */ inline void PfFollowNode(Node& old_node) { TrackFollower F(Yapf().GetVehicle()); diff --git a/yapf/yapf_settings.h b/yapf/yapf_settings.h index 724196ac25..77c4f2da44 100644 --- a/yapf/yapf_settings.h +++ b/yapf/yapf_settings.h @@ -7,15 +7,15 @@ # ifndef YS_DEF /* -* if YS_DEF is not defined, we will only do following declaration: -* typedef struct YapfSettings { -* bool disable_node_optimization; -* uint32 max_search_nodes; -* .... all other yapf related settings ... -* } YapfSettings; -* -* otherwise we will just expand YS_DEF_xx macros and then #undef them -*/ + * if YS_DEF is not defined, we will only do following declaration: + * typedef struct YapfSettings { + * bool disable_node_optimization; + * uint32 max_search_nodes; + * .... all other yapf related settings ... + * } YapfSettings; + * + * otherwise we will just expand YS_DEF_xx macros and then #undef them + */ # define YS_DEF_BEGIN typedef struct YapfSettings { # define YS_DEF(type, name) type name; # define YS_DEF_END } YapfSettings; diff --git a/yapf/yapf_ship.cpp b/yapf/yapf_ship.cpp index 0682cd45fd..728c41cd9d 100644 --- a/yapf/yapf_ship.cpp +++ b/yapf/yapf_ship.cpp @@ -20,8 +20,8 @@ protected: public: /** Called by YAPF to move from the given node to the next tile. For each - * reachable trackdir on the new tile creates new node, initializes it - * and adds it to the open list by calling Yapf().AddNewNode(n) */ + * reachable trackdir on the new tile creates new node, initializes it + * and adds it to the open list by calling Yapf().AddNewNode(n) */ inline void PfFollowNode(Node& old_node) { TrackFollower F; @@ -95,8 +95,8 @@ protected: public: /** Called by YAPF to calculate the cost from the origin to the given node. - * Calculates only the cost of given node, adds it to the parent node cost - * and stores the result into Node::m_cost member */ + * Calculates only the cost of given node, adds it to the parent node cost + * and stores the result into Node::m_cost member */ FORCEINLINE bool PfCalcCost(Node& n) { // base tile cost depending on distance @@ -110,8 +110,8 @@ public: }; /** Config struct of YAPF for ships. - Defines all 6 base YAPF modules as classes providing services for CYapfBaseT. -*/ + * Defines all 6 base YAPF modules as classes providing services for CYapfBaseT. + */ template struct CYapfShip_TypesT {