Counter for 50% of the land in territorial lord doesn't reset
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I played a game with win condition territorial lord with another player.
* I had 50% of the map, so I got the message I needed to hold it for 20 min in order to win.
* After a while I got another message saying I needed to hold it for 15 more min.
* At this point the other player managed to conquer some of my land, and I must have dropped down below 50% again.
* After a pretty tight battle over the border I was finally able to push the other player back again and start reclaiming some of my lost land.
* Even though I reconquered what I had lost and into previously enemy territory I did not receive any additional messages, and while we agreed I had won, the game did not seem to be aware of this.
It seems the counter did not reset when I dropped below 50% again. So if a player loses the majority of the map, even if that player is able to regain it the game will not notice it. The win condition should be able to handle that players in the lead are knocked down, but may make a comeback later.
Widelands build 16 (though I don't think this has been changed since release)
Hello Widelands!
While playing against the AI I experienced this as well. Now I took a look at it, and apparently the player number isn't properly reset when you drop below 50%, leaving you with a bogus remaining_time when you exceed the threshold again. I think you can solve this by letting one of your enemies get over half the land, then reclaim and hold 50% yourself. Or you can apply the attached patch, but note that I haven't tested either one.
I have to say that I find the code a bit untidy, but that may be because I'm new to Lua. For example, most calculations are done once for individual players, and once for teams - not quite concise. But that's more a matter of style.
As a matter of function, I'd like to mention that:
*The code assumes a constant land mass. Don't know if that could be a problem outside of the Atlantean campaign.
*In a corner case, it's -probably- possible to fall below the 50% threshold and exceed it again in one sample period. Gotta be fast though.
*Like in Autocrat, if you've (almost) won, the game can take some time before it sends you that message.
These problems could be solved by using hooks. Would that be worth it?
Last question: is the amount of conquered land indicated in the graph the same as that calculated in this script? If not this may lead to frustrated player strategies...