Fixed the erroneous load on pause

This commit is contained in:
Capucho 2020-03-03 21:26:59 +00:00
parent af21d19ff3
commit f13314e3da
2 changed files with 6 additions and 2 deletions

View File

@ -383,6 +383,10 @@ impl PlayState for SessionState {
if global_state.singleplayer.is_none() if global_state.singleplayer.is_none()
|| !global_state.singleplayer.as_ref().unwrap().is_paused() || !global_state.singleplayer.as_ref().unwrap().is_paused()
{ {
log::warn!(
"{}",
global_state.singleplayer.as_ref().unwrap().is_paused()
);
// Perform an in-game tick. // Perform an in-game tick.
if let Err(err) = self.tick(clock.get_avg_delta()) { if let Err(err) = self.tick(clock.get_avg_delta()) {
global_state.info_message = global_state.info_message =

View File

@ -57,12 +57,12 @@ impl Singleplayer {
} }
/// Returns wether or not the server is paused /// Returns wether or not the server is paused
pub fn is_paused(&self) -> bool { self.paused.load(Ordering::Relaxed) } pub fn is_paused(&self) -> bool { self.paused.load(Ordering::SeqCst) }
/// Pauses if true is passed and unpauses if false (Does nothing if in that /// Pauses if true is passed and unpauses if false (Does nothing if in that
/// state already) /// state already)
pub fn pause(&self, state: bool) { pub fn pause(&self, state: bool) {
self.paused.load(Ordering::SeqCst); self.paused.store(state, Ordering::SeqCst);
let _ = self.sender.send(Msg::Pause(state)); let _ = self.sender.send(Msg::Pause(state));
} }
} }