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

Units costing less than 10 shields have 0 bribe cost.

Added by Lexxie L 5 months ago. Updated 5 months 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.

History

#1 Updated by Lexxie L 5 months 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.

#2 Updated by Marko Lindqvist 5 months ago

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

#3 Updated by Marko Lindqvist 5 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

#4 Updated by Lexxie L 5 months ago

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

#5 Updated by Alexandro Ignatiev 5 months 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?) %\

#6 Updated by Marko Lindqvist 5 months 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

#7 Updated by Marko Lindqvist 5 months 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