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

@@ -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,