(svn r14461) -Document: add some doxygen comments (Albert)

This commit is contained in:
rubidium 2008-10-13 03:26:48 +00:00
parent c768516a61
commit 3ee482ca1b
8 changed files with 60 additions and 12 deletions

View File

@ -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;

View File

@ -67,7 +67,7 @@ const byte _tileh_to_sprite[32] = {
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 @@ TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode
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);

View File

@ -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,

View File

@ -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 @@ struct DrawTileSeqStruct {
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
};
/**

View File

@ -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 @@ static const DrawTileSeqStruct _station_display_datas_0171[] = {
#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[] = {

View File

@ -102,6 +102,9 @@ typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
*/
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;

View File

@ -18,7 +18,7 @@ enum {
/**
* The different type of a tile.
* The different types of tiles.
*
* Each tile belongs to one type, according whatever is build on it.
*

View File

@ -83,6 +83,7 @@ struct ChildScreenSpriteToDraw {
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 @@ struct ParentSpriteToDraw {
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> ParentSpriteToDrawVector;
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 @@ ViewPort *IsPtInWindowViewport(const Window *w, int x, int y)
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 @@ static void ViewportDrawTileSprites(const TileSpriteToDrawVector *tstdv)
}
}
/** Sort parent sprites pointer array */
static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv)
{
ParentSpriteToDraw **psdvend = psdv->End();