Page MenuHomeWildfire Games

Fetch teambonus auras from player_{civ}.xml files
ClosedPublic

Authored by s0600204 on Apr 16 2021, 10:46 PM.

Details

Summary

Instead of expecting them all to be in a specific location, loading them all, and checking against a civ key.

Suggested by @Nescio in rP24492

It seems a little overkill to load the files just to extract one bit of information, but this is a better way of finding them:

  • It's where game sessions appear to get the information from,
  • It allows modders to place teambonus auras outside the simulation/data/auras/teambonuses/ directory (so long as the player_{civ}.xml file is correct)

Note: There's no check to make sure that the auras listed in the player_{civ}.xml files are actually Team Bonuses, but this could be added if desired.


The civ key (in the team bonus aura templates) was added in rP24492 for the purpose of identifying which team bonus belongs to which civ. AFAIK it isn't being used by anything else, so for simplicities sake I'm removing it. (#2580 shouldn't be a concern here...)

Test Plan
  • Apply patch;
  • Make sure that Team Bonus auras continue to be listed in the Civ Info page (nothing else is listed under the "Team Bonus" header at the moment);
  • Make sure there's no errors thrown if the name of the aura file doesn't match the name given in a player_{civ}.xml file;
  • Make sure there's no errors when viewing a civ that doesn't have a specific player_{civ}.xml file (e.g. a civ from a mod);
  • Think of any edge cases I may have missed.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

s0600204 created this revision.Apr 16 2021, 10:46 PM
Owners added a subscriber: Restricted Owners Package.Apr 16 2021, 10:46 PM
s0600204 published this revision for review.Apr 17 2021, 12:59 PM
  • Works correctly when removing a civ-template.
  • Works correctly when adding an aura to the generic "player"-template.

Edge case:
If you load up the civ overview (starting at athens) then move to Britons and add e.g. the Briton bonus to Athens and Carths, the bonus does show up when moving to Carth (was not present in the cache yet) but doesn't show for Athens (uses the cached data).

Apart from that, this works and I've not seen any (obvious) flaws in the code.

Edge case:
If you load up the civ overview (starting at athens) then move to Britons and add e.g. the Briton bonus to Athens and Carths, the bonus does show up when moving to Carth (was not present in the cache yet) but doesn't show for Athens (uses the cached data).

You mean it's not hot-loading the player_{civ}.xml files? That's expected - simulation data files are not hot-loaded by the engine.

No, I mean that when you change civs the cached data is used although it may be outdated, e.g. if the file was changed. But I wouldn't call that blocking, just an edge case worth noting :)

Yeah... the JS environment has no way to tell if a file has been modified since it was last requested from the VFS. And considering that the VFS has its own caches - and hot-loading of simulation data files is not implemented - even when bypassing the JS-side cache the old file would still be loaded from the C++-side cache.

And considering that the VFS has its own caches

Ah, thanks, I did not know that :)

This revision was not accepted when it landed; it landed in state Needs Review.Jun 5 2021, 6:25 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.