home city for homeless when killunhomed>0

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Wahazar
Elite
Posts: 321
Joined: Mon Jul 02, 2018 1:49 pm

home city for homeless when killunhomed>0

Postby Wahazar » Tue Feb 04, 2020 12:16 am

Currently you can't set home city for homeless unit - it usually make sense, to avoid accidentally making upkeep of free units,
but is completely counterproductive, if killunhomed option is set.
In such case units others than settlers are dying after at least 10 turns and you can't do anything (besides disbanding them to collect few shields).

Therefore I propose small patch in function can_unit_change_homecity_to in common/unit.c

Code: Select all

  return (punit && pcity
     && ((punit->homecity > 0) || (game.server.killunhomed >0))
     && acity
     && city_owner(acity) == unit_owner(punit)
     && punit->homecity != acity->id);


Not sure if brackets are needed, added them to enhance code.
Augmented2 ruleset/modpack for freeciv2.6: viewtopic.php?f=11&t=91047

User avatar
Caedo
Elite
Posts: 490
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: home city for homeless when killunhomed>0

Postby Caedo » Tue Feb 04, 2020 8:20 am

In the current master (3.1+), the "change home city" action is already controlled by an action enabler; I believe the requirement that a unit must already have a home has been un-hardcoded. However, I don't believe there is currently a means of requiring a server setting to have (or not have) some value, so it is only possible to either always allow it, or never allow it (or some more fine-grained conditions based on other things in the game), regardless of the killunhomed server setting.
~S.C. L.

Ignatus
Hardened
Posts: 288
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: home city for homeless when killunhomed>0

Postby Ignatus » Tue Feb 04, 2020 4:51 pm

Caedo wrote:However, I don't believe there is currently a means of requiring a server setting to have (or not have) some value, so it is only possible to either always allow it, or never allow it (or some more fine-grained conditions based on other things in the game), regardless of the killunhomed server setting.

"ServerSetting" requirement in 3.0 supports boolean-type options.

User avatar
Caedo
Elite
Posts: 490
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: home city for homeless when killunhomed>0

Postby Caedo » Tue Feb 04, 2020 8:27 pm

Ignatus wrote:
Caedo wrote:However, I don't believe there is currently a means of requiring a server setting to have (or not have) some value, so it is only possible to either always allow it, or never allow it (or some more fine-grained conditions based on other things in the game), regardless of the killunhomed server setting.

"ServerSetting" requirement in 3.0 supports boolean-type options.

Do you happen to know if this includes testing whether a numeric setting is non-zero?
~S.C. L.

Ignatus
Hardened
Posts: 288
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: home city for homeless when killunhomed>0

Postby Ignatus » Tue Feb 04, 2020 9:37 pm

Caedo wrote:Do you happen to know if this includes testing whether a numeric setting is non-zero?

For non-boolean options, it yet either does not load or returns always false. The development obstacle seems to me like just it would require some a bit more sophisticated coding to fit universals with non-boolean value into 32 bytes, a bigger structure for requiremens will slow down too many things.

Wahazar
Elite
Posts: 321
Joined: Mon Jul 02, 2018 1:49 pm

Re: home city for homeless when killunhomed>0

Postby Wahazar » Thu Feb 06, 2020 2:29 pm

By the way, this patch (for 2.6) doesn't work - seems it is hardcoded also elsewhere - gui client?

Lachu
Elite
Posts: 413
Joined: Sat May 04, 2013 2:19 pm

Re: home city for homeless when killunhomed>0

Postby Lachu » Fri Mar 06, 2020 4:40 pm

I propose add new action, which consumes and requires 100% MP, but disable killunhomed effect for actor, but also disables HP regen. But.. I don't know, what name should be use for make it reality (made possible not degrade reality of gameplay, when introduce this action). Maybe add this action also for normal units, so we could introduce additional effect for units with home, but uses this action.

Ah... For reality, also makes this action possible only on certain tile/terrain, like with food, farm, irrigation, etc