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?
Post Reply
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

home city for homeless when killunhomed>0

Post by Wahazar »

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: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
User avatar
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: home city for homeless when killunhomed>0

Post by Alien Valkyrie »

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.
~ AVL
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: home city for homeless when killunhomed>0

Post by Ignatus »

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
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: home city for homeless when killunhomed>0

Post by Alien Valkyrie »

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?
~ AVL
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: home city for homeless when killunhomed>0

Post by Ignatus »

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: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: home city for homeless when killunhomed>0

Post by Wahazar »

By the way, this patch (for 2.6) doesn't work - seems it is hardcoded also elsewhere - gui client?
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: home city for homeless when killunhomed>0

Post by Lachu »

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
ilkkachu
Posts: 5
Joined: Tue Jul 07, 2020 11:38 am

Re: home city for homeless when killunhomed>0

Post by ilkkachu »

Wahazar wrote:By the way, this patch (for 2.6) doesn't work - seems it is hardcoded also elsewhere - gui client?
It seems to me it's hardcoded in that the client appears to use that very same function to determine if rehoming is possible. But even if I recompiled the client with that patch, it didn't have the correct value of game.server.killunhomed -- it doesn't get sent to the client. It would require adding some other setting that actually does get sent. Creating a new boolean, e.g. `allow_rehome_unhomed` instead of relying on `killunhomed` would also allow having the current behaviour in case someone wants just that. (You could have a ruleset with the initial units having some advantage the buildable ones don't have, with the downside that they have a limited lifetime.)

Same for 3.x, if the action enabler only supports booleans, it can be solved by adding a new boolean setting.
Post Reply