Project

General

Profile

Bug #5112

Astronaut Complex displaying false recruit cost.

Added by Nifty255 over 9 years ago. Updated about 8 years ago.

Status:
Closed
Severity:
Normal
Assignee:
-
Category:
Gameplay
Target version:
-
Start date:
06/07/2015
% Done:

100%

Version:
Platform:
Any
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

The Astronaut Complex displays a false recruitment cost in Career mode. Sometimes the amount will be in a proper format, but will display an incorrect number, and sometimes the number will display an incorrect number with improper formatting. As an example, the first Kerbal to hire in Career mode costs 79,500 Funds, but the game displays 65,500 to the player. I have also occasionally seen the number displayed as "6,5500.00" instead of the proper "65,500.00". Regardless of the display, the proper amount of funds (in this case, 79,500) are deducted once the Kerbal is actually hired. Additionally, this allows a player with, say, 70,000 funds to hire that first Kerbal (actually costing 79,500), since the display believes the Kerbal costs only 65,500, and thus zero's out the player's balance (and would place it at negative 9,500 Funds if the game allowed a negative balance). I would assume the proper functionality would that the player could not hire a Kerbal at all without sufficient funds, however this bug allows this and zero's the balance.

Steps to reproduce:

1: Create a new Career game save with 500,000 starting Funds.
2: Observe the displayed hiring cost of 65,500 Funds.
3: Hire one Kerbal.
4: Determine the amount actually deducted from available Funds by subtracting the new amount from the old amount.
5: Repeat as desired.

In order to help test this bug, I used a mod called Draft Twitch Viewers (DTV), which randomly pulls names from twitch chat of any given channel, and creates Kerbals with those names. As of its latest version (1.1), it now requires Funds to draft from chat while in Career mode. This mod displays the proper cost of hire, and both stock and Draft Twitch Viewers deduct the proper amount for hiring/drafting. It should be noted that this bug can be seen in pure stock and with any mod installed.

The problem as I see it:

I've learned that the game has an array of predefined costs for each hire, which is calculated for any requesting code by being supplied a crew roster count. For example, the aforementioned mod DTV uses the following code to calculate the next hire's cost:

GUILayout.Label("Next Draft: -" + (GameVariables.Instance.GetRecruitHireCost(HighLogic.CurrentGame.CrewRoster.GetActiveCrewCount() + 1)).ToString("N0") + " Funds", HighLogic.Skin.label);

This code requests the cost of hire, giving the current crew count, plus one.

It is my assumption that, when a Kerbal is hired in the base game, the Kerbal is added to the roster, and then the calculated amount is deducted given the new crew roster count (in the above case, a new Career save, a new count of 5).

I also assume that, in the current code, the display in the Astronaut Complex also performs the exact same calculation, without taking into account that, when the next Kerbal is hired, the new crew count (from which the deduction is calculated from) will be one higher than the number it is providing for its display calculation.

My proposed solution:

Add " + 1" to the code which the Astronaut Complex display uses to request the next hire cost, exactly as DTV's code above does, in order to request a cost given a presumed roster count of one higher than it is currently. In doing so, the stock code which is supposed to prevent hires without sufficient funds should use the new, correctly calculated amount in order to properly prevent a hire without said funds.

History

#2 Updated by nightingale over 8 years ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

#3 Updated by TriggerAu over 8 years ago

  • Status changed from Confirmed to Needs Clarification
  • % Done changed from 10 to 0

#4 Updated by Nifty255 over 8 years ago

As of 1.1.3, this issue is RESOLVED. Previously, the Astronaut Complex would display "65,500" funds for the first hire, but would actually charge "79,500" instead, as a result of a miscalculation in the number of already employed Kerbals. The display calculation used one less than the charge calculation. As of 1.1.3, the Astronaut Conplex now both displays and charges "65,500" for the first hire.

#5 Updated by TriggerAu about 8 years ago

  • Status changed from Needs Clarification to Closed
  • % Done changed from 0 to 100

Closing this report out for now. If you find it is still occuring in the latest version of KSP please open a new report (and this one can be linked to it.) For best results, the wiki contains really useful info for when creating a report http://bugs.kerbalspaceprogram.com/projects/ksp/wiki.

You can also ask questions about the bug cleanup in the forum here: http://forum.kerbalspaceprogram.com/index.php?/topic/143980-time-to-clean-up-the-bug-tracker/ and tag @TriggerAu to get my attention

Also available in: Atom PDF