src/functions.h
changeset 8131 160939e24ed3
parent 8123 ce31d2843a95
child 8138 dbfdc08fa6b9
equal deleted inserted replaced
8130:d2eb7d04f6e1 8131:160939e24ed3
     5 #ifndef FUNCTIONS_H
     5 #ifndef FUNCTIONS_H
     6 #define FUNCTIONS_H
     6 #define FUNCTIONS_H
     7 
     7 
     8 #include "core/random_func.hpp"
     8 #include "core/random_func.hpp"
     9 #include "command_type.h"
     9 #include "command_type.h"
    10 #include "window_type.h"
       
    11 #include "openttd.h"
    10 #include "openttd.h"
    12 
       
    13 void UpdateTownMaxPass(Town *t);
       
    14 
    11 
    15 /* clear_land.cpp */
    12 /* clear_land.cpp */
    16 void DrawHillyLandTile(const TileInfo *ti);
    13 void DrawHillyLandTile(const TileInfo *ti);
    17 void DrawClearLandTile(const TileInfo *ti, byte set);
    14 void DrawClearLandTile(const TileInfo *ti, byte set);
    18 void DrawClearLandFence(const TileInfo *ti);
    15 void DrawClearLandFence(const TileInfo *ti);
    22 bool CheckPlayerHasMoney(CommandCost cost);
    19 bool CheckPlayerHasMoney(CommandCost cost);
    23 void SubtractMoneyFromPlayer(CommandCost cost);
    20 void SubtractMoneyFromPlayer(CommandCost cost);
    24 void SubtractMoneyFromPlayerFract(PlayerID player, CommandCost cost);
    21 void SubtractMoneyFromPlayerFract(PlayerID player, CommandCost cost);
    25 bool CheckOwnership(Owner owner);
    22 bool CheckOwnership(Owner owner);
    26 bool CheckTileOwnership(TileIndex tile);
    23 bool CheckTileOwnership(TileIndex tile);
    27 
       
    28 /* standard */
       
    29 void ShowInfo(const char *str);
       
    30 void CDECL ShowInfoF(const char *str, ...);
       
    31 
    24 
    32 /* openttd.cpp */
    25 /* openttd.cpp */
    33 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
    26 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
    34 static inline TileIndex RandomTile() { return TILE_MASK(Random()); }
    27 static inline TileIndex RandomTile() { return TILE_MASK(Random()); }
    35 
    28 
    65  * Mark a tile given by its index dirty for repaint.
    58  * Mark a tile given by its index dirty for repaint.
    66  *
    59  *
    67  * @ingroup dirty
    60  * @ingroup dirty
    68  */
    61  */
    69 void MarkTileDirtyByTile(TileIndex tile);
    62 void MarkTileDirtyByTile(TileIndex tile);
    70 void InvalidateWindow(WindowClass cls, WindowNumber number);
       
    71 void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
       
    72 void InvalidateWindowClasses(WindowClass cls);
       
    73 void InvalidateWindowClassesData(WindowClass cls);
       
    74 void DeleteWindowById(WindowClass cls, WindowNumber number);
       
    75 void DeleteWindowByClass(WindowClass cls);
       
    76 
       
    77 bool EnsureNoVehicleOnGround(TileIndex tile);
       
    78 
    63 
    79 /**
    64 /**
    80  * Mark all viewports dirty for repaint.
    65  * Mark all viewports dirty for repaint.
    81  *
    66  *
    82  * @ingroup dirty
    67  * @ingroup dirty
    83  */
    68  */
    84 void MarkAllViewportsDirty(int left, int top, int right, int bottom);
    69 void MarkAllViewportsDirty(int left, int top, int right, int bottom);
    85 void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost);
    70 void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost);
    86 void ShowFeederIncomeAnimation(int x, int y, int z, Money cost);
    71 void ShowFeederIncomeAnimation(int x, int y, int z, Money cost);
    87 
    72 
    88 bool CheckIfAuthorityAllows(TileIndex tile);
       
    89 Town *ClosestTownFromTile(TileIndex tile, uint threshold);
       
    90 void ChangeTownRating(Town *t, int add, int max);
       
    91 
       
    92 uint GetTownRadiusGroup(const Town* t, TileIndex tile);
       
    93 void ShowHighscoreTable(int difficulty, int8 rank);
    73 void ShowHighscoreTable(int difficulty, int8 rank);
    94 
    74 
    95 void AfterLoadTown();
       
    96 void UpdatePatches();
       
    97 void AskExitGame();
    75 void AskExitGame();
    98 void AskExitToGameMenu();
    76 void AskExitToGameMenu();
    99 
    77 
   100 void RedrawAutosave();
    78 void RedrawAutosave();
   101 
    79 
   113 };
    91 };
   114 void ShowSaveLoadDialog(int mode);
    92 void ShowSaveLoadDialog(int mode);
   115 
    93 
   116 /* callback from drivers that is called if the game size changes dynamically */
    94 /* callback from drivers that is called if the game size changes dynamically */
   117 void GameSizeChanged();
    95 void GameSizeChanged();
   118 bool FileExists(const char *filename);
       
   119 const char *GetCurrentLocale(const char *param);
    96 const char *GetCurrentLocale(const char *param);
   120 void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
       
   121 
    97 
   122 void LoadFromConfig();
       
   123 void SaveToConfig();
       
   124 void CheckConfig();
       
   125 int ttd_main(int argc, char* argv[]);
    98 int ttd_main(int argc, char* argv[]);
   126 void HandleExitGameRequest();
    99 void HandleExitGameRequest();
   127 
   100 
   128 #endif /* FUNCTIONS_H */
   101 #endif /* FUNCTIONS_H */