<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://manicpop.org/gewiki/index.php?action=history&amp;feed=atom&amp;title=Classic_bug%3A_Wormhole_projectile_cleanup</id>
	<title>Classic bug: Wormhole projectile cleanup - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://manicpop.org/gewiki/index.php?action=history&amp;feed=atom&amp;title=Classic_bug%3A_Wormhole_projectile_cleanup"/>
	<link rel="alternate" type="text/html" href="https://manicpop.org/gewiki/index.php?title=Classic_bug:_Wormhole_projectile_cleanup&amp;action=history"/>
	<updated>2026-10-20T15:22:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://manicpop.org/gewiki/index.php?title=Classic_bug:_Wormhole_projectile_cleanup&amp;diff=1132&amp;oldid=prev</id>
		<title>CodexBot: Link glossary terms and clarify ship slot terminology</title>
		<link rel="alternate" type="text/html" href="https://manicpop.org/gewiki/index.php?title=Classic_bug:_Wormhole_projectile_cleanup&amp;diff=1132&amp;oldid=prev"/>
		<updated>2026-10-09T06:12:24Z</updated>

		<summary type="html">&lt;p&gt;Link glossary terms and clarify ship slot terminology&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Classic bug&lt;br /&gt;
|id=GE-BUG-010&lt;br /&gt;
|affected=Classic 3.2d/3.2e lineage and published source&lt;br /&gt;
|status=Verified in source and release history&lt;br /&gt;
|fixed=ge-next 0.2.4&lt;br /&gt;
|source=GEFUNCS.C proximity(), cleartm(), clearitm(), and checktm(); classic 3.2d release notes&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Galactic Empire 3.2d explicitly announced that torpedoes and missiles would no longer follow a player through a wormhole. The wormhole movement code was changed to call &amp;lt;code&amp;gt;cleartm()&amp;lt;/code&amp;gt;, but that function clears the traveler&amp;#039;s ownership of projectiles fired at other ships. It does not clear torpedoes and missiles incoming to the traveler.&lt;br /&gt;
&lt;br /&gt;
The intended 3.2d correction therefore did not work. The same mistake remains in the published classic 3.2e source.&lt;br /&gt;
&lt;br /&gt;
== Symptoms ==&lt;br /&gt;
Torpedoes and missiles already fired at a player continue counting down after that player enters a wormhole. They can produce tracking messages and eventually strike the ship even though it was instantaneously transported to a distant [[Sector|sector]].&lt;br /&gt;
&lt;br /&gt;
At the same time, projectiles previously fired by the wormhole traveler at other ships remain active but lose their owner. If one later hits, it is treated as having come from no user rather than from the player who fired it.&lt;br /&gt;
&lt;br /&gt;
This is the opposite of the announced behavior: incoming attacks follow the traveler, while the traveler&amp;#039;s unrelated outgoing attacks lose attribution.&lt;br /&gt;
&lt;br /&gt;
== Projectile representation ==&lt;br /&gt;
Classic does not keep a global projectile object containing both a source and a target. Incoming projectiles are stored directly in arrays belonging to the target ship:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;target-&amp;amp;gt;ltorps[i].distance&amp;lt;/code&amp;gt; records an incoming torpedo&amp;#039;s remaining distance.&lt;br /&gt;
* &amp;lt;code&amp;gt;target-&amp;amp;gt;ltorps[i].channel&amp;lt;/code&amp;gt; records the firing ship&amp;#039;s channel.&lt;br /&gt;
* &amp;lt;code&amp;gt;target-&amp;amp;gt;lmissl[i]&amp;lt;/code&amp;gt; stores the equivalent missile state, including missile energy.&lt;br /&gt;
&lt;br /&gt;
The periodic &amp;lt;code&amp;gt;checktm()&amp;lt;/code&amp;gt; routine operates on the target ship and reduces these stored distances until the projectile hits or is otherwise removed. Relocating the target does not recalculate the distance from the attacker. Unless the target&amp;#039;s array entries are cleared, their countdown simply continues in the new sector.&lt;br /&gt;
&lt;br /&gt;
== Cause ==&lt;br /&gt;
When a ship is pulled through a wormhole, classic changes its coordinates and then executes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cleartm(usrn);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the nearby comment saying that this clears the torpedoes and missiles, &amp;lt;code&amp;gt;cleartm()&amp;lt;/code&amp;gt; takes an attacker channel. It walks the incoming arrays of every active ship and changes any projectile whose &amp;lt;code&amp;gt;channel&amp;lt;/code&amp;gt; matches that attacker to 255. It does not set the projectile&amp;#039;s &amp;lt;code&amp;gt;distance&amp;lt;/code&amp;gt; to zero, so the projectile remains active but becomes ownerless.&lt;br /&gt;
&lt;br /&gt;
For example, suppose player A has fired a torpedo at player B and player C has fired a missile at player A. The records are arranged as follows:&lt;br /&gt;
&lt;br /&gt;
* B&amp;#039;s incoming torpedo array contains an active entry whose owner is A.&lt;br /&gt;
* A&amp;#039;s incoming missile array contains an active entry whose owner is C.&lt;br /&gt;
&lt;br /&gt;
If A enters a wormhole, &amp;lt;code&amp;gt;cleartm(A)&amp;lt;/code&amp;gt; finds the torpedo stored on B and changes its owner to 255. It never selects the missile stored on A because that missile&amp;#039;s owner is C. The missile therefore continues toward A after the relocation.&lt;br /&gt;
&lt;br /&gt;
The function is useful for a different event: when an attacker leaves the game or its ship is destroyed, active projectiles attributed to that channel must not later be credited to a different user who inherits the same channel. It was simply the wrong operation for moving a target through a wormhole.&lt;br /&gt;
&lt;br /&gt;
== Correction ==&lt;br /&gt;
ge-next 0.2.4 added the complementary &amp;lt;code&amp;gt;clearitm()&amp;lt;/code&amp;gt; routine. Given a target [[Ship slot|ship slot]], it examines that ship&amp;#039;s own incoming torpedo and missile arrays and sets every active projectile&amp;#039;s &amp;lt;code&amp;gt;distance&amp;lt;/code&amp;gt; to zero. The wormhole path calls &amp;lt;code&amp;gt;clearitm(usrn)&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;cleartm(usrn)&amp;lt;/code&amp;gt;, so incoming weapons are removed while the traveler&amp;#039;s outbound weapons retain their ownership and continue toward their existing targets.&lt;br /&gt;
&lt;br /&gt;
ge-next also notifies each applicable attacker that its torpedoes or missiles have been lost. Later refinements group those notices so an attacker does not receive one duplicate message for every projectile.&lt;br /&gt;
&lt;br /&gt;
The same release separately clears the traveler&amp;#039;s jamming effect during a wormhole transition and destroys incoming ordnance when a player reaches the protected neutral sector. Those are related transition rules, but they are not the correction to the 3.2d &amp;lt;code&amp;gt;cleartm()&amp;lt;/code&amp;gt; mistake itself.&lt;br /&gt;
&lt;br /&gt;
== Porting guidance ==&lt;br /&gt;
Name source-oriented and target-oriented cleanup operations distinctly. In classic&amp;#039;s data model, clearing an attacker means scanning every target and removing or anonymizing entries by &amp;lt;code&amp;gt;channel&amp;lt;/code&amp;gt;; clearing a target means zeroing active entries in that target&amp;#039;s own arrays. These operations are not interchangeable.&lt;br /&gt;
&lt;br /&gt;
Every instantaneous relocation should also define what happens to incoming ordnance, locks, jamming, area effects, and NPC pursuit state rather than changing coordinates independently of those decisions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Classic bugs: Combat]]&lt;br /&gt;
[[Category:Classic bugs: Navigation]]&lt;br /&gt;
&lt;br /&gt;
{{GE navigation}}&lt;/div&gt;</summary>
		<author><name>CodexBot</name></author>
	</entry>
</feed>