Changeset - r17966:0c023b07072a
[Not reviewed]
master
0 9 0
rubidium - 13 years ago 2011-08-21 12:46:46
rubidium@openttd.org
(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress
9 files changed with 17 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/command.cpp
Show inline comments
 
@@ -500,10 +500,10 @@ bool DoCommandP(TileIndex tile, uint32 p
 
	/* Cost estimation is generally only done when the
 
	 * local user presses shift while doing somthing.
 
	 * However, in case of incoming network commands,
 
	 * map generation of the pause button we do want
 
	 * map generation or the pause button we do want
 
	 * to execute. */
 
	bool estimate_only = _shift_pressed && IsLocalCompany() &&
 
			!IsGeneratingWorld() &&
 
			!_generating_world &&
 
			!(cmd & CMD_NETWORK_COMMAND) &&
 
			(cmd & CMD_ID_MASK) != CMD_PAUSE;
 

	
src/genworld.h
Show inline comments
 
@@ -75,7 +75,7 @@ enum GenWorldProgress {
 
 * Check if we are currently in the process of generating a world.
 
 * @return are we generating world?
 
 */
 
static inline bool IsGeneratingWorld()
 
static inline bool HasModalProgress()
 
{
 
	extern GenWorldInfo _gw;
 
	return _gw.active;
src/genworld_gui.cpp
Show inline comments
 
@@ -1250,7 +1250,7 @@ static void AbortGeneratingWorldCallback
 
{
 
	if (confirmed) {
 
		AbortGeneratingWorld();
 
	} else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) {
 
	} else if (HasModalProgress() && !IsGeneratingWorldAborted()) {
 
		SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
 
	}
 
}
src/gfx.cpp
Show inline comments
 
@@ -1554,7 +1554,7 @@ void DrawDirtyBlocks()
 
	int x;
 
	int y;
 

	
 
	if (IsGeneratingWorld()) {
 
	if (HasModalProgress()) {
 
		/* We are generating the world, so release our rights to the map and
 
		 * painting while we are waiting a bit. */
 
		_genworld_paint_mutex->EndCritical();
src/main_gui.cpp
Show inline comments
 
@@ -282,7 +282,7 @@ struct MainWindow : Window
 
		 * generating the world, otherwise they create threading
 
		 * problem during the generating, resulting in random
 
		 * assertions that are hard to trigger and debug */
 
		if (IsGeneratingWorld()) return ES_NOT_HANDLED;
 
		if (HasModalProgress()) return ES_NOT_HANDLED;
 

	
 
		switch (num) {
 
			case GHK_ABANDON:
src/openttd.cpp
Show inline comments
 
@@ -1113,7 +1113,7 @@ void StateGameLoop()
 
		CallWindowTickEvent();
 
		return;
 
	}
 
	if (IsGeneratingWorld()) return;
 
	if (HasModalProgress()) return;
 

	
 
	ClearStorageChanges(false);
 

	
 
@@ -1217,7 +1217,7 @@ void GameLoop()
 
	/* Check for UDP stuff */
 
	if (_network_available) NetworkUDPGameLoop();
 

	
 
	if (_networking && !IsGeneratingWorld()) {
 
	if (_networking && !HasModalProgress()) {
 
		/* Multiplayer */
 
		NetworkGameLoop();
 
	} else {
src/road.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ bool HasRoadTypesAvail(const CompanyID c
 
{
 
	RoadTypes avail_roadtypes;
 

	
 
	if (company == OWNER_TOWN || _game_mode == GM_EDITOR || IsGeneratingWorld()) {
 
	if (company == OWNER_TOWN || _game_mode == GM_EDITOR || _generating_world) {
 
		avail_roadtypes = ROADTYPES_ROAD;
 
	} else {
 
		Company *c = Company::GetIfValid(company);
src/video/sdl_v.cpp
Show inline comments
 
@@ -594,7 +594,7 @@ void VideoDriver_SDL::MainLoop()
 
		}
 

	
 
		/* End of the critical part. */
 
		if (_draw_threaded && !IsGeneratingWorld()) {
 
		if (_draw_threaded && !HasModalProgress()) {
 
			_draw_mutex->SendSignal();
 
		} else {
 
			/* Oh, we didn't have threads, then just draw unthreaded */
src/window.cpp
Show inline comments
 
@@ -1997,7 +1997,7 @@ void HandleKeypress(uint32 raw_key)
 
{
 
	/* World generation is multithreaded and messes with companies.
 
	 * But there is no company related window open anyway, so _current_company is not used. */
 
	assert(IsGeneratingWorld() || IsLocalCompany());
 
	assert(HasModalProgress() || IsLocalCompany());
 

	
 
	/* Setup event */
 
	uint16 key     = GB(raw_key,  0, 16);
 
@@ -2063,7 +2063,7 @@ static int _input_events_this_tick = 0;
 
 */
 
static void HandleAutoscroll()
 
{
 
	if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) {
 
	if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !HasModalProgress()) {
 
		int x = _cursor.pos.x;
 
		int y = _cursor.pos.y;
 
		Window *w = FindWindowFromPt(x, y);
 
@@ -2158,7 +2158,7 @@ static void MouseLoop(MouseClick click, 
 
{
 
	/* World generation is multithreaded and messes with companies.
 
	 * But there is no company related window open anyway, so _current_company is not used. */
 
	assert(IsGeneratingWorld() || IsLocalCompany());
 
	assert(HasModalProgress() || IsLocalCompany());
 

	
 
	HandlePlacePresize();
 
	UpdateTileSelection();
 
@@ -2182,8 +2182,8 @@ static void MouseLoop(MouseClick click, 
 
	if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
 
	ViewPort *vp = IsPtInWindowViewport(w, x, y);
 

	
 
	/* Don't allow any action in a viewport if either in menu of in generating world */
 
	if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return;
 
	/* Don't allow any action in a viewport if either in menu or when having a modal progress window */
 
	if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
 

	
 
	if (mousewheel != 0) {
 
		/* Send mousewheel event to window */
 
@@ -2248,7 +2248,7 @@ void HandleMouseEvents()
 
{
 
	/* World generation is multithreaded and messes with companies.
 
	 * But there is no company related window open anyway, so _current_company is not used. */
 
	assert(IsGeneratingWorld() || IsLocalCompany());
 
	assert(HasModalProgress() || IsLocalCompany());
 

	
 
	static int double_click_time = 0;
 
	static Point double_click_pos = {0, 0};
 
@@ -2355,7 +2355,7 @@ void InputLoop()
 
{
 
	/* World generation is multithreaded and messes with companies.
 
	 * But there is no company related window open anyway, so _current_company is not used. */
 
	assert(IsGeneratingWorld() || IsLocalCompany());
 
	assert(HasModalProgress() || IsLocalCompany());
 

	
 
	CheckSoftLimit();
 
	HandleKeyScrolling();
0 comments (0 inline, 0 general)