Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions code/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2427,9 +2427,11 @@ void DisplayClass::Mouse_Left_Release(Coord const & coord, Cell const & cell, Ob
}
}

SuperWeaponTypeClass *stype = SuperWeaponTypeClass::From_Action(action);
if (stype != NULL) {
OutList.push_back(EventClass(PlayerPtr->HeapID, EventClass::SPECIAL_PLACE, stype->HeapID, cell));
if (IsTargettingMode != SUPER_NONE) {
SuperWeaponTypeClass *stype = SuperWeaponTypes[IsTargettingMode];
if (stype != NULL && stype->Action == action) {
OutList.push_back(EventClass(PlayerPtr->HeapID, EventClass::SPECIAL_PLACE, stype->HeapID, cell));
}
}
}

Expand Down
16 changes: 16 additions & 0 deletions manual/changes/fix-sw-shadowing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Keep superweapons that share an Action from replacing each other
category: fix
release: 0.2.0
targets:
- type: system
id: superweapons
effect: changed
credit: [Templarfreak]
---

Placing a superweapon on the map now fires the one that was actually armed, even when
another superweapon defines the same Action. Clicking a target cell previously resolved
back to whichever superweapon type first matched that Action, so two superweapons sharing
one Action value could not be fired independently: placing either one always discharged
the same type and left the other's charge untouched.
2 changes: 1 addition & 1 deletion manual/content/enums/cursor-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ values:

These are the actions the engine picks between as the cursor crosses the map — what the mouse shape offers and what a left click will then do. They are not the trigger actions a map fires from its tags, which are a separate list.

One rules setting takes a name from here: a SuperWeaponType's [`Action`](/keys/action/). While the map is in that weapon's targeting mode the name becomes the action under the cursor, which is what picks the mouse shape, and it is also the key the click is matched on afterward: a click whose action is neither `None` nor `Select` is compared against every superweapon's `Action` in turn, and the first weapon carrying that action has a firing order queued for the cell. Two weapons naming the same action therefore leave the later one unreachable, and a weapon left at `None` neither takes the cursor nor can be fired by a click at all — which is where an unrecognized name lands it, since the parser reads anything it does not know as `None`.
One rules setting takes a name from here: a SuperWeaponType's [`Action`](/keys/action/). While the map is in that weapon's targeting mode the name becomes the action under the cursor, which is what picks the mouse shape. A weapon left at `None` neither takes the cursor nor can be fired by a click at all — which is where an unrecognized name lands it, since the parser reads anything it does not know as `None`.

Seven entries carry historical `DontUse` tokens even though their engine constants still name older actions. Nothing assigns or tests those seven, so what survives of them is the spelling: they are distinct names a superweapon can claim, and nothing more.
4 changes: 0 additions & 4 deletions manual/content/keys/action--superweapontype.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ The values that carry a superweapon cursor are `Nuke`, `IonCannon`, `DropPod`, `
:::caution[An unrecognized value reads as `None`]
A misspelling is not rejected. It resolves to `None`, and the weapon then fires from the cameo click at cell 0,0 with no targeting step and no choice of where the effect lands.
:::

:::caution[The map click finds the weapon by this value alone]
Every left click that resolves to an action searches the declared superweapons for the first one carrying that `Action=`, whether or not targeting mode was armed. Two sections sharing a value therefore always fire the earlier of the two, and a value that ordinary orders also produce — an attack, a move — discharges a charged weapon on the next such order.
:::
2 changes: 0 additions & 2 deletions manual/content/systems/superweapons.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ Clicking a cameo that can be fired takes one of two paths, decided by [`Action=`

While targeting mode is armed, the cursor over the map reports the weapon's `Action=` in place of the ordinary one, and releasing the left button fires the weapon at the cell under the pointer. A right click on the cameo or on the map cancels targeting, and band selection is suppressed while it is armed. The minimap does not accept superweapon actions, so a shot cannot be aimed there.

Every left click that resolves to an action searches the declared list for the first section whose `Action=` matches, whether or not targeting mode was armed and without asking which weapon armed it. Two sections sharing one `Action=` therefore always fire the earlier of the two, and an `Action=` that ordinary orders also produce discharges a charged weapon on the next such order.

:::caution[A misspelled `Action=` becomes `None`]
An `Action=` value the engine does not recognize is not rejected; it reads as `None`. The weapon then takes the immediate-fire path: clicking the charged cameo discharges it on the spot at cell 0,0, with no targeting step and no opportunity to choose where the effect lands.
:::
Expand Down