project-navigation
Personal tools

Author Topic: Add production costs value in scriptfiles  (Read 4817 times)

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Add production costs value in scriptfiles
« 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 ....

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Add production costs value in scriptfiles
« Reply #1 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.

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: Add production costs value in scriptfiles
« Reply #2 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 ?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Add production costs value in scriptfiles
« Reply #3 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

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Add production costs value in scriptfiles
« Reply #4 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

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: Add production costs value in scriptfiles
« Reply #5 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


Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Add production costs value in scriptfiles
« Reply #6 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