Repository navigation
Quake 2 follow-up for #586-#589 - #591
Merged
Merged
Conversation
Net (#589): restore Q2 CL_Disconnect semantics - the client always tells its server it left - and fix the stale loopback disconnect at the server's session boundary instead. Q2 never reads a dead server's queue (SV_Frame needs svs.initialized) and is protected by its handshake riding the same FIFO; our local client is admitted straight into slot 0, so SV_InitGame now discards the dead session's client->server loopback datagrams (NET_ClearLoopPackets). Drops the send_disconnect flag and the NA_LOOPBACK special case at the mission-exit call site, and a duplicated ss_dead branch in SV_ReadPackets. Movement (#588): decide unreachable-goal ownership once (point orders own a private waypoint like Q2 movetarget; entity goals are never moved), and make the gate test prove the attacker actually steers to the approach. Powerups (#587): one table-driven pickup decision (AB_POWERUP ability flag, cf. Q2 gitem_t.pickup) replaces two duplicated if-chains; powerups are always consumed instead of falling into a slot when nobody is affected; the speed cap follows the ability procedure, so custom AIsp-based runes are capped; reuse S_SpellApplyTimedTargetStatus. Ancients/bots (#586): uprooted Ancients retaliate with their uprooted mask (an air attacker no longer triggers a doomed melee counterattack); one S_AncientIsMorphing helper and one mask-taking attack predicate shared by orders and retaliation (cf. Q2 M_CheckAttack); bots iterate shop stock directly instead of re-parsing a shared static buffer. No network wire-format or save-format change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the four PRs landed today (#589, #588, #587, #586), applying Quake 2 review findings in one commit.
Net (#589): fix the stale loopback disconnect at the session boundary
main.conly callsSV_FramewhileSV_IsActive(), the same as Q2'sif (!svs.initialized) return. The client's farewelldisconnecttherefore survivesSV_Shutdown. Q2 is protected because the next client'sgetchallenge/connecthandshake rides the same FIFO, so the stale packet is consumed while every slot iscs_free. OurSV_ClientConnectadmits the local client straight into slot 0, so the stale packet hit a live slot.SV_InitGamediscards the dead session's client→server loopback datagrams through the newNET_ClearLoopPackets.CL_Disconnectsemantics and always tells its server. This removes thesend_disconnectflag and theNA_LOOPBACKspecial case at the mission-exit call site, so every shutdown path is covered, not just one.ss_deadbranch inSV_ReadPackets.Movement (#588)
movetarget; entity goals are never moved, as inM_MoveToGoal. Behaviour is equivalent, with one edict scan instead of up to three.Powerups (#587)
AB_POWERUPability flag, like Q2'sgitem_t.pickup, replaces two duplicated if-chains.S_SpellApplyTimedTargetStatus.Ancients and bots (#586)
S_AncientIsMorphinghelper and one mask-taking attack predicate are now shared by orders and retaliation (cf. Q2M_CheckAttack). Retaliation now also respectsG_BuildingIsUnsummoning.G_IsItemShoprewrites mid-parse. Behaviour change: bots can buy items added withAddItemToStock, as players can.Protocol / save impact
edict_tfields or callbacks added.Tests
Each regression test was confirmed to fail before its fix:
server_net.stale_loopback_disconnect_does_not_drop_next_local_session: exercises the realSV_Map→ stale disconnect →SV_Shutdown→SV_Map→SV_Framepath.net.loopback_clear_discards_only_the_named_receiver_queueclient_session.disconnect_always_tells_the_local_server_it_leftt_items: speed rune with no recipient is consumed; custom speed rawcode is capped; full inventory accepts only powerups.wc3_ancient_root.uprooted_protector_does_not_counterattack_with_rooted_weaponwc3_bot.hero_item_policy_buys_trigger_added_stockattacking_unreachable_gate_keeps_gate_at_authored_position.make test: 46,819/46,819 assertions in 2,345 tests.Possible split, in dependency order, if you'd rather review separately: (1) net, (2) movement, (3) powerups, (4) Ancients/bots. The four parts are independent.
🤖 Generated with Claude Code