Branch: refs/heads/master
  Home:   https://github.com/Warzone2100/warzone2100
  Commit: 91ce267100564a1d7ec0edb54294bd46a14d938e
      
https://github.com/Warzone2100/warzone2100/commit/91ce267100564a1d7ec0edb54294bd46a14d938e
  Author: Colin MacDonald <git...@colinmacdonald.org>
  Date:   2020-06-18 (Thu, 18 Jun 2020)

  Changed paths:
    M src/structure.cpp
    M src/structure.h

  Log Message:
  -----------
  Fixes #922 Moduled building demolishing

The function structPowerToBuild() is rather confusingly named, as it returns 
the power to either build the structure, or to add its next module, not the 
total power it took to build it as might have been mistakenly inferred.  I've 
renamed it to structPowerToBuildOrAddNextModule(), since that's what it returns.

The real problem is in structureTotalReturn() which (ab)uses 
structPowerToBuild() and then tries to correct the (bad) number it gets back 
from that depending on whether the structure has any modules (irrespective of 
how many).

What we actually want to do is to return:

(power to build basic structure + (power to build a module * number of 
modules)) / 2




_______________________________________________
Warzone2100-commits mailing list
Warzone2100-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/warzone2100-commits

Reply via email to