Overview
Comment: | Use enumerateObjectsUsingBlock: where appropriate |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fd4460c7b65410b1f78e2f0df253cb5d |
User & Date: | js on 2025-03-20 11:03:23 |
Other Links: | manifest | tags |
Context
2025-03-20
| ||
13:21 | Make more use of convenience methods check-in: 89fbd7a152 user: js tags: trunk | |
11:03 | Use enumerateObjectsUsingBlock: where appropriate check-in: fd4460c7b6 user: js tags: trunk | |
10:52 | Fix projectiles check-in: be136b699f user: js tags: trunk | |
Changes
Modified src/clientextras.mm from [364ff9cb88] to [d40925e827].
︙ | ︙ | |||
76 77 78 79 80 81 82 | } extern int democlientnum; void renderclients() { | | < < | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | } extern int democlientnum; void renderclients() { [players enumerateObjectsUsingBlock:^(id player, size_t i, bool *stop) { if (player != [OFNull null] && (!demoplayback || i != democlientnum)) renderclient(player, isteam(player1.team, [player team]), @"monster/ogro", false, 1.0f); }]; } // creation of scoreboard pseudo-menu bool scoreson = false; void |
︙ | ︙ |
Modified src/clientgame.mm from [ec0093549c] to [75ba298a0a].
︙ | ︙ | |||
194 195 196 197 198 199 200 | } extern int democlientnum; void otherplayers() { | | | > | | | | < | | > | | | | | < < | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | } extern int democlientnum; void otherplayers() { [players enumerateObjectsUsingBlock:^(id player, size_t i, bool *stop) { if (player == [OFNull null]) return; const int lagtime = lastmillis - [player lastupdate]; if (lagtime > 1000 && [player state] == CS_ALIVE) { [player setState:CS_LAGGED]; return; } if (lagtime && [player state] != CS_DEAD && (!demoplayback || i != democlientnum)) // use physics to extrapolate player position moveplayer(player, 2, false); }]; } void respawn() { if (player1.state == CS_DEAD) { player1.attacking = false; |
︙ | ︙ |
Modified src/server.mm from [bc477ab2a8] to [f99720b385].
︙ | ︙ | |||
425 426 427 428 429 430 431 | lastsec = seconds; if ((mode > 1 || (mode == 0 && nonlocalclients)) && seconds > mapend - minremain * 60) checkintermission(); if (interm && seconds > interm) { interm = 0; | | | > | < < | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | lastsec = seconds; if ((mode > 1 || (mode == 0 && nonlocalclients)) && seconds > mapend - minremain * 60) checkintermission(); if (interm && seconds > interm) { interm = 0; [clients enumerateObjectsUsingBlock:^( Client *client, size_t i, bool *stop) { if (client.type != ST_EMPTY) { // ask a client to trigger map reload send2(true, i, SV_MAPRELOAD, 0); mapreload = true; *stop = true; return; } }]; } resetserverifempty(); if (!isdedicated) return; // below is network only |
︙ | ︙ |
Modified src/serverbrowser.mm from [bb466005e7] to [7409dbfc1c].
︙ | ︙ | |||
270 271 272 273 274 275 276 | refreshservers() { checkresolver(); checkpings(); if (lastmillis - lastinfo >= 5000) pingservers(); [servers sort]; | < | > | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | refreshservers() { checkresolver(); checkpings(); if (lastmillis - lastinfo >= 5000) pingservers(); [servers sort]; __block int maxmenu = 16; [servers enumerateObjectsUsingBlock:^( ServerInfo *si, size_t i, bool *stop) { if (si.address.host != ENET_HOST_ANY && si.ping != 9999) { if (si.protocol != PROTOCOL_VERSION) si.full = [[OFString alloc] initWithFormat: @"%@ [different cube protocol]", si.name]; else |
︙ | ︙ | |||
302 303 304 305 306 307 308 | if (si.full.length > 50) si.full = [si.full substringToIndex:50]; menumanual(1, i, si.full); if (!--maxmenu) return; | < < | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | if (si.full.length > 50) si.full = [si.full substringToIndex:50]; menumanual(1, i, si.full); if (!--maxmenu) return; }]; } void servermenu() { if (pingsock == ENET_SOCKET_NULL) { pingsock = enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM, NULL); |
︙ | ︙ |
Modified src/weapon.mm from [c14fa40d91] to [5796e07781].
︙ | ︙ | |||
341 342 343 344 345 346 347 | particle_trail(1, 500, from, to); break; } } void hitpush(int target, int damage, DynamicEntity *d, DynamicEntity *at, | | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | particle_trail(1, 500, from, to); break; } } void hitpush(int target, int damage, DynamicEntity *d, DynamicEntity *at, const OFVector3D &from, const OFVector3D &to) { hit(target, damage, d, at); vdist(dist, v, from, to); vmul(v, damage / dist / 50); vadd(d.vel, v); } void raydamage( DynamicEntity *o, const OFVector3D &from, const OFVector3D &to, DynamicEntity *d, int i) { if (o.state != CS_ALIVE) return; int qdam = guns[d.gunselect].damage; if (d.quadmillis) qdam *= 4; if (d.monsterstate) |
︙ | ︙ | |||
420 421 422 423 424 425 426 | (int)(from.y * DMF), (int)(from.z * DMF), (int)(to.x * DMF), (int)(to.y * DMF), (int)(to.z * DMF)); d.gunwait = guns[d.gunselect].attackdelay; if (guns[d.gunselect].projspeed) return; | | < < | | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | (int)(from.y * DMF), (int)(from.z * DMF), (int)(to.x * DMF), (int)(to.y * DMF), (int)(to.z * DMF)); d.gunwait = guns[d.gunselect].attackdelay; if (guns[d.gunselect].projspeed) return; [players enumerateObjectsUsingBlock:^(id player, size_t i, bool *stop) { if (player != [OFNull null]) raydamage(player, from, to, d, i); }]; for (DynamicEntity *monster in getmonsters()) if (monster != d) raydamage(monster, from, to, d, -2); if (d.monsterstate) raydamage(player1, from, to, d, -1); } |