How to specify the exclusive building

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
taka
Posts: 12
Joined: Sat Oct 11, 2014 11:42 pm

How to specify the exclusive building

Post by taka »

Hi,
I want to build Building_A or Building_B, but I can build both Building_A and Building_B.
Why?

Code: Select all

[building_A]
name		= _("Building A")
genus		= "SmallWonder"
flags		= "SaveSmallWonder"
reqs	=
    { "type", "name", "range"
      "Tech", "Electricity", "Player"
    }
nreqs	=
    { "type", "name", "range"
      "Building", "Building B", "Player"
    }
((snip))

[building_B]
name		= _("Building B")
genus		= "SmallWonder"
flags		= "SaveSmallWonder"
reqs	=
    { "type", "name", "range"
      "Tech", "Mass Production", "Player"
    }
nreqs	=
    { "type", "name", "range"
      "Building", "Building A", "Player"
    }
((snip))
Expectation:
I can't build Building_A if I built Building_B.
I can't build Building_B if I built Building_A.
cazfi
Elite
Posts: 3105
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to specify the exclusive building

Post by cazfi »

There has never been 'nreqs' field for buildings, only for effects.

However, you can have negated 'reqs'. In versions up to 2.5, the column is called 'negated', in 2.6+ you can use 'present' for that:

Code: Select all

reqs =
 { "type", "name", "range", "negated"
  "Tech", "Electricity", "Player", FALSE
  "Building", "Building B", "Player", TRUE
 }

Code: Select all

reqs =
 { "type", "name", "range", "present"
  "Tech", "Electricity", "Player", TRUE
  "Building", "Building B", "Player", FALSE
 }
taka
Posts: 12
Joined: Sat Oct 11, 2014 11:42 pm

Re: How to specify the exclusive building

Post by taka »

That's a good news!
Post Reply