Changeset - r10233:f4b6f7cfa2ac
[Not reviewed]
master
0 8 0
rubidium - 16 years ago 2008-10-13 03:26:48
rubidium@openttd.org
(svn r14461) -Document: add some doxygen comments (Albert)
8 files changed with 60 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/gfx_type.h
Show inline comments
 
@@ -9,15 +9,16 @@
 
#include "core/enum_type.hpp"
 
#include "core/geometry_type.hpp"
 
#include "zoom_type.h"
 

	
 
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;
 

	
 
enum WindowKeyCodes {
 
	WKC_SHIFT = 0x8000,
 
	WKC_CTRL  = 0x4000,
src/landscape.cpp
Show inline comments
 
@@ -64,13 +64,13 @@ const byte _tileh_to_sprite[32] = {
 
	0, 0, 0, 0, 0, 0, 0, 16, 0, 0,  0, 17,  0, 15, 18, 0,
 
};
 

	
 
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.
 
 * @param s  The #Slope to modify.
 
 * @return   Increment to the tile Z coordinate.
 
 */
 
@@ -470,12 +470,18 @@ void DoClearSquare(TileIndex tile)
 
 */
 
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
 
{
 
	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);
 
}
 

	
 
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac)
src/landscape_type.h
Show inline comments
 
@@ -2,16 +2,16 @@
 

	
 
/** @file landscape_type.h Types related to the landscape. */
 

	
 
#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,
 
	LT_TOYLAND    = 3,
 

	
 
	NUM_LANDSCAPE = 4,
src/sprite.h
Show inline comments
 
@@ -20,25 +20,27 @@
 
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
 

	
 
/* The following describes bunch of sprites to be drawn together in a single 3D
 
 * 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;
 
	byte size_y;
 
	byte size_z;
 
	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
 
};
 

	
 
/**
 
 * This structure is the same for both Industries and Houses.
 
 * Buildings here reference a general type of construction
 
 */
src/table/station_land.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @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[] = {
 
	TILE_SEQ_END()
 
};
 

	
 
@@ -992,12 +1014,17 @@ static const DrawTileSeqStruct _station_
 
};
 

	
 
#undef TILE_SEQ_END
 
#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[] = {
 
	TILE_SPRITE_LINE(SPR_RAIL_TRACK_X,               _station_display_datas_0)
 
	TILE_SPRITE_LINE(SPR_RAIL_TRACK_Y,               _station_display_datas_1)
 
	TILE_SPRITE_LINE(SPR_RAIL_TRACK_X,               _station_display_datas_2)
src/tile_cmd.h
Show inline comments
 
@@ -99,12 +99,15 @@ typedef Foundation GetFoundationProc(Til
 
 * @param z_new     TileZ after terraforming.
 
 * @param tileh_new Slope after terraforming.
 
 * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
 
 */
 
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;
 
	ClearTileProc *clear_tile_proc;
 
	GetAcceptedCargoProc *get_accepted_cargo_proc;
 
	GetTileDescProc *get_tile_desc_proc;
src/tile_type.h
Show inline comments
 
@@ -15,13 +15,13 @@ enum {
 
	MAX_TILE_HEIGHT     = 15,                    ///< Maximum allowed tile height
 
	MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height
 
};
 

	
 

	
 
/**
 
 * The different type of a tile.
 
 * The different types of tiles.
 
 *
 
 * Each tile belongs to one type, according whatever is build on it.
 
 *
 
 * @note A railway with a crossing street is marked as MP_ROAD.
 
 */
 
enum TileType {
src/viewport.cpp
Show inline comments
 
@@ -80,12 +80,13 @@ struct ChildScreenSpriteToDraw {
 
	const SubSprite *sub;           ///< only draw a rectangular part of the sprite
 
	int32 x;
 
	int32 y;
 
	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
 
	const SubSprite *sub;           ///< only draw a rectangular part of the sprite
 

	
 
	int32 x;                        ///< screen X coordinate of sprite
 
@@ -102,13 +103,13 @@ struct ParentSpriteToDraw {
 
	int zmax;                       ///< maximal world Z coordinate of bounding box
 

	
 
	int first_child;                ///< the first child to draw.
 
	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)
 
	FOUNDATION_PART_HALFTILE = 1,     ///< Second part (halftile foundation)
 
	FOUNDATION_PART_END
 
};
 
@@ -116,19 +117,20 @@ enum FoundationPart {
 
typedef SmallVector<TileSpriteToDraw, 64> TileSpriteToDrawVector;
 
typedef SmallVector<StringSpriteToDraw, 4> StringSpriteToDrawVector;
 
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;
 

	
 
	byte combine_sprites;
 

	
 
@@ -353,12 +355,18 @@ ViewPort *IsPtInWindowViewport(const Win
 
			IsInsideMM(y, vp->top, vp->top + vp->height))
 
		return vp;
 

	
 
	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;
 
	int a,b;
 
	uint z;
 

	
 
@@ -1283,12 +1291,13 @@ static void ViewportDrawTileSprites(cons
 
	for (const TileSpriteToDraw *ts = tstdv->Begin(); ts != tsend; ++ts) {
 
		Point pt = RemapCoords(ts->x, ts->y, ts->z);
 
		DrawSprite(ts->image, ts->pal, pt.x, pt.y, ts->sub);
 
	}
 
}
 

	
 
/** Sort parent sprites pointer array */
 
static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv)
 
{
 
	ParentSpriteToDraw **psdvend = psdv->End();
 
	ParentSpriteToDraw **psd = psdv->Begin();
 
	while (psd != psdvend) {
 
		ParentSpriteToDraw *ps = *psd;
0 comments (0 inline, 0 general)