Knighttime
Prince
- Joined
- Sep 20, 2002
- Messages
- 380
@Prof. Garfield Thanks very much, I have it now.
When you have a moment, can you please take a look at the applyWonderBonus()function in generalLibrary.lua? I think there's a bug in the "check if expired" section. Specifically, on every iteration of that loop, tribe:hasTech(wonder.expires) is repeatedly referencing the tribe that was passed in as a parameter. I think you meant to write civ.getTribe(i):hasTech(wonder.expires) or alternatively, civ.hasTech(civ.getTribe(i), wonder.expires).
I also noticed that your loop starts with 0 (barbarians). In my testing, I'm seeing inconsistent behavior on that front. If you give a wonder-expiring tech that has never been researched to the barbarians, the in-game popup appears announcing that this cancels the effect of the wonder. But it doesn't actually do so! It looks to me like the wonder continues to function until a non-barbarian tribe acquires the tech. So I'd propose that this loop should really start with 1 instead of 0.
Finally, this function seems to be very unusual in that it's a local function only, which is not assigned into the gen table. Is there a reason for this? I'm working on the Lua code for the combat logic, and trying to incorporate existing General Library functions rather than duplicate them as helper functions in the combat logic file. applyWonderBonus() has the logic I need (or it will with the changes mentioned above) but isn't actually accessible.
Lest you think I'm being too critical of your work, I should mention that in figuring all this out, I realized that my own Medieval Millennium code to handle this concept also has a bug (but a different one).
My issue is that I tried to shortcut checking civ.hasTech() for every active tribe by simply checking tech.researched or more precisely wonder.expires.researched. Unfortunately this isn't perfectly equivalent. This field is set to true as soon as any tribe (barbarians or not) acquires that tech, either by research or event. Furthermore, if an event takes away the tech from every tribe, tech.researched remains true -- it doesn't get reset back to false. So for both of these reasons, it isn't equivalent to whether or not any non-barbarian active tribe currently possesses the tech, which is apparently the rule when it comes to wonder expiration. (It works just fine to reactivate a wonder by taking away the wonder-expiring tech from all tribes, despite tech.researched remaining true.)
When you have a moment, can you please take a look at the applyWonderBonus()function in generalLibrary.lua? I think there's a bug in the "check if expired" section. Specifically, on every iteration of that loop, tribe:hasTech(wonder.expires) is repeatedly referencing the tribe that was passed in as a parameter. I think you meant to write civ.getTribe(i):hasTech(wonder.expires) or alternatively, civ.hasTech(civ.getTribe(i), wonder.expires).
I also noticed that your loop starts with 0 (barbarians). In my testing, I'm seeing inconsistent behavior on that front. If you give a wonder-expiring tech that has never been researched to the barbarians, the in-game popup appears announcing that this cancels the effect of the wonder. But it doesn't actually do so! It looks to me like the wonder continues to function until a non-barbarian tribe acquires the tech. So I'd propose that this loop should really start with 1 instead of 0.
Finally, this function seems to be very unusual in that it's a local function only, which is not assigned into the gen table. Is there a reason for this? I'm working on the Lua code for the combat logic, and trying to incorporate existing General Library functions rather than duplicate them as helper functions in the combat logic file. applyWonderBonus() has the logic I need (or it will with the changes mentioned above) but isn't actually accessible.
Lest you think I'm being too critical of your work, I should mention that in figuring all this out, I realized that my own Medieval Millennium code to handle this concept also has a bug (but a different one).
