Follow-up Comment #2, bug #18221 (project freeciv):

Well, I think that there's nothing in the code that would assert that balance
really gets positive before this failing assert(). But this is not simply
matter of removing the assert() as negative balance breaks a lot of things
then on.

Code block before the assert() is like:
while(balance < 0 && something_to_sell) {
  sell_something()
}
but nothing prevents balance from still being negative when everything is
sold.

One thing we may want to change in development code (probably not in stable
branches) is that upkeep for units and buildings being sold because of
negative balance would not be paid. Currently their upkeep is already paid by
the time we sell them.
In stable branches, and temporarily in trunk, I'd just make simple hack to
set balance = 0 if it's still negative after we have sold everything.

I also think that this bug can manifest itself only if upkeep of some unit or
building is higher than its selling value -> otherwise selling it would always
restore balance to at least same level than it was before paying upkeep.
Original reporter may want to use that information to make to his ruleset
such temporary changes that it won't crash freeciv until this is fixed.
However, it's possible that there is some bug in how selling value (or
upkeep) is calculated causing former to be smaller than latter even if ruleset
seems not to allow that. I'll trace exact cause of this reproducible crash a
bit further.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?18221>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to