Exit SDL_PollEvent early if window changes, to avoid menu problems when pressing keys fast; fix 'condition is always false' warning
This commit is contained in:
parent
b41faef1d3
commit
5a66d422bd
|
@ -1,5 +1,9 @@
|
|||
D1X-Rebirth Changelog
|
||||
|
||||
20100725
|
||||
--------
|
||||
arch/sdl/event.c, arch/ogl/gr.c, arch/sdl/gr.c: Exit SDL_PollEvent early if window changes, to avoid menu problems when pressing keys fast; fix 'condition is always false' warning
|
||||
|
||||
20100721
|
||||
--------
|
||||
main/net_udp.c: Fixing crash when joinging game over UDP Netlist: when exiting the menu for any reason, return 0 instead of following the code and possibly lead to drawing text from a newly free'd pointer - D'OH!
|
||||
|
|
|
@ -217,7 +217,7 @@ int gr_list_modes( u_int32_t gsmodes[] )
|
|||
{
|
||||
for (i = 0; modes[i]; ++i)
|
||||
{
|
||||
if (modes[i]->w > 0xFFFF || modes[i]->h > 0xFFFF // resolutions saved in 32bits. so skip bigger ones (unrealistic in 2010)
|
||||
if (modes[i]->w > 0xFFF0 || modes[i]->h > 0xFFF0 // resolutions saved in 32bits. so skip bigger ones (unrealistic in 2010) (kreatordxx - made 0xFFF0 to kill warning)
|
||||
|| modes[i]->w < 320 || modes[i]->h < 200) // also skip everything smaller than 320x200
|
||||
continue;
|
||||
gsmodes[modesnum] = SM(modes[i]->w,modes[i]->h);
|
||||
|
|
|
@ -30,8 +30,12 @@ void event_poll()
|
|||
SDL_Event event;
|
||||
int clean_uniframe=1;
|
||||
fix time = timer_get_fixed_seconds();
|
||||
window *wind = window_get_front();
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
// If the front window changes, exit this loop, otherwise unintended behavior can occur
|
||||
// like pressing 'Return' really fast at 'Difficulty Level' causing multiple games to be started
|
||||
while ((wind == window_get_front()) && SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
|
|
|
@ -65,7 +65,7 @@ int gr_list_modes( u_int32_t gsmodes[] )
|
|||
{
|
||||
for (i = 0; modes[i]; ++i)
|
||||
{
|
||||
if (modes[i]->w > 0xFFFF || modes[i]->h > 0xFFFF // resolutions saved in 32bits. so skip bigger ones (unrealistic in 2010)
|
||||
if (modes[i]->w > 0xFFF0 || modes[i]->h > 0xFFF0 // resolutions saved in 32bits. so skip bigger ones (unrealistic in 2010) (kreatordxx - made 0xFFF0 to kill warning)
|
||||
|| modes[i]->w < 320 || modes[i]->h < 200) // also skip everything smaller than 320x200
|
||||
continue;
|
||||
gsmodes[modesnum] = SM(modes[i]->w,modes[i]->h);
|
||||
|
|
Loading…
Reference in a new issue