dkfans / keeperfx

Open source remake and Fan Expansion of Dungeon Keeper.
https://keeperfx.net/
GNU General Public License v2.0
764 stars 76 forks source link

Map specific magic.cfg does not load in spell names #3388

Open Loobinex opened 2 months ago

Loobinex commented 2 months ago

Have a map00###.magic.cfg file with this:

[spell3]
Name = SPELL_HEAL2
CastAtThing = 0
ShotModel = NOSHOT
SpellPower = POWER_HEAL_CREATURE2
Duration = 50
AuraEffect = -45
SelfCasted = 1 37
SymbolSprites = 356 414

[power3]
Name = POWER_HEAL_CREATURE2
NameTextID = 644
TooltipTextID = 661
SymbolSprites = 87 110
PointerSprites = 104
PanelTabIndex = 10
SoundSamples = 829
SoundPlayed = 37
Power = 800 1200 1600 2100 2800 3600 4800 6800 9500
Cost = 30 40 50 60 70 80 90 100 120
Duration = 16
Castability = ALL_GROUND OWNED_CRTRS ALLIED_CRTRS BOUND_CRTRS CUSTODY_CRTRS
Artifact = SPELLBOOK_HEAL
Properties = 
PlayerState = PLAYER_STATE_HEAL
ParentPower = NOPOWER
CastExpandFunc = general_expand
Spell = SPELL_HEAL
UseFunction = magic_use_power_heal

So a new power and a new spell. It will not work and you will get a log error like this: Warning: parse_magic_spell_blocks(line 9): Couldn't read "SPELLPOWER" parameter in [spell3] block of level magic config file.

This because when the spell is loaded in first, the power name is not recognized yet.

I suspect this is because map specific config files are done with the CnfLd_AcceptPartial flag, and not preceded with this flag:

    CnfLd_ListOnly      =  0x01, /**< Load only list of items and their names, don't parse actual options (when applicable). */
PieterVdc commented 1 month ago

reading this I think it's it does do the list only for all 3 but the list only overwrites the original name, then when it gets to the actual load, it can't find the original name, as it's been overridden by the new one already

since it would be replaced anyways I assume functionally all is fine? it just can't properly load something that'll be replaced anyways

Loobinex commented 1 month ago

reading this I think it's it does do the list only for all 3 but the list only overwrites the original name, then when it gets to the actual load, it can't find the original name, as it's been overridden by the new one already

since it would be replaced anyways I assume functionally all is fine? it just can't properly load something that'll be replaced anyways

no, it actually fails to function.

Loobinex commented 1 week ago

Problem seems limited only to cases where power/spell names are being overwritten.