(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile

This commit is contained in:
tron 2005-01-22 20:23:18 +00:00
parent 7984a9a500
commit 189ca73707
81 changed files with 612 additions and 590 deletions

View File

@ -299,13 +299,13 @@ CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3)
# GNU make can only test for (in)equality
# this is a workaround to test for >=
ifeq ($(shell if test $(CC_VERSION) -ge 29; then echo true; fi), true)
CFLAGS += -O -Wall -Wno-multichar -Wsign-compare
CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wstrict-prototypes
endif
ifeq ($(shell if test $(CC_VERSION) -ge 30; then echo true; fi), true)
CFLAGS += -W -Wno-unused-parameter
endif
ifeq ($(shell if test $(CC_VERSION) -ge 34; then echo true; fi), true)
CFLAGS += -Wdeclaration-after-statement
CFLAGS += -Wdeclaration-after-statement -Wold-style-definition
endif
CDEFS=-DWITH_REV

6
ai.c
View File

@ -413,12 +413,14 @@ typedef struct FoundRoute {
void *to;
} FoundRoute;
static Town *AiFindRandomTown() {
static Town *AiFindRandomTown(void)
{
Town *t = GetTown(RandomRange(_total_towns));
return (t->xy != 0) ? t : NULL;
}
static Industry *AiFindRandomIndustry() {
static Industry *AiFindRandomIndustry(void)
{
Industry *i = GetIndustry(RandomRange(_total_industries));
return (i->xy != 0) ? i : NULL;
}

View File

@ -537,7 +537,7 @@ void OnNewDay_Aircraft(Vehicle *v)
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
void AircraftYearlyLoop()
void AircraftYearlyLoop(void)
{
Vehicle *v;
@ -1875,7 +1875,7 @@ void UpdateOilRig( void )
}
// need to be called to load aircraft from old version
void UpdateOldAircraft()
void UpdateOldAircraft(void)
{
Station *st;
Vehicle *v_oldstyle;

View File

@ -22,7 +22,7 @@ static byte AirportTestFTA(const AirportFTAClass *Airport);
/*static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_report);
static byte AirportBlockToString(uint32 block);*/
void InitializeAirports()
void InitializeAirports(void)
{
// country airport
CountryAirport = malloc(sizeof(AirportFTAClass));
@ -97,7 +97,7 @@ void InitializeAirports()
Oilrig = Heliport; // exactly the same structure for heliport/oilrig, so share state machine
}
void UnInitializeAirports()
void UnInitializeAirports(void)
{
AirportFTAClass_Destructor(CountryAirport);
AirportFTAClass_Destructor(CityAirport);

View File

@ -44,8 +44,8 @@ typedef struct AirportFTA {
struct AirportFTA *next_in_chain; // possible extra movement choices from this position
} AirportFTA;
void InitializeAirports();
void UnInitializeAirports();
void InitializeAirports(void);
void UnInitializeAirports(void);
const AirportFTAClass* GetAirport(const byte airport_type);
#endif /* AIRPORT_H */

View File

@ -14,7 +14,7 @@
static byte _selected_airport_type;
static void ShowBuildAirportPicker();
static void ShowBuildAirportPicker(void);
void CcBuildAirport(bool success, uint tile, uint32 p1, uint32 p2)
@ -124,7 +124,7 @@ static const WindowDesc _air_toolbar_desc = {
BuildAirToolbWndProc
};
void ShowBuildAirToolbar()
void ShowBuildAirToolbar(void)
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
@ -232,12 +232,12 @@ static const WindowDesc _build_airport_desc = {
BuildAirportPickerWndProc
};
static void ShowBuildAirportPicker()
static void ShowBuildAirportPicker(void)
{
AllocateWindowDesc(&_build_airport_desc);
}
void InitializeAirportGui()
void InitializeAirportGui(void)
{
_selected_airport_type = AT_SMALL;
_last_built_aircraft_depot_tile = 0;

View File

@ -729,7 +729,7 @@ static void TileLoop_Clear(uint tile)
MarkTileDirtyByTile(tile);
}
void GenerateClearTile()
void GenerateClearTile(void)
{
int i,j;
uint tile,tile_new;
@ -801,7 +801,8 @@ static void ChangeTileOwner_Clear(uint tile, byte old_player, byte new_player)
return;
}
void InitializeClearLand() {
void InitializeClearLand(void)
{
_opt.snow_line = _patches.snow_line_height * 8;
}

View File

@ -385,7 +385,7 @@ error:
return res;
}
int32 GetAvailableMoneyForCommand()
int32 GetAvailableMoneyForCommand(void)
{
uint pid = _current_player;
if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int

View File

@ -183,6 +183,6 @@ int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
bool IsValidCommand(uint cmd);
int32 GetAvailableMoneyForCommand();
int32 GetAvailableMoneyForCommand(void);
#endif /* COMMAND_H */

View File

@ -140,7 +140,7 @@ DEF_CONSOLE_CMD(ConScrollToTile)
}
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
extern void BuildFileList();
extern void BuildFileList(void);
extern void SetFiosType(const byte fiostype);
/* Load a file-number from current dir */
@ -1167,7 +1167,7 @@ DEF_CONSOLE_CMD(ConSet) {
/* debug commands and variables */
/* ****************************************** */
void IConsoleDebugLibRegister()
void IConsoleDebugLibRegister(void)
{
// debugging variables and functions
extern bool _stdlib_con_developer; /* XXX extern in .c */

View File

@ -694,10 +694,10 @@ void OnNewDay_DisasterVehicle(Vehicle *v)
// not used
}
typedef void DisasterInitProc();
typedef void DisasterInitProc(void);
// Zeppeliner which crashes on a small airport
static void Disaster0_Init()
static void Disaster0_Init(void)
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
Station *st;
@ -730,7 +730,7 @@ static void Disaster0_Init()
}
}
static void Disaster1_Init()
static void Disaster1_Init(void)
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
int x;
@ -753,7 +753,7 @@ static void Disaster1_Init()
}
}
static void Disaster2_Init()
static void Disaster2_Init(void)
{
Industry *i, *found;
Vehicle *v,*u;
@ -789,7 +789,7 @@ static void Disaster2_Init()
}
}
static void Disaster3_Init()
static void Disaster3_Init(void)
{
Industry *i, *found;
Vehicle *v,*u,*w;
@ -831,7 +831,7 @@ static void Disaster3_Init()
}
}
static void Disaster4_Init()
static void Disaster4_Init(void)
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
int x,y;
@ -856,7 +856,7 @@ static void Disaster4_Init()
}
// Submarine type 1
static void Disaster5_Init()
static void Disaster5_Init(void)
{
Vehicle *v = ForceAllocateSpecialVehicle();
int x,y;
@ -877,7 +877,7 @@ static void Disaster5_Init()
}
// Submarine type 2
static void Disaster6_Init()
static void Disaster6_Init(void)
{
Vehicle *v = ForceAllocateSpecialVehicle();
int x,y;
@ -897,7 +897,7 @@ static void Disaster6_Init()
v->age = 0;
}
static void Disaster7_Init()
static void Disaster7_Init(void)
{
Industry *i;
int maxloop = 15;
@ -954,7 +954,7 @@ static const DisasterYears _dis_years[8] = {
};
static void DoDisaster()
static void DoDisaster(void)
{
byte buf[8];
byte year = _cur_year;
@ -973,12 +973,12 @@ static void DoDisaster()
}
static void ResetDisasterDelay()
static void ResetDisasterDelay(void)
{
_disaster_delay = (int)(Random() & 0x1FF) + 730;
}
void DisasterDailyLoop()
void DisasterDailyLoop(void)
{
if (--_disaster_delay != 0)
return;
@ -989,7 +989,8 @@ void DisasterDailyLoop()
DoDisaster();
}
void StartupDisasters() {
void StartupDisasters(void)
{
ResetDisasterDelay();
}

View File

@ -10,8 +10,8 @@
#include "sound.h"
#include "command.h"
static void ShowBuildDockStationPicker();
static void ShowBuildDocksDepotPicker();
static void ShowBuildDockStationPicker(void);
static void ShowBuildDocksDepotPicker(void);
static byte _ship_depot_direction;
@ -202,7 +202,7 @@ static const WindowDesc _build_docks_toolbar_desc = {
BuildDocksToolbWndProc
};
void ShowBuildDocksToolbar()
void ShowBuildDocksToolbar(void)
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
@ -278,12 +278,12 @@ static const WindowDesc _build_dock_station_desc = {
BuildDockStationWndProc
};
static void ShowBuildDockStationPicker()
static void ShowBuildDockStationPicker(void)
{
AllocateWindowDesc(&_build_dock_station_desc);
}
static void UpdateDocksDirection()
static void UpdateDocksDirection(void)
{
if (_ship_depot_direction != 0) {
SetTileSelectSize(1, 2);
@ -349,14 +349,14 @@ static const WindowDesc _build_docks_depot_desc = {
};
static void ShowBuildDocksDepotPicker()
static void ShowBuildDocksDepotPicker(void)
{
AllocateWindowDesc(&_build_docks_depot_desc);
UpdateDocksDirection();
}
void InitializeDockGui()
void InitializeDockGui(void)
{
_ship_depot_direction = 0;
}

View File

@ -584,7 +584,7 @@ StringID GetNewsStringBankrupcy(NewsItem *ni)
return 0;
}
static void PlayersGenStatistics()
static void PlayersGenStatistics(void)
{
Station *st;
Player *p;
@ -633,7 +633,7 @@ static void AddSingleInflation(int32 *value, uint16 *frac, int32 amt)
*value += (int32)(tmp >> 16) + (low >> 16);
}
static void AddInflation()
static void AddInflation(void)
{
int i;
int32 inf = _economy.infl_amount * 54;
@ -661,7 +661,7 @@ static void AddInflation()
InvalidateWindow(WC_PAYMENT_RATES, 0);
}
static void PlayersPayInterest()
static void PlayersPayInterest(void)
{
Player *p;
int interest = _economy.interest_rate * 54;
@ -680,7 +680,7 @@ static void PlayersPayInterest()
}
}
static void HandleEconomyFluctuations()
static void HandleEconomyFluctuations(void)
{
if (_opt.diff.economy == 0)
return;
@ -756,7 +756,7 @@ static const int32 _price_base[NUM_PRICES] = {
1000000, // build_industry
};
void StartupEconomy()
void StartupEconomy(void)
{
int i;
@ -988,7 +988,7 @@ void RemoteSubsidyAdd(Subsidy *s_new)
InvalidateWindow(WC_SUBSIDIES_LIST, 0);
}
static void SubsidyMonthlyHandler()
static void SubsidyMonthlyHandler(void)
{
Subsidy *s;
Pair pair;
@ -1068,7 +1068,7 @@ static const byte _subsidies_desc[] = {
SLE_END()
};
static void Save_SUBS()
static void Save_SUBS(void)
{
int i;
Subsidy *s;
@ -1082,7 +1082,7 @@ static void Save_SUBS()
}
}
static void Load_SUBS()
static void Load_SUBS(void)
{
int index;
while ((index = SlIterateArray()) != -1)
@ -1473,7 +1473,7 @@ int LoadUnloadVehicle(Vehicle *v)
return result;
}
void PlayersMonthlyLoop()
void PlayersMonthlyLoop(void)
{
PlayersGenStatistics();
if (_patches.inflation)
@ -1611,14 +1611,14 @@ int32 CmdBuyCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
// Prices
static void SaveLoad_PRIC()
static void SaveLoad_PRIC(void)
{
SlArray(&_price, NUM_PRICES, SLE_INT32);
SlArray(&_price_frac, NUM_PRICES, SLE_UINT16);
}
// Cargo payment rates
static void SaveLoad_CAPR()
static void SaveLoad_CAPR(void)
{
SlArray(&_cargo_payment_rates, NUM_CARGO, SLE_INT32);
SlArray(&_cargo_payment_rates_frac, NUM_CARGO, SLE_UINT16);
@ -1635,7 +1635,7 @@ static const byte _economy_desc[] = {
};
// Economy variables
static void SaveLoad_ECMY()
static void SaveLoad_ECMY(void)
{
SlObject(&_economy, &_economy_desc);
}

View File

@ -50,7 +50,7 @@ byte _local_cargo_id_landscape[NUM_CID] = {
void ShowEnginePreviewWindow(int engine);
void DeleteCustomEngineNames()
void DeleteCustomEngineNames(void)
{
uint i;
StringID old;
@ -64,13 +64,13 @@ void DeleteCustomEngineNames()
_vehicle_design_names &= ~1;
}
void LoadCustomEngineNames()
void LoadCustomEngineNames(void)
{
// XXX: not done */
DEBUG(misc, 1) ("LoadCustomEngineNames: not done");
}
static void SetupEngineNames()
static void SetupEngineNames(void)
{
uint i;
@ -81,7 +81,7 @@ static void SetupEngineNames()
LoadCustomEngineNames();
}
static void AdjustAvailAircraft()
static void AdjustAvailAircraft(void)
{
uint16 date = _date;
byte avail = 0;
@ -116,7 +116,7 @@ static void CalcEngineReliability(Engine *e)
}
}
void AddTypeToEngines()
void AddTypeToEngines(void)
{
Engine *e;
uint32 counter = 0;
@ -139,7 +139,7 @@ void AddTypeToEngines()
}
}
void StartupEngines()
void StartupEngines(void)
{
Engine *e;
const EngineInfo *ei;
@ -653,7 +653,7 @@ void AcceptEnginePreview(Engine *e, int player)
InvalidateWindowClasses(WC_BUILD_VEHICLE);
}
void EnginesDailyLoop()
void EnginesDailyLoop(void)
{
Engine *e;
int i,num;
@ -781,7 +781,7 @@ static void NewVehicleAvailable(Engine *e)
}
}
void EnginesMonthlyLoop()
void EnginesMonthlyLoop(void)
{
Engine *e;
@ -876,7 +876,7 @@ static const byte _engine_desc[] = {
SLE_END()
};
static void Save_ENGN()
static void Save_ENGN(void)
{
Engine *e;
int i;
@ -886,7 +886,7 @@ static void Save_ENGN()
}
}
static void Load_ENGN()
static void Load_ENGN(void)
{
int index;
while ((index = SlIterateArray()) != -1) {
@ -894,7 +894,7 @@ static void Load_ENGN()
}
}
static void LoadSave_ENGS()
static void LoadSave_ENGS(void)
{
SlArray(_engine_name_strings, lengthof(_engine_name_strings), SLE_STRINGID);
}

View File

@ -80,8 +80,8 @@ enum {
};
void AddTypeToEngines();
void StartupEngines();
void AddTypeToEngines(void);
void StartupEngines(void);
extern byte _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO];
@ -130,8 +130,8 @@ void DrawAircraftEngineInfo(int engine, int x, int y, int maxw);
void AcceptEnginePreview(Engine *e, int player);
void LoadCustomEngineNames();
void DeleteCustomEngineNames();
void LoadCustomEngineNames(void);
void DeleteCustomEngineNames(void);
enum {

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
#include "fileio.h"
#if defined(UNIX) || defined(__OS2__)
#include <ctype.h> // required for tolower()
#endif
@ -21,7 +22,7 @@ typedef struct {
static Fio _fio;
// Get current position in file
uint32 FioGetPos()
uint32 FioGetPos(void)
{
return _fio.pos + (_fio.buffer - _fio.buffer_start) - FIO_BUFFER_SIZE;
}
@ -42,7 +43,7 @@ void FioSeekToFile(uint32 pos)
FioSeekTo(pos & 0xFFFFFF, SEEK_SET);
}
byte FioReadByte()
byte FioReadByte(void)
{
if (_fio.buffer == _fio.buffer_end) {
_fio.pos += FIO_BUFFER_SIZE;
@ -64,13 +65,13 @@ void FioSkipBytes(int n)
}
uint16 FioReadWord()
uint16 FioReadWord(void)
{
byte b = FioReadByte();
return (FioReadByte() << 8) | b;
}
uint32 FioReadDword()
uint32 FioReadDword(void)
{
uint b = FioReadWord();
return (FioReadWord() << 16) | b;

View File

@ -3,11 +3,11 @@
void FioSeekTo(uint32 pos, int mode);
void FioSeekToFile(uint32 pos);
uint32 FioGetPos();
byte FioReadByte();
uint16 FioReadWord();
uint32 FioReadDword();
void FioCloseAll();
uint32 FioGetPos(void);
byte FioReadByte(void);
uint16 FioReadWord(void);
uint32 FioReadDword(void);
void FioCloseAll(void);
void FioOpenFile(int slot, const char *filename);
void FioReadBlock(void *ptr, uint size);
void FioSkipBytes(int n);

View File

@ -16,7 +16,7 @@ void DoClearSquare(uint tile);
void CDECL ModifyTile(uint tile, uint flags, ...);
void SetMapExtraBits(uint tile, byte flags);
uint GetMapExtraBits(uint tile);
void RunTileLoop();
void RunTileLoop(void);
uint GetPartialZ(int x, int y, int corners);
uint GetSlopeZ(int x, int y);
@ -58,10 +58,10 @@ static inline Point RemapCoords2(int x, int y)
byte *GetString(byte *buffr, uint16 string);
void InjectDparam(int amount);
int32 GetParamInt32();
int GetParamInt16();
int GetParamInt8();
int GetParamUint16();
int32 GetParamInt32(void);
int GetParamInt16(void);
int GetParamInt8(void);
int GetParamUint16(void);
/* clear_land.c */
@ -117,13 +117,13 @@ void NORETURN CDECL error(const char *str, ...);
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint DoRandomRange(uint max, uint line, char *file);
#else
uint32 Random();
uint32 Random(void);
uint RandomRange(uint max);
#endif
void InitPlayerRandoms();
void InitPlayerRandoms(void);
uint32 InteractiveRandom(); /* 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);
void SetDate(uint date);
@ -131,21 +131,21 @@ void SetDate(uint date);
void DrawPlayerFace(uint32 face, int color, int x, int y);
/* texteff.c */
void MoveAllTextEffects();
void MoveAllTextEffects(void);
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
void InitTextEffects();
void InitTextEffects(void);
void DrawTextEffects(DrawPixelInfo *dpi);
void InitTextMessage();
void DrawTextMessage();
void InitTextMessage(void);
void DrawTextMessage(void);
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
void UndrawTextMessage();
void TextMessageDailyLoop();
void UndrawTextMessage(void);
void TextMessageDailyLoop(void);
bool AddAnimatedTile(uint tile);
void DeleteAnimatedTile(uint tile);
void AnimateAnimatedTiles();
void InitializeAnimatedTiles();
void AnimateAnimatedTiles(void);
void InitializeAnimatedTiles(void);
/* tunnelbridge_cmd.c */
bool CheckTunnelInWay(uint tile, int z);
@ -158,18 +158,18 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
/* network.c */
void NetworkUDPClose(void);
void NetworkStartUp();
void NetworkStartUp(void);
void NetworkShutDown(void);
void NetworkGameLoop(void);
void NetworkUDPGameLoop(void);
bool NetworkServerStart(void);
bool NetworkClientConnectGame(const byte* host, unsigned short port);
void NetworkReboot();
void NetworkDisconnect();
void NetworkReboot(void);
void NetworkDisconnect(void);
void NetworkSend_Command(uint32 tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
/* misc_cmd.c */
void PlaceTreesRandomly();
void PlaceTreesRandomly(void);
uint GetTileDist(TileIndex xy1, TileIndex xy2);
uint GetTileDist1D(TileIndex xy1, TileIndex xy2);
@ -206,7 +206,7 @@ void DeleteWindowByClass(WindowClass cls);
void SetObjectToPlaceWnd(int icon, byte mode, Window *w);
void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace();
void ResetObjectToPlace(void);
bool ScrollWindowToTile(TileIndex tile, Window * w);
bool ScrollWindowTo(int x, int y, Window * w);
@ -230,8 +230,8 @@ uint GetRoadBitsByTile(TileIndex tile);
int GetTownRadiusGroup(Town *t, uint tile);
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
void ShowNetworkGiveMoneyWindow(byte player);
void ShowNetworkNeedGamePassword();
void ShowNetworkNeedCompanyPassword();
void ShowNetworkNeedGamePassword(void);
void ShowNetworkNeedCompanyPassword(void);
void ShowRenameWaypointWindow(Waypoint *cp);
int FindFirstBit(uint32 x);
void ShowHighscoreTable(int difficulty, int8 rank);
@ -252,11 +252,11 @@ enum SaveOrLoadMode {
int SaveOrLoad(const char *filename, int mode);
void AfterLoadTown();
void AskExitGame();
void AskExitToGameMenu();
void AfterLoadTown(void);
void AskExitGame(void);
void AskExitToGameMenu(void);
void RedrawAutosave();
void RedrawAutosave(void);
StringID RemapOldStringID(StringID s);
@ -274,21 +274,21 @@ void ShowSaveLoadDialog(int mode);
void ttd_strlcpy(char *dst, const char *src, size_t len);
// callback from drivers that is called if the game size changes dynamically
void GameSizeChanged();
void GameSizeChanged(void);
bool FileExists(const char *filename);
bool ReadLanguagePack(int index);
void InitializeLanguagePacks();
void InitializeLanguagePacks(void);
byte *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
int GetLanguageList(char **languages, int max);
void CheckSwitchToEuro();
void CheckSwitchToEuro(void);
void LoadFromConfig();
void SaveToConfig();
void LoadFromConfig(void);
void SaveToConfig(void);
int ttd_main(int argc, char* argv[]);
byte GetOSVersion();
byte GetOSVersion(void);
void DeterminePaths();
void DeterminePaths(void);
char * CDECL str_fmt(const char *str, ...);
#endif /* FUNCTIONS_H */

23
gfx.c
View File

@ -1483,9 +1483,9 @@ static void GfxScalePalette(int pal, byte scaling)
}
#endif
void DoPaletteAnimations();
void DoPaletteAnimations(void);
void GfxInitPalettes()
void GfxInitPalettes(void)
{
int pal = _use_dos_palette?1:0;
memcpy(_cur_palette, _palettes[pal], 256*3);
@ -1499,7 +1499,7 @@ void GfxInitPalettes()
#define EXTR2(p,q) (((uint16)(~_timer_counter * (p)) * (q)) >> 16)
#define COPY_TRIPLET do {d[0]=s[0+j]; d[1]=s[1+j]; d[2]=s[2+j];d+=3;}while(0)
void DoPaletteAnimations()
void DoPaletteAnimations(void)
{
const byte *s;
byte *d;
@ -1612,7 +1612,7 @@ void DoPaletteAnimations()
}
void LoadStringWidthTable()
void LoadStringWidthTable(void)
{
int i;
byte *b;
@ -1633,7 +1633,7 @@ void LoadStringWidthTable()
}
}
void ScreenSizeChanged()
void ScreenSizeChanged(void)
{
// check the dirty rect
if (_invalid_rect.right >= _screen.width) _invalid_rect.right = _screen.width;
@ -1643,7 +1643,7 @@ void ScreenSizeChanged()
_cursor.visible = false;
}
void UndrawMouseCursor()
void UndrawMouseCursor(void)
{
if (_cursor.visible) {
_cursor.visible = false;
@ -1656,7 +1656,7 @@ void UndrawMouseCursor()
}
}
void DrawMouseCursor()
void DrawMouseCursor(void)
{
int x,y,w,h;
@ -1739,7 +1739,7 @@ void RedrawScreenRect(int left, int top, int right, int bottom)
_video_driver->make_dirty(left, top, right-left, bottom-top);
}
void DrawDirtyBlocks()
void DrawDirtyBlocks(void)
{
byte *b = _dirty_blocks;
int x=0,y=0;
@ -1845,7 +1845,7 @@ void SetDirtyBlocks(int left, int top, int right, int bottom)
} while (--height);
}
void MarkWholeScreenDirty()
void MarkWholeScreenDirty(void)
{
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
}
@ -1914,7 +1914,7 @@ static void SetCursorSprite(uint cursor)
cv->dirty = true;
}
static void SwitchAnimatedCursor()
static void SwitchAnimatedCursor(void)
{
CursorVars *cv = &_cursor;
const uint16 *cur;
@ -1930,7 +1930,8 @@ static void SwitchAnimatedCursor()
SetCursorSprite(sprite);
}
void CursorTick() {
void CursorTick(void)
{
CursorVars *cv = &_cursor;
if (cv->animate_timeout && !--cv->animate_timeout)
SwitchAnimatedCursor();

18
gfx.h
View File

@ -53,14 +53,14 @@ void DrawFrameRect(int left, int top, int right, int bottom, int color, int flag
uint16 GetDrawStringPlayerColor(byte player);
int GetStringWidth(const byte *str);
void LoadStringWidthTable();
void LoadStringWidthTable(void);
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw);
void DrawStringMultiLine(int x, int y, uint16 str, int maxw);
void DrawDirtyBlocks();
void DrawDirtyBlocks(void);
void SetDirtyBlocks(int left, int top, int right, int bottom);
void MarkWholeScreenDirty();
void MarkWholeScreenDirty(void);
void GfxInitPalettes();
void GfxInitPalettes(void);
bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height);
@ -70,14 +70,14 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
/* spritecache.c */
byte *GetSpritePtr(uint sprite);
void GfxInitSpriteMem(byte *ptr, uint32 size);
void GfxLoadSprites();
void GfxLoadSprites(void);
void SetMouseCursor(uint cursor);
void SetAnimatedMouseCursor(const uint16 *table);
void CursorTick();
void DrawMouseCursor();
void ScreenSizeChanged();
void UndrawMouseCursor();
void CursorTick(void);
void DrawMouseCursor(void);
void ScreenSizeChanged(void);
void UndrawMouseCursor(void);
bool ChangeResInGame(int w, int h);
void ToggleFullScreen(const bool full_screen);

View File

@ -272,7 +272,7 @@ static const WindowDesc _graph_legend_desc = {
GraphLegendWndProc
};
static void ShowGraphLegend()
static void ShowGraphLegend(void)
{
AllocateWindowDescFront(&_graph_legend_desc, 0);
}
@ -374,7 +374,7 @@ static const WindowDesc _operating_profit_desc = {
};
void ShowOperatingProfitGraph()
void ShowOperatingProfitGraph(void)
{
if (AllocateWindowDescFront(&_operating_profit_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@ -448,7 +448,7 @@ static const WindowDesc _income_graph_desc = {
IncomeGraphWndProc
};
void ShowIncomeGraph()
void ShowIncomeGraph(void)
{
if (AllocateWindowDescFront(&_income_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@ -521,7 +521,7 @@ static const WindowDesc _delivered_cargo_graph_desc = {
DeliveredCargoGraphWndProc
};
void ShowDeliveredCargoGraph()
void ShowDeliveredCargoGraph(void)
{
if (AllocateWindowDescFront(&_delivered_cargo_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@ -597,7 +597,7 @@ static const WindowDesc _performance_history_desc = {
PerformanceHistoryWndProc
};
void ShowPerformanceHistoryGraph()
void ShowPerformanceHistoryGraph(void)
{
if (AllocateWindowDescFront(&_performance_history_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@ -670,7 +670,7 @@ static const WindowDesc _company_value_graph_desc = {
CompanyValueGraphWndProc
};
void ShowCompanyValueGraph()
void ShowCompanyValueGraph(void)
{
if (AllocateWindowDescFront(&_company_value_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@ -774,7 +774,7 @@ static const WindowDesc _cargo_payment_rates_desc = {
};
void ShowCargoPaymentRates()
void ShowCargoPaymentRates(void)
{
AllocateWindowDescFront(&_cargo_payment_rates_desc, 0);
}
@ -874,7 +874,7 @@ static const WindowDesc _company_league_desc = {
CompanyLeagueWndProc
};
void ShowCompanyLeagueTable()
void ShowCompanyLeagueTable(void)
{
AllocateWindowDescFront(&_company_league_desc,0);
}
@ -1094,7 +1094,7 @@ static const WindowDesc _performance_rating_detail_desc = {
PerformanceRatingDetailWndProc
};
void ShowPerformanceRatingDetail()
void ShowPerformanceRatingDetail(void)
{
AllocateWindowDescFront(&_performance_rating_detail_desc, 0);
}

74
gui.h
View File

@ -4,30 +4,30 @@
#include "window.h"
/* main_gui.c */
void SetupColorsAndInitialWindow();
void SetupColorsAndInitialWindow(void);
void CcPlaySound10(bool success, uint tile, uint32 p1, uint32 p2);
/* settings_gui.c */
void ShowGameOptions();
void ShowGameDifficulty();
void ShowPatchesSelection();
void ShowNewgrf();
void ShowCustCurrency();
void ShowGameOptions(void);
void ShowGameDifficulty(void);
void ShowPatchesSelection(void);
void ShowNewgrf(void);
void ShowCustCurrency(void);
/* graph_gui.c */
void ShowOperatingProfitGraph();
void ShowIncomeGraph();
void ShowDeliveredCargoGraph();
void ShowPerformanceHistoryGraph();
void ShowCompanyValueGraph();
void ShowCargoPaymentRates();
void ShowCompanyLeagueTable();
void ShowPerformanceRatingDetail();
void ShowOperatingProfitGraph(void);
void ShowIncomeGraph(void);
void ShowDeliveredCargoGraph(void);
void ShowPerformanceHistoryGraph(void);
void ShowCompanyValueGraph(void);
void ShowCargoPaymentRates(void);
void ShowCompanyLeagueTable(void);
void ShowPerformanceRatingDetail(void);
/* news_gui.c */
void ShowLastNewsMessage();
void ShowMessageOptions();
void ShowMessageHistory();
void ShowLastNewsMessage(void);
void ShowMessageOptions(void);
void ShowMessageHistory(void);
/* traintoolb_gui.c */
void ShowBuildRailToolbar(int index, int button);
@ -42,18 +42,18 @@ void ShowOrdersWindow(Vehicle *v);
void ShowRoadVehViewWindow(Vehicle *v);
/* road_gui.c */
void ShowBuildRoadToolbar();
void ShowBuildRoadScenToolbar();
void ShowBuildRoadToolbar(void);
void ShowBuildRoadScenToolbar(void);
void ShowPlayerRoadVehicles(int player, int station);
/* dock_gui.c */
void ShowBuildDocksToolbar();
void ShowBuildDocksToolbar(void);
void ShowPlayerShips(int player, int station);
void ShowShipViewWindow(Vehicle *v);
/* aircraft_gui.c */
void ShowBuildAirToolbar();
void ShowBuildAirToolbar(void);
void ShowPlayerAircraft(int player, int station);
/* terraform_gui.c */
@ -61,16 +61,16 @@ void PlaceProc_DemolishArea(uint tile);
void PlaceProc_LowerLand(uint tile);
void PlaceProc_RaiseLand(uint tile);
void PlaceProc_LevelLand(uint tile);
void ShowTerraformToolbar();
void ShowTerraformToolbar(void);
/* misc_gui.c */
void PlaceLandBlockInfo();
void ShowAboutWindow();
void ShowBuildTreesToolbar();
void ShowBuildTreesScenToolbar();
void ShowTownDirectory();
void ShowIndustryDirectory();
void ShowSubsidiesList();
void PlaceLandBlockInfo(void);
void ShowAboutWindow(void);
void ShowBuildTreesToolbar(void);
void ShowBuildTreesScenToolbar(void);
void ShowTownDirectory(void);
void ShowIndustryDirectory(void);
void ShowSubsidiesList(void);
void ShowPlayerStations(int player);
void ShowPlayerFinances(int player);
void ShowPlayerCompany(int player);
@ -81,20 +81,20 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
void CheckRedrawStationCoverage(Window *w);
void ShowSmallMap();
void ShowExtraViewPortWindow();
void ShowSmallMap(void);
void ShowExtraViewPortWindow(void);
void SetVScrollCount(Window *w, int num);
void SetVScroll2Count(Window *w, int num);
void SetHScrollCount(Window *w, int num);
int HandleEditBoxKey(Window *w, int wid, WindowEvent *we);
void ShowCheatWindow();
void AskForNewGameToStart();
void ShowCheatWindow(void);
void AskForNewGameToStart(void);
void DrawEditBox(Window *w, int wid);
void HandleEditBox(Window *w, int wid);
void BuildFileList();
void BuildFileList(void);
void SetFiosType(const byte fiostype);
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
@ -102,7 +102,7 @@ static const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5};
/* network gui */
void ShowNetworkGameWindow();
void ShowNetworkGameWindow(void);
void ShowChatWindow(StringID str, StringID caption, int maxlen, int maxwidth, byte window_class, uint16 window_number);
/* bridge_gui.c */
@ -115,9 +115,9 @@ enum {
};
bool DoZoomInOutWindow(int how, Window * w);
void ShowBuildIndustryWindow();
void ShowBuildIndustryWindow(void);
void ShowQueryString(StringID str, StringID caption, int maxlen, int maxwidth, byte window_class, uint16 window_number);
void ShowMusicWindow();
void ShowMusicWindow(void);
/* main_gui.c */
VARDEF byte _newspaper_flag;

20
hal.h
View File

@ -3,14 +3,14 @@
typedef struct {
char *(*start)(char **parm);
void (*stop)();
void (*stop)(void);
} HalCommonDriver;
typedef struct {
const char *(*start)(char **parm);
void (*stop)();
void (*stop)(void);
void (*make_dirty)(int left, int top, int width, int height);
int (*main_loop)();
int (*main_loop)(void);
bool (*change_resolution)(int w, int h);
} HalVideoDriver;
@ -21,16 +21,16 @@ enum {
typedef struct {
char *(*start)(char **parm);
void (*stop)();
void (*stop)(void);
} HalSoundDriver;
typedef struct {
char *(*start)(char **parm);
void (*stop)();
void (*stop)(void);
void (*play_song)(const char *filename);
void (*stop_song)();
bool (*is_song_playing)();
void (*stop_song)(void);
bool (*is_song_playing)(void);
void (*set_volume)(byte vol);
} HalMusicDriver;
@ -83,7 +83,7 @@ enum DriverType {
MUSIC_DRIVER = 2,
};
extern void GameLoop();
extern void GameLoop(void);
extern bool _dbg_screen_rect;
void LoadDriver(int driver, const char *name);
@ -141,7 +141,7 @@ FiosItem *FiosGetSavegameList(int *num, int mode);
// Get a list of scenarios
FiosItem *FiosGetScenarioList(int *num, int mode);
// Free the list of savegames
void FiosFreeSavegameList();
void FiosFreeSavegameList(void);
// Browse to. Returns a filename w/path if we reached a file.
char *FiosBrowseTo(const FiosItem *item);
// Get descriptive texts.
@ -153,6 +153,6 @@ void FiosDelete(const char *name);
// Make a filename from a name
void FiosMakeSavegameName(char *buf, const char *name);
void CreateConsole();
void CreateConsole(void);
#endif /* HAL_H */

View File

@ -1096,7 +1096,7 @@ static void ProduceIndustryGoods(Industry *i)
}
}
void OnTick_Industry()
void OnTick_Industry(void)
{
Industry *i;
@ -1399,7 +1399,7 @@ static bool CheckIfTooCloseToIndustry(uint tile, int type)
return true;
}
static Industry *AllocateIndustry()
static Industry *AllocateIndustry(void)
{
Industry *i;
@ -1614,7 +1614,7 @@ static void PlaceInitialIndustry(byte type, int amount)
}
}
void GenerateIndustries()
void GenerateIndustries(void)
{
const byte *b;
@ -1814,7 +1814,7 @@ add_news:
}
}
void IndustryMonthlyLoop()
void IndustryMonthlyLoop(void)
{
Industry *i;
byte old_player = _current_player;
@ -1843,7 +1843,7 @@ void IndustryMonthlyLoop()
}
void InitializeIndustries()
void InitializeIndustries(void)
{
Industry *i;
int j;
@ -1905,7 +1905,7 @@ static const byte _industry_desc[] = {
SLE_END()
};
static void Save_INDY()
static void Save_INDY(void)
{
Industry *ind;
@ -1918,7 +1918,7 @@ static void Save_INDY()
}
}
static void Load_INDY()
static void Load_INDY(void)
{
int index;
_total_industries = 0;

View File

@ -264,7 +264,7 @@ static const WindowDesc * const _industry_window_desc[2][4] = {
},
};
void ShowBuildIndustryWindow()
void ShowBuildIndustryWindow(void)
{
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt.landscape],0);
}
@ -555,7 +555,7 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
return r;
}
static void MakeSortedIndustryList()
static void MakeSortedIndustryList(void)
{
Industry *i;
int n = 0;
@ -691,7 +691,7 @@ static const WindowDesc _industry_directory_desc = {
void ShowIndustryDirectory()
void ShowIndustryDirectory(void)
{
/* Industry List */
Window *w;

View File

@ -40,7 +40,7 @@ static const Widget _select_game_widgets[] = {
};
extern void HandleOnEditText(WindowEvent *e);
extern void HandleOnEditTextCancel();
extern void HandleOnEditTextCancel(void);
static void SelectGameWndProc(Window *w, WindowEvent *e) {
switch(e->event) {
@ -94,7 +94,7 @@ static const WindowDesc _select_game_desc = {
SelectGameWndProc
};
void ShowSelectGameWindow()
void ShowSelectGameWindow(void)
{
AllocateWindowDesc(&_select_game_desc);
}
@ -232,7 +232,7 @@ static const WindowDesc _ask_abandon_game_desc = {
AskAbandonGameWndProc
};
void AskExitGame()
void AskExitGame(void)
{
AllocateWindowDescFront(&_ask_abandon_game_desc, 0);
}
@ -285,7 +285,7 @@ static const WindowDesc _ask_quit_game_desc = {
};
void AskExitToGameMenu()
void AskExitToGameMenu(void)
{
AllocateWindowDescFront(&_ask_quit_game_desc, 0);
}

View File

@ -457,7 +457,7 @@ uint GetMapExtraBits(uint tile)
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
void RunTileLoop()
void RunTileLoop(void)
{
uint tile;
uint count;
@ -483,7 +483,7 @@ void RunTileLoop()
_cur_tileloop_tile = tile;
}
void InitializeLandscape()
void InitializeLandscape(void)
{
uint map_size = MapSize();
uint i;
@ -503,7 +503,7 @@ void InitializeLandscape()
memset(_map5, 3, map_size);
}
void ConvertGroundTilesIntoWaterTiles()
void ConvertGroundTilesIntoWaterTiles(void)
{
uint tile = 0;
int h;
@ -630,7 +630,7 @@ static void GenerateTerrain(int type, int flag)
#include "table/genland.h"
static void CreateDesertOrRainForest()
static void CreateDesertOrRainForest(void)
{
uint tile;
const TileIndexDiffC *data;
@ -660,7 +660,7 @@ static void CreateDesertOrRainForest()
}
}
void GenerateLandscape()
void GenerateLandscape(void)
{
int i,flag;
uint32 r;
@ -709,15 +709,15 @@ void GenerateLandscape()
CreateDesertOrRainForest();
}
void OnTick_Town();
void OnTick_Trees();
void OnTick_Station();
void OnTick_Industry();
void OnTick_Town(void);
void OnTick_Trees(void);
void OnTick_Station(void);
void OnTick_Industry(void);
void OnTick_Players();
void OnTick_Train();
void OnTick_Players(void);
void OnTick_Train(void);
void CallLandscapeTick()
void CallLandscapeTick(void)
{
OnTick_Town();
OnTick_Trees();

View File

@ -29,8 +29,8 @@
static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL)
static const uint MaxDate = 29220; // 2000-01-01
extern void DoTestSave();
extern void DoTestLoad();
extern void DoTestSave(void);
extern void DoTestLoad(void);
extern bool disable_computer;
@ -41,14 +41,15 @@ static byte _terraform_size = 1;
static byte _last_built_railtype;
extern void GenerateWorld(int mode);
extern void GenerateIndustries();
extern void GenerateTowns();
extern void GenerateIndustries(void);
extern void GenerateTowns(void);
extern uint GetCurrentCurrencyRate();
extern uint GetCurrentCurrencyRate(void);
extern void CcTerraform(bool success, uint tile, uint32 p1, uint32 p2);
void HandleOnEditTextCancel() {
void HandleOnEditTextCancel(void)
{
switch(_rename_what) {
#ifdef ENABLE_NETWORK
case 4:
@ -364,14 +365,14 @@ void ShowNetworkGiveMoneyWindow(byte player)
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, 1, 0);
}
void ShowNetworkNeedGamePassword()
void ShowNetworkNeedGamePassword(void)
{
_rename_id = NETWORK_GAME_PASSWORD;
_rename_what = 4;
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_GAME_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0);
}
void ShowNetworkNeedCompanyPassword()
void ShowNetworkNeedCompanyPassword(void)
{
_rename_id = NETWORK_COMPANY_PASSWORD;
_rename_what = 4;
@ -404,7 +405,7 @@ void ShowRenameWaypointWindow(Waypoint *cp)
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0);
}
static void SelectSignTool()
static void SelectSignTool(void)
{
if (_cursor.sprite == 0x2D2)
ResetObjectToPlace();
@ -918,7 +919,7 @@ bool DoZoomInOutWindow(int how, Window *w)
return true;
}
static void MaxZoomIn()
static void MaxZoomIn(void)
{
while (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0) ) ) {}
}
@ -1074,7 +1075,7 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
}
}
static void ResetLandscape()
static void ResetLandscape(void)
{
_random_seeds[0][0] = InteractiveRandom();
_random_seeds[0][1] = InteractiveRandom();
@ -1585,7 +1586,8 @@ static const Widget _scenedit_industry_candy_widgets[] = {
int _industry_type_to_place;
static bool AnyTownExists() {
static bool AnyTownExists(void)
{
Town *t;
FOR_ALL_TOWNS(t) {
if (t->xy)
@ -2372,10 +2374,10 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) {
}
void ShowSelectGameWindow();
void ShowSelectGameWindow(void);
extern void ShowJoinStatusWindowAfterJoin(void);
void SetupColorsAndInitialWindow()
void SetupColorsAndInitialWindow(void)
{
int i;
byte *b;
@ -2449,7 +2451,7 @@ void ShowVitalWindows(void)
WP(w,def_d).data_1 = -1280;
}
void GameSizeChanged()
void GameSizeChanged(void)
{
RelocateAllWindows(_screen.width, _screen.height);
ScreenSizeChanged();

135
misc.c
View File

@ -11,8 +11,8 @@
#include "network_server.h"
#include "engine.h"
extern void StartupEconomy();
extern void InitNewsItemStructs();
extern void StartupEconomy(void);
extern void InitNewsItemStructs(void);
byte _name_array[512][32];
@ -31,7 +31,7 @@ static inline uint32 ROR(uint32 x, int n)
uint32 DoRandom(uint line, char *file)
#else
uint32 Random()
uint32 Random(void)
#endif
{
#ifdef RANDOM_DEBUG
@ -72,7 +72,7 @@ uint RandomRange(uint max)
}
#endif
uint32 InteractiveRandom()
uint32 InteractiveRandom(void)
{
uint32 t = _random_seeds[1][1];
uint32 s = _random_seeds[1][0];
@ -85,7 +85,7 @@ uint InteractiveRandomRange(uint max)
return (uint16)InteractiveRandom() * max >> 16;
}
void InitPlayerRandoms()
void InitPlayerRandoms(void)
{
int i;
for (i=0; i<MAX_PLAYERS; i++) {
@ -150,40 +150,40 @@ void CSleep(int milliseconds)
#endif
}
void InitializeVehicles();
void InitializeOrders();
void InitializeClearLand();
void InitializeRail();
void InitializeRailGui();
void InitializeRoad();
void InitializeRoadGui();
void InitializeAirportGui();
void InitializeDock();
void InitializeDockGui();
void InitializeIndustries();
void InitializeLandscape();
void InitializeTowns();
void InitializeTrees();
void InitializeSigns();
void InitializeStations();
static void InitializeNameMgr();
void InitializePlayers();
static void InitializeCheats();
void InitializeVehicles(void);
void InitializeOrders(void);
void InitializeClearLand(void);
void InitializeRail(void);
void InitializeRailGui(void);
void InitializeRoad(void);
void InitializeRoadGui(void);
void InitializeAirportGui(void);
void InitializeDock(void);
void InitializeDockGui(void);
void InitializeIndustries(void);
void InitializeLandscape(void);
void InitializeTowns(void);
void InitializeTrees(void);
void InitializeSigns(void);
void InitializeStations(void);
static void InitializeNameMgr(void);
void InitializePlayers(void);
static void InitializeCheats(void);
void GenerateLandscape();
void GenerateClearTile();
void GenerateLandscape(void);
void GenerateClearTile(void);
void GenerateIndustries();
void GenerateUnmovables();
void GenerateTowns();
void GenerateIndustries(void);
void GenerateUnmovables(void);
void GenerateTowns(void);
void StartupPlayers();
void StartupDisasters();
void GenerateTrees();
void StartupPlayers(void);
void StartupDisasters(void);
void GenerateTrees(void);
void ConvertGroundTilesIntoWaterTiles();
void ConvertGroundTilesIntoWaterTiles(void);
void InitializeGame()
void InitializeGame(void)
{
// Initialize the autoreplace array. Needs to be cleared between each game
uint i;
@ -319,13 +319,13 @@ byte *GetName(int id, byte *buff)
}
static void InitializeCheats()
static void InitializeCheats(void)
{
memset(&_cheats, 0, sizeof(Cheats));
}
static void InitializeNameMgr()
static void InitializeNameMgr(void)
{
memset(_name_array, 0, sizeof(_name_array));
}
@ -583,21 +583,21 @@ static OnNewVehicleDayProc * _on_new_vehicle_day_proc[] = {
OnNewDay_DisasterVehicle,
};
void EnginesDailyLoop();
void DisasterDailyLoop();
void PlayersMonthlyLoop();
void EnginesMonthlyLoop();
void TownsMonthlyLoop();
void IndustryMonthlyLoop();
void StationMonthlyLoop();
void EnginesDailyLoop(void);
void DisasterDailyLoop(void);
void PlayersMonthlyLoop(void);
void EnginesMonthlyLoop(void);
void TownsMonthlyLoop(void);
void IndustryMonthlyLoop(void);
void StationMonthlyLoop(void);
void PlayersYearlyLoop();
void TrainsYearlyLoop();
void RoadVehiclesYearlyLoop();
void AircraftYearlyLoop();
void ShipsYearlyLoop();
void PlayersYearlyLoop(void);
void TrainsYearlyLoop(void);
void RoadVehiclesYearlyLoop(void);
void AircraftYearlyLoop(void);
void ShipsYearlyLoop(void);
void WaypointsDailyLoop();
void WaypointsDailyLoop(void);
static const uint16 _autosave_months[] = {
@ -608,7 +608,7 @@ static const uint16 _autosave_months[] = {
0x001, // every 12 months
};
void IncreaseDate()
void IncreaseDate(void)
{
const int vehicles_per_day = (1 << (sizeof(_date_fract) * 8)) / 885;
uint i;
@ -738,7 +738,7 @@ int FindFirstBit(uint32 value)
}
static void Save_NAME()
static void Save_NAME(void)
{
int i;
byte *b = _name_array[0];
@ -751,7 +751,7 @@ static void Save_NAME()
}
}
static void Load_NAME()
static void Load_NAME(void)
{
int index;
@ -776,7 +776,7 @@ static const byte _game_opt_desc[] = {
};
// Save load game options
static void SaveLoad_OPTS()
static void SaveLoad_OPTS(void)
{
SlObject(&_opt, _game_opt_desc);
}
@ -804,7 +804,7 @@ static const SaveLoadGlobVarList _date_desc[] = {
// Save load date related variables as well as persistent tick counters
// XXX: currently some unrelated stuff is just put here
static void SaveLoad_DATE()
static void SaveLoad_DATE(void)
{
SlGlobList(_date_desc);
}
@ -817,16 +817,18 @@ static const SaveLoadGlobVarList _view_desc[] = {
{NULL, 0, 0, 0}
};
static void SaveLoad_VIEW()
static void SaveLoad_VIEW(void)
{
SlGlobList(_view_desc);
}
static void SaveLoad_MAPT() {
static void SaveLoad_MAPT(void)
{
SlArray(_map_type_and_height, MapSize(), SLE_UINT8);
}
static void SaveLoad_MAP2() {
static void SaveLoad_MAP2(void)
{
if (_sl.version < 5) {
/* In those versions the _map2 was 8 bits */
SlArray(_map2, MapSize(), SLE_FILE_U8 | SLE_VAR_U16);
@ -835,28 +837,33 @@ static void SaveLoad_MAP2() {
}
}
static void SaveLoad_M3LO() {
static void SaveLoad_M3LO(void)
{
SlArray(_map3_lo, MapSize(), SLE_UINT8);
}
static void SaveLoad_M3HI() {
static void SaveLoad_M3HI(void)
{
SlArray(_map3_hi, MapSize(), SLE_UINT8);
}
static void SaveLoad_MAPO() {
static void SaveLoad_MAPO(void)
{
SlArray(_map_owner, MapSize(), SLE_UINT8);
}
static void SaveLoad_MAP5() {
static void SaveLoad_MAP5(void)
{
SlArray(_map5, MapSize(), SLE_UINT8);
}
static void SaveLoad_MAPE() {
static void SaveLoad_MAPE(void)
{
SlArray(_map_extra_bits, MapSize() / 4, SLE_UINT8);
}
static void Save_CHTS()
static void Save_CHTS(void)
{
byte count = sizeof(_cheats)/sizeof(Cheat);
Cheat* cht = (Cheat*) &_cheats;
@ -869,7 +876,7 @@ static void Save_CHTS()
}
}
static void Load_CHTS()
static void Load_CHTS(void)
{
Cheat* cht = (Cheat*) &_cheats;

View File

@ -153,7 +153,7 @@ static void Place_LandInfo(uint tile)
#endif
}
void PlaceLandBlockInfo()
void PlaceLandBlockInfo(void)
{
if (_cursor.sprite == 0x2CF) {
ResetObjectToPlace();
@ -268,7 +268,7 @@ static const WindowDesc _about_desc = {
};
void ShowAboutWindow()
void ShowAboutWindow(void)
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
AllocateWindowDesc(&_about_desc);
@ -426,12 +426,12 @@ static const WindowDesc _build_trees_scen_desc = {
};
void ShowBuildTreesToolbar()
void ShowBuildTreesToolbar(void)
{
AllocateWindowDesc(&_build_trees_desc);
}
void ShowBuildTreesScenToolbar()
void ShowBuildTreesScenToolbar(void)
{
AllocateWindowDescFront(&_build_trees_scen_desc, 0);
}
@ -1075,7 +1075,7 @@ static const Widget _save_dialog_scen_widgets[] = {
};
void BuildFileList()
void BuildFileList(void)
{
FiosFreeSavegameList();
if(_saveload_mode==SLD_NEW_GAME || _saveload_mode==SLD_LOAD_SCENARIO || _saveload_mode==SLD_SAVE_SCENARIO)
@ -1084,7 +1084,7 @@ void BuildFileList()
_fios_list = FiosGetSavegameList(&_fios_num, _saveload_mode);
}
static void DrawFiosTexts()
static void DrawFiosTexts(void)
{
const char *path;
StringID str;
@ -1102,7 +1102,7 @@ static void DrawFiosTexts()
#endif
static void MakeSortedSaveGameList()
static void MakeSortedSaveGameList(void)
{
/* Directories are always above the files (FIOS_TYPE_DIR)
* Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE)
@ -1352,7 +1352,7 @@ void ShowSaveLoadDialog(int mode)
ResetObjectToPlace();
}
void RedrawAutosave()
void RedrawAutosave(void)
{
SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
}
@ -1475,7 +1475,7 @@ static const WindowDesc _select_scenario_desc = {
SelectScenarioWndProc
};
void AskForNewGameToStart()
void AskForNewGameToStart(void)
{
Window *w;
@ -1524,7 +1524,7 @@ int32 ClickChangeClimateCheat(int32 p1, int32 p2)
return _opt.landscape;
}
extern void EnginesMonthlyLoop();
extern void EnginesMonthlyLoop(void);
// p2 1 (increase) or -1 (decrease)
int32 ClickChangeDateCheat(int32 p1, int32 p2)
@ -1759,7 +1759,7 @@ static const WindowDesc _cheats_desc = {
};
void ShowCheatWindow()
void ShowCheatWindow(void)
{
Window *w;

View File

@ -62,7 +62,7 @@ static const int midi_idx[] = {
};
static void SkipToPrevSong()
static void SkipToPrevSong(void)
{
byte *b = _cur_playlist;
byte *p = b;
@ -86,7 +86,7 @@ static void SkipToPrevSong()
_song_is_active = false;
}
static void SkipToNextSong()
static void SkipToNextSong(void)
{
byte *b = _cur_playlist, t;
@ -106,7 +106,7 @@ static void MusicVolumeChanged(byte new_vol)
_music_driver->set_volume(new_vol);
}
static void DoPlaySong()
static void DoPlaySong(void)
{
char filename[256];
snprintf(filename, sizeof(filename), "%sgm_tt%.2d.gm",
@ -114,12 +114,12 @@ static void DoPlaySong()
_music_driver->play_song(filename);
}
static void DoStopMusic()
static void DoStopMusic(void)
{
_music_driver->stop_song();
}
static void SelectSongToPlay()
static void SelectSongToPlay(void)
{
int i;
@ -142,7 +142,7 @@ static void SelectSongToPlay()
}
}
static void StopMusic()
static void StopMusic(void)
{
_music_wnd_cursong = 0;
DoStopMusic();
@ -150,7 +150,7 @@ static void StopMusic()
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
}
static void PlayPlaylistSong()
static void PlayPlaylistSong(void)
{
if (_cur_playlist[0] == 0) {
SelectSongToPlay();
@ -164,13 +164,13 @@ static void PlayPlaylistSong()
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
}
void ResetMusic()
void ResetMusic(void)
{
_music_wnd_cursong = 1;
DoPlaySong();
}
void MusicLoop()
void MusicLoop(void)
{
if (!msf.btn_down && _song_is_active) {
StopMusic();
@ -299,7 +299,7 @@ static const WindowDesc _music_track_selection_desc = {
MusicTrackSelectionWndProc
};
static void ShowMusicTrackSelection()
static void ShowMusicTrackSelection(void)
{
AllocateWindowDescFront(&_music_track_selection_desc, 0);
}
@ -475,7 +475,7 @@ static const WindowDesc _music_window_desc = {
MusicWindowWndProc
};
void ShowMusicWindow()
void ShowMusicWindow(void)
{
AllocateWindowDescFront(&_music_window_desc, 0);
}

View File

@ -41,9 +41,9 @@ static byte _network_clients_connected = 0;
static uint16 _network_client_index = NETWORK_SERVER_INDEX + 1;
/* Some externs / forwards */
extern void ShowJoinStatusWindow();
extern void StateGameLoop();
extern uint GetCurrentCurrencyRate();
extern void ShowJoinStatusWindow(void);
extern void StateGameLoop(void);
extern uint GetCurrentCurrencyRate(void);
// Function that looks up the CI for a given client-index
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index)
@ -878,7 +878,7 @@ void NetworkAddServer(const byte *b)
/* Generates the list of manually added hosts from NetworkGameList and
* dumps them into the array _network_host_list. This array is needed
* by the function that generates the config file. */
void NetworkRebuildHostList()
void NetworkRebuildHostList(void)
{
uint i = 0;
NetworkGameList *item = _network_game_list;

View File

@ -214,7 +214,7 @@ VARDEF byte _network_playas; // an id to play as..
void ParseConnectionString(const byte **player, const byte **port, byte *connection_string);
void NetworkUpdateClientInfo(uint16 client_index);
void NetworkAddServer(const byte *b);
void NetworkRebuildHostList();
void NetworkRebuildHostList(void);
void NetworkChangeCompanyPassword(const char *str);
#endif /* NETWORK_H */

View File

@ -221,7 +221,7 @@ void NetworkCloseClient(NetworkClientState *cs);
void CDECL NetworkTextMessage(NetworkAction action, uint16 color, bool self_send, const char *name, const char *str, ...);
void NetworkGetClientName(char *clientname, size_t size, const NetworkClientState *cs);
uint NetworkCalculateLag(const NetworkClientState *cs);
byte NetworkGetCurrentLanguageIndex();
byte NetworkGetCurrentLanguageIndex(void);
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
NetworkClientState *NetworkFindClientStateFromIndex(uint16 client_index);
unsigned long NetworkResolveHost(const char *hostname);

View File

@ -425,7 +425,7 @@ static const WindowDesc _network_game_window_desc = {
NetworkGameWindowWndProc,
};
void ShowNetworkGameWindow()
void ShowNetworkGameWindow(void)
{
uint i;
Window *w;
@ -1330,7 +1330,7 @@ static const WindowDesc _network_join_status_window_desc = {
NetworkJoinStatusWindowWndProc,
};
void ShowJoinStatusWindow()
void ShowJoinStatusWindow(void)
{
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
_network_join_status = NETWORK_JOIN_STATUS_CONNECTING;

View File

@ -1323,7 +1323,7 @@ void NetworkUpdateClientInfo(uint16 client_index)
extern void SwitchMode(int new_mode);
/* Check if we want to restart the map */
static void NetworkCheckRestartMap()
static void NetworkCheckRestartMap(void)
{
if (_network_restart_game_date != 0 && _cur_year + MAX_YEAR_BEGIN_REAL >= _network_restart_game_date) {
_docommand_recursive = 0;
@ -1342,7 +1342,7 @@ static void NetworkCheckRestartMap()
1) If a company is not protected, it is closed after 1 year (for example)
2) If a company is protected, protection is disabled after 3 years (for example)
(and item 1. happens a year later) */
static void NetworkAutoCleanCompanies()
static void NetworkAutoCleanCompanies(void)
{
NetworkClientState *cs;
NetworkClientInfo *ci;

View File

@ -525,7 +525,7 @@ typedef struct LoadSavegameState {
static LoadSavegameState *_cur_state;
static byte GetSavegameByteFromBuffer()
static byte GetSavegameByteFromBuffer(void)
{
LoadSavegameState *lss = _cur_state;
@ -544,7 +544,7 @@ static byte GetSavegameByteFromBuffer()
return *lss->buffer_cur++;
}
static byte DecodeSavegameByte()
static byte DecodeSavegameByte(void)
{
LoadSavegameState *lss = _cur_state;
int8 x;

View File

@ -90,7 +90,7 @@ static inline bool HasOrderPoolFree(uint amount)
return false;
}
static inline bool IsOrderPoolFull()
static inline bool IsOrderPoolFull(void)
{
return !HasOrderPoolFree(1);
}

View File

@ -80,7 +80,7 @@ static void SwapOrders(Order *order1, Order *order2)
* @return Order* if a free space is found, else NULL.
*
*/
static Order *AllocateOrder()
static Order *AllocateOrder(void)
{
Order *order;
@ -914,7 +914,7 @@ static const byte _order_desc[] = {
SLE_END()
};
static void Save_ORDR()
static void Save_ORDR(void)
{
Order *order;
@ -926,7 +926,7 @@ static void Save_ORDR()
}
}
static void Load_ORDR()
static void Load_ORDR(void)
{
if (_sl.full_version <= 0x501) {
/* Version older than 0x502 did not have a ->next pointer. Convert them

View File

@ -14,7 +14,7 @@
#include "sound.h"
#include "network.h"
extern void StartupEconomy();
extern void StartupEconomy(void);
static const SpriteID cheeks_table[4] = {
0x325, 0x326,
@ -352,7 +352,7 @@ static const byte _color_sort[16] = {2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1
static const byte _color_similar_1[16] = {8, 6, 255, 12, 255, 0, 1, 1, 0, 13, 11, 10, 3, 9, 15, 14};
static const byte _color_similar_2[16] = {5, 7, 255, 255, 255, 8, 7, 6, 5, 12, 255, 255, 9, 255, 255, 255};
static byte GeneratePlayerColor()
static byte GeneratePlayerColor(void)
{
byte colors[16], pcolor, t2;
int i,j,n;
@ -446,7 +446,7 @@ restart:;
extern int GetPlayerMaxRailtype(int p);
static Player *AllocatePlayer()
static Player *AllocatePlayer(void)
{
Player *p;
// Find a free slot
@ -496,13 +496,13 @@ Player *DoStartupNewPlayer(bool is_ai)
return p;
}
void StartupPlayers()
void StartupPlayers(void)
{
// The AI starts like in the setting with +2 month max
_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
}
static void MaybeStartNewPlayer()
static void MaybeStartNewPlayer(void)
{
uint n;
Player *p;
@ -521,7 +521,7 @@ static void MaybeStartNewPlayer()
_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
}
void InitializePlayers()
void InitializePlayers(void)
{
int i;
memset(_players, 0, sizeof(_players));
@ -530,7 +530,7 @@ void InitializePlayers()
_cur_player_tick_index = 0;
}
void OnTick_Players()
void OnTick_Players(void)
{
Player *p;
@ -546,7 +546,7 @@ void OnTick_Players()
}
}
void RunOtherPlayersLoop()
void RunOtherPlayersLoop(void)
{
Player *p;
@ -578,7 +578,7 @@ StringID GetPlayerNameString(byte player, byte index)
extern void ShowPlayerFinances(int player);
void PlayersYearlyLoop()
void PlayersYearlyLoop(void)
{
Player *p;
@ -1040,7 +1040,7 @@ static void SaveLoad_PLYR(Player *p) {
}
}
static void Save_PLYR()
static void Save_PLYR(void)
{
Player *p;
FOR_ALL_PLAYERS(p) {
@ -1051,7 +1051,7 @@ static void Save_PLYR()
}
}
static void Load_PLYR()
static void Load_PLYR(void)
{
int index;
while ((index = SlIterateArray()) != -1) {

View File

@ -212,7 +212,8 @@ void init_InsSort(Queue* q) {
q->freeq = false;
}
Queue* new_InsSort() {
Queue* new_InsSort(void)
{
Queue* q = malloc(sizeof(Queue));
init_InsSort(q);
q->freeq = true;

View File

@ -113,7 +113,7 @@ int build_Fifo(void* buffer, uint size);
void init_InsSort(Queue* q);
/* Allocate a new fifo and initializes it. There is no maximum size */
Queue* new_InsSort();
Queue* new_InsSort(void);
/*
* Binary Heap

View File

@ -777,7 +777,7 @@ static void DoDeleteWaypoint(Waypoint *cp)
}
// delete waypoints after a while
void WaypointsDailyLoop()
void WaypointsDailyLoop(void)
{
Waypoint *cp;
for(cp = _waypoints; cp != endof(_waypoints); cp++) {
@ -2276,7 +2276,7 @@ static uint32 VehicleEnter_Track(Vehicle *v, uint tile, int x, int y)
return 0;
}
void InitializeRail()
void InitializeRail(void)
{
_last_built_train_depot_tile = 0;
}

View File

@ -26,9 +26,9 @@ struct {
static void HandleStationPlacement(uint start, uint end);
static void ShowBuildTrainDepotPicker();
static void ShowBuildWaypointPicker();
static void ShowStationBuilder();
static void ShowBuildTrainDepotPicker(void);
static void ShowBuildWaypointPicker(void);
static void ShowStationBuilder(void);
typedef void OnButtonClick(Window *w);
@ -322,7 +322,7 @@ static void DoRailroadTrack(int mode)
// This function is more or less a hack because DoRailroadTrack() would otherwise screw up
static void SwapSelection()
static void SwapSelection(void)
{
TileHighlightData *thd = &_thd;
Point pt = thd->selstart;
@ -332,7 +332,7 @@ static void SwapSelection()
}
static void HandleAutodirPlacement()
static void HandleAutodirPlacement(void)
{
TileHighlightData *thd = &_thd;
int bit;
@ -865,7 +865,7 @@ static const WindowDesc _station_builder_desc = {
StationBuildWndProc
};
static void ShowStationBuilder()
static void ShowStationBuilder(void)
{
AllocateWindowDesc(&_station_builder_desc);
}
@ -932,7 +932,7 @@ static const WindowDesc _build_depot_desc = {
BuildTrainDepotWndProc
};
static void ShowBuildTrainDepotPicker()
static void ShowBuildTrainDepotPicker(void)
{
AllocateWindowDesc(&_build_depot_desc);
}
@ -1007,7 +1007,7 @@ static const WindowDesc _build_waypoint_desc = {
BuildWaypointWndProc
};
static void ShowBuildWaypointPicker()
static void ShowBuildWaypointPicker(void)
{
Window *w = AllocateWindowDesc(&_build_waypoint_desc);
w->hscroll.cap = 5;
@ -1015,7 +1015,7 @@ static void ShowBuildWaypointPicker()
}
void InitializeRailGui()
void InitializeRailGui(void)
{
_build_depot_direction = 3;
_railstation.numtracks = 1;

View File

@ -1142,7 +1142,7 @@ static void ChangeTileOwner_Road(uint tile, byte old_player, byte new_player)
}
}
void InitializeRoad()
void InitializeRoad(void)
{
_last_built_road_depot_tile = 0;
}

View File

@ -12,9 +12,9 @@
#include "station.h"
static void ShowBusStationPicker();
static void ShowTruckStationPicker();
static void ShowRoadDepotPicker();
static void ShowBusStationPicker(void);
static void ShowTruckStationPicker(void);
static void ShowRoadDepotPicker(void);
static bool _remove_button_clicked;
static bool _build_road_flag;
@ -302,7 +302,7 @@ static const WindowDesc _build_road_desc = {
BuildRoadToolbWndProc
};
void ShowBuildRoadToolbar()
void ShowBuildRoadToolbar(void)
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
@ -335,7 +335,7 @@ static const WindowDesc _build_road_scen_desc = {
BuildRoadToolbWndProc
};
void ShowBuildRoadScenToolbar()
void ShowBuildRoadScenToolbar(void)
{
AllocateWindowDescFront(&_build_road_scen_desc, 0);
}
@ -398,7 +398,7 @@ static const WindowDesc _build_road_depot_desc = {
BuildRoadDepotWndProc
};
static void ShowRoadDepotPicker()
static void ShowRoadDepotPicker(void)
{
AllocateWindowDesc(&_build_road_depot_desc);
}
@ -493,7 +493,7 @@ static const WindowDesc _bus_station_picker_desc = {
RoadStationPickerWndProc
};
static void ShowBusStationPicker()
static void ShowBusStationPicker(void)
{
AllocateWindowDesc(&_bus_station_picker_desc);
}
@ -519,12 +519,12 @@ static const WindowDesc _truck_station_picker_desc = {
RoadStationPickerWndProc
};
static void ShowTruckStationPicker()
static void ShowTruckStationPicker(void)
{
AllocateWindowDesc(&_truck_station_picker_desc);
}
void InitializeRoadGui()
void InitializeRoadGui(void)
{
_road_depot_orientation = 3;
_road_station_picker_orientation = 3;

View File

@ -1509,7 +1509,7 @@ void HandleClickOnRoadVeh(Vehicle *v)
ShowRoadVehViewWindow(v);
}
void RoadVehiclesYearlyLoop()
void RoadVehiclesYearlyLoop(void)
{
Vehicle *v;

View File

@ -22,7 +22,7 @@ enum NeedLengthValues { NL_NONE = 0,NL_WANTLENGTH = 1,NL_CALCLENGTH = 2};
SaverLoader _sl;
// fill the input buffer
static void SlReadFill()
static void SlReadFill(void)
{
uint len = _sl.read_bytes();
assert(len != 0);
@ -32,13 +32,13 @@ static void SlReadFill()
_sl.offs_base += len;
}
static uint32 SlGetOffs()
static uint32 SlGetOffs(void)
{
return _sl.offs_base - (_sl.bufe - _sl.bufp);
}
// flush the output buffer
static void SlWriteFill()
static void SlWriteFill(void)
{
// flush current buffer?
if (_sl.bufp != NULL) {
@ -59,7 +59,7 @@ static void NORETURN SlError(const char *msg)
longjmp(_sl.excpt, 0);
}
int SlReadByte()
int SlReadByte(void)
{
if (_sl.bufp == _sl.bufe) SlReadFill();
return *_sl.bufp++;
@ -71,19 +71,19 @@ void SlWriteByte(byte v)
*_sl.bufp++ = v;
}
static int SlReadUint16()
static int SlReadUint16(void)
{
int x = SlReadByte() << 8;
return x | SlReadByte();
}
static uint32 SlReadUint32()
static uint32 SlReadUint32(void)
{
uint32 x = SlReadUint16() << 16;
return x | SlReadUint16();
}
static uint64 SlReadUint64()
static uint64 SlReadUint64(void)
{
uint32 x = SlReadUint32();
uint32 y = SlReadUint32();
@ -108,7 +108,7 @@ static void SlWriteUint64(uint64 x)
SlWriteUint32((uint32)x);
}
static int SlReadSimpleGamma()
static int SlReadSimpleGamma(void)
{
int x = SlReadByte();
if (x & 0x80)
@ -131,7 +131,7 @@ static uint SlGetGammaLength(uint i) {
return (i>=0x80) ? 2 : 1;
}
inline int SlReadSparseIndex()
inline int SlReadSparseIndex(void)
{
return SlReadSimpleGamma();
}
@ -141,7 +141,7 @@ inline void SlWriteSparseIndex(uint index)
SlWriteSimpleGamma(index);
}
inline int SlReadArrayLength()
inline int SlReadArrayLength(void)
{
return SlReadSimpleGamma();
}
@ -157,7 +157,7 @@ void SlSetArrayIndex(uint index)
_sl.array_index = index;
}
int SlIterateArray()
int SlIterateArray(void)
{
int ind;
static uint32 next_offs;
@ -249,7 +249,7 @@ void SlSkipBytes(size_t length)
}
}
uint SlGetFieldLength()
uint SlGetFieldLength(void)
{
return _sl.obj_len;
}
@ -583,7 +583,7 @@ static void SlStubSaveProc2(void *arg)
_tmp_proc_1();
}
static void SlStubSaveProc()
static void SlStubSaveProc(void)
{
SlAutolength(SlStubSaveProc2, NULL);
}
@ -623,7 +623,7 @@ static void SlSaveChunk(const ChunkHandler *ch)
}
}
static void SlSaveChunks()
static void SlSaveChunks(void)
{
const ChunkHandler *ch;
const ChunkHandler * const * chsc;
@ -661,7 +661,7 @@ static const ChunkHandler *SlFindChunkHandler(uint32 id)
return NULL;
}
static void SlLoadChunks()
static void SlLoadChunks(void)
{
uint32 id;
const ChunkHandler *ch;
@ -686,7 +686,7 @@ static void SlLoadChunks()
#include "minilzo.h"
static uint ReadLZO()
static uint ReadLZO(void)
{
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
uint32 tmp[2];
@ -731,20 +731,22 @@ static void WriteLZO(uint size)
if (fwrite(out, outlen + sizeof(uint32)*2, 1, _sl.fh) != 1) SlError("file write failed");
}
static bool InitLZO() {
static bool InitLZO(void)
{
_sl.bufsize = LZO_SIZE;
_sl.buf = (byte*)malloc(LZO_SIZE);
return true;
}
static void UninitLZO() {
static void UninitLZO(void)
{
free(_sl.buf);
}
//*******************************************
//******** START OF NOCOMP CODE *************
//*******************************************
static uint ReadNoComp()
static uint ReadNoComp(void)
{
return fread(_sl.buf, 1, LZO_SIZE, _sl.fh);
}
@ -754,14 +756,14 @@ static void WriteNoComp(uint size)
fwrite(_sl.buf, 1, size, _sl.fh);
}
static bool InitNoComp()
static bool InitNoComp(void)
{
_sl.bufsize = LZO_SIZE;
_sl.buf = (byte*)malloc(LZO_SIZE);
return true;
}
static void UninitNoComp()
static void UninitNoComp(void)
{
free(_sl.buf);
}
@ -774,7 +776,7 @@ static void UninitNoComp()
#include <zlib.h>
static z_stream _z;
static bool InitReadZlib()
static bool InitReadZlib(void)
{
memset(&_z, 0, sizeof(_z));
if (inflateInit(&_z) != Z_OK) return false;
@ -784,7 +786,7 @@ static bool InitReadZlib()
return true;
}
static uint ReadZlib()
static uint ReadZlib(void)
{
int r;
@ -809,13 +811,13 @@ static uint ReadZlib()
return 4096 - _z.avail_out;
}
static void UninitReadZlib()
static void UninitReadZlib(void)
{
inflateEnd(&_z);
free(_sl.buf);
}
static bool InitWriteZlib()
static bool InitWriteZlib(void)
{
memset(&_z, 0, sizeof(_z));
if (deflateInit(&_z, 6) != Z_OK) return false;
@ -851,7 +853,7 @@ static void WriteZlib(uint len)
WriteZlibLoop(&_z, _sl.buf, len, 0);
}
static void UninitWriteZlib()
static void UninitWriteZlib(void)
{
// flush any pending output.
if (_sl.fh) WriteZlibLoop(&_z, NULL, 0, Z_FINISH);
@ -958,13 +960,13 @@ typedef struct {
const char *name;
uint32 tag;
bool (*init_read)();
bool (*init_read)(void);
ReaderProc *reader;
void (*uninit_read)();
void (*uninit_read)(void);
bool (*init_write)();
bool (*init_write)(void);
WriterProc *writer;
void (*uninit_write)();
void (*uninit_write)(void);
} SaveLoadFormat;
@ -998,9 +1000,9 @@ static const SaveLoadFormat *GetSavegameFormat(const char *s)
}
// actual loader/saver function
extern void InitializeGame();
extern void InitializeGame(void);
extern bool AfterLoadGame(uint version);
extern void BeforeSaveGame();
extern void BeforeSaveGame(void);
extern bool LoadOldSaveGame(const char *file);
// Save or Load files SL_LOAD, SL_SAVE, SL_OLD_LOAD
@ -1132,13 +1134,13 @@ init_err:
return SL_OK;
}
bool EmergencySave()
bool EmergencySave(void)
{
SaveOrLoad("crash.sav", SL_SAVE);
return true;
}
void DoExitSave()
void DoExitSave(void)
{
char buf[200];
sprintf(buf, "%s%sexit.sav", _path.autosave_dir, PATHSEP);

View File

@ -3,7 +3,7 @@
#include <setjmp.h>
typedef void ChunkSaveLoadProc();
typedef void ChunkSaveLoadProc(void);
typedef void AutolengthProc(void *arg);
typedef struct SaveLoadGlobVarList {
@ -26,7 +26,7 @@ typedef struct {
} NullStruct;
typedef void WriterProc(uint len);
typedef uint ReaderProc();
typedef uint ReaderProc(void);
typedef uint ReferenceToIntProc(void *v, uint t);
typedef void *IntToReferenceProc(uint r, uint t);
@ -62,7 +62,7 @@ typedef struct {
uint bufsize;
FILE *fh;
void (*excpt_uninit)();
void (*excpt_uninit)(void);
const char *excpt_msg;
jmp_buf excpt; // used to jump to "exception handler"
} SaverLoader;
@ -159,12 +159,12 @@ enum {
void SlSetArrayIndex(uint index);
int SlIterateArray();
int SlIterateArray(void);
void SlArray(void *array, uint length, uint conv);
void SlObject(void *object, const void *desc);
void SlAutolength(AutolengthProc *proc, void *arg);
uint SlGetFieldLength();
int SlReadByte();
uint SlGetFieldLength(void);
int SlReadByte(void);
void SlSetLength(uint length);
void SlWriteByte(byte v);
void SlGlobList(const SaveLoadGlobVarList *desc);

2
sdl.c
View File

@ -441,7 +441,7 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
return (key << 16) + sym->unicode;
}
void DoExitSave();
void DoExitSave(void);
static int PollEvent(void)
{

View File

@ -104,7 +104,7 @@ struct IniFile {
};
// allocate an inifile object
static IniFile *ini_alloc()
static IniFile *ini_alloc(void)
{
IniFile *ini;
MemoryPool *pool;
@ -981,7 +981,7 @@ static void SaveList(IniFile *ini, const char *grpname, char **list, int len)
}
}
void LoadFromConfig()
void LoadFromConfig(void)
{
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, load_setting_desc);
@ -991,7 +991,7 @@ void LoadFromConfig()
ini_free(ini);
}
void SaveToConfig()
void SaveToConfig(void)
{
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, save_setting_desc);

View File

@ -17,7 +17,7 @@ static uint32 _difficulty_click_b;
static byte _difficulty_timeout;
extern const StringID _currency_string_list[];
extern uint GetMaskOfAllowedCurrencies();
extern uint GetMaskOfAllowedCurrencies(void);
static const StringID _distances_dropdown[] = {
STR_0139_IMPERIAL_MILES,
@ -55,7 +55,7 @@ static StringID *BuildDynamicDropdown(StringID base, int num)
return buf;
}
static int GetCurRes()
static int GetCurRes(void)
{
int i;
for(i = 0; i != _num_resolutions; i++)
@ -269,7 +269,7 @@ static const WindowDesc _game_options_desc = {
};
void ShowGameOptions()
void ShowGameOptions(void)
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
AllocateWindowDesc(&_game_options_desc);
@ -328,7 +328,7 @@ void SetDifficultyLevel(int mode, GameOptions *gm_opt)
}
}
extern void StartupEconomy();
extern void StartupEconomy(void);
enum {
GAMEDIFF_WND_TOP_OFFSET = 45,
@ -506,7 +506,7 @@ static const WindowDesc _game_difficulty_desc = {
GameDifficultyWndProc
};
void ShowGameDifficulty()
void ShowGameDifficulty(void)
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
/* copy current settings to temporary holding place
@ -715,7 +715,7 @@ static const PatchPage _patches_page[] = {
{_patches_ai, lengthof(_patches_ai) },
};
extern uint GetCurrentCurrencyRate();
extern uint GetCurrentCurrencyRate(void);
static int32 ReadPE(const PatchEntry*pe)
{
@ -1154,7 +1154,7 @@ static const WindowDesc _patches_selection_desc = {
PatchesSelectionWndProc,
};
void ShowPatchesSelection()
void ShowPatchesSelection(void)
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
AllocateWindowDesc(&_patches_selection_desc);
@ -1281,7 +1281,7 @@ static const WindowDesc _newgrf_desc = {
NewgrfWndProc,
};
void ShowNewgrf()
void ShowNewgrf(void)
{
Window *w;
DeleteWindowById(WC_GAME_OPTIONS, 0);
@ -1509,7 +1509,7 @@ static const WindowDesc _cust_currency_desc = {
CustCurrencyWndProc,
};
void ShowCustCurrency()
void ShowCustCurrency(void)
{
Window *w;

View File

@ -789,7 +789,7 @@ void HandleClickOnShip(Vehicle *v)
ShowShipViewWindow(v);
}
void ShipsYearlyLoop()
void ShipsYearlyLoop(void)
{
Vehicle *v;

10
signs.c
View File

@ -22,7 +22,7 @@ static void UpdateSignVirtCoords(SignStruct *ss)
* Update the coordinates of all signs
*
*/
void UpdateAllSignVirtCoords()
void UpdateAllSignVirtCoords(void)
{
SignStruct *ss;
@ -53,7 +53,7 @@ static void MarkSignDirty(SignStruct *ss)
*
* @return The pointer to the new sign, or NULL if there is no more free space
*/
static SignStruct *AllocateSign()
static SignStruct *AllocateSign(void)
{
SignStruct *s;
FOR_ALL_SIGNS(s)
@ -173,7 +173,7 @@ void PlaceProc_Sign(uint tile)
* Initialize the signs
*
*/
void InitializeSigns()
void InitializeSigns(void)
{
SignStruct *s;
int i;
@ -200,7 +200,7 @@ static const byte _sign_desc[] = {
* Save all signs
*
*/
static void Save_SIGN()
static void Save_SIGN(void)
{
SignStruct *s;
@ -218,7 +218,7 @@ static void Save_SIGN()
* Load all signs
*
*/
static void Load_SIGN()
static void Load_SIGN(void)
{
int index;
while ((index = SlIterateArray()) != -1) {

View File

@ -24,7 +24,7 @@ static inline SignStruct *GetSign(uint index)
VARDEF SignStruct *_new_sign_struct;
void UpdateAllSignVirtCoords();
void UpdateAllSignVirtCoords(void);
void PlaceProc_Sign(uint tile);
/* misc.c */

View File

@ -899,7 +899,7 @@ static const WindowDesc _smallmap_desc = {
SmallMapWindowProc
};
void ShowSmallMap()
void ShowSmallMap(void)
{
Window *w;
ViewPort *vp;
@ -997,7 +997,7 @@ static const WindowDesc _extra_view_port_desc = {
ExtraViewPortWndProc
};
void ShowExtraViewPortWindow()
void ShowExtraViewPortWindow(void)
{
Window *w, *v;
int i = 0;

View File

@ -82,7 +82,7 @@ static const uint16 * const _slopes_spriteindexes[] = {
_slopes_spriteindexes_3,
};
static void CompactSpriteCache();
static void CompactSpriteCache(void);
static void ReadSpriteHeaderSkipData(int num, int load_index)
{
@ -409,7 +409,7 @@ static bool HandleCachedSpriteHeaders(const char *filename, bool read)
#define S_FREE_MASK 1
#define S_HDRSIZE sizeof(uint32)
static uint32 GetSpriteCacheUsage()
static uint32 GetSpriteCacheUsage(void)
{
byte *s = _spritecache_ptr;
size_t cur_size, tot_size = 0;
@ -425,7 +425,7 @@ static uint32 GetSpriteCacheUsage()
}
void IncreaseSpriteLRU()
void IncreaseSpriteLRU(void)
{
int i;
@ -461,7 +461,7 @@ void IncreaseSpriteLRU()
// Called when holes in the sprite cache should be removed.
// That is accomplished by moving the cached data.
static void CompactSpriteCache()
static void CompactSpriteCache(void)
{
byte *s, *t;
size_t size, sizeb, cur_size;
@ -519,7 +519,7 @@ static void CompactSpriteCache()
}
}
static void DeleteEntryFromSpriteCache()
static void DeleteEntryFromSpriteCache(void)
{
int i;
int best = -1;
@ -814,7 +814,7 @@ static bool FileMD5(const MD5File file, bool warn)
* If neither are found, Windows palette is assumed.
*
* (Note: Also checks sample.cat for corruption) */
void CheckExternalFiles()
void CheckExternalFiles(void)
{
int i;
int dos=0, win=0; // count of files from this version
@ -845,7 +845,7 @@ void CheckExternalFiles()
}
}
static void LoadSpriteTables()
static void LoadSpriteTables(void)
{
int i,j;
FileList *files; // list of grf files to be loaded. Either Windows files or DOS files
@ -957,7 +957,8 @@ void GfxInitSpriteMem(byte *ptr, uint32 size)
}
void GfxLoadSprites() {
void GfxLoadSprites(void)
{
static byte *_sprite_mem;
// Need to reload the sprites only if the landscape changed

View File

@ -91,7 +91,7 @@ void ModifyStationRatingAround(TileIndex tile, byte owner, int amount, uint radi
TileIndex GetStationTileForVehicle(const Vehicle *v, const Station *st);
void ShowStationViewWindow(int station);
void UpdateAllStationVirtCoord();
void UpdateAllStationVirtCoord(void);
VARDEF Station _stations[250];
VARDEF uint _stations_size;

View File

@ -137,7 +137,7 @@ static bool CheckStationSpreadOut(Station *st, uint tile, int w, int h)
return true;
}
static Station *AllocateStation()
static Station *AllocateStation(void)
{
Station *st, *a_free = NULL;
int num_free = 0;
@ -360,7 +360,7 @@ static void UpdateStationVirtCoord(Station *st)
}
// Update the virtual coords needed to draw the station sign for all stations.
void UpdateAllStationVirtCoord()
void UpdateAllStationVirtCoord(void)
{
Station *st;
FOR_ALL_STATIONS(st) {
@ -2293,7 +2293,7 @@ static void DeleteStation(Station *st)
DeleteSubsidyWithStation(index);
}
void DeleteAllPlayerStations()
void DeleteAllPlayerStations(void)
{
Station *st;
@ -2433,7 +2433,7 @@ static void StationHandleSmallTick(Station *st)
UpdateStationRating(st);
}
void OnTick_Station()
void OnTick_Station(void)
{
int i;
Station *st;
@ -2456,7 +2456,7 @@ void OnTick_Station()
}
void StationMonthlyLoop()
void StationMonthlyLoop(void)
{
}
@ -2772,7 +2772,7 @@ static int32 ClearTile_Station(uint tile, byte flags) {
}
void InitializeStations()
void InitializeStations(void)
{
int i;
Station *s;
@ -2874,7 +2874,7 @@ static void SaveLoad_STNS(Station *st)
SlObject(&st->goods[i], _goods_desc);
}
static void Save_STNS()
static void Save_STNS(void)
{
Station *st;
// Write the stations
@ -2886,7 +2886,7 @@ static void Save_STNS()
}
}
static void Load_STNS()
static void Load_STNS(void)
{
int index;
while ((index = SlIterateArray()) != -1) {

View File

@ -73,7 +73,7 @@ static int CDECL StationNameSorter(const void *a, const void *b)
return strcmp(buf1, _bufcache); // sort by name
}
static void GlobalSortStationList()
static void GlobalSortStationList(void)
{
const Station *st;
uint32 n = 0;

View File

@ -114,14 +114,14 @@ void InjectDparam(int amount)
}
int32 GetParamInt32()
int32 GetParamInt32(void)
{
int32 result = GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
static int64 GetParamInt64()
static int64 GetParamInt64(void)
{
int64 result = GetDParam(0) + ((uint64)GetDParam(1) << 32);
memmove(&_decode_parameters[0], &_decode_parameters[2], sizeof(uint32) * (lengthof(_decode_parameters)-2));
@ -129,21 +129,21 @@ static int64 GetParamInt64()
}
int GetParamInt16()
int GetParamInt16(void)
{
int result = (int16)GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
int GetParamInt8()
int GetParamInt8(void)
{
int result = (int8)GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
int GetParamUint16()
int GetParamUint16(void)
{
int result = GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
@ -259,7 +259,8 @@ static byte *FormatMonthAndYear(byte *buff, uint16 number)
return FormatNoCommaNumber(buff, ymd.year + MAX_YEAR_BEGIN_REAL);
}
uint GetCurrentCurrencyRate() {
uint GetCurrentCurrencyRate(void)
{
return (&_currency_specs[_opt.currency])->rate;
}
@ -777,7 +778,7 @@ bool ReadLanguagePack(int lang_index) {
}
// make a list of the available language packs. put the data in _dynlang struct.
void InitializeLanguagePacks()
void InitializeLanguagePacks(void)
{
DynamicLanguages *dl = &_dynlang;
int i, j, n, m,def;

View File

@ -159,7 +159,7 @@ static const WindowDesc _subsidies_list_desc = {
};
void ShowSubsidiesList()
void ShowSubsidiesList(void)
{
AllocateWindowDescFront(&_subsidies_list_desc, 0);
}

View File

@ -209,7 +209,7 @@ static const WindowDesc _terraform_desc = {
void ShowTerraformToolbar()
void ShowTerraformToolbar(void)
{
if (_current_player == OWNER_SPECTATOR) return;
AllocateWindowDescFront(&_terraform_desc, 0);

View File

@ -87,7 +87,7 @@ void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...
_textmessage_dirty = true;
}
void InitTextMessage()
void InitTextMessage(void)
{
int i;
for (i = 0; i < MAX_CHAT_MESSAGES; i++) {
@ -98,7 +98,7 @@ void InitTextMessage()
}
// Hide the textbox
void UndrawTextMessage()
void UndrawTextMessage(void)
{
if (_textmessage_visible) {
// Sometimes we also need to hide the cursor
@ -135,7 +135,7 @@ void UndrawTextMessage()
}
// Check if a message is expired every day
void TextMessageDailyLoop()
void TextMessageDailyLoop(void)
{
int i = 0;
while (i < MAX_CHAT_MESSAGES) {
@ -151,7 +151,7 @@ void TextMessageDailyLoop()
}
// Draw the textmessage-box
void DrawTextMessage()
void DrawTextMessage(void)
{
int i, j;
bool has_message;
@ -250,7 +250,7 @@ static void MoveTextEffect(TextEffect *te)
MarkTextEffectAreaDirty(te);
}
void MoveAllTextEffects()
void MoveAllTextEffects(void)
{
TextEffect *te;
@ -260,7 +260,7 @@ void MoveAllTextEffects()
}
}
void InitTextEffects()
void InitTextEffects(void)
{
TextEffect *te;
@ -334,7 +334,7 @@ bool AddAnimatedTile(uint tile)
return false;
}
void AnimateAnimatedTiles()
void AnimateAnimatedTiles(void)
{
TileIndex *ti;
uint tile;
@ -344,12 +344,12 @@ void AnimateAnimatedTiles()
}
}
void InitializeAnimatedTiles()
void InitializeAnimatedTiles(void)
{
memset(_animated_tile_list, 0, sizeof(_animated_tile_list));
}
static void SaveLoad_ANIT()
static void SaveLoad_ANIT(void)
{
SlArray(_animated_tile_list, lengthof(_animated_tile_list), SLE_UINT16);
}

6
town.h
View File

@ -73,15 +73,15 @@ struct Town {
uint16 radius[5];
};
uint32 GetWorldPopulation();
uint32 GetWorldPopulation(void);
void UpdateTownVirtCoord(Town *t);
void InitializeTown();
void InitializeTown(void);
void ShowTownViewWindow(uint town);
void DeleteTown(Town *t);
void ExpandTown(Town *t);
bool GrowTown(Town *t);
Town *CreateRandomTown();
Town *CreateRandomTown(void);
enum {
ROAD_REMOVE = 0,

View File

@ -203,7 +203,7 @@ static void ChangePopulation(Town *t, int mod)
if (_town_sort_order & 2) _town_sort_dirty = true;
}
uint32 GetWorldPopulation()
uint32 GetWorldPopulation(void)
{
uint32 pop;
Town *t;
@ -403,7 +403,7 @@ static void TownTickHandler(Town *t)
UpdateTownRadius(t);
}
void OnTick_Town()
void OnTick_Town(void)
{
uint i;
Town *t;
@ -730,7 +730,7 @@ static int GrowTownAtRoad(Town *t, uint tile)
// Generate a random road block
// The probability of a straight road
// is somewhat higher than a curved.
static int GenRandomRoadBits()
static int GenRandomRoadBits(void)
{
uint32 r = Random();
int a = r&3, b = (r >> 8) & 3;
@ -948,7 +948,7 @@ static void DoCreateTown(Town *t, TileIndex tile)
UpdateTownMaxPass(t);
}
static Town *AllocateTown()
static Town *AllocateTown(void)
{
Town *t;
FOR_ALL_TOWNS(t) {
@ -995,7 +995,7 @@ int32 CmdBuildTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
Town *CreateRandomTown()
Town *CreateRandomTown(void)
{
uint tile;
TileInfo ti;
@ -1034,7 +1034,7 @@ static const byte _num_initial_towns[3] = {
11, 23, 46
};
void GenerateTowns()
void GenerateTowns(void)
{
uint n;
n = _num_initial_towns[_opt.diff.number_towns] + (Random()&7);
@ -1806,7 +1806,7 @@ bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type)
return true;
}
void TownsMonthlyLoop()
void TownsMonthlyLoop(void)
{
Town *t;
@ -1824,7 +1824,7 @@ void TownsMonthlyLoop()
}
}
void InitializeTowns()
void InitializeTowns(void)
{
Subsidy *s;
Town *t;
@ -1917,7 +1917,7 @@ static const byte _town_desc[] = {
SLE_END()
};
static void Save_TOWN()
static void Save_TOWN(void)
{
Town *t;
@ -1929,7 +1929,7 @@ static void Save_TOWN()
}
}
static void Load_TOWN()
static void Load_TOWN(void)
{
int index;
while ((index = SlIterateArray()) != -1) {
@ -1940,7 +1940,7 @@ static void Load_TOWN()
}
}
void AfterLoadTown()
void AfterLoadTown(void)
{
Town *t;
FOR_ALL_TOWNS(t) {

View File

@ -395,7 +395,7 @@ static int CDECL TownPopSorter(const void *a, const void *b)
return r;
}
static void MakeSortedTownList()
static void MakeSortedTownList(void)
{
Town *t;
int n = 0;
@ -509,7 +509,7 @@ static const WindowDesc _town_directory_desc = {
};
void ShowTownDirectory()
void ShowTownDirectory(void)
{
Window *w;

View File

@ -1234,7 +1234,7 @@ int32 CmdChangeTrainServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
void OnTick_Train()
void OnTick_Train(void)
{
_age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
}
@ -2782,7 +2782,7 @@ void OnNewDay_Train(Vehicle *v)
}
}
void TrainsYearlyLoop()
void TrainsYearlyLoop(void)
{
Vehicle *v;
@ -2815,7 +2815,7 @@ void HandleClickOnTrain(Vehicle *v)
ShowTrainViewWindow(v);
}
void InitializeTrains()
void InitializeTrains(void)
{
_age_cargo_skip_counter = 1;
}

View File

@ -88,7 +88,7 @@ static void DoPlaceMoreTrees(uint tile)
} while (--i);
}
static void PlaceMoreTrees()
static void PlaceMoreTrees(void)
{
int i = (Random() & 0x1F) + 25;
do {
@ -96,7 +96,7 @@ static void PlaceMoreTrees()
} while (--i);
}
void PlaceTreesRandomly()
void PlaceTreesRandomly(void)
{
int i;
uint32 r;
@ -126,7 +126,7 @@ void PlaceTreesRandomly()
}
}
void GenerateTrees()
void GenerateTrees(void)
{
int i;
@ -568,7 +568,7 @@ static void TileLoop_Trees(uint tile)
MarkTileDirtyByTile(tile);
}
void OnTick_Trees()
void OnTick_Trees(void)
{
uint32 r;
uint tile;
@ -638,7 +638,7 @@ static void ChangeTileOwner_Trees(uint tile, byte old_player, byte new_player)
/* not used */
}
void InitializeTrees()
void InitializeTrees(void)
{
_trees_tick_ctr = 0;
}

67
ttd.c
View File

@ -30,16 +30,16 @@
#include <stdarg.h>
void IncreaseSpriteLRU();
void IncreaseSpriteLRU(void);
void GenerateWorld(int mode);
void CallLandscapeTick();
void IncreaseDate();
void RunOtherPlayersLoop();
void DoPaletteAnimations();
void MusicLoop();
void ResetMusic();
void InitializeStations();
void DeleteAllPlayerStations();
void CallLandscapeTick(void);
void IncreaseDate(void);
void RunOtherPlayersLoop(void);
void DoPaletteAnimations(void);
void MusicLoop(void);
void ResetMusic(void);
void InitializeStations(void);
void DeleteAllPlayerStations(void);
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
extern void DoStartupNewPlayer(bool is_ai);
@ -48,7 +48,7 @@ extern void ShowOSErrorBox(const char *buf);
void redsq_debug(int tile);
bool LoadSavegame(const char *filename);
extern void HalGameLoop();
extern void HalGameLoop(void);
uint32 _pixels_redrawn;
bool _dbg_screen_rect;
@ -110,10 +110,10 @@ char * CDECL str_fmt(const char *str, ...)
// NULL midi driver
static char *NullMidiStart(char **parm) { return NULL; }
static void NullMidiStop() {}
static void NullMidiStop(void) {}
static void NullMidiPlaySong(const char *filename) {}
static void NullMidiStopSong() {}
static bool NullMidiIsSongPlaying() { return true; }
static void NullMidiStopSong(void) {}
static bool NullMidiIsSongPlaying(void) { return true; }
static void NullMidiSetVolume(byte vol) {}
const HalMusicDriver _null_music_driver = {
@ -133,9 +133,10 @@ static const char *NullVideoStart(char **parm) {
_null_video_mem = malloc(_cur_resolution[0]*_cur_resolution[1]);
return NULL;
}
static void NullVideoStop() { free(_null_video_mem); }
static void NullVideoStop(void) { free(_null_video_mem); }
static void NullVideoMakeDirty(int left, int top, int width, int height) {}
static int NullVideoMainLoop() {
static int NullVideoMainLoop(void)
{
int i = 1000;
do {
GameLoop();
@ -158,7 +159,7 @@ const HalVideoDriver _null_video_driver = {
// NULL sound driver
static char *NullSoundStart(char **parm) { return NULL; }
static void NullSoundStop() {}
static void NullSoundStop(void) {}
const HalSoundDriver _null_sound_driver = {
NullSoundStart,
NullSoundStop,
@ -289,7 +290,7 @@ void LoadDriver(int driver, const char *name)
*var = drv;
}
static void showhelp()
static void showhelp(void)
{
char buf[4096], *p;
const DriverClass *dc = _driver_classes;
@ -512,7 +513,7 @@ static void UnInitializeDynamicVariables(void)
}
void LoadIntroGame()
void LoadIntroGame(void)
{
char filename[256];
_game_mode = GM_MENU;
@ -546,7 +547,7 @@ void LoadIntroGame()
}
extern void DedicatedFork(void);
extern void CheckExternalFiles();
extern void CheckExternalFiles(void);
int ttd_main(int argc, char* argv[])
{
@ -775,7 +776,7 @@ static void ShowScreenshotResult(bool b)
}
void MakeNewGame()
void MakeNewGame(void)
{
_game_mode = GM_NORMAL;
@ -807,7 +808,7 @@ void MakeNewGame()
MarkWholeScreenDirty();
}
static void MakeNewEditorWorld()
static void MakeNewEditorWorld(void)
{
_game_mode = GM_EDITOR;
@ -830,10 +831,10 @@ static void MakeNewEditorWorld()
MarkWholeScreenDirty();
}
void StartupPlayers();
void StartupDisasters();
void StartupPlayers(void);
void StartupDisasters(void);
void StartScenario()
void StartScenario(void)
{
_game_mode = GM_NORMAL;
@ -1028,7 +1029,7 @@ normal_load:
// The state must not be changed from anywhere
// but here.
// That check is enforced in DoCommand.
void StateGameLoop()
void StateGameLoop(void)
{
// dont execute the state loop during pause
if (_pause) return;
@ -1078,7 +1079,7 @@ void StateGameLoop()
_in_state_game_loop = false;
}
static void DoAutosave()
static void DoAutosave(void)
{
char buf[200];
@ -1103,7 +1104,7 @@ static void DoAutosave()
ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0);
}
void GameLoop()
void GameLoop(void)
{
int m;
@ -1178,7 +1179,7 @@ void GameLoop()
MusicLoop();
}
void BeforeSaveGame()
void BeforeSaveGame(void)
{
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
@ -1189,7 +1190,7 @@ void BeforeSaveGame()
}
}
void ConvertTownOwner()
void ConvertTownOwner(void)
{
uint tile;
@ -1208,7 +1209,7 @@ void ConvertTownOwner()
}
// before savegame version 4, the name of the company determined if it existed
void CheckIsPlayerActive()
void CheckIsPlayerActive(void)
{
Player *p;
FOR_ALL_PLAYERS(p) {
@ -1219,7 +1220,7 @@ void CheckIsPlayerActive()
}
// since savegame version 4.1, exclusive transport rights are stored at towns
void UpdateExclusiveRights()
void UpdateExclusiveRights(void)
{
Town *t;
FOR_ALL_TOWNS(t) if (t->xy != 0) {
@ -1244,14 +1245,14 @@ byte convert_currency[] = {
18, 2, 20, };
// since savegame version 4.2 the currencies are arranged differently
void UpdateCurrencies()
void UpdateCurrencies(void)
{
_opt.currency = convert_currency[_opt.currency];
}
// up to revision 1413, the invisible tiles at the southern border have not been MP_VOID
// even though they should have. This is fixed by this function
void UpdateVoidTiles()
void UpdateVoidTiles(void)
{
uint i;
// create void tiles on the border

8
unix.c
View File

@ -34,7 +34,7 @@ static char *_fios_scn_path;
static FiosItem *_fios_items;
static int _fios_count, _fios_alloc;
static FiosItem *FiosAlloc()
static FiosItem *FiosAlloc(void)
{
if (_fios_count == _fios_alloc) {
_fios_alloc += 256;
@ -243,7 +243,7 @@ FiosItem *FiosGetScenarioList(int *num, int mode)
// Free the list of savegames
void FiosFreeSavegameList()
void FiosFreeSavegameList(void)
{
free(_fios_items);
_fios_items = NULL;
@ -370,7 +370,7 @@ const DriverDesc _music_driver_descs[] = {
/* GetOSVersion returns the minimal required version of OS to be able to use that driver.
Not needed for *nix. */
byte GetOSVersion()
byte GetOSVersion(void)
{
return 2; // any arbitrary number bigger than 0
// numbers lower than 2 breaks default music selection on mac
@ -451,7 +451,7 @@ int CDECL main(int argc, char* argv[])
return ttd_main(argc, argv);
}
void DeterminePaths()
void DeterminePaths(void)
{
char *s;

View File

@ -246,7 +246,7 @@ static bool checkRadioTowerNearby(uint tile)
return true;
}
void GenerateUnmovables()
void GenerateUnmovables(void)
{
int i,j;
uint tile;

View File

@ -158,7 +158,7 @@ void RedrawWaypointSign(Waypoint *cp)
}
// Called after load to update coordinates
void AfterLoadVehicles()
void AfterLoadVehicles(void)
{
Vehicle *v;
Waypoint *cp;
@ -202,7 +202,7 @@ static Vehicle *InitializeVehicle(Vehicle *v)
return v;
}
Vehicle *ForceAllocateSpecialVehicle()
Vehicle *ForceAllocateSpecialVehicle(void)
{
Vehicle *v;
FOR_ALL_VEHICLES_FROM(v, NUM_NORMAL_VEHICLES) {
@ -213,7 +213,7 @@ Vehicle *ForceAllocateSpecialVehicle()
}
Vehicle *ForceAllocateVehicle()
Vehicle *ForceAllocateVehicle(void)
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
@ -226,7 +226,7 @@ Vehicle *ForceAllocateVehicle()
return NULL;
}
Vehicle *AllocateVehicle()
Vehicle *AllocateVehicle(void)
{
Vehicle *v;
int num;
@ -327,7 +327,7 @@ void UpdateVehiclePosHash(Vehicle *v, int x, int y)
}
}
void InitializeVehicles()
void InitializeVehicles(void)
{
Vehicle *v;
int i;
@ -385,7 +385,7 @@ int CountVehiclesInChain(Vehicle *v)
}
Depot *AllocateDepot()
Depot *AllocateDepot(void)
{
Depot *dep, *free_dep = NULL;
int num_free = 0;
@ -407,7 +407,7 @@ Depot *AllocateDepot()
return free_dep;
}
Waypoint *AllocateWaypoint()
Waypoint *AllocateWaypoint(void)
{
Waypoint *cp;
@ -485,7 +485,7 @@ VehicleTickProc *_vehicle_tick_procs[] = {
DisasterVehicle_Tick,
};
void CallVehicleTicks()
void CallVehicleTicks(void)
{
Vehicle *v;
@ -1981,7 +1981,7 @@ static const void *_veh_descs[] = {
};
// Will be called when the vehicles need to be saved.
static void Save_VEHS()
static void Save_VEHS(void)
{
Vehicle *v;
// Write the vehicles
@ -1994,7 +1994,7 @@ static void Save_VEHS()
}
// Will be called when vehicles need to be loaded.
static void Load_VEHS()
static void Load_VEHS(void)
{
int index;
Vehicle *v;
@ -2064,7 +2064,7 @@ static const byte _depot_desc[] = {
SLE_END()
};
static void Save_DEPT()
static void Save_DEPT(void)
{
Depot *d;
int i;
@ -2076,7 +2076,7 @@ static void Save_DEPT()
}
}
static void Load_DEPT()
static void Load_DEPT(void)
{
int index;
while ((index = SlIterateArray()) != -1) {
@ -2095,7 +2095,7 @@ static const byte _waypoint_desc[] = {
SLE_END()
};
static void Save_CHKP()
static void Save_CHKP(void)
{
Waypoint *cp;
int i;
@ -2107,7 +2107,7 @@ static void Save_CHKP()
}
}
static void Load_CHKP()
static void Load_CHKP(void)
{
int index;
while ((index = SlIterateArray()) != -1) {

View File

@ -259,12 +259,12 @@ typedef void VehicleTickProc(Vehicle *v);
typedef void *VehicleFromPosProc(Vehicle *v, void *data);
void VehicleServiceInDepot(Vehicle *v);
Vehicle *AllocateVehicle();
Vehicle *ForceAllocateVehicle();
Vehicle *ForceAllocateSpecialVehicle();
Vehicle *AllocateVehicle(void);
Vehicle *ForceAllocateVehicle(void);
Vehicle *ForceAllocateSpecialVehicle(void);
void UpdateVehiclePosHash(Vehicle *v, int x, int y);
void VehiclePositionChanged(Vehicle *v);
void AfterLoadVehicles();
void AfterLoadVehicles(void);
Vehicle *GetLastVehicleInChain(Vehicle *v);
Vehicle *GetPrevVehicleInChain(Vehicle *v);
Vehicle *GetFirstVehicleInChain(Vehicle *v);
@ -272,14 +272,14 @@ int CountVehiclesInChain(Vehicle *v);
void DeleteVehicle(Vehicle *v);
void DeleteVehicleChain(Vehicle *v);
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
void CallVehicleTicks();
void CallVehicleTicks(void);
Depot *AllocateDepot();
Waypoint *AllocateWaypoint();
Depot *AllocateDepot(void);
Waypoint *AllocateWaypoint(void);
void UpdateWaypointSign(Waypoint *cp);
void RedrawWaypointSign(Waypoint *cp);
void InitializeTrains();
void InitializeTrains(void);
bool IsTrainDepotTile(TileIndex tile);
bool IsRoadDepotTile(TileIndex tile);

View File

@ -141,7 +141,7 @@ void SortVehicleList(vehiclelist_d *vl)
/* General Vehicle GUI based procedures that are independent of vehicle types */
void InitializeVehiclesGuiList()
void InitializeVehiclesGuiList(void)
{
}

View File

@ -4,7 +4,7 @@
struct vehiclelist_d;
void DrawVehicleProfitButton(Vehicle *v, int x, int y);
void InitializeVehiclesGuiList();
void InitializeVehiclesGuiList(void);
/* sorter stuff */
void RebuildVehicleLists(void);

View File

@ -320,7 +320,7 @@ static Point GetTileFromScreenXY(int x, int y, int zoom_x, int zoom_y)
return pt;
}
Point GetTileBelowCursor()
Point GetTileBelowCursor(void)
{
return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, _cursor.pos.x, _cursor.pos.y);
}
@ -473,12 +473,12 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
}
}
void StartSpriteCombine()
void StartSpriteCombine(void)
{
_cur_vd->combine_sprites = 1;
}
void EndSpriteCombine()
void EndSpriteCombine(void)
{
_cur_vd->combine_sprites = 0;
}
@ -550,7 +550,7 @@ static uint _stored_tile[200];
static int _stored_track[200];
static int _num_stored;
void dbg_store_path()
void dbg_store_path(void)
{
memcpy(_stored_tile, _pushed_tile, sizeof(_stored_tile));
memcpy(_stored_track, _pushed_track, sizeof(_stored_tile));
@ -565,7 +565,7 @@ void dbg_push_tile(uint tile, int track)
dbg_store_path();
}
void dbg_pop_tile()
void dbg_pop_tile(void)
{
_num_push--;
}
@ -711,7 +711,7 @@ static void DrawTileSelection(const TileInfo *ti)
}
}
static void ViewportAddLandscape()
static void ViewportAddLandscape(void)
{
ViewportDrawer *vd = _cur_vd;
int x, y, width, height;
@ -1427,7 +1427,7 @@ void MarkTileDirty(int x, int y)
);
}
static void SetSelectionTilesDirty()
static void SetSelectionTilesDirty(void)
{
int y_size, x_size;
TileHighlightData *thd = _thd_ptr;
@ -1716,7 +1716,7 @@ void HandleViewportClicked(ViewPort *vp, int x, int y)
}
}
Vehicle *CheckMouseOverVehicle()
Vehicle *CheckMouseOverVehicle(void)
{
Window *w;
ViewPort *vp;
@ -1738,7 +1738,7 @@ Vehicle *CheckMouseOverVehicle()
void PlaceObject()
void PlaceObject(void)
{
Point pt;
Window *w;
@ -1852,7 +1852,7 @@ static byte GetAutorailHT(int x, int y)
}
// called regular to update tile highlighting in all cases
void UpdateTileSelection()
void UpdateTileSelection(void)
{
TileHighlightData *thd = _thd_ptr;
Point pt;
@ -1956,7 +1956,7 @@ void VpSetPresizeRange(uint from, uint to)
thd->next_drawstyle = HT_RECT;
}
void VpStartPreSizing()
void VpStartPreSizing(void)
{
_thd.selend.x = -1;
_special_mouse_mode = WSM_PRESIZE;
@ -2131,7 +2131,7 @@ void VpSelectTilesWithMethod(int x, int y, int method)
}
// while dragging
bool VpHandlePlaceSizingDrag()
bool VpHandlePlaceSizingDrag(void)
{
Window *w;
WindowEvent e;
@ -2225,6 +2225,7 @@ void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumbe
SetMouseCursor(icon);
}
void ResetObjectToPlace(){
void ResetObjectToPlace(void)
{
SetObjectToPlace(0,0,0,0);
}

View File

@ -17,7 +17,7 @@ void AssignWindowViewport(Window *w, int x, int y,
int width, int height, uint32 follow_flags, byte zoom);
void SetViewportPosition(Window *w, int x, int y);
ViewPort *IsPtInWindowViewport(Window *w, int x, int y);
Point GetTileBelowCursor();
Point GetTileBelowCursor(void);
void ZoomInOrOutToCursorWindow(bool in, Window * w);
Point GetTileZoomCenterWindow(bool in, Window * w);
void UpdateViewportPosition(Window *w);
@ -31,21 +31,21 @@ void *AddStringToDraw(int x, int y, StringID string, uint32 params_1, uint32 par
void AddChildSpriteScreen(uint32 image, int x, int y);
void StartSpriteCombine();
void EndSpriteCombine();
void StartSpriteCombine(void);
void EndSpriteCombine(void);
void HandleViewportClicked(ViewPort *vp, int x, int y);
void PlaceObject();
void PlaceObject(void);
void SetRedErrorSquare(TileIndex tile);
void SetTileSelectSize(int w, int h);
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
void VpStartPlaceSizing(uint tile, int user);
void VpStartPreSizing();
void VpStartPreSizing(void);
void VpSetPresizeRange(uint from, uint to);
void VpSetPlaceSizingLimit(int limit);
Vehicle *CheckMouseOverVehicle();
Vehicle *CheckMouseOverVehicle(void);
enum {
VPM_X_OR_Y = 0,

View File

@ -714,7 +714,7 @@ static uint32 VehicleEnter_Water(Vehicle *v, uint tile, int x, int y)
return 0;
}
void InitializeDock()
void InitializeDock(void)
{
_last_built_ship_depot_tile = 0;
}

View File

@ -663,7 +663,7 @@ Window *FindWindowFromPt(int x, int y)
}
void InitWindowSystem()
void InitWindowSystem(void)
{
IConsoleClose();
memset(&_windows, 0, sizeof(_windows));
@ -672,7 +672,7 @@ void InitWindowSystem()
_active_viewports = 0;
}
static void DecreaseWindowCounters()
static void DecreaseWindowCounters(void)
{
Window *w;
@ -698,12 +698,12 @@ static void DecreaseWindowCounters()
}
}
Window *GetCallbackWnd()
Window *GetCallbackWnd(void)
{
return FindWindowById(_thd.window_class, _thd.window_number);
}
static void HandlePlacePresize()
static void HandlePlacePresize(void)
{
Window *w;
WindowEvent e;
@ -724,7 +724,7 @@ static void HandlePlacePresize()
w->wndproc(w, &e);
}
static bool HandleDragDrop()
static bool HandleDragDrop(void)
{
Window *w;
WindowEvent e;
@ -750,7 +750,7 @@ static bool HandleDragDrop()
return false;
}
static bool HandlePopupMenu()
static bool HandlePopupMenu(void)
{
Window *w;
WindowEvent e;
@ -778,7 +778,7 @@ static bool HandlePopupMenu()
return false;
}
bool HandleMouseOver()
bool HandleMouseOver(void)
{
Window *w;
WindowEvent e;
@ -811,7 +811,7 @@ bool HandleMouseOver()
return true;
}
bool HandleWindowDragging()
bool HandleWindowDragging(void)
{
Window *w;
// Get out immediately if no window is being dragged at all.
@ -1069,7 +1069,7 @@ Window *StartWindowSizing(Window *w)
}
static bool HandleScrollbarScrolling()
static bool HandleScrollbarScrolling(void)
{
Window *w;
int i;
@ -1115,7 +1115,7 @@ static bool HandleScrollbarScrolling()
return false;
}
static bool HandleViewportScroll()
static bool HandleViewportScroll(void)
{
Window *w;
ViewPort *vp;
@ -1257,10 +1257,10 @@ static void HandleKeypress(uint32 key)
}
}
extern void UpdateTileSelection();
extern bool VpHandlePlaceSizingDrag();
extern void UpdateTileSelection(void);
extern bool VpHandlePlaceSizingDrag(void);
void MouseLoop()
void MouseLoop(void)
{
int x,y;
Window *w;
@ -1390,7 +1390,7 @@ static int _we4_timer;
extern uint32 _pixels_redrawn;
void UpdateWindows()
void UpdateWindows(void)
{
Window *w;
int t;
@ -1481,7 +1481,7 @@ void InvalidateWindowClasses(byte cls)
}
void CallWindowTickEvent()
void CallWindowTickEvent(void)
{
Window *w;
for(w=_last_window; w != _windows;) {
@ -1490,7 +1490,7 @@ void CallWindowTickEvent()
}
}
void DeleteNonVitalWindows()
void DeleteNonVitalWindows(void)
{
Window *w;
for(w=_windows; w!=_last_window;) {

View File

@ -510,7 +510,7 @@ void DispatchMouseWheelEvent(Window *w, uint widget, int wheel);
/* window.c */
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
void CallWindowEventNP(Window *w, int event);
void CallWindowTickEvent();
void CallWindowTickEvent(void);
void SetWindowDirty(Window *w);
Window *FindWindowById(WindowClass cls, WindowNumber number);
@ -555,10 +555,10 @@ Window *AllocateWindowAutoPlace2(
void DrawWindowViewport(Window *w);
void InitWindowSystem();
void InitWindowSystem(void);
int GetMenuItemIndex(Window *w, int x, int y);
void MouseLoop();
void UpdateWindows();
void MouseLoop(void);
void UpdateWindows(void);
void InvalidateWidget(Window *w, byte widget_index);
void GuiShowTooltips(uint16 string_id);
@ -575,8 +575,8 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
void HandleButtonClick(Window *w, byte widget);
Window *GetCallbackWnd();
void DeleteNonVitalWindows();
Window *GetCallbackWnd(void);
void DeleteNonVitalWindows(void);
void DeleteAllNonVitalWindows(void);
void HideVitalWindows(void);
void ShowVitalWindows(void);