Skip to content

Instantly share code, notes, and snippets.

@blast007
Last active January 17, 2016 15:00
Show Gist options
  • Save blast007/a4301d99aca932d3b5e4 to your computer and use it in GitHub Desktop.
Save blast007/a4301d99aca932d3b5e4 to your computer and use it in GitHub Desktop.
BZFlag-Dev/bzflag issue #33 possible fix
diff --git a/src/bzfs/bzfs.cxx b/src/bzfs/bzfs.cxx
index c86c1a4..5aecf73 100644
--- a/src/bzfs/bzfs.cxx
+++ b/src/bzfs/bzfs.cxx
@@ -3041,6 +3041,20 @@ void checkTeamScore(int playerIndex, int teamIndex)
buf = nboPackUByte(bufStart, playerIndex);
buf = nboPackUShort(buf, uint16_t(teamIndex));
broadcastMessage(MsgScoreOver, (char*)buf-(char*)bufStart, bufStart);
+
+ double spawnDelay = (double)BZDB.eval(StateDatabase::BZDB_EXPLODETIME);
+ for (int i = 0; i < curMaxPlayers; i++) {
+ GameKeeper::Player *p = GameKeeper::Player::getPlayerByIndex(i);
+ if (p != NULL && p->player.getTeam() != ObserverTeam) {
+ if (p->player.isAlive()) {
+ p->player.setDead();
+ p->player.setSpawnDelay(spawnDelay);
+ }
+ zapFlagByPlayer(i);
+ p->player.setRestartOnBase(true);
+ }
+ }
+
gameOver = true;
if (clOptions->oneGameOnly) {
done = true;
@@ -3208,6 +3222,20 @@ void playerKilled(int victimIndex, int killerIndex, int reason,
buf = nboPackUByte(bufStart, killerIndex);
buf = nboPackUShort(buf, uint16_t(NoTeam));
broadcastMessage(MsgScoreOver, (char*)buf-(char*)bufStart, bufStart);
+
+ double spawnDelay = (double)BZDB.eval(StateDatabase::BZDB_EXPLODETIME);
+ for (int i = 0; i < curMaxPlayers; i++) {
+ GameKeeper::Player *p = GameKeeper::Player::getPlayerByIndex(i);
+ if (p != NULL && p->player.getTeam() != ObserverTeam) {
+ if (p->player.isAlive()) {
+ p->player.setDead();
+ p->player.setSpawnDelay(spawnDelay);
+ }
+ zapFlagByPlayer(i);
+ p->player.setRestartOnBase(true);
+ }
+ }
+
gameOver = true;
if (clOptions->oneGameOnly) {
done = true;
@@ -6672,6 +6700,19 @@ int main(int argc, char **argv)
gameData.eventType = bz_eGameEndEvent;
gameData.duration = clOptions->timeLimit;
worldEventManager.callEvents(bz_eGameEndEvent,&gameData);
+
+ double spawnDelay = (double)BZDB.eval(StateDatabase::BZDB_EXPLODETIME);
+ for (int i = 0; i < curMaxPlayers; i++) {
+ GameKeeper::Player *p = GameKeeper::Player::getPlayerByIndex(i);
+ if (p != NULL && p->player.getTeam() != ObserverTeam) {
+ if (p->player.isAlive()) {
+ p->player.setDead();
+ p->player.setSpawnDelay(spawnDelay);
+ }
+ zapFlagByPlayer(i);
+ p->player.setRestartOnBase(true);
+ }
+ }
}
if (countdownActive && clOptions->countdownPaused && !countdownPauseStart)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment