|
|
/* $Id$ */
|
|
|
|
|
|
/** @file functions.h */
|
|
|
|
|
|
#ifndef FUNCTIONS_H
|
|
|
#define FUNCTIONS_H
|
|
|
|
|
|
#include "gfx.h"
|
|
|
|
|
|
void DoClearSquare(TileIndex tile);
|
|
|
void RunTileLoop(void);
|
|
|
|
|
|
uint GetPartialZ(int x, int y, Slope corners);
|
|
|
uint GetSlopeZ(int x, int y);
|
|
|
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
|
|
|
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
|
|
@@ -25,48 +27,48 @@ static inline Point RemapCoords(int x, i
|
|
|
Point pt;
|
|
|
pt.x = (y - x) * 2;
|
|
|
pt.y = y + x - z;
|
|
|
return pt;
|
|
|
}
|
|
|
|
|
|
static inline Point RemapCoords2(int x, int y)
|
|
|
{
|
|
|
return RemapCoords(x, y, GetSlopeZ(x, y));
|
|
|
}
|
|
|
|
|
|
|
|
|
/* clear_land.c */
|
|
|
/* clear_land.cpp */
|
|
|
void DrawHillyLandTile(const TileInfo *ti);
|
|
|
void DrawClearLandTile(const TileInfo *ti, byte set);
|
|
|
void DrawClearLandFence(const TileInfo *ti);
|
|
|
void TileLoopClearHelper(TileIndex tile);
|
|
|
|
|
|
/* water_land.c */
|
|
|
/* water_land.cpp */
|
|
|
void DrawShipDepotSprite(int x, int y, int image);
|
|
|
void TileLoop_Water(TileIndex tile);
|
|
|
|
|
|
/* players.c */
|
|
|
/* players.cpp */
|
|
|
bool CheckPlayerHasMoney(int32 cost);
|
|
|
void SubtractMoneyFromPlayer(int32 cost);
|
|
|
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
|
|
|
bool CheckOwnership(Owner owner);
|
|
|
bool CheckTileOwnership(TileIndex tile);
|
|
|
StringID GetPlayerNameString(PlayerID player, uint index);
|
|
|
|
|
|
/* standard */
|
|
|
void ShowInfo(const char *str);
|
|
|
void CDECL ShowInfoF(const char *str, ...);
|
|
|
void NORETURN CDECL error(const char *str, ...);
|
|
|
|
|
|
/* openttd.c */
|
|
|
/* openttd.cpp */
|
|
|
|
|
|
/**************
|
|
|
* Warning: DO NOT enable this unless you understand what it does
|
|
|
*
|
|
|
* If enabled, in a network game all randoms will be dumped to the
|
|
|
* stdout if the first client joins (or if you are a client). This
|
|
|
* is to help finding desync problems.
|
|
|
*
|
|
|
* Warning: DO NOT enable this unless you understand what it does
|
|
|
**************/
|
|
|
|
|
|
//#define RANDOM_DEBUG
|
|
@@ -92,63 +94,63 @@ uint32 RandomMT(void);
|
|
|
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
|
|
|
uint DoRandomRange(uint max, int line, const char *file);
|
|
|
#else
|
|
|
uint32 Random(void);
|
|
|
uint RandomRange(uint max);
|
|
|
#endif
|
|
|
#endif // MERSENNE_TWISTER
|
|
|
|
|
|
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
|
|
|
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
|
|
|
|
|
|
|
|
|
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
|
|
uint32 InteractiveRandom(void); // Used for random sequences that are not the same on the other end of the multiplayer link
|
|
|
uint InteractiveRandomRange(uint max);
|
|
|
|
|
|
/* facedraw.c */
|
|
|
/* facedraw.cpp */
|
|
|
void DrawPlayerFace(uint32 face, int color, int x, int y);
|
|
|
|
|
|
/* texteff.c */
|
|
|
/* texteff.cpp */
|
|
|
void MoveAllTextEffects(void);
|
|
|
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
|
|
|
void InitTextEffects(void);
|
|
|
void DrawTextEffects(DrawPixelInfo *dpi);
|
|
|
|
|
|
void InitTextMessage(void);
|
|
|
void DrawTextMessage(void);
|
|
|
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
|
|
|
void UndrawTextMessage(void);
|
|
|
|
|
|
bool AddAnimatedTile(TileIndex tile);
|
|
|
void DeleteAnimatedTile(TileIndex tile);
|
|
|
void AnimateAnimatedTiles(void);
|
|
|
void InitializeAnimatedTiles(void);
|
|
|
|
|
|
/* tunnelbridge_cmd.c */
|
|
|
/* tunnelbridge_cmd.cpp */
|
|
|
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
|
|
|
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
|
|
|
int CalcBridgeLenCostFactor(int x);
|
|
|
|
|
|
/* misc_cmd.c */
|
|
|
/* misc_cmd.cpp */
|
|
|
void PlaceTreesRandomly(void);
|
|
|
|
|
|
void InitializeLandscapeVariables(bool only_constants);
|
|
|
|
|
|
/* misc.c */
|
|
|
/* misc.cpp */
|
|
|
bool IsCustomName(StringID id);
|
|
|
void DeleteName(StringID id);
|
|
|
char *GetName(char *buff, StringID id, const char* last);
|
|
|
|
|
|
// AllocateNameUnique also tests if the name used is not used anywere else
|
|
|
// and if it is used, it returns an error.
|
|
|
/* AllocateNameUnique also tests if the name used is not used anywere else
|
|
|
* and if it is used, it returns an error. */
|
|
|
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
|
|
|
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
|
|
|
StringID RealAllocateName(const char *name, byte skip, bool check_double);
|
|
|
void ConvertNameArray(void);
|
|
|
|
|
|
/* misc functions */
|
|
|
void MarkTileDirty(int x, int y);
|
|
|
void MarkTileDirtyByTile(TileIndex tile);
|
|
|
void InvalidateWindow(WindowClass cls, WindowNumber number);
|
|
|
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
|
|
|
void InvalidateWindowClasses(WindowClass cls);
|
|
|
void InvalidateWindowClassesData(WindowClass cls);
|
|
@@ -194,25 +196,25 @@ StringID RemapOldStringID(StringID s);
|
|
|
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str);
|
|
|
|
|
|
enum {
|
|
|
SLD_LOAD_GAME,
|
|
|
SLD_LOAD_SCENARIO,
|
|
|
SLD_SAVE_GAME,
|
|
|
SLD_SAVE_SCENARIO,
|
|
|
SLD_LOAD_HEIGHTMAP,
|
|
|
SLD_NEW_GAME,
|
|
|
};
|
|
|
void ShowSaveLoadDialog(int mode);
|
|
|
|
|
|
// callback from drivers that is called if the game size changes dynamically
|
|
|
/* callback from drivers that is called if the game size changes dynamically */
|
|
|
void GameSizeChanged(void);
|
|
|
bool FileExists(const char *filename);
|
|
|
bool ReadLanguagePack(int index);
|
|
|
void InitializeLanguagePacks(void);
|
|
|
const char *GetCurrentLocale(const char *param);
|
|
|
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
|
|
|
|
|
|
void LoadFromConfig(void);
|
|
|
void SaveToConfig(void);
|
|
|
void CheckConfig(void);
|
|
|
int ttd_main(int argc, char* argv[]);
|
|
|
void HandleExitGameRequest(void);
|