[Freeciv-Dev] [bug #21389] Gold looted when conquering city may exceed victim's treasury

2014-01-25 Thread Marko Lindqvist
Follow-up Comment #6, bug #21389 (project freeciv):

> as fc_rand(1) always returns zero.

Oh right, I just keep on remembering that fc_rand() has unusual interface that
it returns from range (1 - max). Maybe I'm just remembering some ancient
version?

___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #21389] Gold looted when conquering city may exceed victim's treasury

2013-12-30 Thread Jacob Nevins
Update of bug #21389 (project freeciv):

  Status:  Ready For Test => Fixed  
 Open/Closed:Open => Closed 

___

Follow-up Comment #5:

> I think treasury = 0 is enough no matter size of the conquered 
> city (there's the +1 const part to fc_rand() ) 
> -> fc_rand(0 + 1) + 0 = 1.
I don't think this triggers it as fc_rand(1) always returns zero.
(Fortunately, as this would be a much more likely situation.)

___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #21389] Gold looted when conquering city may exceed victim's treasury

2013-12-29 Thread Marko Lindqvist
Follow-up Comment #1, bug #21389 (project freeciv):

> I think it would have to be a very large city (size > 190) to
> trigger this

I think treasury = 0 is enough no matter size of the conquered city (there's
the +1 const part to fc_rand() ) -> fc_rand(0 + 1) + 0 = 1.

___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #21389] Gold looted when conquering city may exceed victim's treasury

2013-12-28 Thread Jacob Nevins
Update of bug #21389 (project freeciv):

  Status: In Progress => Ready For Test 

___

Additional Item Attachment:

File name: trunk-S2_5-S2_4-looting-overdrawn.patch Size:0 KB


___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #21389] Gold looted when conquering city may exceed victim's treasury

2013-12-28 Thread Jacob Nevins
URL:
  

 Summary: Gold looted when conquering city may exceed victim's
treasury
 Project: Freeciv
Submitted by: jtn
Submitted on: Sun Dec 29 01:41:01 2013
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
  Status: In Progress
 Assigned to: jtn
Originator Email: 
 Open/Closed: Open
 Release: 
 Discussion Lock: Any
Operating System: Any
 Planned Release: 2.4.2,2.5.0,2.6.0

___

Details:

The calculation of spoils in unit_enter_city() is not guaranteed to be less
than the victim's entire treasury, so their gold could end up negative.

I think it would have to be a very large city (size > 190) to trigger this,
but better safe than sorry.




___

Reply to this item at:

  

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


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