Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reported bug around PHBE and illusionary dragons #182

Merged
merged 2 commits into from
May 2, 2024

Conversation

jt-traub
Copy link
Contributor

@jt-traub jt-traub commented May 2, 2024

Looking into this also revealed that liches suffered the same problem/bug, so they have been fixed as well. Additionally the
spell descriptions were incorrect in that they implied you could only summon one dragon or lich per turn illusorily, but the code would actually allow you to summon up to the (incorrect) limit. Allowing this to take a number mimics the other illusory spells, and the max a unit can hold of the illusory objects mimics the max they can hold of the real objects.

Note that the create phantasmal undead skill is disabled, so the lich bug never showed up in a live game but it's fixed now anyway.

Additional to this, while reviewing all the summon code, I discovered that the spell description for Bird Lore 3 was incorrectly using the .mOut value for skeletons rather than eagles. The actual execution code was using the correct .mOut value, so the correct fix was to make the spell description correct to match reality.

This does cause the snapshot turns to need to be updated since those reflected the wrong value in the spell description.

It also revealed that the most recent version of CLANG (the MacOS compiler) detected unused variables which were set and incremented but never actually read, so they were in fact dead code. The second commit in this PR cleans that up to fix the Mac compile.

  • Added unit tests validating fixed behavior.

jt-traub added 2 commits May 2, 2024 00:49
Looking into this also revealed that liches suffered the same
problem/bug, so they have been fixed as well.   Additionally the
spell descriptions were incorrect in that they implied you could only
summon one dragon or lich per turn illusorily, but the code would
actually allow you to summon up to the (incorrect) limit.  Allowing this
to take a number mimics the other illusory spells, and the max a unit
can hold of the illusory objects mimics the max they can hold of the
real objects.

Additional to this, while reviewing all the summon code, I discovered
that the spell description for Bird Lore 3 was incorrectly using the
.mOut value for skeletons rather than eagles.   The actual execution
code was using the correct .mOut value, so the correct fix was to make
the spell description correct to match reality.

This does cause the snapshot turns to need to be updated since those
reflected the wrong value in the spell description.
The MacOS (clang) compiler is stricter about static analysis than
some of the others.  It correctly detected that these variables were
set and incremented but never read, so errored about them being unused.

So, let's get rid of dead variables.
@@ -1062,17 +1062,13 @@ void ARegionList::SetFractalTerrain(ARegionArray *pArr)

void ARegionList::NameRegions(ARegionArray *pArr)
{
int seed = 0;
int grown = 0;
Copy link
Contributor Author

@jt-traub jt-traub May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the variables in this file being removed here are set and incremented but never actually used, so the MacOS X compiler (CLANG) complained about them since it's static analysis code is stronger than the standard GCC code.

@jt-traub jt-traub marked this pull request as ready for review May 2, 2024 08:15
@jt-traub jt-traub requested review from artyomtrityak and valdisz May 2, 2024 08:15
@valdisz valdisz merged commit 244f632 into master May 2, 2024
10 checks passed
@jt-traub jt-traub deleted the jt-phantbeasts-bug branch May 3, 2024 02:49
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.

3 participants