| 434 | } |
| 435 | |
| 436 | inline bool oneTeam(bz_eTeamType leavingPlayerTeam) { |
| 437 | int RT = bz_getTeamCount(eRedTeam); |
| 438 | int GT = bz_getTeamCount(eGreenTeam); |
| 439 | int BT = bz_getTeamCount(eBlueTeam); |
| 440 | int PT = bz_getTeamCount(ePurpleTeam); |
| 441 | int RGT = bz_getTeamCount(eRogueTeam); |
| 442 | |
| 443 | if (leavingPlayerTeam == eRedTeam) { |
| 444 | RT--; |
| 445 | } |
| 446 | if (leavingPlayerTeam == eGreenTeam) { |
| 447 | GT--; |
| 448 | } |
| 449 | if (leavingPlayerTeam == eBlueTeam) { |
| 450 | BT--; |
| 451 | } |
| 452 | if (leavingPlayerTeam == ePurpleTeam) { |
| 453 | PT--; |
| 454 | } |
| 455 | if (leavingPlayerTeam == eRogueTeam) { |
| 456 | RGT--; |
| 457 | } |
| 458 | |
| 459 | int Test1 = (RT * GT) + (RT * BT) + (RT * PT) + (GT * BT) + (GT * PT) + (BT * PT); |
| 460 | int Test2 = RT + GT + BT + PT + RGT; |
| 461 | |
| 462 | if (Test1 < 1 && Test2 < 2) { |
| 463 | if (!keepaway.oneTeamWarn) { |
| 464 | bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Keep Away disabled: less than 2 teams."); |
| 465 | } |
| 466 | |
| 467 | keepaway.oneTeamWarn = true; |
| 468 | return true; |
| 469 | } |
| 470 | else { |
| 471 | if (keepaway.oneTeamWarn) { |
| 472 | bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Keep Away enabled: more than 1 team."); |
| 473 | } |
| 474 | |
| 475 | keepaway.oneTeamWarn = false; |
| 476 | return false; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | void autoTime() { |
| 481 | int numPlayers = |
no test coverage detected