(svn r12921) -Codechange: coding style fixes and documentation updates.

pull/155/head
rubidium 16 years ago
parent 299b15c2bf
commit 6056d1fb31

@ -101,10 +101,11 @@ extern Player* DoStartupNewPlayer(bool is_ai);
extern void ShowOSErrorBox(const char *buf);
extern void InitializeRailGUI();
/* TODO: usrerror() for errors which are not of an internal nature but
* caused by the user, i.e. missing files or fatal configuration errors.
* Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */
/**
* Error handling for fatal errors.
* @param s the string to print.
* @note Does NEVER return.
*/
void CDECL error(const char *s, ...)
{
va_list va;
@ -121,6 +122,10 @@ void CDECL error(const char *s, ...)
exit(1);
}
/**
* Shows some information on the console/a popup box depending on the OS.
* @param str the text to show.
*/
void CDECL ShowInfoF(const char *str, ...)
{
va_list va;
@ -131,13 +136,16 @@ void CDECL ShowInfoF(const char *str, ...)
ShowInfo(buf);
}
/** The current revision of OpenTTD */
extern const char _openttd_revision[];
static void showhelp()
{
char buf[4096], *p;
p = buf;
/**
* Show the help message when someone passed a wrong parameter.
*/
static void ShowHelp()
{
char buf[4096];
char *p = buf;
p += snprintf(p, lengthof(buf), "OpenTTD %s\n", _openttd_revision);
p = strecpy(p,
@ -253,7 +261,12 @@ md_continue_here:;
}
}
/**
* Extract the resolution from the given string and store
* it in the 'res' parameter.
* @param res variable to store the resolution in.
* @param s the string to decompose.
*/
static void ParseResolution(int res[2], const char *s)
{
const char *t = strchr(s, 'x');
@ -430,7 +443,7 @@ int ttd_main(int argc, char *argv[])
case 'x': save_config = false; break;
case -2:
case 'h':
showhelp();
ShowHelp();
return 0;
}
}
@ -778,7 +791,8 @@ static void StartScenario()
* @param filename file to be loaded
* @param mode mode of loading, either SL_LOAD or SL_OLD_LOAD
* @param newgm switch to this mode of loading fails due to some unknown error
* @param subdir default directory to look for filename, set to 0 if not needed */
* @param subdir default directory to look for filename, set to 0 if not needed
*/
bool SafeSaveOrLoad(const char *filename, int mode, int newgm, Subdirectory subdir)
{
byte ogm = _game_mode;
@ -944,10 +958,11 @@ void SwitchMode(int new_mode)
}
/* State controlling game loop.
* The state must not be changed from anywhere
* but here.
* That check is enforced in DoCommand. */
/**
* State controlling game loop.
* The state must not be changed from anywhere but here.
* That check is enforced in DoCommand.
*/
void StateGameLoop()
{
/* dont execute the state loop during pause */
@ -1044,8 +1059,7 @@ static void DoAutosave()
#if defined(PSP)
/* Autosaving in networking is too time expensive for the PSP */
if (_networking)
return;
if (_networking) return;
#endif /* PSP */
if (_patches.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
@ -1061,9 +1075,10 @@ static void DoAutosave()
}
DEBUG(sl, 2, "Autosaving to '%s'", buf);
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK)
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK) {
ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0);
}
}
static void ScrollMainViewport(int x, int y)
{
@ -1075,6 +1090,7 @@ static void ScrollMainViewport(int x, int y)
WP(w, vp_d).dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
}
}
/**
* Describes all the different arrow key combinations the game allows
* when it is in scrolling mode.
@ -1189,9 +1205,7 @@ void BeforeSaveGame()
static void ConvertTownOwner()
{
TileIndex tile;
for (tile = 0; tile != MapSize(); tile++) {
for (TileIndex tile = 0; tile != MapSize(); tile++) {
switch (GetTileType(tile)) {
case MP_ROAD:
if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {

Loading…
Cancel
Save