| 1313 | #include "serverchecks.h" |
| 1314 | |
| 1315 | bool flagdistance(sflaginfo &f, int cn) |
| 1316 | { |
| 1317 | if(!valid_client(cn) || m_demo) return false; |
| 1318 | client &c = *clients[cn]; |
| 1319 | vec v(-1, -1, c.state.o.z); |
| 1320 | switch(f.state) |
| 1321 | { |
| 1322 | case CTFF_INBASE: |
| 1323 | v.x = f.x; v.y = f.y; |
| 1324 | break; |
| 1325 | case CTFF_DROPPED: |
| 1326 | v.x = f.pos[0]; v.y = f.pos[1]; |
| 1327 | break; |
| 1328 | } |
| 1329 | bool lagging = (c.ping > 1000 || c.spj > 100); |
| 1330 | if(v.x < 0 && !lagging) return true; |
| 1331 | float dist = c.state.o.dist(v); |
| 1332 | int pdist = check_pdist(&c,dist); |
| 1333 | if(pdist) |
| 1334 | { |
| 1335 | c.farpickups++; |
| 1336 | mlog(ACLOG_INFO, "[%s] %s %s the %s flag at distance %.2f (%d)", |
| 1337 | c.hostname, c.name, (pdist==2?"tried to touch":"touched"), team_string(&f == sg->sflaginfos + 1), dist, c.farpickups); |
| 1338 | if (pdist==2) return false; |
| 1339 | } |
| 1340 | return lagging ? false : true; // today I found a lag hacker :: Brahma, 19-oct-2010... lets test it a bit |
| 1341 | } |
| 1342 | |
| 1343 | void sendflaginfo(int flag = -1, int cn = -1) |
| 1344 | { |
no test coverage detected