Move kmatrix_screen into local scope
It is only used inside one function, so there is no need to store it into the structure.
This commit is contained in:
parent
5501683dda
commit
363ecc36f1
|
@ -175,7 +175,6 @@ struct kmatrix_screen : ignore_window_pointer_t
|
||||||
{
|
{
|
||||||
grs_main_bitmap background;
|
grs_main_bitmap background;
|
||||||
fix64 end_time;
|
fix64 end_time;
|
||||||
int playing;
|
|
||||||
kmatrix_network network;
|
kmatrix_network network;
|
||||||
kmatrix_result result;
|
kmatrix_result result;
|
||||||
};
|
};
|
||||||
|
@ -324,24 +323,24 @@ static window_event_result kmatrix_handler(window *, const d_event &event, kmatr
|
||||||
if (km->network != kmatrix_network::offline)
|
if (km->network != kmatrix_network::offline)
|
||||||
multi_do_protocol_frame(0, 1);
|
multi_do_protocol_frame(0, 1);
|
||||||
|
|
||||||
km->playing = 0;
|
uint8_t playing = 0;
|
||||||
|
|
||||||
// Check if all connected players are also looking at this screen ...
|
// Check if all connected players are also looking at this screen ...
|
||||||
range_for (auto &i, Players)
|
range_for (auto &i, Players)
|
||||||
if (i.connected)
|
if (i.connected)
|
||||||
if (i.connected != CONNECT_END_MENU && i.connected != CONNECT_DIED_IN_MINE)
|
if (i.connected != CONNECT_END_MENU && i.connected != CONNECT_DIED_IN_MINE)
|
||||||
{
|
{
|
||||||
km->playing = 1;
|
playing = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... and let the reactor blow sky high!
|
// ... and let the reactor blow sky high!
|
||||||
if (!km->playing)
|
if (!playing)
|
||||||
LevelUniqueControlCenterState.Countdown_seconds_left = -1;
|
LevelUniqueControlCenterState.Countdown_seconds_left = -1;
|
||||||
|
|
||||||
// If Reactor is finished and end_time not inited, set the time when we will exit this loop
|
// If Reactor is finished and end_time not inited, set the time when we will exit this loop
|
||||||
const auto Countdown_seconds_left = LevelUniqueControlCenterState.Countdown_seconds_left;
|
const auto Countdown_seconds_left = LevelUniqueControlCenterState.Countdown_seconds_left;
|
||||||
if (km->end_time == -1 && Countdown_seconds_left < 0 && !km->playing)
|
if (km->end_time == -1 && Countdown_seconds_left < 0 && !playing)
|
||||||
km->end_time = timer_query() + (KMATRIX_VIEW_SEC * F1_0);
|
km->end_time = timer_query() + (KMATRIX_VIEW_SEC * F1_0);
|
||||||
|
|
||||||
// Check if end_time has been reached and exit loop
|
// Check if end_time has been reached and exit loop
|
||||||
|
@ -369,7 +368,7 @@ static window_event_result kmatrix_handler(window *, const d_event &event, kmatr
|
||||||
}
|
}
|
||||||
|
|
||||||
kmatrix_redraw(km);
|
kmatrix_redraw(km);
|
||||||
kmatrix_status_msg(*grd_curcanv, km->playing ? Countdown_seconds_left : f2i(timer_query() - km->end_time), km->playing);
|
kmatrix_status_msg(*grd_curcanv, playing ? Countdown_seconds_left : f2i(timer_query() - km->end_time), playing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +397,6 @@ kmatrix_result kmatrix_view(const kmatrix_network network)
|
||||||
|
|
||||||
km.network = network;
|
km.network = network;
|
||||||
km.end_time = -1;
|
km.end_time = -1;
|
||||||
km.playing = 0;
|
|
||||||
km.result = kmatrix_result::proceed;
|
km.result = kmatrix_result::proceed;
|
||||||
|
|
||||||
set_screen_mode( SCREEN_MENU );
|
set_screen_mode( SCREEN_MENU );
|
||||||
|
|
Loading…
Reference in a new issue