[Freeciv-Dev] Re: Tech cost patch v6
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Nov 29, 2001 at 02:39:08PM +0200, Juha Litola wrote:
> On Thu, Nov 29, 2001 at 02:36:32PM +0200, Juha Litola wrote:
> > Added preset_cost and num_reqs, got rid of cost. Also changed
> > tech_cost_rec to num_tech_reqs. You were right, it's much
> > cleaner this way.
> And patch.
From
+ int value = 1;
+ if (tech == A_NONE)
+ return 0;
+ if (advances[tech].num_reqs != 0) /* Precalculated value */
+ return advances[tech].num_reqs;
+
+ value += num_req_techs(advances[tech].req[0]);
+ value += num_req_techs(advances[tech].req[1]);
+ advances[tech].num_reqs = value;
+ return value;
to
+ if (tech == A_NONE)
+ return 0;
+ if (advances[tech].num_reqs != 0) /* Precalculated value */
+ return advances[tech].num_reqs;
+
+ advances[tech].num_reqs = 1 + num_req_techs(advances[tech].req[0]) +
num_req_techs(advances[tech].req[1]);
+ return advances[tech].num_reqs
Problem: where is num_reqs set to 0 (initialized)?
Suggestion: at the correct places (one for the server and one for the client)
do:
for each tech:
tech.num_reqs=0;
for each tech:
num_req_techs(tech)
and later doesn't use num_req_techs() anymore.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"At the beginning of the week, we sealed ten BSD programmers
into a computer room with a single distribution of BSD Unix.
Upon opening the room after seven days, we found all ten programmers
dead, clutching each other's throats, and thirteen new flavors of BSD."
- [Freeciv-Dev] Tech cost patch v5, Juha Litola, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v5, Raimar Falke, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v5, Juha Litola, 2001/11/29
- [Freeciv-Dev] Tech cost patch v6, Juha Litola, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6,
Raimar Falke <=
- [Freeciv-Dev] Re: Tech cost patch v6, Juha Litola, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Raimar Falke, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Juha Litola, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Petr Baudis, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Juha Litola, 2001/11/29
- [Freeciv-Dev] Re: Tech cost patch v6, Raahul Kumar, 2001/11/30
- [Freeciv-Dev] Re: Tech cost patch v6, Juha Litola, 2001/11/30
|
|