Skip to content

Fix inverted command checks - #60

Merged
Bytekeeper merged 16 commits into
masterfrom
fix-inverted-command-checks
Oct 12, 2026
Merged

Bytekeeper merged 16 commits into
masterfrom
fix-inverted-command-checks

Conversation

@Bytekeeper

Copy link
Copy Markdown
Owner

No description provided.

Dennis Waldherr and others added 16 commits September 28, 2026 16:59
Both conditions were negated relative to BWAPI's Templates.h: every command
to a morphing egg was rejected as Incompatible_State, and cancelling a
building under construction was rejected as Incompatible_UnitType.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
has_power converted the tile size to pixels and then multiplied by 16, so the checked point lay
size x 512 pixels away and every building that needs power failed can_build_here. BWAPI uses
tile size x 16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
build_addon sent a Build command, can_research denied available tech and
completed buildings, and can_make rejected a builder carrying the required
addon, so no tech was researched and no tank was trained.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
The data tables skipped BWAPI's unused ids but were indexed by id, so
upgrades from Argus_Jewel on read another row or panicked (Chitinous
Plating read None's row), and TechType::None and Nuclear_Strike panicked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
Both targets sent the untargeted Use_Tech command, so Psionic Storm, Scanner
Sweep, the Archon merge and every other targeted spell failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
can_cloak refused unless the unit was already cloaked, the opposite of
BWAPI's check, so no unit could ever cloak.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
The Dark Archon Meld check rejected targets owned by the caster, the
opposite of BWAPI's check, so no Dark Archon could be made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
The research check applied only to Lurkers, the opposite of BWAPI's, so
unresearched spells passed the check and the game ignored the command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
can_use_tech_unit skipped the tech's own checks (research, energy), so an
unresearched Mind Control passed and the game ignored it; the Burrowing
check rejected the units that can burrow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rQK8yo5j7dzMXzqMnUuGm
…ed building

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
unload_all(Some(pos)) sent Unload_All instead of Unload_All_Position.
can_cancel_research and can_cancel_addon were inverted, CanBuild and
CanUnloadAllPosition rejected a unit exactly when the command type was legal,
and can_morph rejected an idle Hatchery, Lair or Hive without larva, so Lair
and Hive could not be started then. All compared with BWAPI's Templates.h;
tests run the checks on a synthetic game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
can_build_here tested the blocking unit's own type for being an addon, so any
SCV walking over a Command Center's addon spot refused the Comsat Station.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Maps the shared memory via shm_open/mmap and talks to the server over its
Unix socket. RSBWAPI_SERVER_PID connects to that server directly, without
going through the game table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bytekeeper
Bytekeeper merged commit 7624fe3 into master Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant