Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7236) removal of most direct references to build_cost
Home

[Freeciv-Dev] (PR#7236) removal of most direct references to build_cost

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7236) removal of most direct references to build_cost
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Mon, 12 Jan 2004 14:57:13 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7236 >

I've removed quite a lot of the direct references to the build_cost
values in unit_type and impr_type, and redirected them to value
functions, which replace unit_value() and improvement_value().

I've made them into unit_build_value(), unit_buy_value(), 
unit_disband_value(), improvement_build_value(),
improvement_buy_value(), and improvement_sell_value().

Why?  Because I want to be able to easily change a couple of the
hardcoded values which are dependent on the build_cost value for units
and improvements, for instance gold per shield when rushing
production,
or number of shields for disbanding.  Mostly because I want to
implement accelerated production. :)

This patch is far from complete; I've changed pretty much every
reference that I could with a small awk script, and the rest I have to
change manually.  And since I only used a quick swap to 
unit_build_value() and improvement_build_value(), I also have to step
through all of my changes, changing them to references to the other
four functions.

Here's the patch so far.  Savegames match, and the new version takes
1m16.870s seconds in an autogame, as opposed to the original CVS
taking
1m16.540s.  This is probably attibutable to accesses now going through
a function, and could be fixed by changing the functions into macros.

But I don't want to get into THAT argument.  :)

Still workin on it,
-James Canete
-- 
_______________________________________________
http://www.ign.com
Upgrade to Premium IGN Email
- 15MB of space
- No ads!
- Pop3 Downloads

Powered by Outblaze

Attachment: build_cost-ref-removal.diff
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7236) removal of most direct references to build_cost, James Canete <=