summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-03-03 04:04:22 +0000
committerbelugas <belugas@openttd.org>2007-03-03 04:04:22 +0000
commitb71354dc406340a0d9b57b64b17ea5f3758e4309 (patch)
treea56d1e1d13bc7d618e33a50ed711f4c5387a5c21
parent6887fbbaaf73751fe0675e322c83fddcdb9f09d8 (diff)
downloadopenttd-b71354dc406340a0d9b57b64b17ea5f3758e4309.tar.xz
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
-rw-r--r--src/fileio.cpp2
-rw-r--r--src/fileio.h2
-rw-r--r--src/industry.h110
-rw-r--r--src/industry_cmd.cpp43
-rw-r--r--src/industry_gui.cpp19
-rw-r--r--src/industry_map.h72
-rw-r--r--src/intro_gui.cpp2
-rw-r--r--src/landscape.cpp26
-rw-r--r--src/livery.h2
-rw-r--r--src/lzoconf.h2
-rw-r--r--src/macros.h10
-rw-r--r--src/main_gui.cpp84
-rw-r--r--src/map.cpp64
-rw-r--r--src/map.h36
-rw-r--r--src/md5.cpp4
-rw-r--r--src/md5.h4
-rw-r--r--src/mersenne.cpp2
-rw-r--r--src/minilzo.cpp2
-rw-r--r--src/minilzo.h2
-rw-r--r--src/misc.cpp12
-rw-r--r--src/misc_cmd.cpp2
-rw-r--r--src/misc_gui.cpp91
-rw-r--r--src/mixer.cpp16
-rw-r--r--src/mixer.h2
-rw-r--r--src/music.cpp2
-rw-r--r--src/music.h2
-rw-r--r--src/music_gui.cpp2
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/town_cmd.cpp4
-rw-r--r--src/yapf/yapf_common.cpp34
30 files changed, 369 insertions, 288 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index f62eb5eb7..b0bb3b6b2 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file fileio.cpp Standard In/Out file operations*/
+/** @file fileio.cpp Standard In/Out file operations */
#include "stdafx.h"
#include "openttd.h"
diff --git a/src/fileio.h b/src/fileio.h
index 11e7b4ef6..dc35100f6 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file fileio.h Declarations for Standard In/Out file operations*/
+/** @file fileio.h Declarations for Standard In/Out file operations */
#ifndef FILEIO_H
#define FILEIO_H
diff --git a/src/industry.h b/src/industry.h
index f67ec4d2a..d4fe8717e 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file industry.h */
+
#ifndef INDUSTRY_H
#define INDUSTRY_H
@@ -18,30 +20,33 @@ typedef enum IndustryLifeTypes {
INDUSTRYLIFE_CLOSABLE, ///< Industry can only close (no production change)
} IndustryLifeType;
+/**
+ * Defines the internal data of a functionnal industry
+ */
struct Industry {
- TileIndex xy;
- byte width; /* swapped order of w/h with town */
+ TileIndex xy; ///< coordinates of the primary tile the industry is built one
+ byte width;
byte height;
- const Town* town;
- CargoID produced_cargo[2];
- uint16 cargo_waiting[2];
- byte production_rate[2];
- CargoID accepts_cargo[3];
- byte prod_level;
- uint16 last_mo_production[2];
- uint16 last_mo_transported[2];
- byte pct_transported[2];
- uint16 total_production[2];
- uint16 total_transported[2];
- uint16 counter;
-
- byte type;
- OwnerByte owner;
- byte random_color;
- Year last_prod_year;
- byte was_cargo_delivered;
-
- IndustryID index;
+ const Town* town; ///< Nearest town
+ CargoID produced_cargo[2]; ///< 2 production cargo slots
+ uint16 cargo_waiting[2]; ///< amount of cargo produced per cargo
+ byte production_rate[2]; ///< production rate for each cargo
+ CargoID accepts_cargo[3]; ///< 3 input cargo slots
+ byte prod_level; ///< general production level
+ uint16 last_mo_production[2]; ///< stats of last month production per cargo
+ uint16 last_mo_transported[2]; ///< stats of last month transport per cargo
+ byte pct_transported[2]; ///< percentage transported per cargo
+ uint16 total_production[2]; ///< total units produced per cargo
+ uint16 total_transported[2]; ///< total units transported per cargo
+ uint16 counter; ///< used for animation and/or production (if available cargo)
+
+ byte type; ///< type of industry. see IT_COAL_MINE and others
+ OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
+ byte random_color; ///< randomized colour of the industry, for display purpose
+ Year last_prod_year; ///< last year of production
+ byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
+
+ IndustryID index; ///< index of the industry in the pool of industries
};
typedef struct IndustryTileTable {
@@ -49,59 +54,62 @@ typedef struct IndustryTileTable {
IndustryGfx gfx;
} IndustryTileTable;
+/**
+ * Defines the data structure for constructing industry.
+ */
typedef struct IndustrySpec {
- /** Tables with the 'layout' of different composition of GFXes */
- const IndustryTileTable *const *table;
- /** Number of elements in the table */
- byte num_table;
- /** Base cost multiplier*/
- byte cost_multiplier;
- /** Industries this industry cannot be close to */
- IndustryType conflicting[3];
- /** index to a procedure to check for conflicting circumstances */
- byte check_proc;
-
+ const IndustryTileTable *const *table;///< List of the tiles composing the industry
+ byte num_table; ///< Number of elements in the table
+ byte cost_multiplier; ///< Base cost multiplier*/
+ IndustryType conflicting[3]; ///< Industries this industry cannot be close to
+ byte check_proc; ///< Index to a procedure to check for conflicting circumstances
CargoID produced_cargo[2];
byte production_rate[2];
- /** The minimum amount of cargo transported to the stations; if the
- * waiting cargo is less than this number, no cargo is moved to it*/
- byte minimal_cargo;
- CargoID accepts_cargo[3];
-
- IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
-
- byte climate_availability; ///< Bitmask, giving landscape enums as bit position
-
- StringID name;
- StringID closure_text;
- StringID production_up_text;
- StringID production_down_text;
+ byte minimal_cargo; ///< minimum amount of cargo transported to the stations
+ ///< If the waiting cargo is less than this number, no cargo is moved to it
+ CargoID accepts_cargo[3]; ///< 3 accepted cargos
+ IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
+ byte climate_availability; ///< Bitmask, giving landscape enums as bit position
+ StringID name; ///< Displayed name of the industry
+ StringID closure_text; ///< Message appearing when the industry closes
+ StringID production_up_text; ///< Message appearing when the industry's production is increasing
+ StringID production_down_text; ///< Message appearing when the industry's production is decreasing
} IndustrySpec;
+/**
+ * Defines the data structure of each indivudual tile of an industry.
+ */
typedef struct IndustryTileSpec {
- CargoID accepts_cargo[3];
- Slope slopes_refused;
+ CargoID accepts_cargo[3]; ///< Cargo accepted by this tile
+ Slope slopes_refused; ///< slope pattern on which this tile cannot be built
} IndustryTileSpec;
-const IndustrySpec *GetIndustrySpec(IndustryType thistype);
-const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx);
+const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data
+const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data
DECLARE_OLD_POOL(Industry, Industry, 3, 8000)
/**
* Check if an Industry really exists.
+ * @param industry to check
+ * @return true if position is a valid one
*/
static inline bool IsValidIndustry(const Industry *industry)
{
return industry->xy != 0;
}
+/**
+ * Check if an Industry exists whithin the pool of industries
+ * @param index of the desired industry
+ * @return true if it is inside the pool
+ */
static inline bool IsValidIndustryID(IndustryID index)
{
return index < GetIndustryPoolSize() && IsValidIndustry(GetIndustry(index));
}
-VARDEF int _total_industries;
+VARDEF int _total_industries; //general counter
static inline IndustryID GetMaxIndustryIndex(void)
{
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index b1ae614bb..810ae0da6 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file industry_cmd.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "clear_map.h"
@@ -80,6 +82,7 @@ IndustryType GetIndustryType(TileIndex tile)
* not allowing modifications of it.
* @param thistype of industry (which is the index in _industry_specs)
* @pre thistype < IT_END
+ * @return a pointer to the corresponding industry spec
**/
const IndustrySpec *GetIndustrySpec(IndustryType thistype)
{
@@ -87,6 +90,14 @@ const IndustrySpec *GetIndustrySpec(IndustryType thistype)
return &_industry_specs[thistype];
}
+/**
+ * Accessor for array _industry_tile_specs.
+ * This will ensure at once : proper access and
+ * not allowing modifications of it.
+ * @param gfx of industrytile (which is the index in _industry_specs)
+ * @pre gfx < NUM_INDUSTRY_GFXES
+ * @return a pointer to the corresponding industrytile spec
+ **/
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx)
{
assert(gfx < NUM_INDUSTRY_GFXES);
@@ -427,7 +438,7 @@ static void AnimateTile_Industry(TileIndex tile)
}
break;
- // Sparks on a coal plant
+ /* Sparks on a coal plant */
case GFX_POWERPLANT_SPARKS:
if ((_tick_counter & 3) == 0) {
m = GetIndustryAnimationState(tile);
@@ -869,7 +880,7 @@ static void MaybePlantFarmField(const Industry *i)
* Search callback function for ChopLumberMillTrees
* @param tile to test
* @param data that is passed by the caller. In this case, nothing
- * @result of the test
+ * @return the result of the test
*/
static bool SearchLumberMillTrees(TileIndex tile, uint32 data)
{
@@ -1317,12 +1328,12 @@ static bool CheckIfTooCloseToIndustry(TileIndex tile, int type)
const IndustrySpec *indspec = GetIndustrySpec(type);
const Industry *i;
- // accepting industries won't be close, not even with patch
+ /* accepting industries won't be close, not even with patch */
if (_patches.same_industry_close && indspec->accepts_cargo[0] == CT_INVALID)
return true;
FOR_ALL_INDUSTRIES(i) {
- // check if an industry that accepts the same goods is nearby
+ /* check if an industry that accepts the same goods is nearby */
if (DistanceMax(tile, i->xy) <= 14 &&
indspec->accepts_cargo[0] != CT_INVALID &&
indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
@@ -1334,7 +1345,7 @@ static bool CheckIfTooCloseToIndustry(TileIndex tile, int type)
return false;
}
- // check "not close to" field.
+ /* check "not close to" field. */
if ((i->type == indspec->conflicting[0] || i->type == indspec->conflicting[1] || i->type == indspec->conflicting[2]) &&
DistanceMax(tile, i->xy) <= 14) {
_error_message = STR_INDUSTRY_TOO_CLOSE;
@@ -1445,6 +1456,14 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0);
}
+/** Helper function for Build/Fund an industry
+ * @param tile tile where industry is built
+ * @param type of industry to build
+ * @param flags of operations to conduct
+ * @param indspec pointer to industry specifications
+ * @param it pointer to list of tile type to build
+ * @return the pointer of the newly created industry, or NULL if it failed
+ */
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint32 flags, const IndustrySpec *indspec, const IndustryTileTable *it)
{
const Town *t;
@@ -1474,8 +1493,10 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
/** Build/Fund an industry
* @param tile tile where industry is built
- * @param p1 industry type @see build_industry.h and @see industry.h
+ * @param flags of operations to conduct
+ * @param p1 industry type see build_industry.h and see industry.h
* @param p2 unused
+ * @return index of the newly create industry, or CMD_ERROR if it failed
*/
int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -1524,7 +1545,7 @@ Industry *CreateNewIndustry(TileIndex tile, IndustryType type)
}
static const byte _numof_industry_table[4][12] = {
- // difficulty settings for number of industries
+ /* difficulty settings for number of industries */
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //none
{0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5}, //low
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, //normal
@@ -1536,7 +1557,7 @@ static void PlaceInitialIndustry(IndustryType type, int amount)
int num = _numof_industry_table[_opt.diff.number_industries][amount];
if (type == IT_OIL_REFINERY || type == IT_OIL_RIG) {
- // These are always placed next to the coastline, so we scale by the perimeter instead.
+ /* These are always placed next to the coastline, so we scale by the perimeter instead. */
num = ScaleByMapSize1D(num);
} else {
num = ScaleByMapSize(num);
@@ -1823,7 +1844,7 @@ void IndustryMonthlyLoop(void)
_current_player = old_player;
- // production-change
+ /* production-change */
_industry_sort_dirty = true;
InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0);
}
@@ -1881,7 +1902,7 @@ static const SaveLoad _industry_desc[] = {
SLE_CONDVAR(Industry, last_prod_year, SLE_INT32, 31, SL_MAX_VERSION),
SLE_VAR(Industry, was_cargo_delivered, SLE_UINT8),
- // reserve extra space in savegame here. (currently 32 bytes)
+ /* reserve extra space in savegame here. (currently 32 bytes) */
SLE_CONDNULL(32, 2, SL_MAX_VERSION),
SLE_END()
@@ -1891,7 +1912,7 @@ static void Save_INDY(void)
{
Industry *ind;
- // Write the vehicles
+ /* Write the vehicles */
FOR_ALL_INDUSTRIES(ind) {
SlSetArrayIndex(ind->index);
SlObject(ind, _industry_desc);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index cc95a1de6..2443c9d6f 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file industry_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
@@ -19,6 +21,7 @@
#include "helpers.hpp"
#include "cargotype.h"
+/* industries per climate, according to the different construction windows */
const byte _build_industry_types[4][12] = {
{ 1, 2, 4, 6, 8, 0, 3, 5, 9, 11, 18 },
{ 1, 14, 4, 13, 7, 0, 3, 9, 11, 15 },
@@ -290,9 +293,9 @@ static inline bool IsProductionAlterable(const Industry *i)
static void IndustryViewWndProc(Window *w, WindowEvent *e)
{
- // WP(w,vp2_d).data_1 is for the editbox line
- // WP(w,vp2_d).data_2 is for the clickline
- // WP(w,vp2_d).data_3 is for the click pos (left or right)
+ /* WP(w,vp2_d).data_1 is for the editbox line
+ * WP(w,vp2_d).data_2 is for the clickline
+ * WP(w,vp2_d).data_3 is for the click pos (left or right) */
switch (e->event) {
case WE_PAINT: {
@@ -325,7 +328,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
SetDParam(2, i->pct_transported[0] * 100 >> 8);
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 127, STR_482B_TRANSPORTED, 0);
- // Let's put out those buttons..
+ /* Let's put out those buttons.. */
if (IsProductionAlterable(i)) {
DrawArrowButtons(5, 127, 3, (WP(w,vp2_d).data_2 == 1) ? WP(w,vp2_d).data_3 : 0,
!isProductionMinimum(i, 0), !isProductionMaximum(i, 0));
@@ -336,7 +339,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, i->total_production[1]);
SetDParam(2, i->pct_transported[1] * 100 >> 8);
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0);
- // Let's put out those buttons..
+ /* Let's put out those buttons.. */
if (IsProductionAlterable(i)) {
DrawArrowButtons(5, 137, 3, (WP(w,vp2_d).data_2 == 2) ? WP(w,vp2_d).data_3 : 0,
!isProductionMinimum(i, 1), !isProductionMaximum(i, 1));
@@ -357,7 +360,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
i = GetIndustry(w->window_number);
- // We should work if needed..
+ /* We should work if needed.. */
if (!IsProductionAlterable(i)) return;
x = e->we.click.pt.x;
@@ -379,7 +382,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
WP(w,vp2_d).data_2 = line+1;
WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
} else if (IS_INT_INSIDE(x, 34, 160)) {
- // clicked the text
+ /* clicked the text */
WP(w,vp2_d).data_1 = line;
SetDParam(0, i->production_rate[line] * 8);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, w, CS_ALPHANUMERAL);
@@ -533,7 +536,7 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
break;
}
- // default to string sorting if they are otherwise equal
+ /* default to string sorting if they are otherwise equal */
if (r == 0) {
char buf1[96];
diff --git a/src/industry_map.h b/src/industry_map.h
index 5a3512fd3..4427b58fb 100644
--- a/src/industry_map.h
+++ b/src/industry_map.h
@@ -172,42 +172,42 @@ typedef struct IndustryTypeSolver {
} IndustryTypeSolver;
static const IndustryTypeSolver industry_gfx_Solver [IT_END] = {
- { 0, 6}, //IT_COAL_MINE
- { 7, 10}, //IT_POWER_STATION,
- { 11, 15}, //IT_SAWMILL,
- { 16, 17}, //IT_FOREST,
- { 18, 23}, //IT_OIL_REFINERY,
- { 24, 28}, //IT_OIL_RIG,
- { 29, 31}, //IT_OIL_WELL,
- { 32, 38}, //IT_FARM,
- { 39, 42}, //IT_FACTORY,
- { 43, 46}, //IT_PRINTING_WORKS,
- { 47, 51}, //IT_COPPER_MINE,
- { 52, 57}, //IT_STEEL_MILL,
- { 58, 59}, //IT_BANK_TEMP,
- { 60, 63}, //IT_FOOD_PROCESS,
- { 64, 71}, //IT_PAPER_MILL,
- { 72, 88}, //IT_GOLD_MINE,
- { 89, 90}, //IT_BANK_TROPIC_ARCTIC,
- { 91, 99}, //IT_DIAMOND_MINE,
- {100, 115}, //IT_IRON_MINE,
- {116, 116}, //IT_FRUIT_PLANTATION,
- {117, 117}, //IT_RUBBER_PLANTATION,
- {118, 119}, //IT_WATER_SUPPLY,
- {120, 120}, //IT_WATER_TOWER,
- {121, 124}, //IT_FACTORY_2,
- {125, 128}, //IT_LUMBER_MILL,
- {129, 130}, //IT_COTTON_CANDY,
- {131, 134}, //IT_CANDY_FACTORY or sweet factory
- {135, 136}, //IT_BATTERY_FARM,
- {137, 137}, //IT_COLA_WELLS,
- {138, 141}, //IT_TOY_SHOP,
- {142, 147}, //IT_TOY_FACTORY,
- {148, 155}, //IT_PLASTIC_FOUNTAINS,
- {156, 159}, //IT_FIZZY_DRINK_FACTORY,
- {160, 163}, //IT_BUBBLE_GENERATOR,
- {164, 166}, //IT_TOFFEE_QUARRY,
- {167, 174} //IT_SUGAR_MINE,
+ { 0, 6}, ///< IT_COAL_MINE
+ { 7, 10}, ///< IT_POWER_STATION,
+ { 11, 15}, ///< IT_SAWMILL,
+ { 16, 17}, ///< IT_FOREST,
+ { 18, 23}, ///< IT_OIL_REFINERY,
+ { 24, 28}, ///< IT_OIL_RIG,
+ { 29, 31}, ///< IT_OIL_WELL,
+ { 32, 38}, ///< IT_FARM,
+ { 39, 42}, ///< IT_FACTORY,
+ { 43, 46}, ///< IT_PRINTING_WORKS,
+ { 47, 51}, ///< IT_COPPER_MINE,
+ { 52, 57}, ///< IT_STEEL_MILL,
+ { 58, 59}, ///< IT_BANK_TEMP,
+ { 60, 63}, ///< IT_FOOD_PROCESS,
+ { 64, 71}, ///< IT_PAPER_MILL,
+ { 72, 88}, ///< IT_GOLD_MINE,
+ { 89, 90}, ///< IT_BANK_TROPIC_ARCTIC,
+ { 91, 99}, ///< IT_DIAMOND_MINE,
+ {100, 115}, ///< IT_IRON_MINE,
+ {116, 116}, ///< IT_FRUIT_PLANTATION,
+ {117, 117}, ///< IT_RUBBER_PLANTATION,
+ {118, 119}, ///< IT_WATER_SUPPLY,
+ {120, 120}, ///< IT_WATER_TOWER,
+ {121, 124}, ///< IT_FACTORY_2,
+ {125, 128}, ///< IT_LUMBER_MILL,
+ {129, 130}, ///< IT_COTTON_CANDY,
+ {131, 134}, ///< IT_CANDY_FACTORY or sweet factory
+ {135, 136}, ///< IT_BATTERY_FARM,
+ {137, 137}, ///< IT_COLA_WELLS,
+ {138, 141}, ///< IT_TOY_SHOP,
+ {142, 147}, ///< IT_TOY_FACTORY,
+ {148, 155}, ///< IT_PLASTIC_FOUNTAINS,
+ {156, 159}, ///< IT_FIZZY_DRINK_FACTORY,
+ {160, 163}, ///< IT_BUBBLE_GENERATOR,
+ {164, 166}, ///< IT_TOFFEE_QUARRY,
+ {167, 174} ///< IT_SUGAR_MINE,
};
/**
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index 8cb217486..d39849fd4 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file intro_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
diff --git a/src/landscape.cpp b/src/landscape.cpp
index c790d9c04..06cb02d7b 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -172,7 +172,7 @@ static Slope GetFoundationSlope(TileIndex tile, uint* z)
Slope tileh = GetTileSlope(tile, z);
Slope slope = _tile_type_procs[GetTileType(tile)]->get_slope_tileh_proc(tile, tileh);
- // Flatter slope -> higher base height
+ /* Flatter slope -> higher base height */
if (slope < tileh) *z += TILE_HEIGHT;
return slope;
}
@@ -223,7 +223,7 @@ void DrawFoundation(TileInfo *ti, uint f)
if (IsSteepSlope(ti->tileh)) {
SpriteID lower_base;
- // Lower part of foundation
+ /* Lower part of foundation */
lower_base = sprite_base;
if (lower_base == SPR_SLOPES_BASE - 15) lower_base = SPR_FOUNDATION_BASE;
AddSortableSpriteToDraw(
@@ -232,24 +232,24 @@ void DrawFoundation(TileInfo *ti, uint f)
ti->z += TILE_HEIGHT;
ti->tileh = _inclined_tileh[f - 15];
if (f < 15 + 8) {
- // inclined
+ /* inclined */
AddSortableSpriteToDraw(sprite_base + f, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z);
OffsetGroundSprite(31, 9);
} else if (f >= 15 + 8 + 4) {
- // three corners raised
+ /* three corners raised */
SpriteID upper = sprite_base + 15 + (f - 15 - 8 - 4) * 2;
AddSortableSpriteToDraw(upper, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z);
AddChildSpriteScreen(upper + 1, PAL_NONE, 31, 9);
OffsetGroundSprite(31, 9);
} else {
- // one corner raised
+ /* one corner raised */
OffsetGroundSprite(31, 1);
}
} else {
if (f < 15) {
- // leveled foundation
- // Use the original slope sprites if NW and NE borders should be visible
+ /* leveled foundation
+ * Use the original slope sprites if NW and NE borders should be visible */
if (sprite_base == SPR_SLOPES_BASE - 15) sprite_base = SPR_FOUNDATION_BASE;
AddSortableSpriteToDraw(sprite_base + f, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z);
@@ -257,7 +257,7 @@ void DrawFoundation(TileInfo *ti, uint f)
ti->tileh = SLOPE_FLAT;
OffsetGroundSprite(31, 1);
} else {
- // inclined foundation
+ /* inclined foundation */
AddSortableSpriteToDraw(sprite_base + f, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z);
ti->tileh = _inclined_tileh[f - 15];
OffsetGroundSprite(31, 9);
@@ -304,6 +304,7 @@ void GetTileDesc(TileIndex tile, TileDesc *td)
/** Clear a piece of landscape
* @param tile tile to clear
+ * @param flags of operation to conduct
* @param p1 unused
* @param p2 unused
*/
@@ -317,6 +318,7 @@ int32 CmdLandscapeClear(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/** Clear a big piece of landscape
* @param tile end tile of area dragging
* @param p1 start tile of area dragging
+ * @param flags of operation to conduct
* @param p2 unused
*/
int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
@@ -332,7 +334,7 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
- // make sure sx,sy are smaller than ex,ey
+ /* make sure sx,sy are smaller than ex,ey */
ex = TileX(tile);
ey = TileY(tile);
sx = TileX(p1);
@@ -357,9 +359,9 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
DoCommand(TileXY(x, y), 0, 0, flags, CMD_LANDSCAPE_CLEAR);
- // draw explosion animation...
+ /* draw explosion animation... */
if ((x == sx || x == ex) && (y == sy || y == ey)) {
- // big explosion in each corner, or small explosion for single tiles
+ /* big explosion in each corner, or small explosion for single tiles */
CreateEffectVehicleAbove(x * TILE_SIZE + TILE_SIZE / 2, y * TILE_SIZE + TILE_SIZE / 2, 2,
sy == ey && sx == ex ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
);
@@ -390,7 +392,7 @@ void RunTileLoop(void)
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
if (TileX(tile) < MapSizeX() - TILELOOP_SIZE) {
- tile += TILELOOP_SIZE; /* no overflow */
+ tile += TILELOOP_SIZE; // no overflow
} else {
tile = TILE_MASK(tile - TILELOOP_SIZE * (MapSizeX() / TILELOOP_SIZE - 1) + TileDiffXY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */
}
diff --git a/src/livery.h b/src/livery.h
index 76b5c7e28..18fa0b11c 100644
--- a/src/livery.h
+++ b/src/livery.h
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file livery.h */
+
#ifndef LIVERY_H
#define LIVERY_H
diff --git a/src/lzoconf.h b/src/lzoconf.h
index fa50113f4..a5b38c121 100644
--- a/src/lzoconf.h
+++ b/src/lzoconf.h
@@ -1,6 +1,6 @@
/* $Id$ */
-/* lzoconf.h -- configuration for the LZO real-time data compression library
+/** @file lzoconf.h -- configuration for the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
diff --git a/src/macros.h b/src/macros.h
index 00ef5af65..35964c07b 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,13 +1,15 @@
/* $Id$ */
+/** @file macros.h */
+
#ifndef MACROS_H
#define MACROS_H
-/// Fetch n bits starting at bit s from x
+/* Fetch n bits starting at bit s from x */
#define GB(x, s, n) (((x) >> (s)) & ((1U << (n)) - 1))
-/// Set n bits starting at bit s in x to d
+/* Set n bits starting at bit s in x to d */
#define SB(x, s, n, d) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | ((d) << (s)))
-/// Add i to the n bits starting at bit s in x
+/* Add i to the n bits starting at bit s in x */
#define AB(x, s, n, i) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | (((x) + ((i) << (s))) & (((1U << (n)) - 1) << (s))))
#ifdef min
@@ -79,7 +81,7 @@ template<typename T> static inline T TOGGLEBIT(T& x, int y)
}
-// checking more bits. Maybe unneccessary, but easy to use
+/* checking more bits. Maybe unneccessary, but easy to use */
#define HASBITS(x,y) ((x) & (y))
#define SETBITS(x,y) ((x) |= (y))
#define CLRBITS(x,y) ((x) &= ~(y))
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index b94b5fe74..f5933c5c7 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file main_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "heightmap.h"
@@ -60,25 +62,25 @@ void HandleOnEditText(const char *str)
_cmd_text = str;
switch (_rename_what) {
- case 0: /* Rename a s sign, if string is empty, delete sign */
+ case 0: // Rename a s sign, if string is empty, delete sign
DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME));
break;
- case 1: /* Rename a waypoint */
+ case 1: // Rename a waypoint
if (*str == '\0') return;
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
break;
#ifdef ENABLE_NETWORK
- case 3: { /* Give money, you can only give money in excess of loan */
+ case 3: { // Give money, you can only give money in excess of loan
const Player *p = GetPlayer(_current_player);
int32 money = min(p->money64 - p->current_loan, atoi(str) / _currency->rate);
char msg[20];
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
- // Give 'id' the money, and substract it from ourself
+ /* Give 'id' the money, and substract it from ourself */
if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS))) break;
- // Inform the player of this action
+ /* Inform the player of this action */
snprintf(msg, sizeof(msg), "%d", money);
if (!_network_server) {
@@ -103,7 +105,6 @@ void HandleOnEditText(const char *str)
* @param cursor How should the cursor image change? E.g. cursor with depot image in it
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
* @param placeproc Procedure which will be called when someone clicks on the map
-
* @return true if the button is clicked, false if it's unclicked
*/
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc)
@@ -526,7 +527,7 @@ static void UpdatePlayerMenuHeight(Window *w)
{
byte num = ActivePlayerCount();
- // Increase one to fit in PlayerList in the menu when in network
+ /* Increase one to fit in PlayerList in the menu when in network */
if (_networking && WP(w,menu_d).main_button == 9) num++;
if (WP(w,menu_d).item_count != num) {
@@ -556,7 +557,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
sel = WP(w,menu_d).sel_index;
chk = WP(w,menu_d).checked_items; // let this mean gray items.
- // 9 = playerlist
+ /* 9 = playerlist */
if (_networking && WP(w,menu_d).main_button == 9) {
if (sel == 0) {
GfxFillRect(x, y, x + 238, y + 9, 0);
@@ -601,8 +602,8 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y);
int action_id = WP(w,menu_d).action_id;
- // We have a new entry at the top of the list of menu 9 when networking
- // so keep that in count
+ /* We have a new entry at the top of the list of menu 9 when networking
+ * so keep that in count */
if (_networking && WP(w,menu_d).main_button == 9) {
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1;
} else {
@@ -628,8 +629,8 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
UpdatePlayerMenuHeight(w);
index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y);
- // We have a new entry at the top of the list of menu 9 when networking
- // so keep that in count
+ /* We have a new entry at the top of the list of menu 9 when networking
+ * so keep that in count */
if (_networking && WP(w,menu_d).main_button == 9) {
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1;
} else {
@@ -973,7 +974,7 @@ static void ToolbarScenSaveOrLoad(Window *w)
static void ToolbarScenDateBackward(Window *w)
{
- // don't allow too fast scrolling
+ /* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
HandleButtonClick(w, 6);
SetWindowDirty(w);
@@ -986,7 +987,7 @@ static void ToolbarScenDateBackward(Window *w)
static void ToolbarScenDateForward(Window *w)
{
- // don't allow too fast scrolling
+ /* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
HandleButtonClick(w, 7);
SetWindowDirty(w);
@@ -1041,12 +1042,12 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
}
}
-// TODO - Incorporate into game itself to allow for ingame raising/lowering of
-// larger chunks at the same time OR remove altogether, as we have 'level land' ?
/**
* Raise/Lower a bigger chunk of land at the same time in the editor. When
* raising get the lowest point, when lowering the highest point, and set all
* tiles in the selection to that height.
+ * @todo : Incorporate into game itself to allow for ingame raising/lowering of
+ * larger chunks at the same time OR remove altogether, as we have 'level land' ?
* @param tile The top-left tile where the terraforming will start
* @param mode 1 for raising, 0 for lowering land
*/
@@ -1066,7 +1067,7 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
SndPlayTileFx(SND_1F_SPLAT, tile);
assert(_terraform_size != 0);
- // check out for map overflows
+ /* check out for map overflows */
sizex = min(MapSizeX() - TileX(tile) - 1, _terraform_size);
sizey = min(MapSizeY() - TileY(tile) - 1, _terraform_size);
@@ -1174,8 +1175,10 @@ static const int8 _multi_terraform_coords[][2] = {
{-28, 0}, {-24, -2}, {-20, -4}, {-16, -6}, {-12, -8}, { -8,-10}, { -4,-12}, { 0,-14}, { 4,-12}, { 8,-10}, { 12, -8}, { 16, -6}, { 20, -4}, { 24, -2}, { 28, 0},
};
-// TODO - Merge with terraform_gui.c (move there) after I have cooled down at its braindeadness
-// and changed OnButtonClick to include the widget as well in the function decleration. Post 0.4.0 - Darkvater
+/**
+ * @todo Merge with terraform_gui.cpp (move there) after I have cooled down at its braindeadness
+ * and changed OnButtonClick to include the widget as well in the function declaration. Post 0.4.0 - Darkvater
+ */
static void EditorTerraformClick_Dynamite(Window *w)
{
HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
@@ -1271,7 +1274,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_CREATE:
- // XXX - lighthouse button is widget 10!! Don't forget when changing
+ /* XXX - lighthouse button is widget 10!! Don't forget when changing */
w->widget[10].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
break;
@@ -1311,7 +1314,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
_editor_terraform_button_proc[e->we.click.widget - 4](w);
break;
- case 12: case 13: { /* Increase/Decrease terraform size */
+ case 12: case 13: { // Increase/Decrease terraform size
int size = (e->we.click.widget == 12) ? 1 : -1;
HandleButtonClick(w, e->we.click.widget);
size += _terraform_size;
@@ -1322,11 +1325,11 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
} break;
- case 14: /* gen random land */
+ case 14: // gen random land
HandleButtonClick(w, 14);
ShowCreateScenario();
break;
- case 15: /* Reset landscape */
+ case 15: // Reset landscape
ShowQuery(
STR_022C_RESET_LANDSCAPE,
STR_RESET_LANDSCAPE_CONFIRMATION_TEXT,
@@ -1431,10 +1434,10 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
- case 4: /* new town */
+ case 4: // new town
HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, 1, PlaceProc_Town);
break;
- case 5: {/* random town */
+ case 5: {// random town
Town *t;
HandleButtonClick(w, 5);
@@ -1450,7 +1453,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
break;
}
- case 6: {/* many random towns */
+ case 6: {// many random towns
HandleButtonClick(w, 6);
_generating_world = true;
@@ -1605,7 +1608,7 @@ extern Industry *CreateNewIndustry(TileIndex tile, IndustryType type);
* Search callback function for TryBuildIndustry
* @param tile to test
* @param data that is passed by the caller. In this case, the type of industry been tested
- * @result of the operation
+ * @return the success (or not) of the operation
*/
static bool SearchTileForIndustry(TileIndex tile, uint32 data)
{
@@ -1617,6 +1620,7 @@ static bool SearchTileForIndustry(TileIndex tile, uint32 data)
* in order to find a suitable zone to create the desired industry
* @param tile to start search for
* @param type of the desired industry
+ * @return the success (or not) of the operation
*/
static bool TryBuildIndustry(TileIndex tile, int type)
{
@@ -1665,7 +1669,7 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
case WE_PLACE_OBJ: {
int type;
- // Show error if no town exists at all
+ /* Show error if no town exists at all */
type = _industry_type_to_place;
if (!AnyTownExists()) {
SetDParam(0, GetIndustrySpec(type)->name);
@@ -1804,7 +1808,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
- // Draw brown-red toolbar bg.
+ /* Draw brown-red toolbar bg. */
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
@@ -2017,7 +2021,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
SetWindowWidgetDisabledState(w, 6, _patches_newgame.starting_year <= MIN_YEAR);
SetWindowWidgetDisabledState(w, 7, _patches_newgame.starting_year >= MAX_YEAR);
- // Draw brown-red toolbar bg.
+ /* Draw brown-red toolbar bg. */
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
@@ -2155,12 +2159,12 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
);
if (p != NULL) {
- // Draw player money
+ /* Draw player money */
SetDParam64(0, p->money64);
DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
}
- // Draw status bar
+ /* Draw status bar */
if (w->message.msg) { // true when saving is active
DrawStringCentered(320, 1, STR_SAVING_GAME, 0);
} else if (_do_autosave) {
@@ -2168,12 +2172,12 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
} else if (_pause) {
DrawStringCentered(320, 1, STR_0319_PAUSED, 0);
} else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) {
- // Draw the scrolling news text
+ /* Draw the scrolling news text */
if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1))
WP(w,def_d).data_1 = -1280;
} else {
if (p != NULL) {
- // This is the default text
+ /* This is the default text */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
DrawStringCentered(320, 1, STR_02BA, 0);
@@ -2199,12 +2203,12 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
case WE_TICK: {
if (_pause) return;
- if (WP(w, def_d).data_1 > -1280) { /* Scrolling text */
+ if (WP(w, def_d).data_1 > -1280) { // Scrolling text
WP(w, def_d).data_1 -= 2;
InvalidateWidget(w, 1);
}
- if (WP(w, def_d).data_2 > 0) { /* Red blot to show there are new unread newsmessages */
+ if (WP(w, def_d).data_2 > 0) { // Red blot to show there are new unread newsmessages
WP(w, def_d).data_2 -= 2;
} else if (WP(w, def_d).data_2 < 0) {
WP(w, def_d).data_2 = 0;
@@ -2311,17 +2315,17 @@ static void MainWindowWndProc(Window *w, WindowEvent *e)
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break;
#if defined(_DEBUG)
- case '0' | WKC_ALT: /* Crash the game */
+ case '0' | WKC_ALT: // Crash the game
*(byte*)0 = 0;
break;
- case '1' | WKC_ALT: /* Gimme money */
+ case '1' | WKC_ALT: // Gimme money
/* Server can not cheat in advertise mode either! */
if (!_networking || !_network_server || !_network_advertise)
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT);
break;
- case '2' | WKC_ALT: /* Update the coordinates of all station signs */
+ case '2' | WKC_ALT: // Update the coordinates of all station signs
UpdateAllStationVirtCoord();
break;
#endif
@@ -2418,7 +2422,7 @@ void SetupColorsAndInitialWindow(void)
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL);
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), 0);
- // XXX: these are not done
+ /* XXX: these are not done */
switch (_game_mode) {
default: NOT_REACHED();
case GM_MENU:
diff --git a/src/map.cpp b/src/map.cpp
index ca590e92b..4ae44930a 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file map.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
@@ -25,8 +27,8 @@ Tile* _m = NULL;
void AllocateMap(uint size_x, uint size_y)
{
- // Make sure that the map size is within the limits and that
- // the x axis size is a power of 2.
+ /* Make sure that the map size is within the limits and that
+ * the x axis size is a power of 2. */
if (size_x < 64 || size_x > 2048 ||
size_y < 64 || size_y > 2048 ||
(size_x&(size_x-1)) != 0 ||
@@ -44,7 +46,7 @@ void AllocateMap(uint size_x, uint size_y)
free(_m);
_m = CallocT<Tile>(_map_size);
- // XXX TODO handle memory shortage more gracefully
+ /* XXX TODO handle memory shortage more gracefully */
if (_m == NULL) error("Failed to allocate memory for the map");
}
@@ -86,36 +88,36 @@ TileIndex TileAdd(TileIndex tile, TileIndexDiff add,
uint ScaleByMapSize(uint n)
{
- // First shift by 12 to prevent integer overflow for large values of n.
- // >>12 is safe since the min mapsize is 64x64
- // Add (1<<4)-1 to round upwards.
+ /* First shift by 12 to prevent integer overflow for large values of n.
+ * >>12 is safe since the min mapsize is 64x64
+ * Add (1<<4)-1 to round upwards. */
return (n * (MapSize() >> 12) + (1<<4) - 1) >> 4;
}
-// Scale relative to the circumference of the map
+/* Scale relative to the circumference of the map */
uint ScaleByMapSize1D(uint n)
{
- // Normal circumference for the X+Y is 256+256 = 1<<9
- // Note, not actually taking the full circumference into account,
- // just half of it.
- // (1<<9) - 1 is there to scale upwards.
+ /* Normal circumference for the X+Y is 256+256 = 1<<9
+ * Note, not actually taking the full circumference into account,
+ * just half of it.
+ * (1<<9) - 1 is there to scale upwards. */
return (n * (MapSizeX() + MapSizeY()) + (1<<9) - 1) >> 9;
}
-// This function checks if we add addx/addy to tile, if we
-// do wrap around the edges. For example, tile = (10,2) and
-// addx = +3 and addy = -4. This function will now return
-// INVALID_TILE, because the y is wrapped. This is needed in
-// for example, farmland. When the tile is not wrapped,
-// the result will be tile + TileDiffXY(addx, addy)
+/* This function checks if we add addx/addy to tile, if we
+ * do wrap around the edges. For example, tile = (10,2) and
+ * addx = +3 and addy = -4. This function will now return
+ * INVALID_TILE, because the y is wrapped. This is needed in
+ * for example, farmland. When the tile is not wrapped,
+ * the result will be tile + TileDiffXY(addx, addy) */
uint TileAddWrap(TileIndex tile, int addx, int addy)
{
uint x = TileX(tile) + addx;
uint y = TileY(tile) + addy;
- // Are we about to wrap?
+ /* Are we about to wrap? */
if (x < MapMaxX() && y < MapMaxY())
return tile + TileDiffXY(addx, addy);
@@ -123,21 +125,21 @@ uint TileAddWrap(TileIndex tile, int addx, int addy)
}
extern const TileIndexDiffC _tileoffs_by_diagdir[] = {
- {-1, 0}, // DIAGDIR_NE
- { 0, 1}, // DIAGDIR_SE
- { 1, 0}, // DIAGDIR_SW
- { 0, -1} // DIAGDIR_NW
+ {-1, 0}, ///< DIAGDIR_NE
+ { 0, 1}, ///< DIAGDIR_SE
+ { 1, 0}, ///< DIAGDIR_SW
+ { 0, -1} ///< DIAGDIR_NW
};
extern const TileIndexDiffC _tileoffs_by_dir[] = {
- {-1, -1}, // DIR_N
- {-1, 0}, // DIR_NE
- {-1, 1}, // DIR_E
- { 0, 1}, // DIR_SE
- { 1, 1}, // DIR_S
- { 1, 0}, // DIR_SW
- { 1, -1}, // DIR_W
- { 0, -1} // DIR_NW
+ {-1, -1}, ///< DIR_N
+ {-1, 0}, ///< DIR_NE
+ {-1, 1}, ///< DIR_E
+ { 0, 1}, ///< DIR_SE
+ { 1, 1}, ///< DIR_S
+ { 1, 0}, ///< DIR_SW
+ { 1, -1}, ///< DIR_W
+ { 0, -1} ///< DIR_NW
};
uint DistanceManhattan(TileIndex t0, TileIndex t1)
@@ -191,7 +193,7 @@ uint DistanceFromEdge(TileIndex tile)
* @param size: number of tiles per side of the desired search area
* @param proc: callback testing function pointer.
* @param data to be passed to the callback function. Depends on the implementation
- * @result of the search
+ * @return result of the search
* @pre proc != NULL
* @pre size > 0
*/
diff --git a/src/map.h b/src/map.h
index 10202e5c6..e76726c07 100644
--- a/src/map.h
+++ b/src/map.h
@@ -1,12 +1,14 @@
/* $Id$ */
+/** @file map.h */
+
#ifndef MAP_H
#define MAP_H
#include "stdafx.h"
-// Putting externs inside inline functions seems to confuse the aliasing
-// checking on MSVC6. Never use those variables directly.
+/* Putting externs inside inline functions seems to confuse the aliasing
+ * checking on MSVC6. Never use those variables directly. */
extern uint _map_log_x;
extern uint _map_size_x;
extern uint _map_size_y;
@@ -30,7 +32,7 @@ extern Tile* _m;
void AllocateMap(uint size_x, uint size_y);
-// binary logarithm of the map size, try to avoid using this one
+/* binary logarithm of the map size, try to avoid using this one */
static inline uint MapLogX(void) { return _map_log_x; }
/* The size of the map */
static inline uint MapSizeX(void) { return _map_size_x; }
@@ -41,7 +43,7 @@ static inline uint MapMaxY(void) { return _map_size_y - 1; }
/* The number of tiles in the map */
static inline uint MapSize(void) { return _map_size; }
-// Scale a number relative to the map size
+/* Scale a number relative to the map size */
uint ScaleByMapSize(uint); // Scale relative to the number of tiles
uint ScaleByMapSize1D(uint); // Scale relative to the circumference of the map
@@ -55,10 +57,10 @@ static inline TileIndex TileXY(uint x, uint y)
static inline TileIndexDiff TileDiffXY(int x, int y)
{
- // Multiplication gives much better optimization on MSVC than shifting.
- // 0 << shift isn't optimized to 0 properly.
- // Typically x and y are constants, and then this doesn't result
- // in any actual multiplication in the assembly code..
+ /* Multiplication gives much better optimization on MSVC than shifting.
+ * 0 << shift isn't optimized to 0 properly.
+ * Typically x and y are constants, and then this doesn't result
+ * in any actual multiplication in the assembly code.. */
return (y * MapSizeX()) + x;
}
@@ -73,9 +75,9 @@ enum {
};
enum {
- TILE_SIZE = 16, /* Tiles are 16x16 "units" in size */
- TILE_PIXELS = 32, /* a tile is 32x32 pixels */
- TILE_HEIGHT = 8, /* The standard height-difference between tiles on two levels is 8 (z-diff 8) */
+ TILE_SIZE = 16, ///< Tiles are 16x16 "units" in size
+ TILE_PIXELS = 32, ///< a tile is 32x32 pixels
+ TILE_HEIGHT = 8, ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)
};
@@ -132,12 +134,12 @@ static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC dif
return TileXY(x, y);
}
-// Functions to calculate distances
-uint DistanceManhattan(TileIndex, TileIndex); // also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
-uint DistanceSquare(TileIndex, TileIndex); // euclidian- or L2-Norm squared
-uint DistanceMax(TileIndex, TileIndex); // also known as L-Infinity-Norm
-uint DistanceMaxPlusManhattan(TileIndex, TileIndex); // Max + Manhattan
-uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
+/* Functions to calculate distances */
+uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
+uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared
+uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
+uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
+uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
#define BEGIN_TILE_LOOP(var,w,h,tile) \
diff --git a/src/md5.cpp b/src/md5.cpp
index 59728e78a..55f9f8240 100644
--- a/src/md5.cpp
+++ b/src/md5.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file md5.cpp */
+
/*
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
@@ -23,7 +25,7 @@
ghost@aladdin.com
*/
-/* $Id$ */
+
/*
Independent implementation of MD5 (RFC 1321).
diff --git a/src/md5.h b/src/md5.h
index c3c8888d9..42cddc392 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file md5.h */
+
/*
Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
@@ -23,7 +25,7 @@
ghost@aladdin.com
*/
-/* $Id$ */
+
/*
Independent implementation of MD5 (RFC 1321).
diff --git a/src/mersenne.cpp b/src/mersenne.cpp
index bc4cb949a..f387b1703 100644
--- a/src/mersenne.cpp
+++ b/src/mersenne.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file mersenne.cpp */
+
#include "stdafx.h"
#include "openttd.h"
diff --git a/src/minilzo.cpp b/src/minilzo.cpp
index ab26b0a02..e450ca88b 100644
--- a/src/minilzo.cpp
+++ b/src/minilzo.cpp
@@ -1,6 +1,6 @@
/* $Id$ */
-/* minilzo.c -- mini subset of the LZO real-time data compression library
+/* @file minilzo.cpp -- mini subset of the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
diff --git a/src/minilzo.h b/src/minilzo.h
index cf06a4c9c..505249e94 100644
--- a/src/minilzo.h
+++ b/src/minilzo.h
@@ -1,6 +1,6 @@
/* $Id$ */
-/* minilzo.h -- mini subset of the LZO real-time data compression library
+/* @file minilzo.h -- mini subset of the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
diff --git a/src/misc.cpp b/src/misc.cpp
index afb5da538..bfb1177cf 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file misc.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
@@ -234,7 +236,7 @@ void ConvertNameArray(void)
}
}
-// Calculate constants that depend on the landscape type.
+/* Calculate constants that depend on the landscape type. */
void InitializeLandscapeVariables(bool only_constants)
{
if (only_constants) return;
@@ -249,8 +251,8 @@ void InitializeLandscapeVariables(bool only_constants)
int FindFirstBit(uint32 value)
{
- // The macro FIND_FIRST_BIT is better to use when your value is
- // not more than 128.
+ /* The macro FIND_FIRST_BIT is better to use when your value is
+ not more than 128. */
byte i = 0;
if (value == 0) return 0;
@@ -310,8 +312,8 @@ static const SaveLoadGlobVarList _date_desc[] = {
SLEG_END()
};
-// Save load date related variables as well as persistent tick counters
-// XXX: currently some unrelated stuff is just put here
+/* Save load date related variables as well as persistent tick counters
+ * XXX: currently some unrelated stuff is just put here */
static void SaveLoad_DATE(void)
{
SlGlobList(_date_desc);
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index f0ddd2dfc..ff7ed7adb 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file misc_cmd.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 45f4ea6b5..b736de9c4 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file misc_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "hal.h"
@@ -249,7 +251,7 @@ static const char *credits[] = {
static void AboutWindowProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- case WE_CREATE: /* Set up window counter and start position of scroller */
+ case WE_CREATE: // Set up window counter and start position of scroller
WP(w, scroller_d).counter = 0;
WP(w, scroller_d).height = w->height - 40;
break;
@@ -258,11 +260,11 @@ static void AboutWindowProc(Window *w, WindowEvent *e)
int y = WP(w, scroller_d).height;
DrawWindowWidgets(w);
- // Show original copyright and revision version
+ /* Show original copyright and revision version */
DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, 0);
DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, 0);
- // Show all scrolling credits
+ /* Show all scrolling credits */
for (i = 0; i < lengthof(credits); i++) {
if (y >= 50 && y < (w->height - 40)) {
DoDrawString(credits[i], 10, y, 0x10);
@@ -270,13 +272,13 @@ static void AboutWindowProc(Window *w, WindowEvent *e)
y += 10;
}
- // If the last text has scrolled start anew from the start
+ /* If the last text has scrolled start anew from the start */
if (y < 50) WP(w, scroller_d).height = w->height - 40;
DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", 16);
DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
} break;
- case WE_MOUSELOOP: /* Timer to scroll the text and adjust the new top */
+ case WE_MOUSELOOP: // Timer to scroll the text and adjust the new top
if (WP(w, scroller_d).counter++ % 3 == 0) {
WP(w, scroller_d).height--;
SetWindowDirty(w);
@@ -369,7 +371,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e)
_tree_to_plant = -1;
break;
- case 16: /* place trees randomly over the landscape*/
+ case 16: // place trees randomly over the landscape
LowerWindowWidget(w, 16);
w->flags4 |= 5 << WF_TIMEOUT_SHL;
SndPlayFx(SND_15_BEEP);
@@ -545,7 +547,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
case WE_KEYPRESS:
if (e->we.keypress.keycode == WKC_SPACE) {
- // Don't continue.
+ /* Don't continue. */
e->we.keypress.cont = false;
DeleteWindow(w);
}
@@ -576,11 +578,11 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
pt = RemapCoords2(x, y);
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
- // move x pos to opposite corner
+ /* move x pos to opposite corner */
pt.x = ((pt.x - vp->virtual_left) >> vp->zoom) + vp->left;
pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - 260 : 20;
- // move y pos to opposite corner
+ /* move y pos to opposite corner */
pt.y = ((pt.y - vp->virtual_top) >> vp->zoom) + vp->top;
pt.y = (pt.y < (_screen.height >> 1)) ? _screen.height - 80 : 100;
@@ -1105,12 +1107,12 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
case WE_KEYPRESS:
switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) {
- case 1: goto press_ok; /* Enter pressed, confirms change */
- case 2: DeleteWindow(w); break; /* ESC pressed, closes window, abandons changes */
+ case 1: goto press_ok; // Enter pressed, confirms change
+ case 2: DeleteWindow(w); break; // ESC pressed, closes window, abandons changes
}
break;
- case WE_DESTROY: /* Call cancellation of query, if we have not handled it before */
+ case WE_DESTROY: // Call cancellation of query, if we have not handled it before
if (!qs->handled && w->parent != NULL) {
WindowEvent e;
Window *parent = w->parent;
@@ -1225,7 +1227,7 @@ static void QueryWndProc(Window *w, WindowEvent *e)
}
break;
- case WE_KEYPRESS: /* ESC closes the window, Enter confirms the action */
+ case WE_KEYPRESS: // ESC closes the window, Enter confirms the action
switch (e->we.keypress.keycode) {
case WKC_RETURN:
case WKC_NUM_ENTER:
@@ -1239,7 +1241,7 @@ static void QueryWndProc(Window *w, WindowEvent *e)
}
break;
- case WE_DESTROY: /* Call callback function (if any) on window close if not yet called */
+ case WE_DESTROY: // Call callback function (if any) on window close if not yet called
if (!q->calledback && q->proc != NULL) {
q->calledback = true;
q->proc(w->parent, false);
@@ -1327,7 +1329,7 @@ static const Widget _save_dialog_widgets[] = {
{ WIDGETS_END},
};
-// Colors for fios types
+/* Colors for fios types */
const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5, 6, 6, 8};
void BuildFileList(void)
@@ -1406,7 +1408,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
static FiosItem o_dir;
switch (e->event) {
- case WE_CREATE: { /* Set up OPENTTD button */
+ case WE_CREATE: { // Set up OPENTTD button
o_dir.type = FIOS_TYPE_DIRECT;
switch (_saveload_mode) {
case SLD_SAVE_GAME:
@@ -1466,27 +1468,27 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
- case 2: /* Sort save names by name */
+ case 2: // Sort save names by name
_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
_savegame_sort_dirty = true;
SetWindowDirty(w);
break;
- case 3: /* Sort save names by date */
+ case 3: // Sort save names by date
_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ?
SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE;
_savegame_sort_dirty = true;
SetWindowDirty(w);
break;
- case 6: /* OpenTTD 'button', jumps to OpenTTD directory */
+ case 6: // OpenTTD 'button', jumps to OpenTTD directory
FiosBrowseTo(&o_dir);
SetWindowDirty(w);
BuildFileList();
break;
- case 7: { /* Click the listbox */
+ case 7: { // Click the listbox
int y = (e->we.click.pt.y - w->widget[e->we.click.widget].top - 1) / 10;
char *name;
const FiosItem *file;
@@ -1513,20 +1515,20 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
DeleteWindow(w);
ShowHeightmapLoad();
} else {
- // SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox
+ /* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */
ttd_strlcpy(WP(w, querystr_d).text.buf, file->title, WP(w, querystr_d).text.maxlength);
UpdateTextBufferSize(&WP(w, querystr_d).text);
InvalidateWidget(w, 10);
}
} else {
- // Changed directory, need repaint.
+ /* Changed directory, need repaint. */
SetWindowDirty(w);
BuildFileList();
}
break;
}
- case 11: case 12: /* Delete, Save game */
+ case 11: case 12: // Delete, Save game
break;
}
break;
@@ -1542,7 +1544,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
}
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
- if (HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) /* Press Enter */
+ if (HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) // Press Enter
HandleButtonClick(w, 12);
}
break;
@@ -1551,7 +1553,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
* in those two saveload mode */
if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break;
- if (IsWindowWidgetLowered(w, 11)) { /* Delete button clicked */
+ if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked
if (!FiosDelete(WP(w,querystr_d).text.buf)) {
ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
} else {
@@ -1562,7 +1564,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
UpdateTextBufferSize(&WP(w, querystr_d).text);
SetWindowDirty(w);
- } else if (IsWindowWidgetLowered(w, 12)) { /* Save button clicked */
+ } else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked
_switch_mode = SM_SAVE;
FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name));
@@ -1571,7 +1573,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
}
break;
case WE_DESTROY:
- // pause is only used in single-player, non-editor mode, non menu mode
+ /* pause is only used in single-player, non-editor mode, non menu mode */
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
}
@@ -1652,8 +1654,8 @@ void ShowSaveLoadDialog(int mode)
WP(w, querystr_d).afilter = CS_ALPHANUMERAL;
InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240);
- // pause is only used in single-player, non-editor mode, non-menu mode. It
- // will be unpaused in the WE_DESTROY event handler.
+ /* pause is only used in single-player, non-editor mode, non-menu mode. It
+ * will be unpaused in the WE_DESTROY event handler. */
if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) {
DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
}
@@ -1703,7 +1705,10 @@ static int32 ClickMoneyCheat(int32 p1, int32 p2)
return true;
}
-// p1 player to set to, p2 is -1 or +1 (down/up)
+/**
+ * @param p1 player to set to
+ * @param p2 is -1 or +1 (down/up)
+ */
static int32 ClickChangePlayerCheat(int32 p1, int32 p2)
{
while (IsValidPlayer((PlayerID)p1)) {
@@ -1719,7 +1724,9 @@ static int32 ClickChangePlayerCheat(int32 p1, int32 p2)
return _local_player;
}
-// p1 -1 or +1 (down/up)
+/**
+ * @param p1 -1 or +1 (down/up)
+ */
static int32 ClickChangeClimateCheat(int32 p1, int32 p2)
{
if (p1 == -1) p1 = 3;
@@ -1731,7 +1738,9 @@ static int32 ClickChangeClimateCheat(int32 p1, int32 p2)
extern void EnginesMonthlyLoop(void);
-// p2 1 (increase) or -1 (decrease)
+/**
+ * @param p2 1 (increase) or -1 (decrease)
+ */
static int32 ClickChangeDateCheat(int32 p1, int32 p2)
{
YearMonthDay ymd;
@@ -1760,13 +1769,13 @@ typedef TinyEnumT<ce_flags_long> ce_flags;
typedef struct CheatEntry {
- VarType type; // type of selector
- ce_flags flags; // selector flags
- StringID str; // string with descriptive text
- void *variable; // pointer to the variable
- bool *been_used; // has this cheat been used before?
- CheckButtonClick *proc;// procedure
- int16 min, max; // range for spinbox setting
+ VarType type; ///< type of selector
+ ce_flags flags; ///< selector flags
+ StringID str; ///< string with descriptive text
+ void *variable; ///< pointer to the variable
+ bool *been_used; ///< has this cheat been used before?
+ CheckButtonClick *proc;///< procedure
+ int16 min, max; ///< range for spinbox setting
} CheatEntry;
static const CheatEntry _cheats_ui[] = {
@@ -1863,7 +1872,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
int32 value, oldvalue;
uint x = e->we.click.pt.x;
- // not clicking a button?
+ /* not clicking a button? */
if (!IS_INT_INSIDE(x, 20, 40) || btn >= lengthof(_cheats_ui)) break;
ce = &_cheats_ui[btn];
@@ -1887,7 +1896,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
value += (x >= 30) ? step : -step;
value = clamp(value, ce->min, ce->max);
- // take whatever the function returns
+ /* take whatever the function returns */
value = ce->proc(value, (x >= 30) ? 1 : -1);
if (value != oldvalue) {
diff --git a/src/mixer.cpp b/src/mixer.cpp
index 5037f771b..9ae831ae5 100644
--- a/src/mixer.cpp
+++ b/src/mixer.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file mixer.cpp*/
+
#include "stdafx.h"
#include "openttd.h"
#include "mixer.h"
@@ -7,16 +9,16 @@
struct MixerChannel {
bool active;
- // pointer to allocated buffer memory
+ /* pointer to allocated buffer memory */
int8 *memory;
- // current position in memory
+ /* current position in memory */
uint32 pos;
uint32 frac_pos;
uint32 frac_speed;
uint32 samples_left;
- // Mixing volume
+ /* Mixing volume */
uint volume_left;
uint volume_right;
@@ -46,7 +48,7 @@ static void mix_int8_to_int16(MixerChannel *sc, int16 *buffer, uint samples)
volume_right = sc->volume_right;
if (frac_speed == 0x10000) {
- // Special case when frac_speed is 0x10000
+ /* Special case when frac_speed is 0x10000 */
do {
buffer[0] += *b * volume_left >> 8;
buffer[1] += *b * volume_right >> 8;
@@ -79,10 +81,10 @@ void MxMixSamples(void *buffer, uint samples)
{
MixerChannel *mc;
- // Clear the buffer
+ /* Clear the buffer */
memset(buffer, 0, sizeof(int16) * 2 * samples);
- // Mix each channel
+ /* Mix each channel */
for (mc = _channels; mc != endof(_channels); mc++) {
if (mc->active) {
mix_int8_to_int16(mc, (int16*)buffer, samples);
@@ -111,7 +113,7 @@ void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint
mc->frac_speed = (rate << 16) / _play_rate;
- // adjust the magnitude to prevent overflow
+ /* adjust the magnitude to prevent overflow */
while (size & 0xFFFF0000) {
size >>= 1;
rate = (rate >> 1) + 1;
diff --git a/src/mixer.h b/src/mixer.h
index d50dc4739..a9af1a63f 100644
--- a/src/mixer.h
+++ b/src/mixer.h
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file mixer.h */
+
#ifndef MIXER_H
#define MIXER_H
diff --git a/src/music.cpp b/src/music.cpp
index 202690139..7698fd9e1 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file music.cpp */
+
#include "music.h"
const SongSpecs origin_songs_specs[NUM_SONGS_AVAILABLE] = {
diff --git a/src/music.h b/src/music.h
index a33565224..9a33b4319 100644
--- a/src/music.h
+++ b/src/music.h
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file music.h */
+
#ifndef MUSIC_H
#define MUSIC_H
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 143f252d9..cab85e9ba 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file music_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 80879e735..210d5a550 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -141,7 +141,7 @@ static Station* GetStationAround(TileIndex tile, int w, int h, StationID closest
* @param type the type of tile searched for
* @param industry when type == MP_INDUSTRY, the type of the industry,
* in all other cases this parameter is ignored
- * @result the noumber of matching tiles around
+ * @return the result the noumber of matching tiles around
*/
static int CountMapSquareAround(TileIndex tile, TileType type, IndustryType industry)
{
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 88880040e..e0eb03d73 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file town_cmd.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
@@ -1492,7 +1494,7 @@ static bool DoBuildStatueOfCompany(TileIndex tile)
/**
* Search callback function for TownActionBuildStatue
* @param data that is passed by the caller. In this case, nothing
- * @result of the test
+ * @return the result of the test
*/
static bool SearchTileForStatue(TileIndex tile, uint32 data)
{
diff --git a/src/yapf/yapf_common.cpp b/src/yapf/yapf_common.cpp
index 39d119858..31e3a7b2e 100644
--- a/src/yapf/yapf_common.cpp
+++ b/src/yapf/yapf_common.cpp
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file yapf_common.cpp */
+
#include "../stdafx.h"
#include "yapf.hpp"
@@ -10,20 +12,20 @@
/** translate tileh to the bitset of up-hill trackdirs */
const TrackdirBits CYapfCostBase::c_upwards_slopes[] = {
- TRACKDIR_BIT_NONE , // no tileh
- TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW, // 1
- TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE, // 2
- TRACKDIR_BIT_X_SW , // 3
- TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE, // 4
- TRACKDIR_BIT_NONE , // 5
- TRACKDIR_BIT_Y_SE , // 6
- TRACKDIR_BIT_NONE , // 7
- TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW, // 8,
- TRACKDIR_BIT_Y_NW , // 9
- TRACKDIR_BIT_NONE , //10
- TRACKDIR_BIT_NONE , //11,
- TRACKDIR_BIT_X_NE , //12
- TRACKDIR_BIT_NONE , //13
- TRACKDIR_BIT_NONE , //14
- TRACKDIR_BIT_NONE , //15
+ TRACKDIR_BIT_NONE , ///< no tileh
+ TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW, ///< 1
+ TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE, ///< 2
+ TRACKDIR_BIT_X_SW , ///< 3
+ TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE, ///< 4
+ TRACKDIR_BIT_NONE , ///< 5
+ TRACKDIR_BIT_Y_SE , ///< 6
+ TRACKDIR_BIT_NONE , ///< 7
+ TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW, ///< 8
+ TRACKDIR_BIT_Y_NW , ///< 9
+ TRACKDIR_BIT_NONE , ///< 10
+ TRACKDIR_BIT_NONE , ///< 11
+ TRACKDIR_BIT_X_NE , ///< 12
+ TRACKDIR_BIT_NONE , ///< 13
+ TRACKDIR_BIT_NONE , ///< 14
+ TRACKDIR_BIT_NONE , ///< 15
};