Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Bug #929034

closed

Units costing less than 10 shields have 0 bribe cost.

Added by Lexxie L over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
General
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

/common/unit.c::unit_bribe_cost()

blamed lines of code:
/* Consider the build cost. */
cost *= (unit_build_shield_cost_base(punit) / 10;

FIX: Forcing those to (float) fixed it at FCW, but note, FCW version of this function is divergent and has other vars also previously changed to float. So if changing that one line doesn't work, recommend changing more things to float and/or looking at the fcw.org version of the function which no longer has this bug.


Files

Actions #1

Updated by Lexxie L over 1 year ago

I forgot to mention, fcw.org version of the code has previously fixed other similar maths bugs involving rounding and etc., such as a bug that made negative bribe costs where you got PAID to bribe units.

Actions #2

Updated by Marko Lindqvist over 1 year ago

Please open new tickets to osdn ( https://osdn.net/projects/freeciv/ticket/ ) in the future. We are phasing out hrm.

Actions #3

Updated by Marko Lindqvist over 1 year ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist
Actions #4

Updated by Lexxie L over 1 year ago

FYI, I don't think this patch fixed the second bug, where extreme edge cases made negative bribe costs

Actions #5

Updated by Alexandro Ignatiev over 1 year ago

just rant, why so float, not just

cost = cost * unit_build_shield_cost(punit) / 10;

and return MAX(cost, 0) in the end (well, can "Unit_Bribe_Cost_Pct" = -200 be a feature for a very useless undisbandable unit?) %\

Actions #6

Updated by Marko Lindqvist over 1 year ago

Lexxie L wrote:

FYI, I don't think this patch fixed the second bug, where extreme edge cases made negative bribe costs

-> https://osdn.net/projects/freeciv/ticket/42497

Actions #7

Updated by Marko Lindqvist over 1 year ago

Alexandro Ignatiev wrote:

just rant, why so float

Please open a new ticket if you want this further adjusted. This ticket will now go to 2.6.5 in its present form unless actual regressions are found.

Also available in: Atom PDF