(svn r14461) -Document: add some doxygen comments (Albert)
authorrubidium
Mon, 13 Oct 2008 03:26:48 +0000
changeset 10233 ac41e2898d9b
parent 10232 6b0909324733
child 10234 84fbb9da6898
(svn r14461) -Document: add some doxygen comments (Albert)
src/gfx_type.h
src/landscape.cpp
src/landscape_type.h
src/sprite.h
src/table/station_land.h
src/tile_cmd.h
src/tile_type.h
src/viewport.cpp
--- a/src/gfx_type.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/gfx_type.h	Mon Oct 13 03:26:48 2008 +0000
@@ -12,9 +12,10 @@
 
 typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
 
+/** Combination of a palette sprite and a 'real' sprite */
 struct PalSpriteID {
-	SpriteID sprite;
-	SpriteID pal;
+	SpriteID sprite;  ///< The 'real' sprite
+	SpriteID pal;     ///< The palette (use \c PAL_NONE) if not needed)
 };
 typedef int32 CursorID;
 
--- a/src/landscape.cpp	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/landscape.cpp	Mon Oct 13 03:26:48 2008 +0000
@@ -67,7 +67,7 @@
 SnowLine *_snow_line = NULL;
 
 /**
- * Applys a foundation to a slope.
+ * Applies a foundation to a slope.
  *
  * @pre      Foundation and slope must be valid combined.
  * @param f  The #Foundation.
@@ -473,6 +473,12 @@
 	return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode, sub_mode, side);
 }
 
+/**
+ * Change the owner of a tile
+ * @param tile      Tile to change
+ * @param old_owner Current owner of the tile
+ * @param new_owner New owner of the tile
+ */
 void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
 {
 	_tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_owner, new_owner);
--- a/src/landscape_type.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/landscape_type.h	Mon Oct 13 03:26:48 2008 +0000
@@ -5,10 +5,10 @@
 #ifndef LANDSCAPE_TYPE_H
 #define LANDSCAPE_TYPE_H
 
-typedef byte LandscapeID;
+typedef byte LandscapeID; ///< Landscape type. @see LandscapeType
 
