src/functions.h
changeset 6505 abcb0580d976
parent 5919 2b58160d667d
child 6516 ee6d057b9850
equal deleted inserted replaced
6504:5578f2fa1a73 6505:abcb0580d976
     1 /* $Id$ */
     1 /* $Id$ */
       
     2 
       
     3 /** @file functions.h */
     2 
     4 
     3 #ifndef FUNCTIONS_H
     5 #ifndef FUNCTIONS_H
     4 #define FUNCTIONS_H
     6 #define FUNCTIONS_H
     5 
     7 
     6 #include "gfx.h"
     8 #include "gfx.h"
    32 {
    34 {
    33 	return RemapCoords(x, y, GetSlopeZ(x, y));
    35 	return RemapCoords(x, y, GetSlopeZ(x, y));
    34 }
    36 }
    35 
    37 
    36 
    38 
    37 /* clear_land.c */
    39 /* clear_land.cpp */
    38 void DrawHillyLandTile(const TileInfo *ti);
    40 void DrawHillyLandTile(const TileInfo *ti);
    39 void DrawClearLandTile(const TileInfo *ti, byte set);
    41 void DrawClearLandTile(const TileInfo *ti, byte set);
    40 void DrawClearLandFence(const TileInfo *ti);
    42 void DrawClearLandFence(const TileInfo *ti);
    41 void TileLoopClearHelper(TileIndex tile);
    43 void TileLoopClearHelper(TileIndex tile);
    42 
    44 
    43 /* water_land.c */
    45 /* water_land.cpp */
    44 void DrawShipDepotSprite(int x, int y, int image);
    46 void DrawShipDepotSprite(int x, int y, int image);
    45 void TileLoop_Water(TileIndex tile);
    47 void TileLoop_Water(TileIndex tile);
    46 
    48 
    47 /* players.c */
    49 /* players.cpp */
    48 bool CheckPlayerHasMoney(int32 cost);
    50 bool CheckPlayerHasMoney(int32 cost);
    49 void SubtractMoneyFromPlayer(int32 cost);
    51 void SubtractMoneyFromPlayer(int32 cost);
    50 void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
    52 void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
    51 bool CheckOwnership(Owner owner);
    53 bool CheckOwnership(Owner owner);
    52 bool CheckTileOwnership(TileIndex tile);
    54 bool CheckTileOwnership(TileIndex tile);
    55 /* standard */
    57 /* standard */
    56 void ShowInfo(const char *str);
    58 void ShowInfo(const char *str);
    57 void CDECL ShowInfoF(const char *str, ...);
    59 void CDECL ShowInfoF(const char *str, ...);
    58 void NORETURN CDECL error(const char *str, ...);
    60 void NORETURN CDECL error(const char *str, ...);
    59 
    61 
    60 /* openttd.c */
    62 /* openttd.cpp */
    61 
    63 
    62 /**************
    64 /**************
    63  * Warning: DO NOT enable this unless you understand what it does
    65  * Warning: DO NOT enable this unless you understand what it does
    64  *
    66  *
    65  * If enabled, in a network game all randoms will be dumped to the
    67  * If enabled, in a network game all randoms will be dumped to the
    99 
   101 
   100 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
   102 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
   101 static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
   103 static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
   102 
   104 
   103 
   105 
   104 uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
   106 uint32 InteractiveRandom(void); // Used for random sequences that are not the same on the other end of the multiplayer link
   105 uint InteractiveRandomRange(uint max);
   107 uint InteractiveRandomRange(uint max);
   106 
   108 
   107 /* facedraw.c */
   109 /* facedraw.cpp */
   108 void DrawPlayerFace(uint32 face, int color, int x, int y);
   110 void DrawPlayerFace(uint32 face, int color, int x, int y);
   109 
   111 
   110 /* texteff.c */
   112 /* texteff.cpp */
   111 void MoveAllTextEffects(void);
   113 void MoveAllTextEffects(void);
   112 void AddTextEffect(StringID msg, int x, int y, uint16 duration);
   114 void AddTextEffect(StringID msg, int x, int y, uint16 duration);
   113 void InitTextEffects(void);
   115 void InitTextEffects(void);
   114 void DrawTextEffects(DrawPixelInfo *dpi);
   116 void DrawTextEffects(DrawPixelInfo *dpi);
   115 
   117 
   121 bool AddAnimatedTile(TileIndex tile);
   123 bool AddAnimatedTile(TileIndex tile);
   122 void DeleteAnimatedTile(TileIndex tile);
   124 void DeleteAnimatedTile(TileIndex tile);
   123 void AnimateAnimatedTiles(void);
   125 void AnimateAnimatedTiles(void);
   124 void InitializeAnimatedTiles(void);
   126 void InitializeAnimatedTiles(void);
   125 
   127 
   126 /* tunnelbridge_cmd.c */
   128 /* tunnelbridge_cmd.cpp */
   127 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
   129 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
   128 uint32 GetBridgeLength(TileIndex begin, TileIndex end);
   130 uint32 GetBridgeLength(TileIndex begin, TileIndex end);
   129 int CalcBridgeLenCostFactor(int x);
   131 int CalcBridgeLenCostFactor(int x);
   130 
   132 
   131 /* misc_cmd.c */
   133 /* misc_cmd.cpp */
   132 void PlaceTreesRandomly(void);
   134 void PlaceTreesRandomly(void);
   133 
   135 
   134 void InitializeLandscapeVariables(bool only_constants);
   136 void InitializeLandscapeVariables(bool only_constants);
   135 
   137 
   136 /* misc.c */
   138 /* misc.cpp */
   137 bool IsCustomName(StringID id);
   139 bool IsCustomName(StringID id);
   138 void DeleteName(StringID id);
   140 void DeleteName(StringID id);
   139 char *GetName(char *buff, StringID id, const char* last);
   141 char *GetName(char *buff, StringID id, const char* last);
   140 
   142 
   141 // AllocateNameUnique also tests if the name used is not used anywere else
   143 /* AllocateNameUnique also tests if the name used is not used anywere else
   142 //  and if it is used, it returns an error.
   144  * and if it is used, it returns an error. */
   143 #define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
   145 #define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
   144 #define AllocateName(name, skip) RealAllocateName(name, skip, false)
   146 #define AllocateName(name, skip) RealAllocateName(name, skip, false)
   145 StringID RealAllocateName(const char *name, byte skip, bool check_double);
   147 StringID RealAllocateName(const char *name, byte skip, bool check_double);
   146 void ConvertNameArray(void);
   148 void ConvertNameArray(void);
   147 
   149 
   201 	SLD_LOAD_HEIGHTMAP,
   203 	SLD_LOAD_HEIGHTMAP,
   202 	SLD_NEW_GAME,
   204 	SLD_NEW_GAME,
   203 };
   205 };
   204 void ShowSaveLoadDialog(int mode);
   206 void ShowSaveLoadDialog(int mode);
   205 
   207 
   206 // callback from drivers that is called if the game size changes dynamically
   208 /* callback from drivers that is called if the game size changes dynamically */
   207 void GameSizeChanged(void);
   209 void GameSizeChanged(void);
   208 bool FileExists(const char *filename);
   210 bool FileExists(const char *filename);
   209 bool ReadLanguagePack(int index);
   211 bool ReadLanguagePack(int index);
   210 void InitializeLanguagePacks(void);
   212 void InitializeLanguagePacks(void);
   211 const char *GetCurrentLocale(const char *param);
   213 const char *GetCurrentLocale(const char *param);