Skip to content

Recalculate team scores in FFA when a player leaves - #384

Open
TheGiraffe3 wants to merge 1 commit into
BZFlag-Dev:2.4from
TheGiraffe3:recalculate-ffa-scores-on-leave
Open

Recalculate team scores in FFA when a player leaves#384
TheGiraffe3 wants to merge 1 commit into
BZFlag-Dev:2.4from
TheGiraffe3:recalculate-ffa-scores-on-leave

Conversation

@TheGiraffe3

Copy link
Copy Markdown
Contributor

On maps like Badgerking where there are a lot of deaths, you can sometimes end up with a team score of -50 while the only player on that team has a score of -2. This pull request fixes that by recalculating team scores whenever a player leaves.

@Zehra

Zehra commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

I'd probably just add a check to see if it's not an observer. Edit: On second thought, probably way better to check if they're red, green, purple or blue.

Plugin API event example below:

    bz_PlayerJoinPartEventData_V1* partData = (bz_PlayerJoinPartEventData_V1*)eventData;
    if ((bz_getGameType() == eFFAGame) && (partData->record->team != eObservers)) {
      bz_setTeamWins(partData->record->team, bz_getTeamWins(partData->record->team) - (partData->record->wins));
      bz_setTeamLosses(partData->record->team, bz_getTeamLosses(partData->record->team) - (partData->record->losses));
    }

Team switching might need to be figured out in the long run.

@TheGiraffe3

Copy link
Copy Markdown
Contributor Author

What do you mean by "team switching might need to be figured out"?

@Zehra

Zehra commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What do you mean by "team switching might need to be figured out"?

I haven't checked into it, but for the next major release (2.6), there's a feature of team switching. It probably doesn't trigger a part/leave event, which means team scores might be impacted there.

@TheGiraffe3
TheGiraffe3 force-pushed the recalculate-ffa-scores-on-leave branch from 850124d to a5abf3c Compare June 3, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants