Changeset - r6231:4cdf70b5a6ea
[Not reviewed]
master
0 11 0
truelight - 17 years ago 2007-03-06 20:59:52
truelight@openttd.org
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
a symbol called _pause (and therefor our variable conflicts with
thatone. We shouldn't be using _ as global indicator.....)
11 files changed with 22 insertions and 22 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -496,13 +496,13 @@ DEF_CONSOLE_CMD(ConPauseGame)
 
{
 
	if (argc == 0) {
 
		IConsoleHelp("Pause a network game. Usage: 'pause'");
 
		return true;
 
	}
 

	
 
	if (_pause == 0) {
 
	if (_pause_game == 0) {
 
		DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 
		IConsolePrint(_icolour_def, "Game paused.");
 
	} else {
 
		IConsolePrint(_icolour_def, "Game is already paused.");
 
	}
 

	
 
@@ -513,13 +513,13 @@ DEF_CONSOLE_CMD(ConUnPauseGame)
 
{
 
	if (argc == 0) {
 
		IConsoleHelp("Unpause a network game. Usage: 'unpause'");
 
		return true;
 
	}
 

	
 
	if (_pause != 0) {
 
	if (_pause_game != 0) {
 
		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
 
		IConsolePrint(_icolour_def, "Game unpaused.");
 
	} else {
 
		IConsolePrint(_icolour_def, "Game is already unpaused.");
 
	}
 

	
src/gfx.cpp
Show inline comments
 
@@ -34,13 +34,13 @@ bool _left_button_clicked;
 
bool _right_button_down;
 
bool _right_button_clicked;
 
DrawPixelInfo _screen;
 
bool _exit_game;
 
bool _networking;         ///< are we in networking mode?
 
byte _game_mode;
 
byte _pause;
 
byte _pause_game;
 
int _pal_first_dirty;
 
int _pal_last_dirty;
 

	
 
Colour _cur_palette[256];
 
byte _stringwidth_table[FS_END][224];
 

	
src/gfx.h
Show inline comments
 
@@ -153,13 +153,13 @@ extern bool _right_button_down;
 
extern bool _right_button_clicked;
 

	
 
extern DrawPixelInfo _screen;
 
extern bool _exit_game;
 
extern bool _networking;         ///< are we in networking mode?
 
extern byte _game_mode;
 
extern byte _pause;
 
extern byte _pause_game;
 

	
 
extern int _pal_first_dirty;
 
extern int _pal_last_dirty;
 
extern int _num_resolutions;
 
extern uint16 _resolutions[32][2];
 
extern uint16 _cur_resolution[2];
src/main_gui.cpp
Show inline comments
 
@@ -133,13 +133,13 @@ void CcPlaySound10(bool success, TileInd
 

	
 

	
 
static void ToolbarPauseClick(Window *w)
 
{
 
	if (_networking && !_network_server) return; // only server can pause the game
 

	
 
	if (DoCommandP(0, _pause ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP);
 
	if (DoCommandP(0, _pause_game ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP);
 
}
 

	
 
static void ToolbarFastForwardClick(Window *w)
 
{
 
	_fast_forward ^= true;
 
	SndPlayFx(SND_15_BEEP);
 
@@ -1870,13 +1870,13 @@ static void MainToolbarWndProc(Window *w
 
	case WE_ABORT_PLACE_OBJ: {
 
		RaiseWindowWidget(w, 25);
 
		SetWindowDirty(w);
 
	} break;
 

	
 
	case WE_MOUSELOOP:
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause_game) {
 
			ToggleWidgetLoweredState(w, 0);
 
			InvalidateWidget(w, 0);
 
		}
 

	
 
		if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) {
 
			ToggleWidgetLoweredState(w, 1);
 
@@ -2069,13 +2069,13 @@ static void ScenEditToolbarWndProc(Windo
 
	case WE_ABORT_PLACE_OBJ: {
 
		RaiseWindowWidget(w, 25);
 
		SetWindowDirty(w);
 
	} break;
 

	
 
	case WE_MOUSELOOP:
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause_game) {
 
			ToggleWidgetLoweredState(w, 0);
 
			SetWindowDirty(w);
 
		}
 

	
 
		if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) {
 
			ToggleWidgetLoweredState(w, 1);
 
@@ -2152,13 +2152,13 @@ static void StatusBarWndProc(Window *w, 
 
	case WE_PAINT: {
 
		const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player);
 

	
 
		DrawWindowWidgets(w);
 
		SetDParam(0, _date);
 
		DrawStringCentered(
 
			70, 1, (_pause || _patches.status_long_date) ? STR_00AF : STR_00AE, 0
 
			70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, 0
 
		);
 

	
 
		if (p != NULL) {
 
			/* Draw player money */
 
			SetDParam64(0, p->money64);
 
			DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
 
@@ -2166,13 +2166,13 @@ static void StatusBarWndProc(Window *w, 
 

	
 
		/* Draw status bar */
 
		if (w->message.msg) { // true when saving is active
 
			DrawStringCentered(320, 1, STR_SAVING_GAME, 0);
 
		} else if (_do_autosave) {
 
			DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0);
 
		} else if (_pause) {
 
		} else if (_pause_game) {
 
			DrawStringCentered(320, 1, STR_0319_PAUSED, 0);
 
		} else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) {
 
			/* Draw the scrolling news text */
 
			if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1))
 
				WP(w,def_d).data_1 = -1280;
 
		} else {
 
@@ -2198,13 +2198,13 @@ static void StatusBarWndProc(Window *w, 
 
			case 2: if (_local_player != PLAYER_SPECTATOR) ShowPlayerFinances(_local_player); break;
 
			default: ResetObjectToPlace();
 
		}
 
		break;
 

	
 
	case WE_TICK: {
 
		if (_pause) return;
 
		if (_pause_game) return;
 

	
 
		if (WP(w, def_d).data_1 > -1280) { // Scrolling text
 
			WP(w, def_d).data_1 -= 2;
 
			InvalidateWidget(w, 1);
 
		}
 

	
src/misc.cpp
Show inline comments
 
@@ -101,13 +101,13 @@ void InitializeGame(int mode, uint size_
 
	AllocateMap(size_x, size_y);
 

	
 
	AddTypeToEngines(); // make sure all engines have a type
 

	
 
	SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
 

	
 
	_pause = 0;
 
	_pause_game = 0;
 
	_fast_forward = 0;
 
	_tick_counter = 0;
 
	_date_fract = 0;
 
	_cur_tileloop_tile = 0;
 

	
 
	if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
 
@@ -304,13 +304,13 @@ static const SaveLoadGlobVarList _date_d
 
	    SLEG_VAR(_random_seeds[0][1],     SLE_UINT32),
 
	SLEG_CONDVAR(_cur_town_ctr,           SLE_FILE_U8  | SLE_VAR_U32,  0, 9),
 
	SLEG_CONDVAR(_cur_town_ctr,           SLE_UINT32,                 10, SL_MAX_VERSION),
 
	    SLEG_VAR(_cur_player_tick_index,  SLE_FILE_U8  | SLE_VAR_U32),
 
	    SLEG_VAR(_next_competitor_start,  SLE_FILE_U16 | SLE_VAR_U32),
 
	    SLEG_VAR(_trees_tick_ctr,         SLE_UINT8),
 
	SLEG_CONDVAR(_pause,                  SLE_UINT8,                   4, SL_MAX_VERSION),
 
	SLEG_CONDVAR(_pause_game,             SLE_UINT8,                   4, SL_MAX_VERSION),
 
	SLEG_CONDVAR(_cur_town_iter,          SLE_UINT32,                 11, SL_MAX_VERSION),
 
	    SLEG_END()
 
};
 

	
 
/* Save load date related variables as well as persistent tick counters
 
 * XXX: currently some unrelated stuff is just put here */
src/misc_cmd.cpp
Show inline comments
 
@@ -254,14 +254,14 @@ int32 CmdChangePresidentName(TileIndex t
 
 * @param p1 0 = decrease pause counter; 1 = increase pause counter
 
 * @param p2 unused
 
 */
 
int32 CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	if (flags & DC_EXEC) {
 
		_pause += (p1 == 1) ? 1 : -1;
 
		if (_pause == (byte)-1) _pause = 0;
 
		_pause_game += (p1 == 1) ? 1 : -1;
 
		if (_pause_game == (byte)-1) _pause_game = 0;
 
		InvalidateWindow(WC_STATUS_BAR, 0);
 
		InvalidateWindow(WC_MAIN_TOOLBAR, 0);
 
	}
 
	return 0;
 
}
 

	
src/oldloader.cpp
Show inline comments
 
@@ -1608,13 +1608,13 @@ bool LoadOldSaveGame(const char *file)
 

	
 
	/* Load the main chunk */
 
	if (!LoadOldMain(&ls)) return false;
 

	
 
	fclose(ls.file);
 

	
 
	_pause = 2;
 
	_pause_game = 2;
 

	
 
	return true;
 
}
 

	
 
void GetOldSaveGameName(char *title, const char *path, const char *file)
 
{
src/openttd.cpp
Show inline comments
 
@@ -316,13 +316,13 @@ static void LoadIntroGame(void)
 
#endif
 
	if (SaveOrLoad(filename, SL_LOAD) != SL_OK) {
 
		GenerateWorld(GW_EMPTY, 64, 64); // if failed loading, make empty world.
 
		WaitTillGeneratedWorld();
 
	}
 

	
 
	_pause = 0;
 
	_pause_game = 0;
 
	SetLocalPlayer(PLAYER_FIRST);
 
	/* Make sure you can't scroll in the menu */
 
	_scrolling_viewport = 0;
 
	_cursor.fix_at = false;
 
	MarkWholeScreenDirty();
 

	
 
@@ -900,13 +900,13 @@ void SwitchMode(int new_mode)
 
// The state must not be changed from anywhere
 
// but here.
 
// That check is enforced in DoCommand.
 
void StateGameLoop(void)
 
{
 
	// dont execute the state loop during pause
 
	if (_pause) return;
 
	if (_pause_game) return;
 
	if (IsGeneratingWorld()) return;
 

	
 
	if (_game_mode == GM_EDITOR) {
 
		RunTileLoop();
 
		CallVehicleTicks();
 
		CallLandscapeTick();
 
@@ -1061,15 +1061,15 @@ void GameLoop(void)
 
		StateGameLoop();
 
	}
 
#else
 
	StateGameLoop();
 
#endif /* ENABLE_NETWORK */
 

	
 
	if (!_pause && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations();
 
	if (!_pause_game && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations();
 

	
 
	if (!_pause || _cheats.build_in_pause.value) MoveAllTextEffects();
 
	if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
 

	
 
	InputLoop();
 

	
 
	MusicLoop();
 
}
 

	
src/video/sdl_v.cpp
Show inline comments
 
@@ -449,13 +449,13 @@ static void SdlVideoMainLoop(void)
 
			if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;
 
		} else if (_fast_forward & 2) {
 
			_fast_forward = 0;
 
		}
 

	
 
		cur_ticks = SDL_CALL SDL_GetTicks();
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
 
			next_tick = cur_ticks + 30;
 

	
 
			_ctrl_pressed  = !!(mod & KMOD_CTRL);
 
			_shift_pressed = !!(mod & KMOD_SHIFT);
 
#ifdef _DEBUG
 
			_dbg_screen_rect = !!(mod & KMOD_CAPS);
src/video/win32_v.cpp
Show inline comments
 
@@ -832,13 +832,13 @@ static void Win32GdiMainLoop(void)
 
			_fast_forward |= 2;
 
		} else if (_fast_forward & 2) {
 
			_fast_forward = 0;
 
		}
 

	
 
		cur_ticks = GetTickCount();
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
 
			next_tick = cur_ticks + 30;
 
			_ctrl_pressed = _wnd.has_focus && GetAsyncKeyState(VK_CONTROL)<0;
 
			_shift_pressed = _wnd.has_focus && GetAsyncKeyState(VK_SHIFT)<0;
 
#ifdef _DEBUG
 
			_dbg_screen_rect = _wnd.has_focus && GetAsyncKeyState(VK_CAPITAL)<0;
 
#endif
src/window.cpp
Show inline comments
 
@@ -1670,13 +1670,13 @@ void MouseLoop(int click, int mousewheel
 
			case 1:
 
				DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
 
				if (_thd.place_mode != 0 &&
 
						// query button and place sign button work in pause mode
 
						_cursor.sprite != SPR_CURSOR_QUERY &&
 
						_cursor.sprite != SPR_CURSOR_SIGN &&
 
						_pause != 0 &&
 
						_pause_game != 0 &&
 
						!_cheats.build_in_pause.value) {
 
					return;
 
				}
 

	
 
				if (_thd.place_mode == 0) {
 
					HandleViewportClicked(vp, x, y);
0 comments (0 inline, 0 general)