[pull] master from beyond-all-reason:master - #99
Merged
Conversation
On Linux hosts, the game statistics stored in the replay/demo files were incorrectly written using big-endian instead of little-endian. This is due to the "__BYTE_ORDER" and "__BIG_ENDIAN" macros not being defined on Linux under some circumstances. This commit fixes this problem by including the required header <endian.h> just before the macros are used to detect host endianness.
* TraceRay: block rays that start below the terrain CGround::LineGroundCol returns a hit distance of 0 when the ray origin is underground, but TraceRay only accepted ground hits with a distance > 0 and CWeapon::HaveFreeLineOfFire applied the same filter to the result. A ray from an underground origin was therefore reported as unobstructed, so a weapon whose muzzle (or aim-from piece) sat inside a cliff passed the line-of-fire test, stopped, and could never fire (#3242), and Spring.GetUnitWeaponHaveFreeLineOfFire told game code the same (#3301). Accept 0 as a hit in both places: the ray is blocked at its origin. CCannon::HaveFreeLineOfFire had the same pattern with TrajectoryGroundCol, which also reports 0 for an origin below the terrain, but tests against GetApproximateHeight; on rough ground that can lie above a muzzle that is clear of the interpolated surface. Reject an origin below GetHeightReal explicitly instead, the test the fire-time check already applies to the muzzle, and keep ignoring the coarse 0 from the trajectory scan. The underground test of LineGroundCol itself compared the origin against the corner vertex of its heightmap square. Next to a steep cliff that vertex can be far above an origin that is well clear of the ground, which skipped the whole ground trace. Compare against the interpolated surface instead, and treat an origin exactly on the surface as above ground; LineGroundSquareCol still reports a hit at distance 0 when such a ray points into the ground. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Weapons: consistently reject underground line-of-fire sources Reject sources below real terrain height at the start of both the base weapon and cannon line-of-fire checks when ground avoidance is enabled. This matches the existing pre-fire muzzle rejection, including when the target is within explosion range, and covers the early-return cases. Preserve the base weapon AoE exception for surface sources and later ground hits, including zero-distance hits directed into terrain. Validation: Podman engine-headless build and git diff --check passed. In-game validation remains pending. AI assistance: OpenAI Codex prepared the changes and ran the build. * Weapons: explain differing zero-distance ground checks Document why the accurate ray trace accepts zero-distance ground hits while the approximate cannon trajectory scan ignores them. No behavior changes. Validation: git diff --check passed; reviewed comment-only diff. AI assistance: OpenAI Codex wrote the comments and checked the diff. * Weapons: clarify line-of-fire terrain comments --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Fix cleanup after early game load failures * Clear game pointer after constructor failure
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )