beyond-all-reason / beyond-all-reason/RecoilEngine

Fix MoveDef waterline parse from int to float

Open Beginner friendly
#2,996 0 comments 0 reactions 0 assignees View on GitHub
area: Pathfinding
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

### Problem
MoveDef::MoveDef reads waterline from the movedef table with `GetInt`, even though the field and everything around it are float:
https://github.com/.../rts/Sim/MoveTypes/MoveDefHandler.cpp#L336
```
waterline = std::abs(moveDefTable.GetInt("waterline", defaultWaterline));
```

All consumers use it as a float. The movedef parse path is the only place that quantizes it to int, and it's inconsistent with the unitdef path feeding the same concept.

### Fix
switch to GetFloat and make defaultWaterline a float. This also lets the non-floating branch use std::numeric_limits::max() cleanly instead of casting int max to float.

### Note
A movedef with a fractional waterline is currently truncated... This is arguably a bug fix, but it's a behavior change for any content relying on the truncation?

Contributor guide

Open the contributing guide

Research direction

Start in rts/Sim/MoveTypes/MoveDefHandler.cpp around line 336, where MoveDef::MoveDef reads waterline from the movedef table, and compare this path with the unitdef path for the same concept. Verify the defaultWaterline type and parsing behavior for fractional values, then build or run the relevant engine checks to confirm the change compiles and preserves the float value.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.