UFO:Alien Invasion

Development => Newbie Coding => Topic started by: Muton on January 08, 2011, 08:17:40 pm

Title: Add production costs value in scriptfiles
Post by: Muton on January 08, 2011, 08:17:40 pm
I tried to add a production costs value into scriptfiles (instead of using a hardcoded value)
It worked, except for airplanes the costs are 0 credits

Did i miss something???

The patchfile is without scriptfiles
I've added the value into aircraftmanagement.ufo the same way as for weapons ....
Title: Re: Add production costs value in scriptfiles
Post by: Mattn on January 09, 2011, 08:06:32 am
Quote
Price of this aircraft type at game start, it's evolving on the market.

i don't see it evolving anywhere.
Title: Re: Add production costs value in scriptfiles
Post by: Muton on January 09, 2011, 02:37:00 pm
Got it working
needed to modify cp_aircraft.c too
Line: 1424
static const value_t aircraft_vals[] = {
....
+   {"prodprice", V_INT, offsetof(aircraft_t, prodprice), MEMBER_SIZEOF(aircraft_t, prodprice)},


Shouldnt that be moved to script.c


> i don't see it evolving anywhere.

I've made a quick copy paste operation
Personally i think this is an obsolete comment
because i've never seen a market-price changing
But this was my first code-digging.
Maybe, maybe not.
Who knows ?
Title: Re: Add production costs value in scriptfiles
Post by: Mattn on January 11, 2011, 09:44:40 am
the market price evolves - but the produce price not.

would be cool  if you could upload a new patch against latest master
Title: Re: Add production costs value in scriptfiles
Post by: geever on January 11, 2011, 11:05:59 am
the market price evolves - but the produce price not.

would be cool  if you could upload a new patch against latest master

Once I merged it manually to the master (not sure I still have the patch). I like the idea, the more scriptable the better the "engine". However I had a few concerns too:
* it add campaign only data into objDef_t which is global, maybe we should move it into technology_t (production requirements are in tech too)
* If production price is not set in script it's 0. This case (market) price value should be copied to production price at parsing stage.
* We do shorten identifiers but not on all cost. prodprice in script isn't nice.

-geever
Title: Re: Add production costs value in scriptfiles
Post by: Muton on January 11, 2011, 07:31:20 pm
> * If production price is not set in script it's 0. This case (market) price value should be copied to production price at parsing stage.

Thats really needed

> * We do shorten identifiers but not on all cost. prodprice in script isn't nice.

Change it to your liking

Title: Re: Add production costs value in scriptfiles
Post by: geever on February 12, 2011, 11:43:26 am
I've applied your patch (with some modifications) to master. I'm not fully satisfied as I didn't solve my first concern about campaign-only data, but it turned out it can be a more difficult problem.

Maybe if you would like to you could try finding good values for productioncost -s in script files.

-geever