-/* Landscape types */
-enum {
+/** Landscape types */
+enum LandscapeType {
 	LT_TEMPERATE  = 0,
 	LT_ARCTIC     = 1,
 	LT_TROPIC     = 2,
--- a/src/sprite.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/sprite.h	Mon Oct 13 03:26:48 2008 +0000
@@ -23,8 +23,9 @@
  * bounding box. Used especially for various multi-sprite buildings (like
  * depots or stations): */
 
+/** A tile child sprite and palette to draw for stations etc, with 3D bounding box */
 struct DrawTileSeqStruct {
-	int8 delta_x; // 0x80 is sequence terminator
+	int8 delta_x; ///< \c 0x80 is sequence terminator
 	int8 delta_y;
 	int8 delta_z;
 	byte size_x;
@@ -33,9 +34,10 @@
 	PalSpriteID image;
 };
 
+/** Ground palette sprite of a tile, together with its child sprites */
 struct DrawTileSprites {
-	PalSpriteID ground;
-	const DrawTileSeqStruct *seq;
+	PalSpriteID ground;           ///< Palette and sprite for the ground
+	const DrawTileSeqStruct *seq; ///< Array of child sprites. Terminated with a terminator entry
 };
 
 /**
--- a/src/table/station_land.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/table/station_land.h	Mon Oct 13 03:26:48 2008 +0000
@@ -2,8 +2,30 @@
 
 /** @file station_land.h Sprites to use and how to display them for station tiles. */
 
+/**
+ * Constructor macro for an image without a palette in a DrawTileSeqStruct array.
+ * @param dx  Offset in x direction
+ * @param dy  Offset in y direction
+ * @param dz  Offset in z direction
+ * @param sx  Size in x direction
+ * @param sy  Size in y direction
+ * @param sz  Size in z direction
+ * @param img Sprite to draw
+ */
 #define TILE_SEQ_LINE(dx, dy, dz, sx, sy, sz, img) { dx, dy, dz, sx, sy, sz, {img, PAL_NONE} },
+/**
+ * Constructor macro for an image with a palette in a DrawTileSeqStruct array.
+ * @param dx  Offset in x direction
+ * @param dy  Offset in y direction
+ * @param dz  Offset in z direction
+ * @param sx  Size in x direction
+ * @param sy  Size in y direction
+ * @param sz  Size in z direction
+ * @param img Sprite to draw
+ * @param pal Paleltte sprite
+ */
 #define TILE_SEQ_LINE_PAL(dx, dy, dz, sx, sy, sz, img, pal) { dx, dy, dz, sx, sy, sz, {img, pal} },
+/** Constructor macro for a terminating DrawTileSeqStruct entry in an array */
 #define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, {0, 0} }
 
 static const DrawTileSeqStruct _station_display_nothing[] = {
@@ -995,6 +1017,11 @@
 #undef TILE_SEQ_LINE
 #undef TILE_SEQ_LINE_PAL
 
+/**
+ * Constructor macro of a DrawTileSprites structure
+ * @param img   Ground sprite without palette of the tile
+ * @param dtss  Sequence child sprites of the tile
+ */
 #define TILE_SPRITE_LINE(img, dtss) { {img, PAL_NONE}, dtss },
 
 static const DrawTileSprites _station_display_datas_rail[] = {
--- a/src/tile_cmd.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/tile_cmd.h	Mon Oct 13 03:26:48 2008 +0000
@@ -102,6 +102,9 @@
  */
 typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
 
+/**
+ * Set of callback functions for performing tile operations of a given tile type.
+ * @see TileType */
 struct TileTypeProcs {
 	DrawTileProc *draw_tile_proc;
 	GetSlopeZProc *get_slope_z_proc;
--- a/src/tile_type.h	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/tile_type.h	Mon Oct 13 03:26:48 2008 +0000
@@ -18,7 +18,7 @@
 
 
 /**
- * The different type of a tile.
+ * The different types of tiles.
  *
  * Each tile belongs to one type, according whatever is build on it.
  *
--- a/src/viewport.cpp	Sun Oct 12 17:43:52 2008 +0000
+++ b/src/viewport.cpp	Mon Oct 13 03:26:48 2008 +0000
@@ -83,6 +83,7 @@
 	int next;                       ///< next child to draw (-1 at the end)
 };
 
+/** Parent sprite that should be drawn */
 struct ParentSpriteToDraw {
 	SpriteID image;                 ///< sprite to draw
 	SpriteID pal;                   ///< palette to use
@@ -105,7 +106,7 @@
 	bool comparison_done;           ///< Used during sprite sorting: true if sprite has been compared with all other sprites
 };
 
-/* Enumeration of multi-part foundations */
+/** Enumeration of multi-part foundations */
 enum FoundationPart {
 	FOUNDATION_PART_NONE     = 0xFF,  ///< Neither foundation nor groundsprite drawn yet.
 	FOUNDATION_PART_NORMAL   = 0,     ///< First part (normal foundation or no foundation)
@@ -119,13 +120,14 @@
 typedef SmallVector<ParentSpriteToDraw*, 64> ParentSpriteToSortVector;
 typedef SmallVector<ChildScreenSpriteToDraw, 16> ChildScreenSpriteToDrawVector;
 
+/** Data structure storing rendering information */
 struct ViewportDrawer {
 	DrawPixelInfo dpi;
 
 	StringSpriteToDrawVector string_sprites_to_draw;
 	TileSpriteToDrawVector tile_sprites_to_draw;
 	ParentSpriteToDrawVector parent_sprites_to_draw;
-	ParentSpriteToSortVector parent_sprites_to_sort;
+	ParentSpriteToSortVector parent_sprites_to_sort; ///< Parent sprite pointer array used for sorting
 	ChildScreenSpriteToDrawVector child_screen_sprites_to_draw;
 
 	int *last_child;
@@ -356,6 +358,12 @@
 	return NULL;
 }
 
+/**
+ * Translate screen coordinate in a viewport to a tile coordinate
+ * @param vp  Viewport that contains the (\a x, \a y) screen coordinate
+ * @param x   Screen x coordinate
+ * @param y   Screen y coordinate
+ * @return Tile coordinate */
 static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
 {
 	Point pt;
@@ -1286,6 +1294,7 @@
 	}
 }
 
+/** Sort parent sprites pointer array */
 static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv)
 {
 	ParentSpriteToDraw **psdvend = psdv->End();