[Freeciv-Dev] Re: (PR#2464) patch: restrict techs by nation
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, Jan 28, 2003 at 03:08:04PM -0800, Per I. Mathisen via RT wrote:
>
> New patch. I've dropped my previous approach and gone for Greg's idea
> instead. Now you specify a root tech which cannot be shared, and it
> "contaminates" the rest of the tree, unless you explicitly stop it from
> doing this. There is no more mention of nations. Now, nations must specify
> root techs in init_techs.
>
> Please read, comment and test.
> /**************************************************************************
> + Returns TRUE iff the given tech is ever reachable by the given player
> + by checking tech tree limitations.
> +**************************************************************************/
> +bool tech_is_available(struct player *pplayer, Tech_Type_id id)
> +{
> + int root = advances[id].root_req;
The test below can fail but you get a bad array access here.
> + if (!tech_exists(id)) {
> + return FALSE;
> + }
> +
> + if (root != A_NONE && root != A_LAST
tech.h only mentions A_NONE as a special value for root_req.
> + && get_invention(pplayer, root) != TECH_KNOWN) {
> + /* This tech requires knowledge of another tech before being
> + * available. Prevents sharing of untransferable techs. */
> + return FALSE;
> + }
> + return TRUE;
> [advance_babylonian_bonus]
> ; This tech can be stolen by other nations, but only Babylonians can
> ; research it!
If this comment is true than this is bad. An nontransferable tech
should be nontransferable.
Also what happens if a tech gets two root techs?
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"This is Linux Country. On a quiet night, you can hear Windows reboot."
|
|