what happens when...

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

what happens when...

Post by Dino the Dinosore »

In some rulesets, like mp2-caravel, the Legion unit has the "Settlers" flag and can irrigate and build roads. So what happens when it starts irrigating and then gets auto-upgraded to a Musketeer by Leonardo's Workshop? The answer is - it depends. If you save the game, and then re-load the saved game the tile is not irrigated and the Musketeer is waiting to move. Otherwise it continues working until the tile is irrigated. Now you know.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: what happens when...

Post by cazfi »

So legality of the actions is not checked after an upgrade? Doesn't this leave to sanity check errors on following turns?

Sanity of save games is checked when they are loaded, so that explains why you don't see the issue after that.

Please open a ticket. I've already got some other fixes related to cancelling illegal activities in the pipeline, so likely handling this would fit nicely to the rewrite of that area.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: what happens when...

Post by Dino the Dinosore »

Yes there's an inconsistency here but I'm not convinced what is the correct behaviour. I can see the argument that it's OK to let the tile improvement continue til completed.

I didn't notice sanity check errors on following turns but I also wasn't looking for them.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: what happens when...

Post by Ignatus »

Dino the Dinosore wrote:Yes there's an inconsistency here but I'm not convinced what is the correct behaviour. I can see the argument that it's OK to let the tile improvement continue til completed.
Like, if it digs when it can't dig any more, it is an error. Let me file a bug for you: OSDN#44410
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: what happens when...

Post by Dino the Dinosore »

Thanks. Although I can see both sides of the argument that it's OK to let the tile improvement continue til completed, it looks like it's a much easier fix to stop it. I'm OK with that.
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: what happens when...

Post by nef »

Another option to consider is to not allow the upgrade while the unit is doing something the upgrade can`t do. I believe this is the case for the unit being somewhere the upgrade can`t be.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: what happens when...

Post by cazfi »

True. That would also be consistent with another fix currently in review (-> still subject to change itself) that unit currently in the middle of conversion activity is not allowed to upgrade: https://osdn.net/projects/freeciv/ticket/43328
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: what happens when...

Post by Ignatus »

Headscratches: we, in newer versions, basically test if an activity is legal in the ruleset by testing if a unit can do an action switching to this activity from "Idle". But we actually don't switch to it from "Idle" neither do any other action. Does continuing the activity each time we check it count as auto-performed action? Is it, in the game's philosophy of actions and stuff, a clean conception?..
nef wrote:Another option to consider is to not allow the upgrade while the unit is doing something the upgrade can`t do. I believe this is the case for the unit being somewhere the upgrade can`t be.
Actually, I requested unhardcoding autoupgrade for the purpose of handing the behaviour in such twisted corners to ruleset authors (but the API we have now can't tell this specific point). Just we should not allow getting situations we consider illegal on the gameboard.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: what happens when...

Post by cazfi »

nef wrote:Another option to consider is to not allow the upgrade while the unit is doing something the upgrade can`t do. I believe this is the case for the unit being somewhere the upgrade can`t be.
We didn't go that way at this time, as it would have been technically much more complex - we don't currently have good utility functions to predict, in all cases of complex action enablers, what activities would be legal for the upgraded unit before we have actually done the upgrade.
Post Reply