1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Fix crash on point capture caused by counting fix, fix #66

This commit is contained in:
NG (Graham)
2025-12-14 11:38:16 -05:00
parent f6f6e1f127
commit ff796396e3
2 changed files with 9 additions and 3 deletions

View File

@@ -715,7 +715,7 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
log::warn!("Got RequestLoadingSync after user {} was already in/past WaitingForSync stage", user_id);
continue;
}
log::info!("User {} is awaiting sync", user_id);
log::info!("User {} (player {}) is awaiting sync", user_id, player_id);
user_desc.state.mode.store(ConnectionMode::WaitingForSync.to_u8(), std::sync::atomic::Ordering::Relaxed);
ready_count += 1;
} else if matches!(ConnectionMode::from_u8(user_desc.state.mode.load(std::sync::atomic::Ordering::Relaxed)), ConnectionMode::WaitingForSync) {

View File

@@ -372,9 +372,15 @@ impl PointTracker {
lost_lasts.insert(point_owner as u8);
}
// in case 2+ points are captured in the same tick
*owned_points.get_mut(&(new_team as u8)).unwrap() += 1;
if let Some(new_team_owned_points) = owned_points.get_mut(&(new_team as u8)) {
*new_team_owned_points += 1;
} else {
owned_points.insert(new_team as u8, 1);
}
if point_owner >= 0 {
*owned_points.get_mut(&(point_owner as u8)).unwrap() -= 1;
if let Some(old_owner_owned_points) = owned_points.get_mut(&(point_owner as u8)) {
*old_owner_owned_points -= 1;
}
}
generic.broadcast(
rlnl::event_code::NetworkEvent::CapturePointNotification,