Port two transfer fixes to the Modern core
A new arrival no longer inherits the previous occupant's board flags, and a player who is already listed is not listed a second time (from OpenBMH 1.0.3). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2dcf94d2b
commit
8370b5fe60
3 files changed
+15
No files matched your search
@@ -74,6 +74,9 @@ void new_board_entry(GameState& g, int manager, int index, int slot, WatcomRando
|
||||
uint8_t* e = &g.tactics.at(size_t(manager) * kBoard + size_t(index) * kBoardSlot);
|
||||
std::memset(e + 7, 0, 3);
|
||||
std::memset(e + 0x19, 0, 0x24);
|
||||
// Deviates from the original: a new arrival does not inherit the previous occupant's
|
||||
// retirement, refusal and month-processing flags.
|
||||
e[0xb] = 0;
|
||||
e[10] = 2;
|
||||
for (int k = 0; k < 4; k++) e[2 + k] = index < 2 ? 1 : uint8_t(rand.range(2, 0x27));
|
||||
e[0x3f] = 0xff;
|
||||
|
||||
@@ -558,6 +558,15 @@ TransferActionResult list_manager_player(ModernState& g, int manager, int squad_
|
||||
out.status = TransferActionStatus::invalid_player;
|
||||
return out;
|
||||
}
|
||||
// Deviates from the original: a player who is already listed is not listed a second time,
|
||||
// and a full list refuses before any random number is drawn.
|
||||
bool free_entry = false;
|
||||
for (size_t entry = 0; entry < 40; ++entry) {
|
||||
const int listed = g.squad_slots.at(modern::transfer_list_slot() + entry) & 0xfff;
|
||||
if (listed == player) { out.status = TransferActionStatus::pending; out.player = player; out.list_entry = int(entry); return out; }
|
||||
free_entry = free_entry || listed == 0xfff;
|
||||
}
|
||||
if (!free_entry) { out.status = TransferActionStatus::blocked_by_board; return out; }
|
||||
if (!modern::list_transfer_player(g, slot, rand, report)) {
|
||||
out.status = report.unsupported ? TransferActionStatus::invalid_request : TransferActionStatus::blocked_by_board;
|
||||
return out;
|
||||
|
||||
@@ -77,6 +77,9 @@ void new_board_entry(ModernState& g, int manager, int index, int slot, WatcomRan
|
||||
uint8_t* e = &g.tactics.at(size_t(manager) * kBoard + size_t(index) * kBoardSlot);
|
||||
std::memset(e + 7, 0, 3);
|
||||
std::memset(e + 0x19, 0, 0x24);
|
||||
// Deviates from the original: a new arrival does not inherit the previous occupant's
|
||||
// retirement, refusal and month-processing flags.
|
||||
e[0xb] = 0;
|
||||
e[10] = 2;
|
||||
for (int k = 0; k < 4; k++) e[2 + k] = index < 2 ? 1 : uint8_t(rand.range(2, 0x27));
|
||||
e[0x3f] = 0xff;
|
||||
|
||||
Reference in new issue
Block a user