Skip to content

Commit feccd9e

Browse files
committed
formats: Set value for trn_rank_money
1 parent 7b0988b commit feccd9e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/formats/chr.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "formats/tournament.h"
1414
#include "game/common_defines.h"
1515
#include "game/scenes/mechlab/lab_har_constants.h"
16+
#include "game/scenes/mechlab/lab_menu_customize.h"
1617
#include "resources/pathmanager.h"
1718
#include "resources/trnmanager.h"
1819
#include "utils/allocator.h"
@@ -44,6 +45,16 @@ int sd_chr_from_trn(sd_chr_file *chr, sd_tournament_file *trn, sd_pilot *pilot)
4445
chr->pilot.enemies_inc_unranked = trn->enemy_count;
4546
chr->pilot.enemies_ex_unranked = ranked;
4647
chr->pilot.rank = ranked + 1;
48+
49+
int32_t pilot_total_value = calculate_trade_value(&chr->pilot) + chr->pilot.money + (har_prices[0] * 85) / 100;
50+
float extra_value = (pilot_total_value - trn->assumed_initial_value) / 320;
51+
int32_t extra = extra_value / 0.6f;
52+
if(extra > 1500)
53+
extra = 1500;
54+
if(extra < 0)
55+
extra = 0;
56+
chr->pilot.trn_rank_money = (ranked+10)*0.5 + (extra/15);
57+
4758
strncpy_or_abort(chr->pilot.trn_name, trn->filename, sizeof(chr->pilot.trn_name));
4859
strncpy_or_abort(chr->pilot.trn_desc, trn->locales[0]->title, sizeof(chr->pilot.trn_desc));
4960
strncpy_or_abort(chr->pilot.trn_image, trn->pic_file, sizeof(chr->pilot.trn_image));

0 commit comments

Comments
 (0)