(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};

This commit is contained in:
rubidium 2007-03-07 12:11:48 +00:00
parent 36bb92ae24
commit 24c4d5b06d
138 changed files with 779 additions and 789 deletions

View File

@ -7,7 +7,7 @@
#include "../command.h"
/* How DoCommands look like for an AI */
typedef struct AICommand {
struct AICommand {
uint32 tile;
uint32 p1;
uint32 p2;
@ -17,22 +17,22 @@ typedef struct AICommand {
char *text;
uint uid;
struct AICommand *next;
} AICommand;
AICommand *next;
};
/* The struct for an AIScript Player */
typedef struct AIPlayer {
struct AIPlayer {
bool active; ///< Is this AI active?
AICommand *queue; ///< The commands that he has in his queue
AICommand *queue_tail; ///< The tail of this queue
} AIPlayer;
};
/* The struct to keep some data about the AI in general */
typedef struct AIStruct {
struct AIStruct {
/* General */
bool enabled; ///< Is AI enabled?
uint tick; ///< The current tick (something like _frame_counter, only for AIs)
} AIStruct;
};
VARDEF AIStruct _ai;
VARDEF AIPlayer _ai_player[MAX_PLAYERS];

View File

@ -446,12 +446,12 @@ static void AiStateDoReplaceVehicle(Player *p)
_veh_do_replace_proc[v->type - VEH_Train](p);
}
typedef struct FoundRoute {
struct FoundRoute {
int distance;
CargoID cargo;
void *from;
void *to;
} FoundRoute;
};
static Town *AiFindRandomTown()
{
@ -1824,12 +1824,12 @@ static TileIndex AiGetEdgeOfDefaultRailBlock(byte rule, TileIndex tile, byte cmd
return tile + ToTileIndexDiff(p->tileoffs) - TileOffsByDiagDir(*dir = p->attr);
}
typedef struct AiRailPathFindData {
struct AiRailPathFindData {
TileIndex tile;
TileIndex tile2;
int count;
bool flag;
} AiRailPathFindData;
};
static bool AiEnumFollowTrack(TileIndex tile, AiRailPathFindData *a, int track, uint length, byte *state)
{
@ -1858,7 +1858,7 @@ static bool AiDoFollowTrack(const Player* p)
return arpfd.count > 8;
}
typedef struct AiRailFinder {
struct AiRailFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@ -1873,7 +1873,7 @@ typedef struct AiRailFinder {
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
} AiRailFinder;
};
static const byte _ai_table_15[4][8] = {
{0, 0, 4, 3, 3, 1, 128 + 0, 64},
@ -2713,7 +2713,7 @@ static void AiStateBuildDefaultRoadBlocks(Player *p)
p->ai.state_mode = 255;
}
typedef struct {
struct AiRoadFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@ -2728,14 +2728,14 @@ typedef struct {
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
} AiRoadFinder;
};
typedef struct AiRoadEnum {
struct AiRoadEnum {
TileIndex dest;
TileIndex best_tile;
int best_track;
uint best_dist;
} AiRoadEnum;
};
static const byte _dir_by_track[] = {
0, 1, 0, 1, 2, 1,

View File

@ -372,9 +372,9 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
extern uint GetRailFoundation(Slope tileh, TrackBits bits); // XXX function declaration in .c
extern uint GetRoadFoundation(Slope tileh, RoadBits bits); // XXX function declaration in .c
extern uint GetBridgeFoundation(Slope tileh, Axis); // XXX function declaration in .c
typedef enum BridgeFoundations{
enum BridgeFoundation {
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
} BridgeFoundation;
};
// The most important function: it calculates the g-value
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)

View File

@ -8,12 +8,12 @@
#include "station_map.h"
#include "vehicle.h"
typedef enum AircraftSubTypes {
enum AircraftSubType {
AIR_HELICOPTER = 0,
AIR_AIRCRAFT = 2,
AIR_SHADOW = 4,
AIR_ROTOR = 6
} AircraftSubType;
};
/** Check if the aircraft type is a normal flying device; eg

View File

@ -112,17 +112,17 @@ static const uint64
NOTHING_block = 1 << 30;
typedef struct AirportMovingData {
struct AirportMovingData {
int16 x;
int16 y;
uint16 flag;
DirectionByte direction;
} AirportMovingData;
};
struct AirportFTAbuildup;
// Finite sTate mAchine --> FTA
typedef struct AirportFTAClass {
struct AirportFTAClass {
public:
enum Flags {
AIRPLANES = 0x1,
@ -167,19 +167,19 @@ typedef struct AirportFTAClass {
byte size_y;
byte delta_z; // Z adjustment for helicopter pads
byte catchment;
} AirportFTAClass;
};
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
// internal structure used in openttd - Finite sTate mAchine --> FTA
typedef struct AirportFTA {
struct AirportFTA *next; // possible extra movement choices from this position
struct AirportFTA {
AirportFTA *next; // possible extra movement choices from this position
uint64 block; // 64 bit blocks (st->airport_flags), should be enough for the most complex airports
byte position; // the position that an airplane is at
byte next_position; // next position from this position
byte heading; // heading (current orders), guiding an airplane to its target on an airport
} AirportFTA;
};
void InitializeAirports();
void UnInitializeAirports();

View File

@ -8,12 +8,12 @@
// state machine input struct (from external file, etc.)
// Finite sTate mAchine --> FTA
typedef struct AirportFTAbuildup {
struct AirportFTAbuildup {
byte position; // the position that an airplane is at
byte heading; // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
uint64 block; // the block this position is on on the airport (st->airport_flags)
byte next; // next position from this position
} AirportFTAbuildup;
};
///////////////////////////////////////////////////////////////////////
/////*********Movement Positions on Airports********************///////

View File

@ -27,7 +27,6 @@ enum{
AYSTAR_INVALID_NODE = -1,
};
typedef struct AyStarNode AyStarNode;
struct AyStarNode {
TileIndex tile;
int direction;
@ -35,7 +34,6 @@ struct AyStarNode {
};
// The resulting path has nodes looking like this.
typedef struct PathNode PathNode;
struct PathNode {
AyStarNode node;
// The parent of this item
@ -45,13 +43,12 @@ struct PathNode {
// For internal use only
// We do not save the h-value, because it is only needed to calculate the f-value.
// h-value should _always_ be the distance left to the end-tile.
typedef struct OpenListNode OpenListNode;
struct OpenListNode {
int g;
PathNode path;
};
typedef struct AyStar AyStar;
struct AyStar;
/*
* This function is called to check if the end-tile is found
* return values can be:

View File

@ -5,7 +5,7 @@
#ifndef BMP_H
#define BMP_H
typedef struct {
struct BmpInfo {
uint32 offset; ///< offset of bitmap data from .bmp file begining
uint32 width; ///< bitmap width
uint32 height; ///< bitmap height
@ -13,22 +13,22 @@ typedef struct {
uint16 bpp; ///< bits per pixel
uint32 compression; ///< compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
uint32 palette_size; ///< number of colors in palette
} BmpInfo;
};
typedef struct {
struct BmpData {
Colour *palette;
byte *bitmap;
} BmpData;
};
#define BMP_BUFFER_SIZE 1024
typedef struct {
struct BmpBuffer {
byte data[BMP_BUFFER_SIZE];
int pos;
int read;
FILE *file;
uint real_pos;
} BmpBuffer;
};
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file);
bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data);

View File

@ -11,7 +11,7 @@ enum {
/** Struct containing information about a single bridge type
*/
typedef struct Bridge {
struct Bridge {
Year avail_year; ///< the year in which the bridge becomes available
byte min_length; ///< the minimum length of the bridge (not counting start and end tile)
byte max_length; ///< the maximum length of the bridge (not counting start and end tile)
@ -22,7 +22,7 @@ typedef struct Bridge {
StringID material; ///< the string that contains the bridge description
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
byte flags; ///< bit 0 set: disable drawing of far pillars.
} Bridge;
};
extern const Bridge orig_bridge[MAX_BRIDGES];
extern Bridge _bridge[MAX_BRIDGES];

View File

@ -9,7 +9,7 @@
typedef uint32 CargoLabel;
typedef struct CargoSpec {
struct CargoSpec {
uint8 bitnum;
CargoLabel label;
uint32 grfid;
@ -35,7 +35,7 @@ typedef struct CargoSpec {
uint16 classes;
bool IsValid() const;
} CargoSpec;
};
extern uint32 _cargo_mask;

View File

@ -22,12 +22,12 @@
#include "genworld.h"
#include "industry.h"
typedef struct TerraformerHeightMod {
struct TerraformerHeightMod {
TileIndex tile;
byte height;
} TerraformerHeightMod;
};
typedef struct TerraformerState {
struct TerraformerState {
int height[4];
uint32 flags;
@ -40,7 +40,7 @@ typedef struct TerraformerState {
TileIndex *tile_table;
TerraformerHeightMod *modheight;
} TerraformerState;
};
static int TerraformAllowTileProcess(TerraformerState *ts, TileIndex tile)
{

View File

@ -12,14 +12,14 @@
/* ground type, m5 bits 2...4
* valid densities (bits 0...1) in comments after the enum
*/
typedef enum ClearGround {
enum ClearGround {
CLEAR_GRASS = 0, ///< 0-3
CLEAR_ROUGH = 1, ///< 3
CLEAR_ROCKS = 2, ///< 3
CLEAR_FIELDS = 3, ///< 3
CLEAR_SNOW = 4, ///< 0-3
CLEAR_DESERT = 5 ///< 1,3
} ClearGround;
};
static inline ClearGround GetClearGround(TileIndex t)

View File

@ -176,10 +176,10 @@ enum {
typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
typedef struct Command {
struct Command {
CommandProc *proc;
byte flags;
} Command;
};
//#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
#define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)

View File

@ -10,7 +10,7 @@
/* maximum length of a totally expanded command */
#define ICON_MAX_STREAMSIZE 1024
typedef enum IConsoleVarTypes {
enum IConsoleVarTypes {
ICONSOLE_VAR_BOOLEAN,
ICONSOLE_VAR_BYTE,
ICONSOLE_VAR_UINT16,
@ -18,19 +18,19 @@ typedef enum IConsoleVarTypes {
ICONSOLE_VAR_INT16,
ICONSOLE_VAR_INT32,
ICONSOLE_VAR_STRING
} IConsoleVarTypes;
};
typedef enum IConsoleModes {
enum IConsoleModes {
ICONSOLE_FULL,
ICONSOLE_OPENED,
ICONSOLE_CLOSED
} IConsoleModes;
};
typedef enum IConsoleHookTypes {
enum IConsoleHookTypes {
ICONSOLE_HOOK_ACCESS,
ICONSOLE_HOOK_PRE_ACTION,
ICONSOLE_HOOK_POST_ACTION
} IConsoleHookTypes;
};
/** --Hooks--
* Hooks are certain triggers get get accessed/executed on either
@ -38,11 +38,11 @@ typedef enum IConsoleHookTypes {
* for general flow of permissions or special action needed in some cases
*/
typedef bool IConsoleHook();
typedef struct IConsoleHooks{
struct IConsoleHooks{
IConsoleHook *access; ///< trigger when accessing the variable/command
IConsoleHook *pre; ///< trigger before the variable/command is changed/executed
IConsoleHook *post; ///< trigger after the variable/command is changed/executed
} IConsoleHooks;
};
/** --Commands--
* Commands are commands, or functions. They get executed once and any
@ -53,14 +53,13 @@ typedef struct IConsoleHooks{
*/
typedef bool (IConsoleCmdProc)(byte argc, char *argv[]);
struct IConsoleCmd;
typedef struct IConsoleCmd {
struct IConsoleCmd {
char *name; ///< name of command
struct IConsoleCmd *next; ///< next command in list
IConsoleCmd *next; ///< next command in list
IConsoleCmdProc *proc; ///< process executed when command is typed
IConsoleHooks hook; ///< any special trigger action that needs executing
} IConsoleCmd;
};
/** --Variables--
* Variables are pointers to real ingame variables which allow for
@ -71,10 +70,9 @@ typedef struct IConsoleCmd {
* - '++' to increase value by one
* - '--' to decrease value by one
*/
struct IConsoleVar;
typedef struct IConsoleVar {
struct IConsoleVar {
char *name; ///< name of the variable
struct IConsoleVar *next; ///< next variable in list
IConsoleVar *next; ///< next variable in list
void *addr; ///< the address where the variable is pointing at
uint32 size; ///< size of the variable, used for strings
@ -82,7 +80,7 @@ typedef struct IConsoleVar {
IConsoleVarTypes type; ///< type of variable (for correct assignment/output)
IConsoleCmdProc *proc; ///< some variables need really special handling, use a callback function for that
IConsoleHooks hook; ///< any special trigger action that needs executing
} IConsoleVar;
};
/** --Aliases--
* Aliases are like shortcuts for complex functions, variable assignments,
@ -95,13 +93,12 @@ typedef struct IConsoleVar {
* - "%!" also lists all parameters but presenting them to the aliased command as one argument
* - ";" allows for combining commands (see example 'ng')
*/
struct IConsoleAlias;
typedef struct IConsoleAlias {
struct IConsoleAlias {
char *name; ///< name of the alias
struct IConsoleAlias *next; ///< next alias in list
IConsoleAlias *next; ///< next alias in list
char *cmdline; ///< command(s) that is/are being aliased
} IConsoleAlias;
};
/* console parser */
VARDEF IConsoleCmd *_iconsole_cmds; ///< list of registred commands

View File

@ -12,7 +12,7 @@ enum {
CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1
};
typedef struct {
struct CurrencySpec {
uint16 rate;
char separator;
Year to_euro;
@ -29,7 +29,7 @@ typedef struct {
*/
byte symbol_pos;
StringID name;
} CurrencySpec;
};
extern CurrencySpec _currency_specs[NUM_CURRENCY];

View File

@ -44,11 +44,11 @@ typedef uint8 Month;
typedef uint8 Day;
typedef uint16 DateFract;
typedef struct YearMonthDay {
struct YearMonthDay {
Year year;
Month month;
Day day;
} YearMonthDay;
};
extern Year _cur_year;
extern Month _cur_month;

View File

@ -33,10 +33,10 @@ int _debug_sl_level;
int _debug_station_level;
typedef struct DebugLevel {
struct DebugLevel {
const char *name;
int *level;
} DebugLevel;
};
#define DEBUG_LEVEL(x) { #x, &_debug_##x##_level }
static const DebugLevel debug_level[] = {

View File

@ -290,10 +290,10 @@ static void DrawDepotWindow(Window *w)
}
}
typedef struct GetDepotVehiclePtData {
struct GetDepotVehiclePtData {
Vehicle *head;
Vehicle *wagon;
} GetDepotVehiclePtData;
};
enum {
MODE_ERROR = 1,

View File

@ -8,7 +8,7 @@
#include "helpers.hpp"
/* Direction as commonly used in v->direction, 8 way. */
typedef enum Direction {
enum Direction {
DIR_BEGIN = 0,
DIR_N = 0,
DIR_NE = 1, ///< Northeast, upper right on your monitor
@ -20,7 +20,7 @@ typedef enum Direction {
DIR_NW = 7,
DIR_END,
INVALID_DIR = 0xFF,
} Direction;
};
/** Define basic enum properties */
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {};
@ -32,14 +32,14 @@ static inline Direction ReverseDir(Direction d)
}
typedef enum DirDiff {
enum DirDiff {
DIRDIFF_SAME = 0,
DIRDIFF_45RIGHT = 1,
DIRDIFF_90RIGHT = 2,
DIRDIFF_REVERSE = 4,
DIRDIFF_90LEFT = 6,
DIRDIFF_45LEFT = 7
} DirDiff;
};
static inline DirDiff DirDifference(Direction d0, Direction d1)
{
@ -59,7 +59,7 @@ static inline Direction ChangeDir(Direction d, DirDiff delta)
/* Direction commonly used as the direction of entering and leaving tiles, 4-way */
typedef enum DiagDirection {
enum DiagDirection {
DIAGDIR_BEGIN = 0,
DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor
DIAGDIR_SE = 1,
@ -67,7 +67,7 @@ typedef enum DiagDirection {
DIAGDIR_NW = 3,
DIAGDIR_END,
INVALID_DIAGDIR = 0xFF,
} DiagDirection;
};
DECLARE_POSTFIX_INCREMENT(DiagDirection);
@ -81,12 +81,12 @@ static inline DiagDirection ReverseDiagDir(DiagDirection d)
}
typedef enum DiagDirDiff {
enum DiagDirDiff {
DIAGDIRDIFF_SAME = 0,
DIAGDIRDIFF_90RIGHT = 1,
DIAGDIRDIFF_REVERSE = 2,
DIAGDIRDIFF_90LEFT = 3
} DiagDirDiff;
};
static inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
{
@ -107,11 +107,11 @@ static inline Direction DiagDirToDir(DiagDirection dir)
/* the 2 axis */
typedef enum Axis {
enum Axis {
AXIS_X = 0,
AXIS_Y = 1,
AXIS_END
} Axis;
};
static inline Axis OtherAxis(Axis a)

View File

@ -30,17 +30,17 @@
#include "video/cocoa_v.h"
#include "video/win32_v.h"
typedef struct DriverDesc {
struct DriverDesc {
const char* name;
const char* longname;
const HalCommonDriver* drv;
} DriverDesc;
};
typedef struct DriverClass {
struct DriverClass {
const DriverDesc *descs;
const char *name;
const HalCommonDriver** drv;
} DriverClass;
};
#define M(x, y, z) { x, y, (const HalCommonDriver *)(void *)z }

View File

@ -901,12 +901,12 @@ void DeleteSubsidyWithStation(StationID index)
InvalidateWindow(WC_SUBSIDIES_LIST, 0);
}
typedef struct FoundRoute {
struct FoundRoute {
uint distance;
CargoID cargo;
void *from;
void *to;
} FoundRoute;
};
static void FindSubsidyPassengerRoute(FoundRoute *fr)
{

View File

@ -8,24 +8,24 @@
void ResetPriceBaseMultipliers();
void SetPriceBaseMultiplier(uint price, byte factor);
typedef struct {
struct Economy {
int32 max_loan; ///< Maximum possible loan
int32 max_loan_unround; ///< Economy fluctuation status
int fluct;
byte interest_rate; ///< Interest
byte infl_amount; ///< inflation amount
byte infl_amount_pr; ///< "floating" portion of inflation
} Economy;
};
VARDEF Economy _economy;
typedef struct Subsidy {
struct Subsidy {
CargoID cargo_type;
byte age;
/* from and to can either be TownID, StationID or IndustryID */
uint16 from;
uint16 to;
} Subsidy;
};
enum ScoreID {
@ -48,11 +48,11 @@ enum ScoreID {
DECLARE_POSTFIX_INCREMENT(ScoreID);
typedef struct ScoreInfo {
struct ScoreInfo {
byte id; ///< Unique ID of the score
int needed; ///< How much you need to get the perfect score
int score; ///< How much score it will give
} ScoreInfo;
};
extern const ScoreInfo _score_info[];
extern int _score_part[MAX_PLAYERS][SCORE_END];

View File

@ -16,7 +16,7 @@ enum RailVehicleTypes {
RAILVEH_WAGON, ///< simple wagon, not motorized
};
typedef struct RailVehicleInfo {
struct RailVehicleInfo {
byte image_index;
RailVehicleTypes railveh_type;
byte base_cost;
@ -39,9 +39,9 @@ typedef struct RailVehicleInfo {
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
byte tractive_effort; ///< Tractive effort coefficient
byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
} RailVehicleInfo;
};
typedef struct ShipVehicleInfo {
struct ShipVehicleInfo {
byte image_index;
byte base_cost;
uint16 max_speed;
@ -50,7 +50,7 @@ typedef struct ShipVehicleInfo {
byte running_cost;
SoundFxByte sfx;
bool refittable;
} ShipVehicleInfo;
};
/* AircraftVehicleInfo subtypes, bitmask type.
* If bit 0 is 0 then it is a helicopter, otherwise it is a plane
@ -61,7 +61,7 @@ enum {
AIR_FAST = 2
};
typedef struct AircraftVehicleInfo {
struct AircraftVehicleInfo {
byte image_index;
byte base_cost;
byte running_cost;
@ -71,9 +71,9 @@ typedef struct AircraftVehicleInfo {
uint16 max_speed;
byte mail_capacity;
uint16 passenger_capacity;
} AircraftVehicleInfo;
};
typedef struct RoadVehicleInfo {
struct RoadVehicleInfo {
byte image_index;
byte base_cost;
byte running_cost;
@ -81,12 +81,12 @@ typedef struct RoadVehicleInfo {
byte max_speed;
byte capacity;
CargoID cargo_type;
} RoadVehicleInfo;
};
/** Information about a vehicle
* @see table/engines.h
*/
typedef struct EngineInfo {
struct EngineInfo {
Date base_intro;
Year lifelength;
Year base_life;
@ -97,9 +97,9 @@ typedef struct EngineInfo {
byte refit_cost;
byte misc_flags;
byte callbackmask;
} EngineInfo;
};
typedef struct Engine {
struct Engine {
Date intro_date;
Date age;
uint16 reliability;
@ -112,7 +112,7 @@ typedef struct Engine {
byte preview_wait;
byte player_avail;
byte type; ///< type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
} Engine;
};
/**
* EngineInfo.misc_flags is a bitmask, with the following values
@ -261,11 +261,9 @@ struct EngineRenew {
EngineRenewID index;
EngineID from;
EngineID to;
struct EngineRenew *next;
EngineRenew *next;
};
typedef struct EngineRenew EngineRenew;
/**
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
* placed here so the only exception to this rule, the saveload code, can use

View File

@ -48,10 +48,10 @@ static const Widget _engine_preview_widgets[] = {
typedef void DrawEngineProc(int x, int y, EngineID engine, SpriteID pal);
typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw);
typedef struct DrawEngineInfo {
struct DrawEngineInfo {
DrawEngineProc *engine_proc;
DrawEngineInfoProc *info_proc;
} DrawEngineInfo;
};
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw);
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw);

View File

@ -18,7 +18,7 @@
#define FIO_BUFFER_SIZE 512
#define MAX_HANDLES 64
typedef struct {
struct Fio {
byte *buffer, *buffer_end; ///< position pointer in local buffer and last valid byte of buffer
uint32 pos; ///< current (system) position in file
FILE *cur_fh; ///< current file handle
@ -29,7 +29,7 @@ typedef struct {
const char *filename[MAX_HANDLES]; ///< array of filenames we (should) have open
uint usage_count[MAX_HANDLES]; ///< count how many times this file has been opened
#endif /* LIMITED_FDS */
} Fio;
};
static Fio _fio;

View File

@ -6,12 +6,12 @@
#define FIOS_H
/* Deals with finding savegames */
typedef struct {
struct FiosItem {
byte type;
uint64 mtime;
char title[64];
char name[256 - 12 - 64];
} FiosItem;
};
enum {
FIOS_TYPE_DRIVE = 0,
@ -56,15 +56,15 @@ int CDECL compare_FiosItems(const void *a, const void *b);
/* Implementation of opendir/readdir/closedir for Windows */
#if defined(WIN32)
#include <windows.h>
typedef struct DIR DIR;
struct DIR;
typedef struct dirent { // XXX - only d_name implemented
struct dirent { // XXX - only d_name implemented
wchar_t *d_name; // name of found file
/* little hack which will point to parent DIR struct which will
* save us a call to GetFileAttributes if we want information
* about the file (for example in function fio_bla) */
DIR *dir;
} dirent;
};
struct DIR {
HANDLE hFind;

View File

@ -315,10 +315,10 @@ static FT_Face GetFontFace(FontSize size)
}
typedef struct GlyphEntry {
struct GlyphEntry {
Sprite *sprite;
byte width;
} GlyphEntry;
};
/* The glyph cache. This is structured to reduce memory consumption.

View File

@ -14,14 +14,14 @@ void InitializeUnicodeGlyphMap();
#ifdef WITH_FREETYPE
typedef struct FreeTypeSettings {
struct FreeTypeSettings {
char small_font[260];
char medium_font[260];
char large_font[260];
uint small_size;
uint medium_size;
uint large_size;
} FreeTypeSettings;
};
extern FreeTypeSettings _freetype;

View File

@ -29,7 +29,7 @@ enum {
typedef void gw_done_proc();
typedef void gw_abort_proc();
typedef struct gw_info {
struct gw_info {
bool active; ///< Is generating world active
bool abort; ///< Whether to abort the thread ASAP
bool wait_for_draw; ///< Are we waiting on a draw event
@ -42,14 +42,14 @@ typedef struct gw_info {
gw_done_proc *proc; ///< Proc that is called when done (can be NULL)
gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
OTTDThread *thread; ///< The thread we are in (can be NULL)
} gw_info;
};
#ifdef TEMPORARY_OTTDTHREAD_DEFINITION
#undef OTTDThread
#undef TEMPORARY_OTTDTHREAD_DEFINITION
#endif
typedef enum gwp_classes {
enum gwp_class {
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy
GWP_LANDSCAPE, ///< Create the landscape
GWP_ROUGH_ROCKY, ///< Make rough and rocky areas
@ -61,7 +61,7 @@ typedef enum gwp_classes {
GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc
GWP_GAME_START, ///< Really prepare to start the game
GWP_CLASS_COUNT
} gwp_class;
};
/**
* Check if we are currently in the process of generating a world.

View File

@ -29,12 +29,12 @@
/**
* In what 'mode' the GenerateLandscapeWindowProc is.
*/
typedef enum glwp_modes {
enum glwp_modes {
GLWP_GENERATE,
GLWP_HEIGHTMAP,
GLWP_SCENARIO,
GLWP_END
} glwp_modes;
};
static uint _heightmap_x = 0;
static uint _heightmap_y = 0;
@ -740,13 +740,13 @@ static const Widget _show_terrain_progress_widgets[] = {
{ WIDGETS_END},
};
typedef struct tp_info {
struct tp_info {
uint percent;
StringID cls;
uint current;
uint total;
int timer;
} tp_info;
};
static tp_info _tp;

View File

@ -44,11 +44,11 @@ int _pal_last_dirty;
Colour _cur_palette[256];
byte _stringwidth_table[FS_END][224];
typedef enum BlitterModes {
enum BlitterMode {
BM_NORMAL,
BM_COLOUR_REMAP,
BM_TRANSPARENT,
} BlitterMode;
};
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode);
@ -718,7 +718,7 @@ void DrawSprite(SpriteID img, SpriteID pal, int x, int y)
}
}
typedef struct BlitterParams {
struct BlitterParams {
int start_x, start_y;
const byte *sprite;
Pixel *dst;
@ -726,7 +726,7 @@ typedef struct BlitterParams {
int width, height;
int width_org;
int pitch;
} BlitterParams;
};
static void GfxBlitTileZoomIn(BlitterParams *bp)
{

View File

@ -93,13 +93,13 @@ void CreateConsole();
typedef int32 CursorID;
typedef byte Pixel;
typedef struct Point {
struct Point {
int x,y;
} Point;
};
typedef struct Rect {
struct Rect {
int left,top,right,bottom;
} Rect;
};
/** A single sprite of a list of animated cursors */
struct AnimCursor {
@ -108,7 +108,7 @@ struct AnimCursor {
byte display_time; ///< Amount of ticks this sprite will be shown
};
typedef struct CursorVars {
struct CursorVars {
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
SpriteID sprite; ///< current image of cursor
@ -123,20 +123,20 @@ typedef struct CursorVars {
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
bool in_window; ///< mouse inside this window, determines drawing logic
} CursorVars;
};
typedef struct DrawPixelInfo {
struct DrawPixelInfo {
Pixel *dst_ptr;
int left, top, width, height;
int pitch;
uint16 zoom;
} DrawPixelInfo;
};
typedef struct Colour {
struct Colour {
byte r;
byte g;
byte b;
} Colour;
};
@ -181,12 +181,12 @@ void UndrawMouseCursor();
#include "helpers.hpp"
typedef enum FontSizes {
enum FontSize {
FS_NORMAL,
FS_SMALL,
FS_LARGE,
FS_END,
} FontSize;
};
DECLARE_POSTFIX_INCREMENT(FontSize);
@ -292,9 +292,9 @@ VARDEF byte _colour_gradient[16][8];
VARDEF bool _use_dos_palette;
typedef enum StringColorFlags {
enum StringColorFlags {
IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
} StringColorFlags;
};
#ifdef _DEBUG

View File

@ -18,15 +18,15 @@
#include "fontcache.h"
#include <string.h>
typedef struct MD5File {
struct MD5File {
const char * filename; ///< filename
md5_byte_t hash[16]; ///< md5 sum of the file
} MD5File;
};
typedef struct FileList {
struct FileList {
MD5File basic[4]; ///< grf files that always have to be loaded
MD5File landscape[3]; ///< landscape specific grf files
} FileList;
};
enum {
SKIP = 0xFFFE,

View File

@ -43,7 +43,7 @@ enum {
static const int64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn.
typedef struct GraphDrawer {
struct GraphDrawer {
uint excluded_data; ///< bitmask of the datasets that shouldn't be displayed.
byte num_dataset;
byte num_on_x_axis;
@ -65,7 +65,7 @@ typedef struct GraphDrawer {
StringID format_str_y_axis;
byte colors[GRAPH_MAX_DATASETS];
int64 cost[GRAPH_MAX_DATASETS][24]; ///< last 2 years
} GraphDrawer;
};
static void DrawGraph(const GraphDrawer *gw)
{

View File

@ -5,26 +5,26 @@
#ifndef HAL_H
#define HAL_H
typedef struct {
struct HalCommonDriver {
const char *(*start)(const char * const *parm);
void (*stop)();
} HalCommonDriver;
};
typedef struct {
struct HalVideoDriver {
const char *(*start)(const char * const *parm);
void (*stop)();
void (*make_dirty)(int left, int top, int width, int height);
void (*main_loop)();
bool (*change_resolution)(int w, int h);
void (*toggle_fullscreen)(bool fullscreen);
} HalVideoDriver;
};
typedef struct {
struct HalSoundDriver {
const char *(*start)(const char * const *parm);
void (*stop)();
} HalSoundDriver;
};
typedef struct {
struct HalMusicDriver {
const char *(*start)(const char * const *parm);
void (*stop)();
@ -32,7 +32,7 @@ typedef struct {
void (*stop_song)();
bool (*is_song_playing)();
void (*set_volume)(byte vol);
} HalMusicDriver;
};
extern HalMusicDriver *_music_driver;
extern HalSoundDriver *_sound_driver;

View File

@ -14,11 +14,11 @@ enum {
INVALID_INDUSTRY = 0xFFFF,
};
typedef enum IndustryLifeTypes {
enum IndustryLifeType {
INDUSTRYLIFE_NOT_CLOSABLE, ///< Industry can never close
INDUSTRYLIFE_PRODUCTION, ///< Industry can close and change of production
INDUSTRYLIFE_CLOSABLE, ///< Industry can only close (no production change)
} IndustryLifeType;
};
/**
* Defines the internal data of a functionnal industry
@ -49,15 +49,15 @@ struct Industry {
IndustryID index; ///< index of the industry in the pool of industries
};
typedef struct IndustryTileTable {
struct IndustryTileTable {
TileIndexDiffC ti;
IndustryGfx gfx;
} IndustryTileTable;
};
/**
* Defines the data structure for constructing industry.
*/
typedef struct IndustrySpec {
struct IndustrySpec {
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*/
@ -74,15 +74,15 @@ typedef struct IndustrySpec {
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 {
struct IndustryTileSpec {
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); ///< Array of industries default data
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data

View File

@ -166,10 +166,10 @@ static inline void ResetIndustryConstructionStage(TileIndex tile)
_m[tile].m1 = 0;
}
typedef struct IndustryTypeSolver {
struct IndustryTypeSolver {
IndustryGfx MinGfx;
IndustryGfx MaxGfx;
} IndustryTypeSolver;
};
static const IndustryTypeSolver industry_gfx_Solver [IT_END] = {
{ 0, 6}, ///< IT_COAL_MINE

View File

@ -8,7 +8,7 @@
#include "helpers.hpp"
/* List of different livery schemes. */
typedef enum LiverySchemes {
enum LiveryScheme {
LS_BEGIN = 0,
LS_DEFAULT = 0,
@ -39,25 +39,25 @@ typedef enum LiverySchemes {
LS_LARGE_PLANE,
LS_END
} LiveryScheme;
};
DECLARE_POSTFIX_INCREMENT(LiveryScheme);
/* List of different livery classes, used only by the livery GUI. */
typedef enum LiveryClasses {
enum LiveryClass {
LC_OTHER,
LC_RAIL,
LC_ROAD,
LC_SHIP,
LC_AIRCRAFT,
LC_END
} LiveryClass;
};
typedef struct Livery {
struct Livery {
bool in_use; ///< Set if this livery should be used instead of the default livery.
byte colour1; ///< First colour, for all vehicles.
byte colour2; ///< Second colour, for vehicles with 2CC support.
} Livery;
};
#endif /* LIVERY_H */

View File

@ -18,7 +18,7 @@ extern uint _map_size;
#define TILE_MASK(x) ((x) & _map_tile_mask)
#define TILE_ASSERT(x) assert(TILE_MASK(x) == (x));
typedef struct Tile {
struct Tile {
byte type_height;
byte m1;
uint16 m2;
@ -26,7 +26,7 @@ typedef struct Tile {
byte m4;
byte m5;
byte m6;
} Tile;
};
extern Tile* _m;
@ -92,10 +92,10 @@ static inline uint TileY(TileIndex tile)
}
typedef struct TileIndexDiffC {
struct TileIndexDiffC {
int16 x;
int16 y;
} TileIndexDiffC;
};
static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
{

View File

@ -68,11 +68,11 @@ typedef unsigned char md5_byte_t; /* 8-bit byte */
typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
struct md5_state_t {
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
};
/* Initialize the algorithm. */
void md5_init(md5_state_t *pms);

View File

@ -1191,12 +1191,12 @@ enum QueryWidgets {
};
typedef struct query_d {
struct query_d {
void (*proc)(Window*, bool); ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise
StringID message; ///< message shown for query window
uint32 params[20]; ///< local copy of _decode_parameters
bool calledback; ///< has callback been executed already (internal usage for WE_DESTROY event)
} query_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d));
@ -1766,7 +1766,7 @@ template <> struct EnumPropsT<ce_flags_long> : MakeEnumPropsT<ce_flags_long, byt
typedef TinyEnumT<ce_flags_long> ce_flags;
typedef struct CheatEntry {
struct CheatEntry {
VarType type; ///< type of selector
ce_flags flags; ///< selector flags
StringID str; ///< string with descriptive text
@ -1774,7 +1774,7 @@ typedef struct CheatEntry {
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[] = {
{SLE_BOOL, {CE_CLICK}, STR_CHEAT_MONEY, &_cheats.money.value, &_cheats.money.been_used, &ClickMoneyCheat, 0, 0},

View File

@ -5,7 +5,7 @@
#ifndef MIXER_H
#define MIXER_H
typedef struct MixerChannel MixerChannel;
struct MixerChannel;
enum {
MX_AUTOFREE = 1,

View File

@ -8,10 +8,10 @@
#define NUM_SONGS_PLAYLIST 33
#define NUM_SONGS_AVAILABLE 22
typedef struct SongSpecs {
struct SongSpecs {
char filename[256];
char song_name[64];
} SongSpecs;
};
extern const SongSpecs origin_songs_specs[NUM_SONGS_AVAILABLE];

View File

@ -16,7 +16,7 @@ bool NetworkCoreInitialize();
void NetworkCoreShutdown();
/** Status of a network client; reasons why a client has quit */
typedef enum {
enum NetworkRecvStatus {
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs
@ -27,7 +27,7 @@ typedef enum {
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done quering the server
} NetworkRecvStatus;
};
/** Forward declaration due to circular dependencies */
struct Packet;

View File

@ -19,7 +19,7 @@
* some fields will be empty on the client (like game_password) by default
* and only filled with data a player enters.
*/
typedef struct NetworkGameInfo {
struct NetworkGameInfo {
byte game_info_version; ///< Version of the game info
char server_name[NETWORK_NAME_LENGTH]; ///< Server name
char hostname[NETWORK_HOSTNAME_LENGTH]; ///< Hostname of the server (if any)
@ -43,8 +43,8 @@ typedef struct NetworkGameInfo {
byte map_set; ///< Graphical set
bool dedicated; ///< Is this a dedicated server?
char rcon_password[NETWORK_PASSWORD_LENGTH]; ///< RCon password for the server. "" if rcon is disabled
struct GRFConfig *grfconfig; ///< List of NewGRF files used
} NetworkGameInfo;
GRFConfig *grfconfig; ///< List of NewGRF files used
};
#endif /* ENABLE_NETWORK */

View File

@ -58,8 +58,8 @@ enum {
};
/** Packet that wraps a command */
typedef struct CommandPacket {
struct CommandPacket *next; ///< the next command packet (if in queue)
struct CommandPacket {
CommandPacket *next; ///< the next command packet (if in queue)
PlayerByte player; ///< player that is executing the command
uint32 cmd; ///< command being executed
uint32 p1; ///< parameter p1
@ -68,10 +68,10 @@ typedef struct CommandPacket {
char text[80]; ///< possible text sent for name changes etc
uint32 frame; ///< the frame in which this packet is executed
byte callback; ///< any callback function executed upon successful completion of the command
} CommandPacket;
};
/** Status of a client */
typedef enum {
enum ClientStatus {
STATUS_INACTIVE, ///< The client is not connected nor active
STATUS_AUTHORIZING,///< The client is authorizing
STATUS_AUTH, ///< The client is authorized
@ -80,7 +80,7 @@ typedef enum {
STATUS_DONE_MAP, ///< The client has downloaded the map
STATUS_PRE_ACTIVE, ///< The client is catching up the delayed frames
STATUS_ACTIVE, ///< The client is an active player in the game
} ClientStatus;
};
/** Base socket handler for all TCP sockets */
class NetworkTCPSocketHandler : public NetworkSocketHandler {

View File

@ -40,7 +40,7 @@
#define NETWORK_VEHICLE_TYPES 5
#define NETWORK_STATION_TYPES 5
typedef struct NetworkPlayerInfo {
struct NetworkPlayerInfo {
char company_name[NETWORK_NAME_LENGTH]; // Company name
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player
Year inaugurated_year; // What year the company started in
@ -53,9 +53,9 @@ typedef struct NetworkPlayerInfo {
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type?
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..)
uint16 months_empty; // How many months the company is empty
} NetworkPlayerInfo;
};
typedef struct NetworkClientInfo {
struct NetworkClientInfo {
uint16 client_index; // Index of the client (same as ClientState->index)
char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client
byte client_lang; // The language of the client
@ -63,9 +63,9 @@ typedef struct NetworkClientInfo {
uint32 client_ip; // IP-address of the client (so he can be banned)
Date join_date; // Gamedate the player has joined
char unique_id[NETWORK_NAME_LENGTH]; // Every play sends an unique id so we can indentify him
} NetworkClientInfo;
};
typedef enum {
enum NetworkJoinStatus {
NETWORK_JOIN_STATUS_CONNECTING,
NETWORK_JOIN_STATUS_AUTHORIZING,
NETWORK_JOIN_STATUS_WAITING,
@ -74,15 +74,15 @@ typedef enum {
NETWORK_JOIN_STATUS_REGISTERING,
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
} NetworkJoinStatus;
};
// language ids for server_lang and client_lang
typedef enum {
enum NetworkLanguage {
NETLANG_ANY = 0,
NETLANG_ENGLISH = 1,
NETLANG_GERMAN = 2,
NETLANG_FRENCH = 3,
} NetworkLanguage;
};
VARDEF NetworkGameInfo _network_game_info;
VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];

View File

@ -20,13 +20,13 @@
#define NETWORK_SERVER_INDEX 1
#define NETWORK_EMPTY_INDEX 0
typedef enum {
enum MapPacket {
MAP_PACKET_START,
MAP_PACKET_NORMAL,
MAP_PACKET_END,
} MapPacket;
};
typedef enum {
enum NetworkErrorCode {
NETWORK_ERROR_GENERAL, // Try to use thisone like never
// Signals from clients
@ -46,10 +46,10 @@ typedef enum {
NETWORK_ERROR_KICKED,
NETWORK_ERROR_CHEATER,
NETWORK_ERROR_FULL,
} NetworkErrorCode;
};
// Actions that can be used for NetworkTextMessage
typedef enum {
enum NetworkAction {
NETWORK_ACTION_JOIN,
NETWORK_ACTION_LEAVE,
NETWORK_ACTION_SERVER_MESSAGE,
@ -58,18 +58,18 @@ typedef enum {
NETWORK_ACTION_CHAT_CLIENT,
NETWORK_ACTION_GIVE_MONEY,
NETWORK_ACTION_NAME_CHANGE,
} NetworkAction;
};
typedef enum {
enum NetworkPasswordType {
NETWORK_GAME_PASSWORD,
NETWORK_COMPANY_PASSWORD,
} NetworkPasswordType;
};
typedef enum {
enum DestType {
DESTTYPE_BROADCAST, ///< Send message/notice to all players (All)
DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team)
DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private)
} DestType;
};
// following externs are instantiated at network.cpp
extern CommandPacket *_local_command_queue;

View File

@ -32,20 +32,20 @@
#define BGC 5
#define BTC 15
typedef struct network_d {
struct network_d {
PlayerID company; // select company in network lobby
byte field; // select text-field in start-server and game-listing
NetworkGameList *server; // selected server in lobby and game-listing
FiosItem *map; // selected map in start-server
} network_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
typedef struct network_ql_d {
struct network_ql_d {
network_d n; // see above; general stuff
querystr_d q; // text-input in start-server and game-listing
NetworkGameList **sort_list; // list of games (sorted)
list_d l; // accompanying list-administration
} network_ql_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
/* Global to remember sorting after window has been closed */

View File

@ -73,15 +73,15 @@ static const uint _default_cargo_max = 27;
static CargoLabel _default_cargo_list[_default_cargo_max];
typedef enum GrfDataType {
enum GrfDataType {
GDT_SOUND,
} GrfDataType;
};
static byte _grf_data_blocks;
static GrfDataType _grf_data_type;
typedef enum grfspec_feature {
enum grfspec_feature {
GSF_TRAIN,
GSF_ROAD,
GSF_SHIP,
@ -95,7 +95,7 @@ typedef enum grfspec_feature {
GSF_INDUSTRIES,
GSF_CARGOS,
GSF_SOUNDFX,
} grfspec_feature;
};
typedef void (*SpecialSpriteHandler)(byte *buf, int len);

View File

@ -8,31 +8,31 @@
#include "helpers.hpp"
#include "cargotype.h"
typedef enum GrfLoadingStage {
enum GrfLoadingStage {
GLS_FILESCAN,
GLS_SAFETYSCAN,
GLS_LABELSCAN,
GLS_INIT,
GLS_ACTIVATION,
GLS_END,
} GrfLoadingStage;
};
DECLARE_POSTFIX_INCREMENT(GrfLoadingStage);
typedef struct GRFLabel {
struct GRFLabel {
byte label;
uint32 nfo_line;
uint32 pos;
struct GRFLabel *next;
} GRFLabel;
};
typedef struct GRFFile {
struct GRFFile {
char *filename;
uint32 grfid;
uint16 sprite_offset;
byte grf_version;
struct GRFFile *next;
GRFFile *next;
/* A sprite group contains all sprites of a given vehicle (or multiple
* vehicles) when carrying given cargo. It consists of several sprite
@ -65,7 +65,7 @@ typedef struct GRFFile {
uint8 cargo_max;
CargoLabel *cargo_list;
uint8 cargo_map[NUM_CARGO];
} GRFFile;
};
extern GRFFile *_first_grffile;

View File

@ -364,7 +364,6 @@ const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum)
#ifdef ENABLE_NETWORK
/** Structure for UnknownGRFs; this is a lightweight variant of GRFConfig */
typedef struct UnknownGRF UnknownGRF;
struct UnknownGRF : public GRFIdentifier {
UnknownGRF *next;
char name[NETWORK_GRF_NAME_LENGTH];

View File

@ -6,42 +6,42 @@
#include "openttd.h"
/* GRF config bit flags */
typedef enum {
enum GCF_Flags {
GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
GCF_UNSAFE, ///< GRF file is unsafe for static usage
GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
GCF_COMPATIBLE,///< GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
GCF_COPY, ///< The data is copied from a grf in _all_grfs
} GCF_Flags;
};
typedef enum {
enum GRFStatus {
GCS_UNKNOWN, ///< The status of this grf file is unknown
GCS_DISABLED, ///< GRF file is disabled
GCS_NOT_FOUND, ///< GRF file was not found in the local cache
GCS_INITIALISED, ///< GRF file has been initialised
GCS_ACTIVATED ///< GRF file has been activated
} GRFStatus;
};
typedef enum {
enum GRFListCompatibility{
GLC_ALL_GOOD,
GLC_COMPATIBLE,
GLC_NOT_FOUND
} GRFListCompatibility;
};
typedef struct GRFIdentifier {
struct GRFIdentifier {
uint32 grfid;
uint8 md5sum[16];
} GRF;
};
typedef struct GRFError {
struct GRFError {
StringID message;
StringID data;
StringID severity;
uint8 num_params;
uint8 param_number[2];
} GRFError;
};
typedef struct GRFConfig : public GRFIdentifier {
struct GRFConfig : public GRFIdentifier {
char *filename;
char *name;
char *info;
@ -53,7 +53,7 @@ typedef struct GRFConfig : public GRFIdentifier {
uint8 num_params;
struct GRFConfig *next;
} GRFConfig;
};
/* First item in list of all scanned NewGRFs */
extern GRFConfig *_all_grfs;

View File

@ -24,17 +24,17 @@
int _traininfo_vehicle_pitch = 0;
int _traininfo_vehicle_width = 29;
typedef struct WagonOverride {
struct WagonOverride {
byte *train_id;
int trains;
CargoID cargo;
const SpriteGroup *group;
} WagonOverride;
};
typedef struct WagonOverrides {
struct WagonOverrides {
int overrides_count;
WagonOverride *overrides;
} WagonOverrides;
};
static WagonOverrides _engine_wagon_overrides[TOTAL_NUM_ENGINES];

View File

@ -36,7 +36,7 @@ bool UsesWagonOverride(const Vehicle *v);
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
typedef enum VehicleTrigger {
enum VehicleTrigger {
VEHICLE_TRIGGER_NEW_CARGO = 1,
// Externally triggered only for the first vehicle in chain
VEHICLE_TRIGGER_DEPOT = 2,
@ -44,7 +44,7 @@ typedef enum VehicleTrigger {
VEHICLE_TRIGGER_EMPTY = 4,
// Not triggered externally (called for the whole chain if we got NEW_CARGO)
VEHICLE_TRIGGER_ANY_NEW_CARGO = 8,
} VehicleTrigger;
};
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
void SetCustomEngineName(EngineID engine, StringID name);

View File

@ -106,10 +106,10 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show
/* Dialogue for adding NewGRF files to the selection */
typedef struct newgrf_add_d {
struct newgrf_add_d {
GRFConfig **list;
const GRFConfig *sel;
} newgrf_add_d;
};
static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e)
@ -236,14 +236,14 @@ static const WindowDesc _newgrf_add_dlg_desc = {
/* 'NewGRF Settings' dialogue */
typedef struct newgrf_d {
struct newgrf_d {
GRFConfig **orig_list; ///< grf list the window is shown with
GRFConfig **list; ///< temporary grf list to which changes are made
GRFConfig *sel; ///< selected grf item
bool editable; ///< is the window editable
bool show_params; ///< are the grf-parameters shown in the info-panel
bool execute; ///< on pressing 'apply changes' are grf changes applied immediately, or only list is updated
} newgrf_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(newgrf_d));

View File

@ -3,7 +3,7 @@
#ifndef NEWGRF_SOUND_H
#define NEWGRF_SOUND_H
typedef enum VehicleSoundEvents {
enum VehicleSoundEvent {
VSE_START = 1,
VSE_TUNNEL = 2,
VSE_BREAKDOWN = 3,
@ -13,7 +13,7 @@ typedef enum VehicleSoundEvents {
VSE_RUNNING_16 = 7,
VSE_STOPPED_16 = 8,
VSE_LOAD_UNLOAD = 9,
} VehicleSoundEvent;
};
FileEntry *AllocateFileEntry();

View File

@ -4,12 +4,12 @@
#define NEWGRF_SPRITEGROUP_H
typedef struct SpriteGroup SpriteGroup;
struct SpriteGroup;
/* 'Real' sprite groups contain a list of other result or callback sprite
* groups. */
typedef struct RealSpriteGroup {
struct RealSpriteGroup {
// Loaded = in motion, loading = not moving
// Each group contains several spritesets, for various loading stages
@ -21,28 +21,28 @@ typedef struct RealSpriteGroup {
byte num_loading; ///< Number of loading groups
const SpriteGroup **loaded; ///< List of loaded groups (can be SpriteIDs or Callback results)
const SpriteGroup **loading; ///< List of loading groups (can be SpriteIDs or Callback results)
} RealSpriteGroup;
};
/* Shared by deterministic and random groups. */
typedef enum VarSpriteGroupScopes {
enum VarSpriteGroupScope {
VSG_SCOPE_SELF,
// Engine of consists for vehicles, city for stations.
VSG_SCOPE_PARENT,
} VarSpriteGroupScope;
};
typedef enum DeterministicSpriteGroupSizes {
enum DeterministicSpriteGroupSize {
DSG_SIZE_BYTE,
DSG_SIZE_WORD,
DSG_SIZE_DWORD,
} DeterministicSpriteGroupSize;
};
typedef enum DeterministicSpriteGroupAdjustTypes {
enum DeterministicSpriteGroupAdjustType {
DSGA_TYPE_NONE,
DSGA_TYPE_DIV,
DSGA_TYPE_MOD,
} DeterministicSpriteGroupAdjustType;
};
typedef enum DeterministicSpriteGroupAdjustOperations {
enum DeterministicSpriteGroupAdjustOperation {
DSGA_OP_ADD, // a + b
DSGA_OP_SUB, // a - b
DSGA_OP_SMIN, // (signed) min(a, b)
@ -57,10 +57,10 @@ typedef enum DeterministicSpriteGroupAdjustOperations {
DSGA_OP_AND, // a & b
DSGA_OP_OR, // a | b
DSGA_OP_XOR, // a ^ b
} DeterministicSpriteGroupAdjustOperation;
};
typedef struct DeterministicSpriteGroupAdjust {
struct DeterministicSpriteGroupAdjust {
DeterministicSpriteGroupAdjustOperation operation;
DeterministicSpriteGroupAdjustType type;
byte variable;
@ -70,17 +70,17 @@ typedef struct DeterministicSpriteGroupAdjust {
uint32 add_val;
uint32 divmod_val;
const SpriteGroup *subroutine;
} DeterministicSpriteGroupAdjust;
};
typedef struct DeterministicSpriteGroupRange {
struct DeterministicSpriteGroupRange {
const SpriteGroup *group;
uint32 low;
uint32 high;
} DeterministicSpriteGroupRange;
};
typedef struct DeterministicSpriteGroup {
struct DeterministicSpriteGroup {
VarSpriteGroupScope var_scope;
DeterministicSpriteGroupSize size;
byte num_adjusts;
@ -90,14 +90,14 @@ typedef struct DeterministicSpriteGroup {
// Dynamically allocated, this is the sole owner
const SpriteGroup *default_group;
} DeterministicSpriteGroup;
};
typedef enum RandomizedSpriteGroupCompareModes {
enum RandomizedSpriteGroupCompareMode {
RSG_CMP_ANY,
RSG_CMP_ALL,
} RandomizedSpriteGroupCompareMode;
};
typedef struct RandomizedSpriteGroup {
struct RandomizedSpriteGroup {
// Take this object:
VarSpriteGroupScope var_scope;
@ -111,32 +111,32 @@ typedef struct RandomizedSpriteGroup {
// Take the group with appropriate index:
const SpriteGroup **groups;
} RandomizedSpriteGroup;
};
/* This contains a callback result. A failed callback has a value of
* CALLBACK_FAILED */
typedef struct CallbackResultSpriteGroup {
struct CallbackResultSpriteGroup {
uint16 result;
} CallbackResultSpriteGroup;
};
/* A result sprite group returns the first SpriteID and the number of
* sprites in the set */
typedef struct ResultSpriteGroup {
struct ResultSpriteGroup {
SpriteID sprite;
byte num_sprites;
} ResultSpriteGroup;
};
/* List of different sprite group types */
typedef enum SpriteGroupType {
enum SpriteGroupType {
SGT_INVALID,
SGT_REAL,
SGT_DETERMINISTIC,
SGT_RANDOMIZED,
SGT_CALLBACK,
SGT_RESULT,
} SpriteGroupType;
};
/* Common wrapper for all the different sprite group types */
struct SpriteGroup {
@ -156,7 +156,7 @@ SpriteGroup *AllocateSpriteGroup();
void InitializeSpriteGroupPool();
typedef struct ResolverObject {
struct ResolverObject {
uint16 callback;
uint32 callback_param1;
uint32 callback_param2;
@ -187,7 +187,7 @@ typedef struct ResolverObject {
void (*SetTriggers)(const struct ResolverObject*, int);
uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*);
const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const SpriteGroup*);
} ResolverObject;
};
/* Base sprite group resolver */

View File

@ -9,12 +9,12 @@
#include "newgrf_cargo.h"
#include "helpers.hpp"
typedef enum {
enum StationClassID {
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
STAT_CLASS_DFLT = 0, ///< Default station class.
STAT_CLASS_WAYP, ///< Waypoint class.
STAT_CLASS_MAX = 32, ///< Maximum number of classes.
} StationClassID;
};
/** Define basic enum properties */
template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX> {};
@ -27,7 +27,7 @@ DECLARE_POSTFIX_INCREMENT(StationClassID);
* where index is computed as (x * platforms) + platform. */
typedef byte *StationLayout;
typedef struct StationSpec {
struct StationSpec {
uint32 grfid; ///< ID of GRF file station belongs to.
int localidx; ///< Index within GRF file of station.
@ -84,17 +84,17 @@ typedef struct StationSpec {
* evaluating callbacks.
*/
const struct SpriteGroup *spritegroup[NUM_CARGO + 3];
} StationSpec;
};
/**
* Struct containing information relating to station classes.
*/
typedef struct StationClass {
struct StationClass {
uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc.
StringID name; ///< Name of this class.
uint stations; ///< Number of stations in this class.
StationSpec **spec; ///< Array of station specifications.
} StationClass;
};
void ResetStationClasses();
StationClassID AllocateStationClass(uint32 cls);

View File

@ -30,16 +30,16 @@
* the grf base will not be used in order to find the string, but rather for
* jumping from standard langID scheme to the new one.
*/
typedef enum grf_base_languages {
enum grf_base_languages {
GRFLB_AMERICAN = 0x01,
GRFLB_ENGLISH = 0x02,
GRFLB_GERMAN = 0x04,
GRFLB_FRENCH = 0x08,
GRFLB_SPANISH = 0x10,
GRFLB_GENERIC = 0x80,
} grf_base_language;
};
typedef enum grf_extended_languages {
enum grf_extended_languages {
GRFLX_AMERICAN = 0x00,
GRFLX_ENGLISH = 0x01,
GRFLX_GERMAN = 0x02,
@ -73,13 +73,13 @@ typedef enum grf_extended_languages {
GRFLX_CROATIAN = 0x38,
GRFLX_TURKISH = 0x3E,
GRFLX_UNSPECIFIED = 0x7F,
} grf_language;
};
typedef struct iso_grf {
struct iso_grf {
char code[6];
byte grfLangID;
} iso_grf;
};
/**
* ISO code VS NewGrf langID conversion array.
@ -170,12 +170,12 @@ public:
* Putting both grfid and stringid together allows us to avoid duplicates,
* since it is NOT SUPPOSED to happen.
*/
typedef struct GRFTextEntry {
struct GRFTextEntry {
uint32 grfid;
uint16 stringid;
StringID def_string;
GRFText *textholder;
} GRFTextEntry;
};
static uint _num_grf_texts = 0;

View File

@ -35,10 +35,10 @@ enum {
NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH
};
typedef struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */
struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */
TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */
StationID station_index; /* station index we're heading for, or INVALID_STATION when we're heading for a tile */
} NPFFindStationOrTileData;
};
enum { /* Indices into AyStar.userdata[] */
NPF_TYPE = 0, /* Contains a TransportTypes value */
@ -51,18 +51,18 @@ enum { /* Indices into AyStarNode.userdata[] */
NPF_NODE_FLAGS,
};
typedef enum { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */
enum NPFNodeFlag { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */
NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */
NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */
NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */
} NPFNodeFlag;
};
typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */
uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */
Trackdir best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */
AyStarNode node; /* The node within the target the search led us to */
} NPFFoundTargetData;
};
/* These functions below are _not_ re-entrant, in favor of speed! */

View File

@ -27,7 +27,7 @@ enum {
OLD_MAP_SIZE = 256 * 256
};
typedef struct LoadgameState {
struct LoadgameState {
FILE *file;
uint chunk_size;
@ -41,10 +41,10 @@ typedef struct LoadgameState {
uint total_read;
bool failed;
} LoadgameState;
};
/* OldChunk-Type */
typedef enum OldChunkTypes {
enum OldChunkType {
OC_SIMPLE = 0,
OC_NULL = 1,
OC_CHUNK = 2,
@ -78,20 +78,20 @@ typedef enum OldChunkTypes {
OC_TILE = OC_VAR_U32 | OC_FILE_U16,
OC_END = 0 ///< End of the whole chunk, all 32bits set to zero
} OldChunkType;
};
DECLARE_ENUM_AS_BIT_SET(OldChunkType);
typedef bool OldChunkProc(LoadgameState *ls, int num);
typedef struct OldChunks {
struct OldChunks {
OldChunkType type; ///< Type of field
uint32 amount; ///< Amount of fields
void *ptr; ///< Pointer where to save the data (may only be set if offset is 0)
uint offset; ///< Offset from basepointer (may only be set if ptr is NULL)
OldChunkProc *proc; ///< Pointer to function that is called with OC_CHUNK
} OldChunks;
};
/* If it fails, check lines above.. */
assert_compile(sizeof(TileIndex) == 4);

View File

@ -3,7 +3,7 @@
#ifndef OLDPOOL_H
#define OLDPOOL_H
typedef struct OldMemoryPool OldMemoryPool;
struct OldMemoryPool;
/* The function that is called after a new block is added
start_item is the first item of the new made block */

View File

@ -11,43 +11,43 @@
#include "hal.h"
#include "helpers.hpp"
typedef struct Oblong {
struct Oblong {
int x, y;
int width, height;
} Oblong;
};
typedef struct BoundingRect {
struct BoundingRect {
int width;
int height;
} BoundingRect;
};
typedef struct Pair {
struct Pair {
int a;
int b;
} Pair;
};
#include "map.h"
#include "slope.h"
// Forward declarations of structs.
typedef struct Vehicle Vehicle;
typedef struct Depot Depot;
typedef struct Waypoint Waypoint;
typedef struct Window Window;
typedef struct Station Station;
typedef struct ViewPort ViewPort;
typedef struct Town Town;
typedef struct NewsItem NewsItem;
typedef struct Industry Industry;
typedef struct DrawPixelInfo DrawPixelInfo;
struct Vehicle;
struct Depot;
struct Waypoint;
struct Window;
struct Station;
struct ViewPort;
struct Town;
struct NewsItem;
struct Industry;
struct DrawPixelInfo;
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
typedef byte CargoID;
typedef byte LandscapeID;
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables
typedef struct PalSpriteID {
struct PalSpriteID {
SpriteID sprite;
SpriteID pal;
} PalSpriteID;
};
typedef uint16 EngineID;
typedef uint16 UnitID;
typedef uint16 StringID;
@ -140,7 +140,7 @@ typedef TinyEnumT<Owner> OwnerByte;
typedef OwnerByte PlayerByte;
typedef enum TransportTypes {
enum TransportType {
/* These constants are for now linked to the representation of bridges
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
* In an ideal world, these constants would be used everywhere when
@ -153,20 +153,20 @@ typedef enum TransportTypes {
TRANSPORT_WATER, // = 2
TRANSPORT_END,
INVALID_TRANSPORT = 0xff,
} TransportType;
};
/** Define basic enum properties */
template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
typedef TinyEnumT<TransportType> TransportTypeByte;
typedef struct TileInfo {
struct TileInfo {
uint x;
uint y;
Slope tileh;
TileIndex tile;
uint z;
} TileInfo;
};
/* Display Options */
@ -195,7 +195,7 @@ enum {
NUM_PRICES = 49,
};
typedef struct Prices {
struct Prices {
int32 station_value;
int32 build_rail;
int32 build_road;
@ -243,11 +243,11 @@ typedef struct Prices {
int32 roadveh_running;
int32 ship_running;
int32 build_industry;
} Prices;
};
#define GAME_DIFFICULTY_NUM 18
typedef struct GameDifficulty {
struct GameDifficulty {
int max_no_competitors;
int competitor_start_time;
int number_towns;
@ -266,7 +266,7 @@ typedef struct GameDifficulty {
int line_reverse_mode;
int disasters;
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
} GameDifficulty;
};
enum {
// Temperate
@ -317,18 +317,18 @@ enum {
typedef uint AcceptedCargo[NUM_CARGO];
typedef struct TileDesc {
struct TileDesc {
StringID str;
Owner owner;
Date build_date;
uint32 dparam[2];
} TileDesc;
};
typedef struct {
struct ViewportSign {
int32 left;
int32 top;
byte width_1, width_2;
} ViewportSign;
};
typedef void DrawTileProc(TileInfo *ti);
@ -365,7 +365,7 @@ typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID n
typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
typedef Slope GetSlopeTilehProc(TileIndex, Slope tileh);
typedef struct {
struct TileTypeProcs {
DrawTileProc *draw_tile_proc;
GetSlopeZProc *get_slope_z_proc;
ClearTileProc *clear_tile_proc;
@ -379,7 +379,7 @@ typedef struct {
GetProducedCargoProc *get_produced_cargo_proc;
VehicleEnterTileProc *vehicle_enter_tile_proc;
GetSlopeTilehProc *get_slope_tileh_proc;
} TileTypeProcs;
};
enum WindowClass {
@ -575,11 +575,11 @@ VARDEF byte _no_scroll;
/** To have a concurrently running thread interface with the main program, use
* the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
* in the ProcessSentMessage() function */
typedef enum ThreadMsgs {
enum ThreadMsg {
MSG_OTTD_NO_MESSAGE,
MSG_OTTD_SAVETHREAD_DONE,
MSG_OTTD_SAVETHREAD_ERROR,
} ThreadMsg;
};
void OTTD_SendThreadMessage(ThreadMsg msg);

View File

@ -88,8 +88,8 @@ enum {
* - Vehicle -> current_order
* - REF_SHEDULE (all REFs are currently limited to 16 bits!!)
*/
typedef struct Order {
struct Order *next; ///< Pointer to next order. If NULL, end of list
struct Order {
Order *next; ///< Pointer to next order. If NULL, end of list
OrderTypeByte type;
uint8 flags;
@ -99,17 +99,17 @@ typedef struct Order {
CargoID refit_cargo; // Refit CargoID
byte refit_subtype; // Refit subtype
} Order;
};
#define MAX_BACKUP_ORDER_COUNT 40
typedef struct {
struct BackuppedOrders {
VehicleID clone;
VehicleOrderID orderindex;
Order order[MAX_BACKUP_ORDER_COUNT + 1];
uint16 service_interval;
char name[32];
} BackuppedOrders;
};
VARDEF TileIndex _backup_orders_tile;
VARDEF BackuppedOrders _backup_orders_data[1];

View File

@ -423,7 +423,7 @@ void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumP
after_proc(&tpf);
}
typedef struct {
struct StackedItem {
TileIndex tile;
uint16 cur_length; // This is the current length to this tile.
uint16 priority; // This is the current length + estimated length to the goal.
@ -431,7 +431,7 @@ typedef struct {
byte depth;
byte state;
byte first_track;
} StackedItem;
};
static const Trackdir _new_trackdir[6][4] = {
{TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR,},
@ -442,13 +442,13 @@ static const Trackdir _new_trackdir[6][4] = {
{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, TRACKDIR_RIGHT_N,},
};
typedef struct HashLink {
struct HashLink {
TileIndex tile;
uint16 typelength;
uint16 next;
} HashLink;
};
typedef struct {
struct NewTrackPathFinder {
NTPEnumProc *enum_proc;
void *userdata;
TileIndex dest;
@ -468,7 +468,7 @@ typedef struct {
HashLink links[0x400]; // hash links
} NewTrackPathFinder;
};
#define NTP_GET_LINK_OFFS(tpf, link) ((byte*)(link) - (byte*)tpf->links)
#define NTP_GET_LINK_PTR(tpf, link_offs) (HashLink*)((byte*)tpf->links + (link_offs))

View File

@ -14,7 +14,7 @@ enum {
//#define PF_BENCH // perform simple benchmarks on the train pathfinder (not
//supported on all archs)
typedef struct TrackPathFinder TrackPathFinder;
struct TrackPathFinder;
typedef bool TPFEnumProc(TileIndex tile, void *data, Trackdir trackdir, uint length, byte *state);
typedef void TPFAfterProc(TrackPathFinder *tpf);
@ -30,17 +30,17 @@ typedef bool NTPEnumProc(TileIndex tile, void *data, int track, uint length);
*/
#define PATHFIND_HASH_TILE(tile) (TileX(tile) & 0x1F) + ((TileY(tile) & 0x1F) << 5)
typedef struct TrackPathFinderLink {
struct TrackPathFinderLink {
TileIndex tile;
uint16 flags;
uint16 next;
} TrackPathFinderLink;
};
typedef struct RememberData {
struct RememberData {
uint16 cur_length;
byte depth;
byte pft_var6;
} RememberData;
};
struct TrackPathFinder {
int num_links_left;
@ -67,10 +67,10 @@ struct TrackPathFinder {
void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
typedef struct {
struct FindLengthOfTunnelResult {
TileIndex tile;
int length;
} FindLengthOfTunnelResult;
};
FindLengthOfTunnelResult FindLengthOfTunnel(TileIndex tile, DiagDirection direction);
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypeMask railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data);

View File

@ -9,15 +9,15 @@
#include "engine.h"
#include "livery.h"
typedef struct PlayerEconomyEntry {
struct PlayerEconomyEntry {
int32 income;
int32 expenses;
int32 delivered_cargo;
int32 performance_history; // player score (scale 0-1000)
int64 company_value;
} PlayerEconomyEntry;
};
typedef struct AiBuildRec {
struct AiBuildRec {
TileIndex spec_tile;
TileIndex use_tile;
byte rand_rng;
@ -28,9 +28,9 @@ typedef struct AiBuildRec {
byte buildcmd_b;
byte direction;
CargoID cargo;
} AiBuildRec;
};
typedef struct PlayerAI {
struct PlayerAI {
byte state;
byte tick; // Used to determine how often to move
uint32 state_counter; // Can hold tile index!
@ -68,9 +68,9 @@ typedef struct PlayerAI {
TileIndex banned_tiles[16];
byte banned_val[16];
} PlayerAI;
};
typedef struct Ai_PathFinderInfo {
struct Ai_PathFinderInfo {
TileIndex start_tile_tl; // tl = top-left
TileIndex start_tile_br; // br = bottom-right
TileIndex end_tile_tl; // tl = top-left
@ -84,17 +84,17 @@ typedef struct Ai_PathFinderInfo {
int position; // Current position in the build-path, needed to build the path
bool rail_or_road; // true = rail, false = road
} Ai_PathFinderInfo;
};
// The amount of memory reserved for the AI-special-vehicles
#define AI_MAX_SPECIAL_VEHICLES 100
typedef struct Ai_SpecialVehicle {
struct Ai_SpecialVehicle {
VehicleID veh_id;
uint32 flag;
} Ai_SpecialVehicle;
};
typedef struct PlayerAiNew {
struct PlayerAiNew {
uint8 state;
uint tick;
uint idle;
@ -144,12 +144,12 @@ typedef struct PlayerAiNew {
int to_ic;
byte to_type;
} PlayerAiNew;
};
typedef uint32 PlayerFace;
typedef struct Player {
struct Player {
uint32 name_2;
uint16 name_1;
@ -198,7 +198,7 @@ typedef struct Player {
int16 engine_renew_months;
uint32 engine_renew_money;
uint16 num_engines[TOTAL_NUM_ENGINES]; // caches the number of engines of each type the player owns (no need to save this)
} Player;
};
uint16 GetDrawStringPlayerColor(PlayerID player);
@ -282,11 +282,11 @@ static inline RailType GetBestRailtype(const Player* p)
return RAILTYPE_RAIL;
}
typedef struct HighScore {
struct HighScore {
char company[100];
StringID title; // NO_SAVE, has troubles with changing string-numbers.
uint16 score; // do NOT change type, will break hs.dat
} HighScore;
};
VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
void SaveToHighScore();

View File

@ -286,10 +286,10 @@ static const byte livery_height[] = {
3,
};
typedef struct livery_d {
struct livery_d {
uint32 sel;
LiveryClass livery_class;
} livery_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(livery_d));
static void ShowColourDropDownMenu(Window *w, uint32 widget)

View File

@ -9,21 +9,19 @@
//#define HASH_STATS
typedef struct Queue Queue;
struct Queue;
typedef bool Queue_PushProc(Queue* q, void* item, int priority);
typedef void* Queue_PopProc(Queue* q);
typedef bool Queue_DeleteProc(Queue* q, void* item, int priority);
typedef void Queue_ClearProc(Queue* q, bool free_values);
typedef void Queue_FreeProc(Queue* q, bool free_values);
typedef struct InsSortNode InsSortNode;
struct InsSortNode {
void* item;
int priority;
InsSortNode* next;
};
typedef struct BinaryHeapNode BinaryHeapNode;
struct BinaryHeapNode {
void* item;
int priority;
@ -99,7 +97,6 @@ void init_BinaryHeap(Queue* q, uint max_size);
/*
* Hash
*/
typedef struct HashNode HashNode;
struct HashNode {
uint key1;
uint key2;
@ -111,7 +108,7 @@ struct HashNode {
* the resulting range is clearly defined.
*/
typedef uint Hash_HashProc(uint key1, uint key2);
typedef struct Hash {
struct Hash {
/* The hash function used */
Hash_HashProc* hash;
/* The amount of items in the hash */
@ -123,7 +120,7 @@ typedef struct Hash {
/* A pointer to an array of numbuckets booleans, which will be true if
* there are any Nodes in the bucket */
bool* buckets_in_use;
} Hash;
};
/* Call these function to manipulate a hash */

View File

@ -9,7 +9,7 @@
#include "direction.h"
#include "tile.h"
typedef enum RailTypes {
enum RailType {
RAILTYPE_BEGIN = 0,
RAILTYPE_RAIL = 0,
RAILTYPE_ELECTRIC = 1,
@ -17,7 +17,7 @@ typedef enum RailTypes {
RAILTYPE_MAGLEV = 3,
RAILTYPE_END,
INVALID_RAILTYPE = 0xFF
} RailType;
};
typedef byte RailTypeMask;
@ -30,7 +30,7 @@ typedef TinyEnumT<RailType> RailTypeByte;
/** These are used to specify a single track.
* Can be translated to a trackbit with TrackToTrackbit */
typedef enum Track {
enum Track {
TRACK_BEGIN = 0,
TRACK_X = 0,
TRACK_Y = 1,
@ -40,7 +40,7 @@ typedef enum Track {
TRACK_RIGHT = 5,
TRACK_END,
INVALID_TRACK = 0xFF
} Track;
};
/** Allow incrementing of Track variables */
DECLARE_POSTFIX_INCREMENT(Track);
@ -61,7 +61,7 @@ static inline Track AxisToTrack(Axis a)
/** Bitfield corresponding to Track */
typedef enum TrackBits {
enum TrackBits {
TRACK_BIT_NONE = 0U,
TRACK_BIT_X = 1U << TRACK_X,
TRACK_BIT_Y = 1U << TRACK_Y,
@ -81,7 +81,7 @@ typedef enum TrackBits {
TRACK_BIT_WORMHOLE = 0x40U,
TRACK_BIT_DEPOT = 0x80U,
INVALID_TRACK_BIT = 0xFF
} TrackBits;
};
/** Define basic enum properties */
template <> struct EnumPropsT<TrackBits> : MakeEnumPropsT<TrackBits, byte, TRACK_BIT_NONE, TRACK_BIT_ALL, INVALID_TRACK_BIT> {};
@ -110,7 +110,7 @@ static inline TrackBits AxisToTrackBits(Axis a)
* reversing track dirs are not considered to be 'valid' except in a small
* corner in the road vehicle controller.
*/
typedef enum Trackdirs {
enum Trackdir {
TRACKDIR_BEGIN = 0,
TRACKDIR_X_NE = 0,
TRACKDIR_Y_SE = 1,
@ -130,7 +130,7 @@ typedef enum Trackdirs {
TRACKDIR_RVREV_NW = 15,
TRACKDIR_END,
INVALID_TRACKDIR = 0xFF,
} Trackdir;
};
/** Define basic enum properties */
template <> struct EnumPropsT<Trackdir> : MakeEnumPropsT<Trackdir, byte, TRACKDIR_BEGIN, TRACKDIR_END, INVALID_TRACKDIR> {};
@ -138,7 +138,7 @@ typedef TinyEnumT<Trackdir> TrackdirByte;
/** 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. */
typedef enum TrackdirBits {
enum TrackdirBits {
TRACKDIR_BIT_NONE = 0x0000,
TRACKDIR_BIT_X_NE = 0x0001,
TRACKDIR_BIT_Y_SE = 0x0002,
@ -155,7 +155,7 @@ typedef enum TrackdirBits {
TRACKDIR_BIT_RIGHT_N = 0x2000,
TRACKDIR_BIT_MASK = 0x3F3F,
INVALID_TRACKDIR_BIT = 0xFFFF,
} TrackdirBits;
};
/** Define basic enum properties */
template <> struct EnumPropsT<TrackdirBits> : MakeEnumPropsT<TrackdirBits, uint16, TRACKDIR_BIT_NONE, TRACKDIR_BIT_MASK, INVALID_TRACKDIR_BIT> {};
@ -164,7 +164,7 @@ DECLARE_ENUM_AS_BIT_SET(TrackdirBits);
/** This struct contains all the info that is needed to draw and construct tracks.
*/
typedef struct RailtypeInfo {
struct RailtypeInfo {
/** Struct containing the main sprites. @note not all sprites are listed, but only
* the ones used directly in the code */
struct {
@ -237,7 +237,7 @@ typedef struct RailtypeInfo {
* Offset to add to ground sprite when drawing custom waypoints / stations
*/
byte custom_ground_offset;
} RailtypeInfo;
};
// these are the maximums used for updating signal blocks, and checking if a depot is in a pbs block

View File

@ -1417,7 +1417,7 @@ void DrawDefaultWaypointSprite(int x, int y, RailType railtype)
DrawTileSequence(x, y, dts->ground_sprite + offset, dts->seq, 0);
}
typedef struct SetSignalsData {
struct SetSignalsData {
int cur;
int cur_stack;
bool stop;
@ -1435,7 +1435,7 @@ typedef struct SetSignalsData {
TileIndex next_tile[NUM_SSD_STACK];
DiagDirectionByte next_dir[NUM_SSD_STACK];
} SetSignalsData;
};
static bool SetSignalsEnumProc(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
{
@ -1473,10 +1473,10 @@ static bool SetSignalsEnumProc(TileIndex tile, void* data, Trackdir trackdir, ui
}
/* Struct to parse data from VehicleFromPos to SignalVehicleCheckProc */
typedef struct SignalVehicleCheckStruct {
struct SignalVehicleCheckStruct {
TileIndex tile;
uint track;
} SignalVehicleCheckStruct;
};
static void *SignalVehicleCheckProc(Vehicle *v, void *data)
{

View File

@ -8,12 +8,12 @@
#include "tile.h"
typedef enum RailTileType {
enum RailTileType {
RAIL_TILE_NORMAL = 0,
RAIL_TILE_SIGNALS = 1,
RAIL_TILE_WAYPOINT = 2,
RAIL_TILE_DEPOT = 3,
} RailTileType;
};
static inline RailTileType GetRailTileType(TileIndex t)
{
@ -118,12 +118,12 @@ static inline WaypointID GetWaypointIndex(TileIndex t)
return (WaypointID)_m[t].m2;
}
typedef enum SignalType {
enum SignalType {
SIGTYPE_NORMAL = 0, // normal signal
SIGTYPE_ENTRY = 1, // presignal block entry
SIGTYPE_EXIT = 2, // presignal block exit
SIGTYPE_COMBO = 3 // presignal inter-block
} SignalType;
};
static inline SignalType GetSignalType(TileIndex t)
{
@ -159,10 +159,10 @@ static inline void CycleSignalSide(TileIndex t, Track track)
}
typedef enum SignalVariant {
enum SignalVariant {
SIG_ELECTRIC = 0,
SIG_SEMAPHORE = 1
} SignalVariant;
};
static inline SignalVariant GetSignalVariant(TileIndex t)
{
@ -183,10 +183,10 @@ static inline bool IsSignalPresent(TileIndex t, byte signalbit)
* simple boolean logic will do. But do try to compare to this enum instead of
* normal boolean evaluation, since that will make future additions easier.
*/
typedef enum SignalStates {
enum SignalState {
SIGNAL_STATE_RED = 0,
SIGNAL_STATE_GREEN = 1,
} SignalState;
};
static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
{
@ -242,7 +242,7 @@ static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trac
RailType GetTileRailType(TileIndex tile);
typedef enum RailGroundType {
enum RailGroundType {
RAIL_GROUND_BARREN = 0,
RAIL_GROUND_GRASS = 1,
RAIL_GROUND_FENCE_NW = 2,
@ -256,7 +256,7 @@ typedef enum RailGroundType {
RAIL_GROUND_FENCE_HORIZ1 = 10,
RAIL_GROUND_FENCE_HORIZ2 = 11,
RAIL_GROUND_ICE_DESERT = 12,
} RailGroundType;
};
static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
{

View File

@ -5,7 +5,7 @@
#include "helpers.hpp"
typedef enum RoadBits {
enum RoadBits {
ROAD_NONE = 0U,
ROAD_NW = 1U,
ROAD_SW = 2U,
@ -14,7 +14,7 @@ typedef enum RoadBits {
ROAD_X = ROAD_SW | ROAD_NE,
ROAD_Y = ROAD_NW | ROAD_SE,
ROAD_ALL = ROAD_X | ROAD_Y
} RoadBits;
};
DECLARE_ENUM_AS_BIT_SET(RoadBits);

View File

@ -599,11 +599,11 @@ static int32 ClearTile_Road(TileIndex tile, byte flags)
}
typedef struct DrawRoadTileStruct {
struct DrawRoadTileStruct {
uint16 image;
byte subcoord_x;
byte subcoord_y;
} DrawRoadTileStruct;
};
#include "table/road_land.h"

View File

@ -9,11 +9,11 @@
#include "tile.h"
typedef enum RoadTileType {
enum RoadTileType {
ROAD_TILE_NORMAL,
ROAD_TILE_CROSSING,
ROAD_TILE_DEPOT
} RoadTileType;
};
static inline RoadTileType GetRoadTileType(TileIndex t)
{
@ -105,7 +105,7 @@ static inline void ToggleSnow(TileIndex t)
}
typedef enum Roadside {
enum Roadside {
ROADSIDE_BARREN = 0,
ROADSIDE_GRASS = 1,
ROADSIDE_PAVED = 2,
@ -113,7 +113,7 @@ typedef enum Roadside {
ROADSIDE_TREES = 5,
ROADSIDE_GRASS_ROAD_WORKS = 6,
ROADSIDE_PAVED_ROAD_WORKS = 7
} Roadside;
};
static inline Roadside GetRoadside(TileIndex tile)
{

View File

@ -306,11 +306,11 @@ int32 CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return -(int32)v->value;
}
typedef struct RoadFindDepotData {
struct RoadFindDepotData {
uint best_length;
TileIndex tile;
OwnerByte owner;
} RoadFindDepotData;
};
static const DiagDirection _road_pf_directions[] = {
DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, INVALID_DIAGDIR, INVALID_DIAGDIR,
@ -785,12 +785,12 @@ static void StartRoadVehSound(const Vehicle* v)
}
}
typedef struct RoadVehFindData {
struct RoadVehFindData {
int x;
int y;
const Vehicle* veh;
Direction dir;
} RoadVehFindData;
};
static void* EnumCheckRoadVehClose(Vehicle *v, void* data)
{
@ -933,12 +933,12 @@ static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
return ChangeDir(old_dir, delta);
}
typedef struct OvertakeData {
struct OvertakeData {
const Vehicle* u;
const Vehicle* v;
TileIndex tile;
byte tilebits;
} OvertakeData;
};
static void* EnumFindVehToOvertake(Vehicle* v, void* data)
{
@ -1030,11 +1030,11 @@ static int PickRandomBit(uint bits)
return i;
}
typedef struct {
struct FindRoadToChooseData {
TileIndex dest;
uint maxtracklen;
uint mindist;
} FindRoadToChooseData;
};
static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
{
@ -1256,9 +1256,9 @@ enum {
RVC_DRIVE_THROUGH_STOP_FRAME = 7
};
typedef struct RoadDriveEntry {
byte x,y;
} RoadDriveEntry;
struct RoadDriveEntry {
byte x, y;
};
#include "table/roadveh.h"

View File

@ -1045,12 +1045,12 @@ static void UninitNoComp()
#include "gfx.h"
#include "gui.h"
typedef struct ThreadedSave {
struct ThreadedSave {
uint count;
byte ff_state;
bool saveinprogress;
CursorID cursor;
} ThreadedSave;
};
/* A maximum size of of 128K * 500 = 64.000KB savegames */
STATIC_OLD_POOL(Savegame, byte, 17, 500, NULL, NULL)
@ -1326,7 +1326,7 @@ static void *IntToReference(uint index, SLRefType rt)
}
/** The format for a reader/writer type of a savegame */
typedef struct {
struct SaveLoadFormat {
const char *name; ///< name of the compressor/decompressor (debug-only)
uint32 tag; ///< the 4-letter tag by which it is identified in the savegame
@ -1337,7 +1337,7 @@ typedef struct {
bool (*init_write)(); ///< function executed upon intialization of the saver
WriterProc *writer; ///< function that saves the data to the file
void (*uninit_write)(); ///< function executed when writing is done
} SaveLoadFormat;
};
static const SaveLoadFormat _saveload_formats[] = {
{"memory", 0, NULL, NULL, NULL, InitMem, WriteMem, UnInitMem},

View File

@ -9,20 +9,20 @@
#define SIZE_MAX ((size_t)-1)
typedef enum SaveOrLoadResult {
enum SaveOrLoadResult {
SL_OK = 0, // completed successfully
SL_ERROR = 1, // error that was caught before internal structures were modified
SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
} SaveOrLoadResult;
};
typedef enum SaveOrLoadMode {
enum SaveOrLoadMode {
SL_INVALID = -1,
SL_LOAD = 0,
SL_SAVE = 1,
SL_OLD_LOAD = 2,
SL_PNG = 3,
SL_BMP = 4,
} SaveOrLoadMode;
};
SaveOrLoadResult SaveOrLoad(const char *filename, int mode);
void WaitTillSaved();
@ -32,18 +32,18 @@ void DoExitSave();
typedef void ChunkSaveLoadProc();
typedef void AutolengthProc(void *arg);
typedef struct {
struct ChunkHandler {
uint32 id;
ChunkSaveLoadProc *save_proc;
ChunkSaveLoadProc *load_proc;
uint32 flags;
} ChunkHandler;
};
typedef struct {
struct NullStruct {
byte null;
} NullStruct;
};
typedef enum SLRefType {
enum SLRefType {
REF_ORDER = 0,
REF_VEHICLE = 1,
REF_STATION = 2,
@ -51,7 +51,7 @@ typedef enum SLRefType {
REF_VEHICLE_OLD = 4,
REF_ROADSTOPS = 5,
REF_ENGINE_RENEWS = 6,
} SLRefType;
};
#define SL_MAX_VERSION 255
@ -166,7 +166,7 @@ enum SaveLoadTypes {
typedef byte SaveLoadType;
/** SaveLoad type struct. Do NOT use this directly but use the SLE_ macros defined just below! */
typedef struct SaveLoad {
struct SaveLoad {
SaveLoadType cmd; ///< the action to take with the saved/loaded type, All types need different action
VarType conv; ///< type of the variable to be saved, int
uint16 length; ///< (conditional) length of the variable (eg. arrays) (max array size is 65536 elements)
@ -177,7 +177,7 @@ typedef struct SaveLoad {
* during runtime. Decision on which one to use is controlled by the function
* that is called to save it. address: SlGlobList, offset: SlObject */
void *address; ///< address of variable OR offset of variable in the struct (max offset is 65536)
} SaveLoad;
};
/* Same as SaveLoad but global variables are used (for better readability); */
typedef SaveLoad SaveLoadGlobVarList;

View File

@ -24,11 +24,11 @@ ScreenshotType current_screenshot_type;
typedef void ScreenshotCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n);
typedef bool ScreenshotHandlerProc(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette);
typedef struct {
struct ScreenshotFormat {
const char *name;
const char *extension;
ScreenshotHandlerProc *proc;
} ScreenshotFormat;
};
//************************************************
//*** SCREENSHOT CODE FOR WINDOWS BITMAP (.BMP)
@ -37,29 +37,29 @@ typedef struct {
#pragma pack(push, 1)
#endif
typedef struct BitmapFileHeader {
struct BitmapFileHeader {
uint16 type;
uint32 size;
uint32 reserved;
uint32 off_bits;
} GCC_PACK BitmapFileHeader;
} GCC_PACK;
assert_compile(sizeof(BitmapFileHeader) == 14);
#if defined(_MSC_VER) || defined(__WATCOMC__)
#pragma pack(pop)
#endif
typedef struct BitmapInfoHeader {
struct BitmapInfoHeader {
uint32 size;
int32 width, height;
uint16 planes, bitcount;
uint32 compression, sizeimage, xpels, ypels, clrused, clrimp;
} BitmapInfoHeader;
};
assert_compile(sizeof(BitmapInfoHeader) == 40);
typedef struct RgbQuad {
struct RgbQuad {
byte blue, green, red, reserved;
} RgbQuad;
};
assert_compile(sizeof(RgbQuad) == 4);
// generic .BMP writer
@ -260,7 +260,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user
//*** SCREENSHOT CODE FOR ZSOFT PAINTBRUSH (.PCX)
//************************************************
typedef struct {
struct PcxHeader {
byte manufacturer;
byte version;
byte rle;
@ -276,7 +276,7 @@ typedef struct {
uint16 width;
uint16 height;
byte filler[54];
} PcxHeader;
};
assert_compile(sizeof(PcxHeader) == 128);
static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)

View File

@ -8,11 +8,11 @@ void InitializeScreenshotFormats();
const char *GetScreenshotFormatDesc(int i);
void SetScreenshotFormat(int i);
typedef enum ScreenshotType {
enum ScreenshotType {
SC_NONE,
SC_VIEWPORT,
SC_WORLD
} ScreenshotType;
};
bool MakeScreenshot();
void SetScreenshotType(ScreenshotType t);

View File

@ -13,7 +13,7 @@ void SdlClose(uint32 x);
#ifdef DYNAMICALLY_LOADED_SDL
#include <SDL.h>
typedef struct SDLProcs {
struct SDLProcs {
int (SDLCALL *SDL_Init)(Uint32);
int (SDLCALL *SDL_InitSubSystem)(Uint32);
char *(SDLCALL *SDL_GetError)();
@ -46,7 +46,7 @@ void SdlClose(uint32 x);
int (SDLCALL *SDL_SetColorKey)(SDL_Surface *, Uint32, Uint32);
void (SDLCALL *SDL_WM_SetIcon)(SDL_Surface *, Uint8 *);
Uint32 (SDLCALL *SDL_MapRGB)(SDL_PixelFormat *, Uint8, Uint8, Uint8);
} SDLProcs;
};
extern SDLProcs sdl_proc;

View File

@ -49,10 +49,10 @@
/** The patch values that are used for new games and/or modified in config file */
Patches _patches_newgame;
typedef struct IniFile IniFile;
typedef struct IniItem IniItem;
typedef struct IniGroup IniGroup;
typedef struct SettingsMemoryPool SettingsMemoryPool;
struct IniFile;
struct IniItem;
struct IniGroup;
struct SettingsMemoryPool;
typedef const char *SettingListCallbackProc(const IniItem *item, uint index);
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object);

View File

@ -46,7 +46,7 @@ typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
typedef int32 OnChange(int32 var);
typedef struct SettingDescBase {
struct SettingDescBase {
const char *name; ///< name of the setting. Used in configuration file and for console
const void *def; ///< default value given when none is present
SettingDescType cmd; ///< various flags for the variable
@ -56,12 +56,12 @@ typedef struct SettingDescBase {
const char *many; ///< ONE/MANY_OF_MANY: string of possible values for this type
StringID str; ///< (translated) string with descriptive text; gui and console
OnChange *proc; ///< callback procedure for when the value is changed
} SettingDescBase;
};
typedef struct SettingDesc {
struct SettingDesc {
SettingDescBase desc; ///< Settings structure (going to configuration file)
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
} SettingDesc;
};
/* NOTE: The only difference between SettingDesc and SettingDescGlob is
* that one uses global variables as a source and the other offsets
@ -72,10 +72,10 @@ typedef struct SettingDesc {
* offset in a certain struct */
typedef SettingDesc SettingDescGlobVarList;
typedef enum {
enum IniGroupType {
IGT_VARIABLES = 0, ///< values of the form "landscape = hilly"
IGT_LIST = 1, ///< a list of values, seperated by \n and terminated by the next group block
} IniGroupType;
};
/** The patch values that are used for new games and/or modified in config file */
extern Patches _patches_newgame;

View File

@ -295,12 +295,12 @@ void ShowGameOptions()
AllocateWindowDesc(&_game_options_desc);
}
typedef struct {
struct GameSettingData {
int16 min;
int16 max;
int16 step;
StringID str;
} GameSettingData;
};
static const GameSettingData _game_setting_info[] = {
{ 0, 7, 1, STR_NULL},
@ -655,16 +655,16 @@ static const char *_patches_vehicles[] = {
"freight_trains",
};
typedef struct PatchEntry {
struct PatchEntry {
const SettingDesc *setting;
uint index;
} PatchEntry;
};
typedef struct PatchPage {
struct PatchPage {
const char **names;
PatchEntry *entries;
byte num;
} PatchPage;
};
/* PatchPage holds the categories, the number of elements in each category
* and (in NULL) a dynamic array of settings based on the string-representations

View File

@ -447,12 +447,12 @@ static void ShipArrivesAt(const Vehicle* v, Station* st)
}
}
typedef struct {
struct PathFindShip {
TileIndex skiptile;
TileIndex dest_coords;
uint best_bird_dist;
uint best_length;
} PathFindShip;
};
static bool ShipTrackFollower(TileIndex tile, PathFindShip *pfs, int track, uint length, byte *state)
{

View File

@ -5,7 +5,7 @@
#include "oldpool.h"
typedef struct Sign {
struct Sign {
StringID str;
ViewportSign sign;
int32 x;
@ -14,7 +14,7 @@ typedef struct Sign {
PlayerByte owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
SignID index;
} Sign;
};
DECLARE_OLD_POOL(Sign, Sign, 2, 16000)

View File

@ -3,7 +3,7 @@
#ifndef SLOPE_H
#define SLOPE_H
typedef enum Slope {
enum Slope {
SLOPE_FLAT = 0x00,
SLOPE_W = 0x01,
SLOPE_S = 0x02,
@ -25,7 +25,7 @@ typedef enum Slope {
SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE,
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN,
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW
} Slope;
};
static inline bool IsSteepSlope(Slope s)
{

View File

@ -256,10 +256,10 @@ static const uint32 _map_height_bits[16] = {
MKCOLOR(0x27272727),
};
typedef struct AndOr {
struct AndOr {
uint32 mor;
uint32 mand;
} AndOr;
};
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
{

View File

@ -5,7 +5,7 @@
#include "helpers.hpp"
typedef struct MusicFileSettings {
struct MusicFileSettings {
byte playlist;
byte music_vol;
byte effect_vol;
@ -14,11 +14,11 @@ typedef struct MusicFileSettings {
bool playing;
bool shuffle;
char extmidi[80];
} MusicFileSettings;
};
VARDEF MusicFileSettings msf;
typedef struct FileEntry {
struct FileEntry {
uint32 file_offset;
uint32 file_size;
uint16 rate;
@ -26,12 +26,12 @@ typedef struct FileEntry {
uint8 channels;
uint8 volume;
uint8 priority;
} FileEntry;
};
bool SoundInitialize(const char *filename);
uint GetNumOriginalSounds();
typedef enum SoundFx {
enum SoundFx {
SND_BEGIN = 0,
SND_02_SPLAT = 0, // 0 == 0x00 !
SND_03_FACTORY_WHISTLE,
@ -107,7 +107,7 @@ typedef enum SoundFx {
SND_47_MAGLEV_2,
SND_48_DISTANT_BIRD, // 72 == 0x48
SND_END
} SoundFx;
};
/** Define basic enum properties */
template <> struct EnumPropsT<SoundFx> : MakeEnumPropsT<SoundFx, byte, SND_BEGIN, SND_END, SND_END> {};

View File

@ -8,7 +8,7 @@
* bounding box. Used especially for various multi-sprite buildings (like
* depots or stations): */
typedef struct DrawTileSeqStruct {
struct DrawTileSeqStruct {
int8 delta_x; // 0x80 is sequence terminator
int8 delta_y;
int8 delta_z;
@ -17,19 +17,19 @@ typedef struct DrawTileSeqStruct {
byte size_z;
SpriteID image;
SpriteID pal;
} DrawTileSeqStruct;
};
typedef struct DrawTileSprites {
struct DrawTileSprites {
SpriteID ground_sprite;
SpriteID ground_pal;
const DrawTileSeqStruct* seq;
} DrawTileSprites;
};
/**
* This structure is the same for both Industries and Houses.
* Buildings here reference a general type of construction
*/
typedef struct DrawBuildingsTileStruct {
struct DrawBuildingsTileStruct {
PalSpriteID ground;
PalSpriteID building;
byte subtile_x:4;
@ -38,7 +38,7 @@ typedef struct DrawBuildingsTileStruct {
byte height:4;
byte dz;
byte draw_proc; /* this allows to specify a special drawing procedure.*/
} DrawBuildingsTileStruct;
};
// Iterate through all DrawTileSeqStructs in DrawTileSprites.
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)

View File

@ -15,11 +15,11 @@
#endif /* SPRITE_CACHE_SIZE */
typedef struct SpriteCache {
struct SpriteCache {
void *ptr;
uint32 file_pos;
int16 lru;
} SpriteCache;
};
static uint _spritecache_items = 0;
@ -55,10 +55,10 @@ static SpriteCache *AllocateSpriteCache(uint index)
}
typedef struct MemBlock {
struct MemBlock {
uint32 size;
byte data[VARARRAY_SIZE];
} MemBlock;
};
static uint _sprite_lru_counter;
static MemBlock *_spritecache_ptr;

View File

@ -3,14 +3,14 @@
#ifndef SPRITECACHE_H
#define SPRITECACHE_H
typedef struct Sprite {
struct Sprite {
byte info;
byte height;
uint16 width;
int16 x_offs;
int16 y_offs;
byte data[VARARRAY_SIZE];
} Sprite;
};
const void *GetRawSprite(SpriteID sprite);
bool SpriteExists(SpriteID sprite);

View File

@ -12,7 +12,7 @@
static const StationID INVALID_STATION = 0xFFFF;
typedef struct GoodsEntry {
struct GoodsEntry {
GoodsEntry() :
waiting_acceptance(0),
unload_pending(0),
@ -35,7 +35,7 @@ typedef struct GoodsEntry {
byte last_speed;
byte last_age;
int32 feeder_profit;
} GoodsEntry;
};
/** A Stop for a Road Vehicle */
struct RoadStop {
@ -79,11 +79,11 @@ protected:
static RoadStop *AllocateRaw();
};
typedef struct StationSpecList {
struct StationSpecList {
const StationSpec *spec;
uint32 grfid; /// GRF ID of this custom station
uint8 localidx; /// Station ID within GRF of station
} StationSpecList;
};
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
struct StationRect : public Rect {
@ -207,13 +207,13 @@ enum {
HVOT_BUOY = 1 << 6
};
typedef enum CatchmentAreas {
enum CatchmentArea {
CA_NONE = 0,
CA_BUS = 3,
CA_TRUCK = 3,
CA_TRAIN = 4,
CA_DOCK = 5
} CatchmentArea;
};
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);

View File

@ -449,12 +449,12 @@ void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile,
}
}
typedef struct ottd_Rectangle {
struct ottd_Rectangle {
uint min_x;
uint min_y;
uint max_x;
uint max_y;
} ottd_Rectangle;
};
static inline void MergePoint(ottd_Rectangle* rect, TileIndex tile)
{
@ -2071,11 +2071,11 @@ static void TileLoop_Station(TileIndex tile)
static void AnimateTile_Station(TileIndex tile)
{
typedef struct AnimData {
struct AnimData {
StationGfx from; // first sprite
StationGfx to; // last sprite
byte delay;
} AnimData;
};
static const AnimData data[] = {
{ GFX_RADAR_LARGE_FIRST, GFX_RADAR_LARGE_LAST, 3 },

View File

@ -153,21 +153,21 @@ static int CDECL StationRatingMaxSorter(const void *a, const void *b)
return (_internal_sort_order & 1) ? maxr2 - maxr1 : maxr1 - maxr2;
}
typedef enum StationListFlags {
enum StationListFlags {
SL_ORDER = 0x01,
SL_RESORT = 0x02,
SL_REBUILD = 0x04,
} StationListFlags;
};
DECLARE_ENUM_AS_BIT_SET(StationListFlags);
typedef struct plstations_d {
struct plstations_d {
const Station** sort_list;
uint16 list_length;
byte sort_type;
StationListFlags flags;
uint16 resort_timer; //was byte refresh_counter;
} plstations_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
void RebuildStationLists()

View File

@ -58,16 +58,16 @@ enum {
BUS_SIZE_EXT = GFX_BASE_END - GFX_BUS_BASE_EXT,
};
typedef enum HangarTiles {
enum HangarTile {
HANGAR_TILE_0 = 32,
HANGAR_TILE_1 = 65,
HANGAR_TILE_2 = 86,
HANGAR_TILE_3 = 129, // added for west facing hangar
HANGAR_TILE_4 = 130, // added for north facing hangar
HANGAR_TILE_5 = 131 // added for east facing hangar
} HangarTiles;
};
typedef enum StationType {
enum StationType {
STATION_RAIL,
STATION_AIRPORT,
STATION_TRUCK,
@ -75,7 +75,7 @@ typedef enum StationType {
STATION_OILRIG,
STATION_DOCK,
STATION_BUOY
} StationType;
};
StationType GetStationType(TileIndex);

View File

@ -31,7 +31,7 @@
typedef void (*ParseCmdProc)(char *buf, int value);
typedef struct LanguagePackHeader {
struct LanguagePackHeader {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
@ -40,15 +40,15 @@ typedef struct LanguagePackHeader {
uint16 offsets[32]; // the offsets
byte plural_form; // plural form index
byte pad[3]; // pad header to be a multiple of 4
} LanguagePackHeader;
};
typedef struct CmdStruct {
struct CmdStruct {
const char *cmd;
ParseCmdProc proc;
long value;
int8 consumes;
byte flags;
} CmdStruct;
};
enum {
C_DONTCOUNT = 1,
@ -56,11 +56,11 @@ enum {
};
typedef struct Case {
struct Case {
int caseidx;
char *string;
struct Case *next;
} Case;
Case *next;
};
static bool _masterlang;
static bool _translated;
@ -68,7 +68,7 @@ static const char* _file = "(unknown file)";
static int _cur_line;
static int _errors, _warnings;
typedef struct LangString {
struct LangString {
char *name; // Name of the string
char *english; // English text
char *translated; // Translated text
@ -77,7 +77,7 @@ typedef struct LangString {
int line; // line of string in source-file
Case *english_case; // cases for english
Case *translated_case; // cases for foreign
} LangString;
};
static LangString *_strings[65536];
@ -106,16 +106,16 @@ static const byte _plural_form_counts[] = { 2, 1, 2, 3, 3, 3, 3, 3, 4 };
static const char *_cur_ident;
typedef struct CmdPair {
struct CmdPair {
const CmdStruct *a;
const char *v;
} CmdPair;
};
typedef struct ParsedCommandStruct {
struct ParsedCommandStruct {
int np;
CmdPair pairs[32];
const CmdStruct *cmd[32]; // ordered by param #
} ParsedCommandStruct;
};
// Used when generating some advanced commands.
static ParsedCommandStruct _cur_pcs;

View File

@ -37,11 +37,11 @@ void str_strip_colours(char *str);
/**
* Valid filter types for IsValidChar.
*/
typedef enum CharSetFilter {
enum CharSetFilter {
CS_ALPHANUMERAL, //! Both numeric and alphabetic and spaces and stuff
CS_NUMERAL, //! Only numeric ones
CS_ALPHA, //! Only alphabetic values
} CharSetFilter;
};
/** Convert the given string to lowercase, only works with ASCII! */
void strtolower(char *str);

View File

@ -35,7 +35,7 @@ static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv,
static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
typedef struct LanguagePack {
struct LanguagePack {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
@ -45,7 +45,7 @@ typedef struct LanguagePack {
byte plural_form; // how to compute plural forms
byte pad[3]; // pad header to be a multiple of 4
char data[VARARRAY_SIZE];
} LanguagePack;
};
static char **_langpack_offs;
static LanguagePack *_langpack;
@ -461,7 +461,7 @@ static const char *ParseStringChoice(const char *b, uint form, char *dst, int *d
return b + pos;
}
typedef struct Units {
struct Units {
int s_m; ///< Multiplier for velocity
int s_s; ///< Shift for velocity
StringID velocity; ///< String for velocity
@ -479,7 +479,7 @@ typedef struct Units {
int f_m; ///< Multiplier for force
int f_s; ///< Shift for force
StringID force; ///< String for force
} Units;
};
/* Unit conversions */
static const Units units[] = {

Some files were not shown because too many files have changed in this diff Show More