Unit requirements on Upkeep_Factor effect

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Post Reply
User avatar
soundnfury
Posts: 28
Joined: Sat Apr 11, 2020 12:09 pm

Unit requirements on Upkeep_Factor effect

Post by soundnfury »

Currently the Upkeep_Factor effect can only have requirements on Player and Output_Type. Since upkeep is always being calculated for a specific unit, it should be possible to condition on details of the unit (e.g. unit flags).

Ideally, the unit's homecity should also be available to requirements, so that e.g. buildings can do more interesting things with upkeep than just Unit_Upkeep_Free_Per_City.
Creator of the Aviation ruleset. Try it out today!
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: Unit requirements on Upkeep_Factor effect

Post by nef »

The homecity requirement raises the issue concerning Civ I compliance for unhappy uk. (The unit must be IN the homecity to avoid the unhappy uk.)
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Unit requirements on Upkeep_Factor effect

Post by Ignatus »

nef wrote:The homecity requirement raises the issue concerning Civ I compliance for unhappy uk. (The unit must be IN the homecity to avoid the unhappy uk.)
Well, we just don't have this CivI feature, wether we do have any reqs on Upkeep_Factor or not (this effect is not about happiness any way). Neither do we have a requirement that tells us if a unit is in its own home city (may be a variant of "UnitState"). (Also, CivI has its own way of determining the home city of a bribed unit - it takes not the home city of the diplo but the closest bribing player's city, and looks for one only in some area and thus sometimes makes the bribed unit free.)
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: Unit requirements on Upkeep_Factor effect

Post by nef »

Ignatus wrote: (Also, CivI has its own way of determining the home city of a bribed unit - it takes not the home city of the diplo but the closest bribing player's city, and looks for one only in some area and thus sometimes makes the bribed unit free.)
I believe this is exactly the same as the hut enter algorithm - in my version published for civ1 ruleset. I have tried some code to do this for bribed units but have run foul of problems with tolua facilities. Avoiding a server crash makes for ugly code. (edit.unit_kill causes the crash, but in part due to bad design of the callbacks unit_built, unit_killed. I have on my TODO list some workaround using extra unit types, but this too has some problems.)
Post Reply