Modern: the traffic access has four stages
The Modern interface shows four stages for the traffic access, the original has three. A Modern world (WorldLayout::traffic_stages = 4) keeps the condition byte in steps of 64 (64, 128, 192, 255) and offers a build up to stage 3; every stage weighs as one original stage. New careers convert the original start table, older Modern saves are converted on load (traffic_scale). Classic data keeps three stages; the Classic equivalence is unchanged. Also: the live ticker takes the matches from the desk day on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fda4b72967
commit
0046ab90d0
18 files changed
+154
-16
No files matched your search
@@ -654,6 +654,13 @@ ModernSession::ModernSession(const std::filesystem::path &data, uint32_t watcom_
|
||||
// saves from before the national squads end at the reserve: the national squads
|
||||
// start empty (those teams play with their drawn rating until the next nomination)
|
||||
if (g_.squad_slots.size() < world_layout().total_slots) g_.squad_slots.resize(world_layout().total_slots, 0x0fff);
|
||||
// saves from before the four traffic stages keep the original's scale: convert each
|
||||
// manager record's traffic access byte to its stage in the new scale
|
||||
if (modern::four_traffic_stages() && g_.traffic_scale != 64) {
|
||||
for (size_t rec = 0; rec + 0xb0c <= g_.manager_records.size(); rec += 0xb0c)
|
||||
g_.manager_records[rec] = modern::traffic_from_original(g_.manager_records[rec]);
|
||||
g_.traffic_scale = 64;
|
||||
}
|
||||
rand_ = saved.random;
|
||||
game_ = saved.game;
|
||||
native.emplace();
|
||||
@@ -4320,6 +4327,7 @@ bool ModernSession::finish(ui::CareerInitializationResult& result, std::string&
|
||||
// Both UI projections must reflect the freshly initialized driver cursor.
|
||||
// Reuse its prepared groups; these projections do not prepare an event or draw RNG.
|
||||
modern::ensure_ui_identities(g_); // career and manager ids of the interface contract
|
||||
if (modern::four_traffic_stages()) g_.traffic_scale = 64; // the start built the traffic access in that scale
|
||||
result.desktop = desktop_projection(1);
|
||||
result.preparation = preparation_projection(1);
|
||||
for (size_t m = 0; m < managers_.size(); ++m)
|
||||
@@ -8387,7 +8395,7 @@ bool ModernSession::dispatch_stadium(const ui::StadiumRequest& supplied_request,
|
||||
request.object >= 14 || !plain(request.object)) return invalid("invalid_periphery_offer");
|
||||
const size_t object = size_t(request.object);
|
||||
const uint8_t level = g_.manager_records[record + object];
|
||||
if (g_.manager_records[record + 0x1e + object] != 0 || (object == 0 ? level >= 0xab : level != 0))
|
||||
if (g_.manager_records[record + 0x1e + object] != 0 || (object == 0 ? !modern::traffic_buildable(level) : level != 0))
|
||||
return invalid("periphery_unavailable");
|
||||
const int32_t price = modern::periphery_offer(g_, request.object, game_);
|
||||
if (price <= 0) return invalid("invalid_periphery_price");
|
||||
@@ -8403,7 +8411,7 @@ bool ModernSession::dispatch_stadium(const ui::StadiumRequest& supplied_request,
|
||||
if (request.kind == ui::StadiumRequestKind::build_periphery) {
|
||||
const size_t object = size_t(request.object);
|
||||
const uint8_t level = g_.manager_records[record + object];
|
||||
if (g_.manager_records[record + 0x1e + object] != 0 || (object == 0 ? level >= 0xab : level != 0))
|
||||
if (g_.manager_records[record + 0x1e + object] != 0 || (object == 0 ? !modern::traffic_buildable(level) : level != 0))
|
||||
return invalid("periphery_unavailable");
|
||||
// ConstructionPricePercent consumes this genuine JA even when PayConstruction's
|
||||
// payment fails. The Source presenter runs before the quote
|
||||
@@ -8924,7 +8932,7 @@ cli::Json ModernSession::ui_read(const cli::Json& request, uint64_t revision) co
|
||||
for (size_t o = 0; o < 14; ++o) {
|
||||
const int level = st.level[o];
|
||||
O row{{"id", "periphery:" + std::to_string(o)}, {"name", text(720 + o)}, {"constructionDays", int(st.days[o])}};
|
||||
if (o == 0) row["stage"] = level == 0 ? 0 : (level - 1) / 85 + 1, row["maxStage"] = 3;
|
||||
if (o == 0) row["stage"] = modern::traffic_stage(level), row["maxStage"] = world_layout().traffic_stages;
|
||||
else row["built"] = level != 0;
|
||||
periphery.push_back(std::move(row));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "modern/content/projections.hpp"
|
||||
#include "modern/content/statistics.hpp"
|
||||
#include "modern/content/ui_contract.hpp"
|
||||
#include "modern/game/traffic.hpp"
|
||||
#include "modern/content/world_expand.hpp"
|
||||
// The engine side of the UI's career handoff (src/ui/flow.hpp, ENGINE_BINDING.md).
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user