mirror of https://github.com/OpenTTD/OpenTTD
(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.
parent
486172e07f
commit
f438700402
|
@ -230,7 +230,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSELOOP: {
|
case WE_TICK: {
|
||||||
if (WP(w, def_d).close) {
|
if (WP(w, def_d).close) {
|
||||||
delete w;
|
delete w;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -274,7 +274,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) {
|
if (WP(w, def_d).close) {
|
||||||
delete w;
|
delete w;
|
||||||
return;
|
return;
|
||||||
|
@ -349,7 +349,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) delete w;
|
if (WP(w, def_d).close) delete w;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -881,7 +881,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_4:
|
case WE_100_TICKS:
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
|
||||||
if (_right_button_down) delete w;
|
if (_right_button_down) delete w;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_4:
|
case WE_100_TICKS:
|
||||||
if (--_errmsg_duration == 0) delete w;
|
if (--_errmsg_duration == 0) delete w;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 7);
|
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 7);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ void MusicLoop();
|
||||||
void ResetMusic();
|
void ResetMusic();
|
||||||
void ResetOldNames();
|
void ResetOldNames();
|
||||||
void ProcessAsyncSaveFinish();
|
void ProcessAsyncSaveFinish();
|
||||||
|
void CallWindowTickEvent();
|
||||||
|
|
||||||
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
|
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
|
||||||
extern Player* DoStartupNewPlayer(bool is_ai);
|
extern Player* DoStartupNewPlayer(bool is_ai);
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
/* redraw the window every now and then */
|
/* redraw the window every now and then */
|
||||||
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
|
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) {
|
if (WP(w, def_d).close) {
|
||||||
delete w;
|
delete w;
|
||||||
return;
|
return;
|
||||||
|
@ -1345,7 +1345,7 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e)
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) delete w;
|
if (WP(w, def_d).close) delete w;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1436,7 +1436,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) delete w;
|
if (WP(w, def_d).close) delete w;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1535,7 +1535,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) delete w;
|
if (WP(w, def_d).close) delete w;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -762,7 +762,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) delete w;
|
if (WP(w, def_d).close) delete w;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (WP(w, def_d).close) {
|
if (WP(w, def_d).close) {
|
||||||
delete w;
|
delete w;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -655,7 +655,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
} 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) {
|
if (diffic_d->timeout != 0) {
|
||||||
diffic_d->timeout--;
|
diffic_d->timeout--;
|
||||||
if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON;
|
if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON;
|
||||||
|
|
|
@ -982,7 +982,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
/* update the window every now and then */
|
/* update the window every now and then */
|
||||||
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
|
if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -745,7 +745,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
||||||
w->ToggleWidgetLoweredState(0);
|
w->ToggleWidgetLoweredState(0);
|
||||||
w->InvalidateWidget(0);
|
w->InvalidateWidget(0);
|
||||||
|
@ -1017,7 +1017,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_TICK:
|
||||||
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
||||||
w->ToggleWidgetLoweredState(0);
|
w->ToggleWidgetLoweredState(0);
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
|
|
|
@ -252,7 +252,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_4:
|
case WE_100_TICKS:
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_4:
|
case WE_100_TICKS:
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2157,7 +2157,7 @@ static void VehicleViewWndProc(Window *w, WindowEvent *e)
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, w->window_number);
|
DeleteWindowById(WC_VEHICLE_TIMETABLE, w->window_number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP: {
|
case WE_TICK: {
|
||||||
const Vehicle *v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
bool veh_stopped = v->IsStoppedInDepot();
|
bool veh_stopped = v->IsStoppedInDepot();
|
||||||
|
|
||||||
|
|
|
@ -1984,7 +1984,7 @@ void UpdateWindows()
|
||||||
|
|
||||||
if (t >= 100) {
|
if (t >= 100) {
|
||||||
for (wz = _last_z_window; wz != _z_windows;) {
|
for (wz = _last_z_window; wz != _z_windows;) {
|
||||||
CallWindowEventNP(*--wz, WE_4);
|
CallWindowEventNP(*--wz, WE_100_TICKS);
|
||||||
}
|
}
|
||||||
t = 0;
|
t = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,10 @@ enum WindowEventCodes {
|
||||||
WE_DOUBLE_CLICK, ///< Left mouse button double click
|
WE_DOUBLE_CLICK, ///< Left mouse button double click
|
||||||
WE_RCLICK, ///< Right mouse button click
|
WE_RCLICK, ///< Right mouse button click
|
||||||
WE_MOUSEOVER,
|
WE_MOUSEOVER,
|
||||||
WE_MOUSELOOP,
|
|
||||||
WE_MOUSEWHEEL,
|
WE_MOUSEWHEEL,
|
||||||
WE_TICK, ///< Regularly occurring event (about once every 20 seconds orso, 10 days) for slowly changing content (typically list sorting)
|
WE_MOUSELOOP, ///< Event for each mouse event in the game (at least once every game tick)
|
||||||
WE_4, ///< Regularly occurring event for updating continuously changing window content (other than view ports), or timer expiring
|
WE_TICK, ///< Regularly occurring event (every game tick)
|
||||||
|
WE_100_TICKS, ///< Regularly occurring event (every 100 game ticks, approximatelly 3 seconds)
|
||||||
WE_TIMEOUT,
|
WE_TIMEOUT,
|
||||||
WE_PLACE_OBJ,
|
WE_PLACE_OBJ,
|
||||||
WE_ABORT_PLACE_OBJ,
|
WE_ABORT_PLACE_OBJ,
|
||||||
|
@ -504,7 +504,6 @@ enum WindowFlags {
|
||||||
|
|
||||||
/* window.cpp */
|
/* window.cpp */
|
||||||
void CallWindowEventNP(Window *w, int event);
|
void CallWindowEventNP(Window *w, int event);
|
||||||
void CallWindowTickEvent();
|
|
||||||
|
|
||||||
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
||||||
Window *FindWindowFromPt(int x, int y);
|
Window *FindWindowFromPt(int x, int y);
|
||||||
|
|
Loading…
Reference in New Issue