ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.74k stars 377 forks source link

Standartize code to update POL objects #9241

Closed ihhub closed 4 weeks ago

ihhub commented 1 month ago

The previous implementation was based on hardcoded values and differs from our set of object part information. Having a single source of truth is easier to handle the code.

As a bonus point this PR speeds up whirlpool initialization at map or save file loading.

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
1 New Critical Issues (required ≤ 0)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

ihhub commented 4 weeks ago

Hi @Districh-ru , thanks for spotting this issue! I will fix it in a separate PR.

ihhub commented 4 weeks ago

Hi @Districh-ru , did you refer to maps made in the original editor? I am not able to reproduce it within our Editor.

Districh-ru commented 4 weeks ago

Hi, @ihhub, I used the original Editor. And, I tested, this but is not reproducible in our Editor.

The next map is made in original editor and causes assertion fail: 221.zip

Added: MP2::getActionObjectDirection(OBJ_EXPANSION_OBJECT) is called when removing MP2::OBJ_ICN_TYPE_MINIHERO from the map. It is called from updatePassability() after removing the editor's hero object before placing a new real hero there.

ihhub commented 3 weeks ago

Hi @Districh-ru , I don't receive any assertions for this situation.

Districh-ru commented 3 weeks ago

Hi, @ihhub, you are right! Now in master branch all works OK. One of the last PRs fixes this issue. 👍