project-navigation
Personal tools

Author Topic: Alien Materials from Harvester disassembling  (Read 4594 times)

Offline ptbptb

  • Rookie
  • ***
  • Posts: 60
    • View Profile
Alien Materials from Harvester disassembling
« on: September 20, 2011, 03:46:40 pm »
Disassembling an intact Harvester will produce 1600 Alien Materials. The product screen statistics state that 800 should be produced.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Alien Materials from Harvester disassembling
« Reply #1 on: September 20, 2011, 04:15:35 pm »

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Alien Materials from Harvester disassembling
« Reply #2 on: September 22, 2011, 10:56:50 pm »
Disassembling an intact Harvester will produce 1600 Alien Materials. The product screen statistics state that 800 should be produced.

Please attach a savegame.

-geever

Offline ptbptb

  • Rookie
  • ***
  • Posts: 60
    • View Profile
Re: Alien Materials from Harvester disassembling
« Reply #3 on: September 23, 2011, 02:14:01 pm »
One hour till production finished at AtS. Zero Alien Materials before, 1600 after.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Alien Materials from Harvester disassembling
« Reply #4 on: September 23, 2011, 03:59:36 pm »
attached it to the ticket, too

Offline AndyZCS

  • Cannon Fodder
  • **
  • Posts: 2
    • View Profile
Re: Alien Materials from Harvester disassembling
« Reply #5 on: September 28, 2011, 01:30:43 am »
Approximate solution:

CAP_AddCurrent(base, CAP_ITEMS, PR_DisassembleItem(base, ufo->comp, ufo->condition, qfalse)); causes PR_DisassembleItem to be called twice in the inline function 'max'
This is where the inventory is added X 2
Calling PR_DisassembleItem seperately & saving size return value before calling CAP_AddCurrent(base, CAP_ITEMS, sizeret ) makes the invventory correct.

However the base stock level still adds 2 X the inventory.
Total stock is updated as PR_DisassembleItem adds each individual item to the seperate stock items so changing to
CAP_AddCurrent(base, CAP_ITEMS, 0  ) gives correct values.
This line should then do nothing (increases stock level by 0) so should be possible to delete.

Regards

  Andy

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Alien Materials from Harvester disassembling
« Reply #6 on: September 28, 2011, 08:13:38 am »
this patch should fix it - or at least the part where PR_DisassembleItem is called twice (other locations were broken, too)

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Alien Materials from Harvester disassembling
« Reply #7 on: September 28, 2011, 12:48:43 pm »
this patch should fix it - or at least the part where PR_DisassembleItem is called twice (other locations were broken, too)

Your patch misses Doxygen documentations at first...

-geever