| 1551 | } |
| 1552 | |
| 1553 | void htf_forceflag(int flag) |
| 1554 | { |
| 1555 | sflaginfo &f = sg->sflaginfos[flag]; |
| 1556 | int besthealth = 0; |
| 1557 | vector<int> clientnumbers; |
| 1558 | loopv(clients) if(clients[i]->type!=ST_EMPTY) |
| 1559 | { |
| 1560 | if(clients[i]->state.state == CS_ALIVE && team_base(clients[i]->team) == flag) |
| 1561 | { |
| 1562 | if(clients[i]->state.health == besthealth) |
| 1563 | clientnumbers.add(i); |
| 1564 | else |
| 1565 | { |
| 1566 | if(clients[i]->state.health > besthealth) |
| 1567 | { |
| 1568 | besthealth = clients[i]->state.health; |
| 1569 | clientnumbers.shrink(0); |
| 1570 | clientnumbers.add(i); |
| 1571 | } |
| 1572 | } |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | if(clientnumbers.length()) |
| 1577 | { |
| 1578 | int pick = rnd(clientnumbers.length()); |
| 1579 | client *cl = clients[clientnumbers[pick]]; |
| 1580 | f.state = CTFF_STOLEN; |
| 1581 | f.actor_cn = cl->clientnum; |
| 1582 | sendflaginfo(flag); |
| 1583 | flagmessage(flag, FM_PICKUP, cl->clientnum); |
| 1584 | mlog(ACLOG_INFO,"[%s] %s got forced to pickup the flag", cl->hostname, cl->name); |
| 1585 | } |
| 1586 | f.lastupdate = sg->gamemillis; |
| 1587 | } |
| 1588 | |
| 1589 | int cmpscore(const int *a, const int *b) { return clients[*a]->at3_score - clients[*b]->at3_score; } |
| 1590 |
no test coverage detected