<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39530 >

> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=39530 >

> With rndCiv i use Wonders to define special races,
> ie if you build "The Elves" wonder you can build Elvish units.
> I found that this didn't work, so i made building "The Elves"
> allowed you to build "Elveshome" in your cities which allowed
> you to build Elvish units.
> It would be simpler for me, and prolly for the code, if Wonders
> could allow certain units to be built, either on a City, Island,
> Nation, or Planet wide basis.
> This wouldn't affect the default rulesets, but would allow more
> complexity in mods.

Ive looked through the code, and i find that the functions that check
whether a unit can be built...

   common/city.c:490 can_build_unit
    - calls can_build_unit_direct & can_player_build_unit_direct

   common/city.c:463 can_build_unit_direct
    - calls can_player_build_unit_direct

   common/unittypes.c:503 can_player_build_unit_direct
  - calls can_player_build_improvement_direct

end up calling...

   common/improvement.c:312 can_player_build_improvement_direct

which returns false, if the improvement is a wonder & the wonder has
been built.

Which means that a unit that's impr_req is a wonder will never be able
to be built as  can_player_build_improvement_direct() will return false.

It seems that can_player_build_improvement_direct() is used for two
purposes, to check if a building can be built & to check if a unit can
be built.

im not a c coder, but my initial solution..

   can_player_build_improvement_direct {
        X  = main code
        Z  = wonder check


   can_player_build_improvement_direct_main {

   can_player_build_improvement_direct {

Tests that come from unit functions use

Tests that come from building functions use

or something like that


Freeciv-dev mailing list

Reply via email to