| 1630 | void checkitemspawns(int); |
| 1631 | |
| 1632 | void arenacheck() |
| 1633 | { |
| 1634 | if(!m_arena || sg->interm || sg->gamemillis < sg->arenaround || !numactiveclients()) return; |
| 1635 | |
| 1636 | if(sg->arenaround) |
| 1637 | { // start new arena round |
| 1638 | sg->arenaround = 0; |
| 1639 | sg->arenaroundstartmillis = sg->gamemillis; |
| 1640 | distributespawns(); |
| 1641 | checkitemspawns(60*1000); // the server will respawn all items now |
| 1642 | loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->isauthed) |
| 1643 | { |
| 1644 | if(clients[i]->isonrightmap && team_isactive(clients[i]->team)) |
| 1645 | sendspawn(clients[i]); |
| 1646 | } |
| 1647 | return; |
| 1648 | } |
| 1649 | |
| 1650 | #ifndef STANDALONE |
| 1651 | if(m_botmode && clients[0]->type==ST_LOCAL) |
| 1652 | { |
| 1653 | int enemies = 0, alive_enemies = 0; |
| 1654 | playerent *alive = NULL; |
| 1655 | loopv(players) if(players[i] && (!m_teammode || players[i]->team == team_opposite(player1->team))) |
| 1656 | { |
| 1657 | enemies++; |
| 1658 | if(players[i]->state == CS_ALIVE) |
| 1659 | { |
| 1660 | alive = players[i]; |
| 1661 | alive_enemies++; |
| 1662 | } |
| 1663 | } |
| 1664 | if(player1->state != CS_DEAD) alive = player1; |
| 1665 | if(enemies && (!alive_enemies || player1->state == CS_DEAD)) |
| 1666 | { |
| 1667 | sendf(-1, 1, "ri2", SV_ARENAWIN, m_teammode ? (alive ? alive->clientnum : -1) : (alive && alive->type == ENT_BOT ? -2 : player1->state == CS_ALIVE ? player1->clientnum : -1)); |
| 1668 | sg->arenaround = sg->gamemillis + 5000; |
| 1669 | } |
| 1670 | return; |
| 1671 | } |
| 1672 | #endif |
| 1673 | client *alive = NULL; |
| 1674 | bool dead = false; |
| 1675 | int lastdeath = 0; |
| 1676 | loopv(clients) |
| 1677 | { |
| 1678 | client &c = *clients[i]; |
| 1679 | if(c.type==ST_EMPTY || !c.isauthed || !c.isonrightmap || team_isspect(c.team)) continue; |
| 1680 | if(c.state.state==CS_ALIVE || ((c.state.state==CS_DEAD || c.state.state==CS_SPECTATE) && c.state.lastspawn>=0)) |
| 1681 | { |
| 1682 | if(!alive) alive = &c; |
| 1683 | else if(!m_teammode || alive->team != c.team) return; |
| 1684 | } |
| 1685 | else if(c.state.state==CS_DEAD || c.state.state==CS_SPECTATE) |
| 1686 | { |
| 1687 | dead = true; |
| 1688 | lastdeath = max(lastdeath, c.state.lastdeath); |
| 1689 | } |
no test coverage detected