Keep data set ages, fix camp booking, measure camp effect (M7)
- Players of the data set keep their age and seven skills at the career start; the original draws new ones (and OR-ed ages produced players of 46 and a crash once the draws were skipped). - Training camps: the session allowed only resorts 0-7; the manager's club was read as a signed byte (clubs above 127 crashed); at the national coach's desk no camp can be booked. - SIM_CAMP=<resort> in the season sim; the human club's final place is taken from the almanac. Twelve seeds: five stars +1.7 places, six stars +2.5 (about +0.8 over five stars at three times the price), so the six-star rules stay as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f6ec1e240
commit
2a59d398fb
7 files changed
+96
-10
No files matched your search
@@ -8035,7 +8035,7 @@ bool ModernSession::dispatch_training_camp(const ui::TrainingCampRequest& reques
|
||||
return true;
|
||||
}
|
||||
if (request.kind == ui::TrainingCampRequestKind::book) {
|
||||
if (request.resort < 0 || request.resort >= kTrainingCampResorts) {
|
||||
if (request.resort < 0 || size_t(request.resort) >= g_.training_camps.size()) { // the world's catalogue
|
||||
error = "invalid_resort";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -275,6 +275,7 @@ bool new_career_players(ModernState& g, GameRandom& game, WatcomRandom& rand, Mi
|
||||
for (size_t slot = 0; slot < transfer_list_slot(); slot++) {
|
||||
const int id = g.squad_slots.at(slot) & 0x0fff;
|
||||
if (id == 0x0fff) continue;
|
||||
if (keeps_world_values(g, id)) continue; // Modern: age and skills of the data set stay (balance.md)
|
||||
Player& p = g.players.at(size_t(id));
|
||||
p.w364 |= uint32_t(rand.range(4, 0x10)) << 21;
|
||||
p.w368 = (p.w368 & 0xffffc000u) + uint32_t(rand.range(0, 0x3fff));
|
||||
@@ -596,8 +597,10 @@ bool career_add_manager(ModernState& g, const LeImage& exe, int m, const CareerM
|
||||
for (int i = 0; i < players; i++) {
|
||||
const size_t slot = squad.first + size_t(i);
|
||||
Player& p = g.players.at(size_t(g.squad_slots.at(slot) & 0x0fff));
|
||||
p.w364 &= ~(0x1fu << 21);
|
||||
p.w364 |= uint32_t(rand.range(4, 9)) << 21;
|
||||
if (!keeps_world_values(g, g.squad_slots.at(slot) & 0x0fff)) { // Modern: the data set's age stays
|
||||
p.w364 &= ~(0x1fu << 21);
|
||||
p.w364 |= uint32_t(rand.range(4, 9)) << 21;
|
||||
}
|
||||
modern::new_board_entry(g, m, i, int(slot), rand);
|
||||
g.tactics.at(size_t(m) * 0x840 + size_t(i) * 0x58 + 0xd) = 100;
|
||||
}
|
||||
@@ -613,8 +616,10 @@ bool career_add_manager(ModernState& g, const LeImage& exe, int m, const CareerM
|
||||
const int id = g.squad_slots.at(slot) & 0x0fff;
|
||||
if (id == 0x0fff) continue;
|
||||
Player& p = g.players.at(size_t(id));
|
||||
p.w364 &= ~(0x1fu << 21);
|
||||
p.w364 |= uint32_t(rand.range(4, 9)) << 21;
|
||||
if (!keeps_world_values(g, id)) { // Modern: the data set's age stays
|
||||
p.w364 &= ~(0x1fu << 21);
|
||||
p.w364 |= uint32_t(rand.range(4, 9)) << 21;
|
||||
}
|
||||
modern::new_board_entry(g, m, int(i), int(slot), rand);
|
||||
g.tactics.at(size_t(m) * 0x840 + i * 0x58 + 0xd) = 100;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ constexpr int8_t kDirection[5] = {1, 1, 1, -1, 1};
|
||||
// Scaled: a * b * 20 / 100 with unsigned byte arguments.
|
||||
int scaled(int a, int b) { return (a & 0xff) * (b & 0xff) * 20 / 100; }
|
||||
|
||||
// The club of a manager (record +0x290). The original reads the low byte as a signed byte,
|
||||
// which holds for its clubs below 128; Modern clubs go beyond (and the national coach's desk
|
||||
// names the national team), so Modern reads the whole word.
|
||||
int manager_club(const ModernState& g, int manager) {
|
||||
const size_t at = size_t(manager) * kRecordSize + kTeam;
|
||||
return int(g.manager_records.at(at) | g.manager_records.at(at + 1) << 8);
|
||||
}
|
||||
|
||||
FriendlyBookingQuote make_friendly_quote(const ModernState& g, int manager, int opponent,
|
||||
bool manager_home) {
|
||||
FriendlyBookingQuote out;
|
||||
@@ -522,7 +530,7 @@ void configure_training_camp_data(ModernState& g, const LeImage& exe) {
|
||||
int32_t training_camp_price(const ModernState& g, int manager, int resort) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size() || resort < 0 || size_t(resort) >= g.training_camps.size())
|
||||
throw FormatError("training camp: invalid manager or resort");
|
||||
const int team = int8_t(g.manager_records.at(size_t(manager) * kRecordSize + kTeam));
|
||||
const int team = manager_club(g, manager);
|
||||
return g.training_camps[size_t(resort)].base_price + team_average(g, team, 0xff).players * 5000;
|
||||
}
|
||||
|
||||
@@ -1453,6 +1461,10 @@ TrainingCampBookingBlock training_camp_booking_block(const ModernState& g, int m
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size() ||
|
||||
(size_t(manager) + 1) * kRecordSize > g.manager_records.size())
|
||||
return TrainingCampBookingBlock::invalid_request;
|
||||
// Only for the manager's club: at the national coach's desk the record names the
|
||||
// national team, which has no camp (Modern; Classic offers no camp there either).
|
||||
if (manager_club(g, manager) < 0 || manager_club(g, manager) >= league_clubs())
|
||||
return TrainingCampBookingBlock::invalid_request;
|
||||
const uint8_t stays = g.manager_records.at(size_t(manager) * kRecordSize + kStays);
|
||||
if (stays & 0x80) return TrainingCampBookingBlock::booked_this_week;
|
||||
if ((stays & 0x7f) >= 3) return TrainingCampBookingBlock::visit_limit;
|
||||
@@ -1474,7 +1486,7 @@ bool book_training_camp(ModernState& g, int manager, int resort, WatcomRandom& r
|
||||
|
||||
void training_camp_effect(ModernState& g, int manager, int resort, WatcomRandom& rand) {
|
||||
const size_t rec = size_t(manager) * kRecordSize;
|
||||
const int team = int8_t(g.manager_records.at(rec + kTeam));
|
||||
const int team = manager_club(g, manager);
|
||||
const auto& grade = g.training_camps.at(size_t(resort)).quality;
|
||||
|
||||
// Morale (bits 0-5) + 12 * grade * 20 %, clamped to 0..0x2f (ClampSignedWord with a word
|
||||
|
||||
Reference in new issue
Block a user