(svn r13024) -Codechange: do not use WE_MOUSELOOP when WE_TICK suffices, rename WE_4 to something more descriptive and correct some (completely incorrect) comments.

This commit is contained in:
rubidium 2008-05-09 09:29:27 +00:00
parent 486172e07f
commit f438700402
16 changed files with 25 additions and 25 deletions

View File

@ -230,7 +230,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
}
} break;
case WE_MOUSELOOP: {
case WE_TICK: {
if (WP(w, def_d).close) {
delete w;
return;

View File

@ -274,7 +274,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) {
delete w;
return;
@ -349,7 +349,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
}
} break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) delete w;
break;

View File

@ -881,7 +881,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
}
break;
case WE_4:
case WE_100_TICKS:
w->SetDirty();
break;

View File

@ -401,7 +401,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
if (_right_button_down) delete w;
break;
case WE_4:
case WE_100_TICKS:
if (--_errmsg_duration == 0) delete w;
break;

View File

@ -463,7 +463,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 7);
break;
}

View File

@ -97,6 +97,7 @@ void MusicLoop();
void ResetMusic();
void ResetOldNames();
void ProcessAsyncSaveFinish();
void CallWindowTickEvent();
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
extern Player* DoStartupNewPlayer(bool is_ai);

View File

@ -1309,7 +1309,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
/* redraw the window every now and then */
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
break;

View File

@ -1122,7 +1122,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
w->SetDirty();
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) {
delete w;
return;
@ -1345,7 +1345,7 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e)
w->SetDirty();
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) delete w;
return;
@ -1436,7 +1436,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) delete w;
return;
@ -1535,7 +1535,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
break;
}
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) delete w;
break;

View File

@ -762,7 +762,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) delete w;
break;
@ -919,7 +919,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
if (WP(w, def_d).close) {
delete w;
return;

View File

@ -655,7 +655,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
break;
} break;
case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */
case WE_TICK: /* Handle the visual 'clicking' of the buttons */
if (diffic_d->timeout != 0) {
diffic_d->timeout--;
if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON;

View File

@ -982,7 +982,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
}
break;
case WE_MOUSELOOP:
case WE_TICK:
/* update the window every now and then */
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
break;

View File

@ -745,7 +745,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
w->SetDirty();
break;
case WE_MOUSELOOP:
case WE_TICK:
if (w->IsWidgetLowered(0) != !!_pause_game) {
w->ToggleWidgetLoweredState(0);
w->InvalidateWidget(0);
@ -1017,7 +1017,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
}
} break;
case WE_MOUSELOOP:
case WE_TICK:
if (w->IsWidgetLowered(0) != !!_pause_game) {
w->ToggleWidgetLoweredState(0);
w->SetDirty();

View File

@ -252,7 +252,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
}
break;
case WE_4:
case WE_100_TICKS:
w->SetDirty();
break;
}
@ -555,7 +555,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
}
break;
case WE_4:
case WE_100_TICKS:
w->SetDirty();
break;

View File

@ -2157,7 +2157,7 @@ static void VehicleViewWndProc(Window *w, WindowEvent *e)
DeleteWindowById(WC_VEHICLE_TIMETABLE, w->window_number);
break;
case WE_MOUSELOOP: {
case WE_TICK: {
const Vehicle *v = GetVehicle(w->window_number);
bool veh_stopped = v->IsStoppedInDepot();

View File

@ -1984,7 +1984,7 @@ void UpdateWindows()
if (t >= 100) {
for (wz = _last_z_window; wz != _z_windows;) {
CallWindowEventNP(*--wz, WE_4);
CallWindowEventNP(*--wz, WE_100_TICKS);
}
t = 0;
}

View File

@ -117,10 +117,10 @@ enum WindowEventCodes {
WE_DOUBLE_CLICK, ///< Left mouse button double click
WE_RCLICK, ///< Right mouse button click
WE_MOUSEOVER,
WE_MOUSELOOP,
WE_MOUSEWHEEL,
WE_TICK, ///< Regularly occurring event (about once every 20 seconds orso, 10 days) for slowly changing content (typically list sorting)
WE_4, ///< Regularly occurring event for updating continuously changing window content (other than view ports), or timer expiring
WE_MOUSELOOP, ///< Event for each mouse event in the game (at least once every game tick)
WE_TICK, ///< Regularly occurring event (every game tick)
WE_100_TICKS, ///< Regularly occurring event (every 100 game ticks, approximatelly 3 seconds)
WE_TIMEOUT,
WE_PLACE_OBJ,
WE_ABORT_PLACE_OBJ,
@ -504,7 +504,6 @@ enum WindowFlags {
/* window.cpp */
void CallWindowEventNP(Window *w, int event);
void CallWindowTickEvent();
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
Window *FindWindowFromPt(int x, int y);