Give the six play settings of the tactics board an effect; draw the board in chalk
- Match engine (Modern turn driver only, MatchEngine::tactic_effects): wing play, through balls, goal kicks, flat or high balls, offside trap and pressing of a human side shift how often it and its opponent come to a chance (play_shift, at most two steps of the chance roll). Each setting pays in one situation and costs in another; pressing also raises the foul roll. No random numbers are drawn; computer sides and the Classic core are unchanged. Documented in docs/DIFFERENCES.md. - The tactics read names the settings; desk and live dialog show every value in words with one sentence on its effect. The live dialog offers all eight settings again. - The tactics board is a slate with a wooden frame, drawn in wobbling chalk strokes. - modern_season_sim: SIM_TACTICS keeps a tactic set for measuring; new modern_play_shift_tests pin the direction of every setting. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
9708b720b2
commit
919342a5ae
16 files changed
+344
-80
No files matched your search
@@ -1268,6 +1268,10 @@ add_executable(modern_toto_tests tests/modern_toto_tests.cpp)
|
||||
target_link_libraries(modern_toto_tests PRIVATE bmh_season_modern)
|
||||
add_test(NAME modern_toto_tests COMMAND modern_toto_tests)
|
||||
|
||||
add_executable(modern_play_shift_tests tests/modern_play_shift_tests.cpp)
|
||||
target_link_libraries(modern_play_shift_tests PRIVATE bmh_season_modern)
|
||||
add_test(NAME modern_play_shift_tests COMMAND modern_play_shift_tests)
|
||||
|
||||
add_executable(modern_traffic_tests tests/modern_traffic_tests.cpp)
|
||||
target_link_libraries(modern_traffic_tests PRIVATE bmh_season_modern)
|
||||
add_test(NAME modern_traffic_tests COMMAND modern_traffic_tests)
|
||||
|
||||
@@ -28,20 +28,22 @@
|
||||
.training-roster select selectbox {width:310dp;max-height:480dp;margin-top:8dp;padding:10dp;border-radius:16dp;}
|
||||
.training-roster select option {min-height:72dp;padding:10dp 14dp;line-height:52dp;}
|
||||
.tactics-board {position:absolute;left:76dp;top:0;width:2300dp;height:100%;}
|
||||
.tactics-surface {position:absolute;left:0;right:0;top:0;bottom:100dp;border:2dp var(--border);border-radius:28dp;decorator:linear-gradient(130deg,#bfd9e40a,#9ecbb809);}
|
||||
.tactics-board>.image-frame {filter:drop-shadow(#e0edbc 0dp 0dp 1dp);}
|
||||
.tactics-surface {position:absolute;left:0;right:0;top:0;bottom:100dp;}
|
||||
|
||||
.tactic-hotspot {padding:0;border:0dp;background-color:transparent;}
|
||||
.tactic-hotspot:hover,.tactic-hotspot:active {background-color:transparent;}
|
||||
.tactic-hotspot:focus-visible {border:3dp var(--accent);}
|
||||
.tactic-effort {position:absolute;left:1021.188dp;top:1021.469dp;width:1012dp;height:316.875dp;color:#d4e6b3;}
|
||||
body.silver .tactic-effort {color:#536f66;}
|
||||
.tactic-effort {position:absolute;left:1021.188dp;top:1000dp;width:1012dp;height:316.875dp;color:#f1efe2;}
|
||||
.tactic-effort-label {display:flex;align-items:baseline;gap:18dp;font-family:Chalk;font-size:60dp;line-height:1.2;letter-spacing:4dp;}
|
||||
.tactic-effort-marks {font-size:52dp;letter-spacing:1dp;line-height:1.2;}
|
||||
.tactic-effort input {position:absolute;left:2dp;top:96dp;width:96%;height:20dp;}
|
||||
.tactic-effort input slidertrack {margin:8dp 0;height:4dp;}
|
||||
.tactic-effort input sliderprogress {height:4dp;background-color:var(--accent);border-radius:2dp;}
|
||||
.tactic-effort input sliderbar {width:16dp;height:16dp;margin-top:2dp;border:0dp;border-radius:8dp;background-color:var(--accent);}
|
||||
.tactic-hint {position:absolute;left:0;right:0;bottom:34dp;height:39dp;text-align:center;font-size:34dp;color:var(--text);}
|
||||
.tactic-effort input slidertrack {background-color:#f1efe240;}
|
||||
.tactic-effort input sliderprogress {height:6dp;background-color:#f1efe2;border-radius:3dp;}
|
||||
.tactic-effort input sliderbar {width:30dp;height:30dp;margin-top:-5dp;border:0dp;border-radius:15dp;background-color:#f3d977;}
|
||||
.tactic-hint {position:absolute;left:0;right:0;bottom:20dp;height:92dp;text-align:center;font-size:34dp;color:var(--text);}
|
||||
.tactic-hint strong {display:block;font-weight:normal;}
|
||||
.tactic-hint span {display:block;font-size:28dp;line-height:1.4;color:var(--muted);}
|
||||
body.midnight .training-skill {color:#c6d6df;}
|
||||
body.midnight .training-row {color:#d8e3eb;}
|
||||
body.midnight .training-header,body.midnight .training-position {color:#9fb2c3;}
|
||||
|
||||
@@ -21,6 +21,7 @@ describe deliberate changes; they are not a list of every known compatibility li
|
||||
- [src/game/lineup.hpp](../src/game/lineup.hpp): disables the foreign-player limit and supports owner-bound designated set-piece selection.
|
||||
- [src/game/match.hpp](../src/game/match.hpp): uses the enhanced injury selection and suspension rules.
|
||||
- [src/game/match_engine.cpp](../src/game/match_engine.cpp): supports designated set-piece takers, the enhanced injury tables, and the extended suspension fields.
|
||||
- [src/game/match_engine.cpp](../src/game/match_engine.cpp): Dreierpack gives the six play settings of the tactics board (manager record +0xd3..+0xd8), which the original stores but never reads, an effect of its own (`play_shift`, switched on by `MatchEngine::tactic_effects` in the Modern turn driver only). A human side's wing play, through balls, goal kicks, flat or high balls, offside trap and pressing shift how often it and its opponent come to a chance by at most two steps of the chance roll; each setting pays in one situation and costs in another (relative strength, the attitudes of both sides, a wet pitch, the minute). Pressing also raises the foul roll. No random numbers are drawn for it. Computer sides have no board and play as before.
|
||||
- [src/game/season.cpp](../src/game/season.cpp): retains the enhanced academy player-generation strength bands with monthly youth budgets.
|
||||
- [src/game/season.hpp](../src/game/season.hpp): retains the enhanced academy player-generation strength bands with monthly youth budgets.
|
||||
- [src/game/state.hpp](../src/game/state.hpp): retains designated set-piece selections in the supported manager-record extension.
|
||||
|
||||
@@ -713,6 +713,41 @@ ForcedMatchEvent MatchEngine::event_impl(MatchGroup& g, int m, int s, int minute
|
||||
return result;
|
||||
}
|
||||
|
||||
// Dreierpack: what the play settings of the two sides add to the attacking side's chance
|
||||
// roll, in half steps (two half steps = one step of the roll, about a tenth more or fewer
|
||||
// chances). `own`/`other` are the side records of the attacker and the defender, `attack`/
|
||||
// `defend` their boards (manager record +0xd2.., nullptr for a computer side). Nothing is
|
||||
// drawn at random. Every setting is a bet on the situation:
|
||||
// 1 wing play (0-3) pays for the stronger side, costs the weaker one
|
||||
// 2 through balls (0-3) pay against an attacking opponent, fail against a deep one
|
||||
// 3 long goal kicks (0-3) pay with a defensive attitude (counters), cost an attacking one
|
||||
// 4 high balls (0/1) better on a wet pitch and for a side with more condition than
|
||||
// technique; flat play suits technique on a dry pitch
|
||||
// 5 offside trap (0/1) helps a side that stands high, hurts a deep one and against a
|
||||
// clearly stronger attack
|
||||
// 6 pressing (0/1) more chances of one's own for an hour, then the side is tired
|
||||
// and the opponent gets more
|
||||
int play_shift(const uint8_t* own, const uint8_t* other, const uint8_t* attack, const uint8_t* defend, int own_att,
|
||||
int opp_att, int minute, bool wet) {
|
||||
int halves = 0;
|
||||
if (attack) {
|
||||
const int wings = std::min<int>(attack[1], 3), through = std::min<int>(attack[2], 3), kicks = std::min<int>(attack[3], 3);
|
||||
halves += wings * clamp(int(own[2]) - int(other[2]), -6, 6) / 9;
|
||||
static constexpr int kLean[4] = {-2, -1, 1, 2}; // by attitude, 0 = very defensive
|
||||
halves += through * kLean[clamp(opp_att, 0, 3)] / 2;
|
||||
halves -= kicks * kLean[clamp(own_att, 0, 3)] / 2;
|
||||
const bool condition_side = own[6] > 100; // balance: condition above technique
|
||||
if (attack[4]) halves += wet ? 1 : condition_side ? 1 : -1;
|
||||
else halves += wet ? -2 : condition_side ? 0 : 1;
|
||||
if (attack[6] && minute <= 60) halves += 2;
|
||||
}
|
||||
if (defend) {
|
||||
if (defend[5]) halves += (opp_att >= 2 ? -2 : 1) + (int(own[2]) > int(other[2]) + 6 ? 1 : 0);
|
||||
if (defend[6] && minute > 60) halves += 2;
|
||||
}
|
||||
return clamp(halves, -4, 4);
|
||||
}
|
||||
|
||||
void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, int& opp_att, MinuteReport& report) {
|
||||
uint8_t* rec = g.records.data() + m * 18;
|
||||
uint8_t* own = rec + s * 9;
|
||||
@@ -722,8 +757,19 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
|
||||
|
||||
int rhythm = clamp(own[7], 44, 80); // MatchRuntimeField2
|
||||
|
||||
// Dreierpack: the boards of human sides; pressing also means more fouls
|
||||
const auto play_board = [&](int t) -> const uint8_t* {
|
||||
if (!tactic_effects) return nullptr;
|
||||
const int manager = state.manager_of(t);
|
||||
if (manager < 0 || state.manager_records.size() < size_t(manager + 1) * 0xB0C) return nullptr;
|
||||
return state.manager_records.data() + size_t(manager) * 0xB0C + 0xd2;
|
||||
};
|
||||
const uint8_t* own_board = play_board(g.fixtures.at(m * 2 + s));
|
||||
const uint8_t* opp_board = play_board(g.fixtures.at(m * 2 + 1 - s));
|
||||
const int pressing_fouls = own_board && own_board[6] ? 4 : 0;
|
||||
|
||||
// --- event roll (AlternateEventRoll selects an alternative range, separately from indoor) ---
|
||||
bool trigger = alternate_event_roll ? rand.range(0, 10) > 7 : rand.range(0, 220) < rhythm - 30;
|
||||
bool trigger = alternate_event_roll ? rand.range(0, 10) > 7 : rand.range(0, 220) < rhythm - 30 + pressing_fouls;
|
||||
if (trigger) {
|
||||
event(g, m, s, minute, report);
|
||||
if (report.unsupported) return;
|
||||
@@ -737,7 +783,10 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
|
||||
|
||||
// --- chance roll ---------------------------------------------------------------------------
|
||||
int roll = game.range(0, away_penalty * 4 + 44);
|
||||
if (int16_t(opp_att + own_att + 3 + (indoor ? 14 : 0)) < roll) return; // no chance
|
||||
int play = 0; // half steps; the odd half counts in the attack value below
|
||||
if (own_board || opp_board)
|
||||
play = play_shift(own, other, own_board, opp_board, own_att, opp_att, minute, !indoor && g.desc.at(0x50 + m) >= 4);
|
||||
if (int16_t(opp_att + own_att + 3 + (indoor ? 14 : 0) + play / 2) < roll) return; // no chance
|
||||
|
||||
int team = g.fixtures.at(m * 2 + s), opp_team = g.fixtures.at(m * 2 + 1 - s);
|
||||
// A side whose record byte 2 (its attack strength) is 0 gets no chance at all: the
|
||||
@@ -745,6 +794,7 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
|
||||
// block, without the result-screen part after it (WEEK240).
|
||||
if (own[2] == 0) return;
|
||||
int attack = int16_t(own[2] + game.range(0, rhythm) / 10 + own_att * 2 - 9); // uVar5
|
||||
attack = int16_t(attack + play % 2 * 4);
|
||||
if (minute < clamp(own[6], 50, 130)) attack = int16_t(attack + game.range(6, 12));
|
||||
int defence = int16_t(other[2] + (3 - opp_att) * 2); // local_a0
|
||||
if (game.range(0, 100) < other[6]) defence = int16_t(defence + 5);
|
||||
|
||||
@@ -161,6 +161,12 @@ struct LiveRealityEvent {
|
||||
RealitySceneTick tick;
|
||||
};
|
||||
|
||||
// Dreierpack (MatchEngine::tactic_effects): what the play settings of a human attacker's
|
||||
// and a human defender's board (manager record +0xd2.., nullptr for a computer side) add to
|
||||
// the attacker's chance roll, in half steps within -4..4. `own`/`other` are the side records.
|
||||
int play_shift(const uint8_t* own, const uint8_t* other, const uint8_t* attack, const uint8_t* defend, int own_att,
|
||||
int opp_att, int minute, bool wet);
|
||||
|
||||
struct MatchEngine {
|
||||
MatchEngine(GameState& s, std::vector<MatchGroup>& gr, GameRandom& gm, WatcomRandom& r, std::vector<uint8_t> refs)
|
||||
: state(s), groups(gr), game(gm), rand(r), referees(std::move(refs)), last_pick_quality(s.last_pick_quality) {}
|
||||
@@ -177,6 +183,10 @@ struct MatchEngine {
|
||||
bool live_desk_disabled = false; // LiveDeskDisabled: no live desk (both live modes off)
|
||||
int month = 0; // CareerSession_PairingsRuntimeDraw_ExecutableField5, for the climate effect when re-rating
|
||||
bool trace = false; // print events and chances to stderr (debugging)
|
||||
// Dreierpack rule (not in the original, off by default): the six play settings of a
|
||||
// human side (manager record +0xd3..+0xd8) shift how often that side and its opponent
|
||||
// come to a chance. See play_shift in match_engine.cpp and docs/DIFFERENCES.md.
|
||||
bool tactic_effects = false;
|
||||
// What the original would show (presentation.hpp); filled only when set. Appending
|
||||
// draws no random numbers and changes nothing else.
|
||||
std::vector<ShowEvent>* show = nullptr;
|
||||
|
||||
@@ -9501,10 +9501,10 @@ cli::Json ModernSession::ui_read(const cli::Json& request, uint64_t revision) co
|
||||
{"credit", O{{"status", "available"}, {"read", "credit"}, {"command", "bank.commit"}}}});
|
||||
}
|
||||
if (kind == "tactics") {
|
||||
// the eight settings (record +0xd2..+0xd9) with the executable's maxima; the meaning of
|
||||
// settings 1-3, 5 and 6 (diagrams on the original board) is not proven, hence neutral labels
|
||||
static constexpr const char* kLabels[8] = {"Grundausrichtung", "Spielzug 1", "Spielzug 2", "Spielzug 3",
|
||||
"Flache oder hohe Bälle", "Aufbau links", "Aufbau rechts", "Einsatz"};
|
||||
// the eight settings (record +0xd2..+0xd9) with the executable's maxima; settings 1-6
|
||||
// carry Dreierpack's own meaning (play_shift in the match engine)
|
||||
static constexpr const char* kLabels[8] = {"Grundausrichtung", "Flügelspiel", "Steilpässe", "Abschlag",
|
||||
"Flache oder hohe Bälle", "Abseitsfalle", "Pressing", "Einsatz"};
|
||||
const ui::TacticsState t = ui::tactics_from_game(g_, exe_, revision);
|
||||
A controls;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
|
||||
@@ -160,6 +160,7 @@ bool run_current_matchday(TurnDriver& driver, ModernState& g, GameRandom& game,
|
||||
if (manager_match_played) events.push_back(audio_event(driver, TurnAudioKind::kickoff_whistle));
|
||||
|
||||
MatchEngine engine{g, driver.groups, game, rand, driver.referees};
|
||||
engine.tactic_effects = true; // Dreierpack: the play settings count (docs/DIFFERENCES.md)
|
||||
if (driver.original_sound) {
|
||||
engine.original_sound = [&driver, &g](uint8_t id) { driver.original_sound(id, g); };
|
||||
if (manager_match_played) engine.original_sound(3); // EndPhase / ReadButtons, crowd.
|
||||
|
||||
+129
-50
@@ -1,6 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "modern/ui/demo_sports.hpp"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <array>
|
||||
#include <numeric>
|
||||
@@ -182,53 +186,113 @@ std::string edit_demo_tactics(Json &state, const Json &action) {
|
||||
}
|
||||
std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
const Json &lineup_points, int depth_max, int lane_max) {
|
||||
// A slate with a wooden frame, drawn on by hand: every line wobbles a little, is gone
|
||||
// over twice and skips where the chalk did not grip. The wobble follows from the
|
||||
// coordinates alone, so the same board always looks the same.
|
||||
const auto values = state.at("values").get<std::array<int, 8>>();
|
||||
const std::string line = theme == "silver" ? "#536f66" : "#dfe8bf";
|
||||
const auto field_line = theme == "silver" ? "#536f66" : "#d7edbf",
|
||||
man_line = theme == "silver" ? "#536f66" : "#c9e6ae",
|
||||
curve_line = theme == "silver" ? "#536f66" : "#d4e7ba";
|
||||
const std::string defence = theme == "silver" ? "#85600c" : "#ffdd6b";
|
||||
const std::string chalk = "#f1efe2", own = "#f3d977", opponent = "#ee8d77";
|
||||
const std::string slate = theme == "silver" ? "#35584a" : theme == "matchday" ? "#2f3b36" : "#274a3e";
|
||||
std::ostringstream out;
|
||||
out.imbue(std::locale::classic());
|
||||
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 295 "
|
||||
"206'><defs><marker id='arrow' markerWidth='5' markerHeight='5' "
|
||||
"refX='4' refY='2.5' orient='auto'><path d='M0 0L5 2.5L0 5Z' fill='"
|
||||
<< line << "'/></marker></defs>";
|
||||
out << std::fixed << std::setprecision(2);
|
||||
uint32_t seed = 0x9e3779b9u;
|
||||
const auto wobble = [&](double amount) {
|
||||
seed = seed * 1664525u + 1013904223u;
|
||||
return (double((seed >> 8) & 0xffff) / 65535.0 - 0.5) * 2 * amount;
|
||||
};
|
||||
// one stroke through the points: the chalk line itself and a wider, fainter trace of dust
|
||||
const auto stroke = [&](const std::vector<std::pair<double, double>> &points, const std::string &colour, double width,
|
||||
bool dashed = false) {
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
out << "<path d='";
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
out << (i ? 'L' : 'M') << points[i].first + wobble(pass ? .28 : .12) << ' ' << points[i].second + wobble(pass ? .28 : .12);
|
||||
out << "' fill='none' stroke='" << colour << "' stroke-linecap='round' stroke-linejoin='round' stroke-width='"
|
||||
<< (pass ? width * 1.9 : width) << "' stroke-opacity='" << (pass ? .16 : .9) << "'";
|
||||
if (dashed) out << " stroke-dasharray='2.2 1.6'";
|
||||
else if (!pass) out << " stroke-dasharray='" << 9 + wobble(3) << " .35 " << 5 + wobble(2) << " .25 " << 13 + wobble(4) << " .4'";
|
||||
out << "/>";
|
||||
}
|
||||
};
|
||||
const auto line = [&](double x1, double y1, double x2, double y2, const std::string &colour, double width, bool dashed = false) {
|
||||
const double length = std::hypot(x2 - x1, y2 - y1);
|
||||
const int parts = std::max(2, int(length / 7));
|
||||
const double nx = length > 0 ? -(y2 - y1) / length : 0, ny = length > 0 ? (x2 - x1) / length : 0;
|
||||
std::vector<std::pair<double, double>> points;
|
||||
// a hand overshoots the ends a little and bows between them
|
||||
const double bow = wobble(std::min(1.1, length / 60));
|
||||
for (int i = 0; i <= parts; ++i) {
|
||||
const double t = double(i) / parts, lean = std::sin(t * 3.14159265) * bow + wobble(.22);
|
||||
points.emplace_back(x1 + (x2 - x1) * t + nx * lean, y1 + (y2 - y1) * t + ny * lean);
|
||||
}
|
||||
stroke(points, colour, width, dashed);
|
||||
};
|
||||
const auto ring = [&](double cx, double cy, double r, const std::string &colour, double width) {
|
||||
std::vector<std::pair<double, double>> points;
|
||||
const double start = wobble(3.14159265), squash = 1 + wobble(.07);
|
||||
const int parts = std::max(10, int(r * 2.2));
|
||||
// drawn in one go: it closes a little past where it began, slightly off
|
||||
for (int i = 0; i <= parts + 1; ++i) {
|
||||
const double a = start + double(i) / parts * 6.2831853, drift = 1 + double(i) / parts * .05 + wobble(.03);
|
||||
points.emplace_back(cx + std::cos(a) * r * drift, cy + std::sin(a) * r * drift * squash);
|
||||
}
|
||||
stroke(points, colour, width);
|
||||
};
|
||||
const auto arrow = [&](double x, double y, double dx, double dy, bool dashed = false) {
|
||||
line(x, y, x + dx, y + dy, chalk, .95, dashed);
|
||||
const double length = std::hypot(dx, dy);
|
||||
if (length < 1) return;
|
||||
const double ux = dx / length, uy = dy / length;
|
||||
for (int side : {-1, 1})
|
||||
line(x + dx, y + dy, x + dx - ux * 3.6 - uy * 2.1 * side, y + dy - uy * 3.6 + ux * 2.1 * side, chalk, .95);
|
||||
};
|
||||
// a player: a filled chalk mark, scribbled rather than printed
|
||||
const auto dot = [&](double x, double y, bool other = false) {
|
||||
const std::string &colour = other ? opponent : own;
|
||||
out << "<path d='";
|
||||
for (int i = 0; i <= 9; ++i) {
|
||||
const double a = double(i) / 9 * 6.2831853, r = 2.35 + wobble(.3);
|
||||
out << (i ? 'L' : 'M') << x + std::cos(a) * r << ' ' << y + std::sin(a) * r;
|
||||
}
|
||||
out << "Z' fill='" << colour << "' fill-opacity='.82'/>";
|
||||
for (int i = 0; i < 3; ++i)
|
||||
line(x - 1.5 + wobble(.4), y - 1.1 + i * 1.1, x + 1.5 + wobble(.4), y - .5 + i * 1.1 + wobble(.3), colour, .55);
|
||||
ring(x, y, 2.5, colour, .4);
|
||||
};
|
||||
const auto field = [&](double x, double y, double w, double h) {
|
||||
out << "<g fill='none' stroke='" << field_line
|
||||
<< "' stroke-width='.65'><path d='M" << x << ' ' << y << 'h' << w << 'v'
|
||||
<< h << 'h' << -w << "Z M" << x + w / 2 << ' ' << y << 'v' << h << " M"
|
||||
<< x << ' ' << y + h * .25 << 'h' << w * .15 << 'v' << h * .5 << 'h'
|
||||
<< -w * .15 << " M" << x + w << ' ' << y + h * .25 << 'h' << -w * .15
|
||||
<< 'v' << h * .5 << 'h' << w * .15 << "'/><circle cx='" << x + w / 2
|
||||
<< "' cy='" << y + h / 2 << "' r='" << h * .14 << "'/></g>";
|
||||
};
|
||||
const auto dot = [&](double x, double y, bool opponent = false) {
|
||||
out << "<circle cx='" << x << "' cy='" << y << "' r='2.4' fill='"
|
||||
<< (opponent ? "#e46145" : defence)
|
||||
<< "' stroke='#809344' stroke-width='.4'/>";
|
||||
};
|
||||
const auto arrow = [&](double x, double y, double dx, double dy,
|
||||
bool dashed = false) {
|
||||
out << "<path d='M" << x << ' ' << y << 'l' << dx << ' ' << dy
|
||||
<< "' fill='none' stroke='" << line << "' stroke-width='.85' "
|
||||
<< (dashed ? "stroke-dasharray='2 1.3'" : "")
|
||||
<< " marker-end='url(#arrow)'/>";
|
||||
line(x, y, x + w, y, chalk, .8); line(x + w, y, x + w, y + h, chalk, .8);
|
||||
line(x + w, y + h, x, y + h, chalk, .8); line(x, y + h, x, y, chalk, .8);
|
||||
line(x + w / 2, y, x + w / 2, y + h, chalk, .7);
|
||||
for (int side = 0; side < 2; ++side) {
|
||||
const double edge = side ? x + w : x, box = side ? -w * .15 : w * .15;
|
||||
line(edge, y + h * .25, edge + box, y + h * .25, chalk, .7);
|
||||
line(edge + box, y + h * .25, edge + box, y + h * .75, chalk, .7);
|
||||
line(edge + box, y + h * .75, edge, y + h * .75, chalk, .7);
|
||||
}
|
||||
ring(x + w / 2, y + h / 2, h * .14, chalk, .7);
|
||||
};
|
||||
|
||||
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 295 206'>";
|
||||
// frame and slate; the wiped patches of an often used board
|
||||
out << "<rect x='4' y='1' width='272' height='159' rx='3' fill='#6b4a2e'/>"
|
||||
"<rect x='4.8' y='1.8' width='270.4' height='157.4' rx='2.5' fill='none' stroke='#8a6540' stroke-width='.6'/>"
|
||||
"<rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='"
|
||||
<< slate << "'/><rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='none' stroke='#16261f' stroke-opacity='.55' stroke-width='1'/>";
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
const double cx = 40 + i * 27 + wobble(12), cy = 30 + (i % 3) * 45 + wobble(14);
|
||||
out << "<ellipse cx='" << cx << "' cy='" << cy << "' rx='" << 26 + wobble(9) << "' ry='" << 9 + wobble(4)
|
||||
<< "' fill='#ffffff' fill-opacity='" << .022 + (i % 2) * .012 << "' transform='rotate(" << -14 + wobble(10) << ' ' << cx << ' ' << cy << ")'/>";
|
||||
}
|
||||
// chalk tray with two pieces of chalk
|
||||
out << "<rect x='96' y='160' width='88' height='3.2' rx='.8' fill='#58391f'/>"
|
||||
"<rect x='112' y='158.3' width='9' height='1.7' rx='.5' fill='#f1efe2'/>"
|
||||
"<rect x='127' y='158.5' width='6' height='1.6' rx='.5' fill='#f3d977' transform='rotate(-6 130 159)'/>";
|
||||
|
||||
field(19, 9, 104, 62);
|
||||
field(19, 82, 104, 62);
|
||||
field(137, 10, 58, 37);
|
||||
field(205, 10, 58, 37);
|
||||
std::array<std::pair<int, int>, 10> formation = {{{5, 1},
|
||||
{5, 3},
|
||||
{5, 5},
|
||||
{5, 7},
|
||||
{10, 1},
|
||||
{10, 3},
|
||||
{10, 5},
|
||||
{10, 7},
|
||||
{16, 3},
|
||||
{16, 5}}};
|
||||
std::array<std::pair<int, int>, 10> formation = {{{5, 1}, {5, 3}, {5, 5}, {5, 7}, {10, 1}, {10, 3}, {10, 5}, {10, 7}, {16, 3}, {16, 5}}};
|
||||
if (!lineup_points.is_null()) {
|
||||
if (!lineup_points.is_array() || lineup_points.size() != 11)
|
||||
throw editor::Error("invalid_lineup_points");
|
||||
@@ -254,9 +318,10 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
dot(x + 25, 20);
|
||||
dot(x + 25, 37);
|
||||
dot(x + 43, 28, true);
|
||||
if (values[size_t(5 + k)] == 0)
|
||||
out << "<path d='M" << x + 3 << " 12l52 32 M" << x + 55
|
||||
<< " 12l-52 32' stroke='" << line << "' stroke-width='1.6'/>";
|
||||
if (values[size_t(5 + k)] == 0) {
|
||||
line(x + 3, 12, x + 55, 44, chalk, 1.7);
|
||||
line(x + 55, 12, x + 3, 44, chalk, 1.7);
|
||||
}
|
||||
}
|
||||
dot(29, 111);
|
||||
dot(76, 94);
|
||||
@@ -266,15 +331,29 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
arrow(29, 111, 10 + values[3] * 10, -values[3] * 5, true);
|
||||
arrow(76, 94, 10 + values[2] * 8, 12 - values[2] * 5);
|
||||
arrow(76, 119, 10 + values[1] * 8, -8 + values[1] * 4, true);
|
||||
for (int x : {181, 222})
|
||||
out << "<g fill='none' stroke='" << man_line
|
||||
<< "' stroke-width='.8'><circle cx='" << x
|
||||
<< "' cy='65' r='2'/><path d='M" << x
|
||||
<< " 67l-2 7 5 4 m-5-4 -4 4 m5-8 -5 2 m5-2 5 2'/></g>";
|
||||
out << "<path d='M188 72Q201 " << (values[4] ? 45 : 72)
|
||||
<< " 215 72' fill='none' stroke='" << curve_line
|
||||
<< "' stroke-width='.9' stroke-dasharray='1 1.5' "
|
||||
"marker-end='url(#arrow)'/></svg>";
|
||||
for (int x : {181, 222}) {
|
||||
ring(x, 65, 2, chalk, .8);
|
||||
line(x, 67, x - 2, 74, chalk, .8);
|
||||
line(x - 2, 74, x + 3, 78, chalk, .8);
|
||||
line(x - 2, 74, x - 6, 78, chalk, .8);
|
||||
line(x - 1, 70, x - 6, 72, chalk, .8);
|
||||
line(x - 1, 70, x + 4, 72, chalk, .8);
|
||||
}
|
||||
{
|
||||
// the ball's way from one to the other: along the ground or lobbed
|
||||
std::vector<std::pair<double, double>> path;
|
||||
const double peak = values[4] ? 45 : 72;
|
||||
for (int i = 0; i <= 10; ++i) {
|
||||
const double t = i / 10.0;
|
||||
path.emplace_back((1 - t) * (1 - t) * 188 + 2 * (1 - t) * t * 201 + t * t * 215 + wobble(.2),
|
||||
(1 - t) * (1 - t) * 72 + 2 * (1 - t) * t * peak + t * t * 72 + wobble(.25));
|
||||
}
|
||||
stroke(path, chalk, .9, true);
|
||||
const double dy = values[4] ? 2.6 : 0;
|
||||
line(215, 72, 211.4, 72 - 2.1 - dy, chalk, .9);
|
||||
line(215, 72, 212.2 + dy, 72 + 2.3 - dy * 1.6, chalk, .9);
|
||||
}
|
||||
out << "</svg>";
|
||||
return out.str();
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -102,6 +102,6 @@ bool App::engine_sports_event(Rml::Event &event) {
|
||||
if (!change) return false;
|
||||
engine_tactics_draft_["values"][7] = value; last_tactic_ = 7;
|
||||
element("tactic-effort-value")->SetInnerRML(std::string(size_t(value), '!'));
|
||||
element("tactic-hint")->SetInnerRML(esc(engine_tactics_draft_.at("labels")[7].get<std::string>() + ": " + std::to_string(value) + " / " + std::to_string(engine_tactics_draft_.at("limits")[7].get<int>())));
|
||||
element("tactic-hint")->SetInnerRML("<strong>" + esc(engine_tactics_draft_.at("labels")[7].get<std::string>() + ": " + tactic_value_text(7, value, engine_tactics_draft_.at("limits")[7].get<int>())) + "</strong><span>" + esc(tactic_effect_text(7)) + "</span>");
|
||||
engine_sports_update(); dirty_ = true; return true;
|
||||
}
|
||||
@@ -388,6 +388,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
try {
|
||||
const int index = std::stoi(id);
|
||||
if (index < 0 || index > 7) return true;
|
||||
last_tactic_ = index;
|
||||
if (engine_live_running_) {
|
||||
// the next value of the engine's own range, wrapping to its lowest
|
||||
const auto &control = engine_live_tactics_.at(size_t(index));
|
||||
|
||||
@@ -8,14 +8,7 @@ std::string live_score_text(const Json &score) {
|
||||
}
|
||||
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
|
||||
// defensive), the commitment (item 7) and the numbered variants of the play patterns.
|
||||
std::string live_tactic_value(size_t index, int value, int maximum) {
|
||||
if (index == 0 && maximum == 3) {
|
||||
static const std::array<const char *, 4> attitude{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"};
|
||||
if (value >= 0 && value <= 3) return attitude[size_t(value)];
|
||||
}
|
||||
if (index == 7) return std::to_string(value) + " von " + std::to_string(maximum);
|
||||
return "Variante " + std::to_string(value + 1) + " von " + std::to_string(maximum + 1);
|
||||
}
|
||||
std::string live_tactic_value(size_t index, int value, int maximum) { return tactic_value_text(index, value, maximum); }
|
||||
const Json &live_match_by_id(const Json &rows, const Json &id) {
|
||||
|
||||
for (const auto &row : rows) if (row.at("id") == id) return row;
|
||||
@@ -112,13 +105,9 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
|
||||
}
|
||||
if (live_tab_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8) {
|
||||
std::string out = "<div class=\"live-context\"><h3>" + live_text("Taktik in diesem Spiel") + "</h3>";
|
||||
// the match engine reads the attitude (item 0) and the commitment (item 7); the play
|
||||
// patterns between them have no effect on a match and are not offered here
|
||||
for (size_t i = 0; i < engine_live_tactics_.size(); ++i)
|
||||
if (i == 0 || i == 7)
|
||||
out += "<div class=\"live-tactic-row\">" + live_text(engine_live_tactics_[i].at("label").get<std::string>()) +
|
||||
live_text(i == 0 && engine_live_assistant_ ? std::string("Assistent passt an") : live_tactic_value(i, engine_live_tactics_[i].at("value").get<int>(), engine_live_tactics_[i].at("max").get<int>())) + "</div>";
|
||||
out += "<p class=\"live-note\">" + live_text("Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner. Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen.") + "</p>";
|
||||
return out + btn("live-intervene-tactics", "Taktik ändern", "", "id=\"live-tactics-edit\"") + "</div>";
|
||||
}
|
||||
if (live_tab_ == "tactics" && recorded)
|
||||
@@ -181,9 +170,10 @@ std::string App::live_dialog_markup(const Json &owner) {
|
||||
const bool engine_board = live_.running() && engine_live_tactics_.size() == 8;
|
||||
const auto &values = engine_board ? live_dialog_draft_.at("values") : live_dialog_draft_.at("tactics").at("values");
|
||||
for (size_t i = 0; i < names.size(); ++i)
|
||||
if (!engine_board || i == 0 || i == 7)
|
||||
body += "<div class=\"live-tactic-row\">" + live_text(engine_board ? engine_live_tactics_[i].at("label").get<std::string>() : std::string(names[i])) + btn("live-tactic-cycle", engine_board ? live_tactic_value(i, values[i].get<int>(), engine_live_tactics_[i].at("max").get<int>()) : "Wert " + std::to_string(values[i].get<int>()), "", "id=\"live-tactic-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"") + "</div>";
|
||||
}
|
||||
if (live_dialog_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8)
|
||||
body += "<p id=\"live-tactic-effect\">" + live_text(tactic_effect_text(size_t(std::clamp(last_tactic_, 0, 7)))) + "</p>";
|
||||
body += "<div class=\"live-dialog-actions\">" + btn("live-dialog-cancel", "Abbrechen", "", "id=\"live-dialog-cancel\"") +
|
||||
btn("live-dialog-apply", live_.running() ? (live_dialog_ == "lineup" ? "Wechsel ausführen" : "Taktik übernehmen") : "Demovorschau anzeigen", "", "id=\"live-dialog-apply\" " + std::string(live_dialog_ == "lineup" && (live_out_.empty() || live_in_.empty()) ? "disabled" : "")) + "</div>";
|
||||
return "<div class=\"live-dialog-layer\"><div id=\"live-dialog\" class=\"live-dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"live-dialog-heading\">" + body + "</div></div>";
|
||||
|
||||
@@ -180,8 +180,10 @@ std::string App::render_tactics() {
|
||||
"data-input=\"tactic-effort\" min=\"" + std::to_string(engine_mode_ ? t.at("minima")[7].get<int>() : 0) + "\" max=\"" + std::to_string(limits[7]) + "\" step=\"1\" value=\"" +
|
||||
std::to_string(effort) +
|
||||
"\"/></div><p id=\"tactic-hint\" class=\"tactic-hint\">" +
|
||||
esc(names[size_t(last_tactic_)]) + ": " +
|
||||
(engine_mode_
|
||||
? "<strong>" + esc(names[size_t(last_tactic_)] + ": " + tactic_value_text(size_t(last_tactic_), t["values"][size_t(last_tactic_)].get<int>(), limits[size_t(last_tactic_)])) + "</strong><span>" + esc(tactic_effect_text(size_t(last_tactic_))) + "</span>"
|
||||
: esc(names[size_t(last_tactic_)]) + ": " +
|
||||
std::to_string(t["values"][size_t(last_tactic_)].get<int>()) + " / " +
|
||||
std::to_string(limits[size_t(last_tactic_)]) + "</p></div>";
|
||||
std::to_string(limits[size_t(last_tactic_)])) + "</p></div>";
|
||||
return body + (engine_mode_ ? engine_sports_footer() : "");
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
namespace bmh::modern_ui {
|
||||
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
|
||||
// defensive), the six play settings (items 1-6) and the commitment (item 7).
|
||||
inline std::string tactic_value_text(size_t index, int value, int maximum) {
|
||||
static const std::array<std::array<const char *, 4>, 4> steps{{
|
||||
{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"},
|
||||
{"Durch die Mitte", "Eher durch die Mitte", "Eher über die Flügel", "Über die Flügel"},
|
||||
{"Kurzpassspiel", "Selten steil", "Oft steil", "Immer steil"},
|
||||
{"Kurz herausspielen", "Halblang", "Lang", "Weit nach vorn"}}};
|
||||
if (index < 4 && maximum == 3 && value >= 0 && value <= 3) return steps[index][size_t(value)];
|
||||
if (index == 4 && maximum == 1) return value ? "Hoch" : "Flach";
|
||||
if ((index == 5 || index == 6) && maximum == 1) return value ? "An" : "Aus";
|
||||
return std::to_string(value) + " von " + std::to_string(maximum);
|
||||
}
|
||||
// What a setting does in a match, in one sentence (the rule: play_shift in the match engine).
|
||||
inline std::string tactic_effect_text(size_t index) {
|
||||
static const std::array<const char *, 8> text{
|
||||
"Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner.",
|
||||
"Flügelspiel lohnt sich als stärkere Mannschaft. Gegen stärkere Gegner geht der Ball außen verloren.",
|
||||
"Steilpässe wirken gegen offensive Gegner. Gegen tief stehende verpuffen sie.",
|
||||
"Lange Abschläge passen zu defensiver Ausrichtung, kurzes Herausspielen zu offensiver.",
|
||||
"Hoch bei nassem Platz und für konditionsstarke Mannschaften, flach für technisch starke auf trockenem Platz.",
|
||||
"Die Abseitsfalle hilft, wenn die Mannschaft offensiv steht. Bei defensiver Ausrichtung und gegen klar stärkere Gegner schadet sie.",
|
||||
"Pressing bringt eine Stunde lang mehr eigene Chancen und mehr Fouls. Danach ist die Mannschaft müde und der Gegner kommt häufiger durch.",
|
||||
"Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen."};
|
||||
return index < text.size() ? text[index] : std::string();
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "modern/ui/career_files.hpp"
|
||||
#include "modern/ui/live_match_info.hpp"
|
||||
#include "modern/ui/date_text.hpp"
|
||||
#include "modern/ui/tactic_text.hpp"
|
||||
#include "modern/ui/script_locator.hpp"
|
||||
#include "modern/ui/select_menu.hpp"
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
@@ -876,7 +877,7 @@ class App final : public Rml::EventListener {
|
||||
if (auto *label = doc_->QuerySelector(".tactic-effort-label")) {
|
||||
const auto offset = std::to_string(int(std::round(2 * scale_)));
|
||||
label->SetProperty("font-effect",
|
||||
"shadow(" + offset + "px " + offset + "px #386824)");
|
||||
"shadow(" + offset + "px " + offset + "px #1b3329)");
|
||||
}
|
||||
}
|
||||
// Called after the stage was rebuilt: zoom in when it now shows a menu window.
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Dreierpack's play settings (tactics board items 1-6): each one pays in one situation and
|
||||
// costs in another, and a computer side (no board) is never touched.
|
||||
#include "game/match_engine.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
void require(bool yes, const std::string& message) {
|
||||
if (!yes) throw std::runtime_error(message);
|
||||
}
|
||||
// a side record: byte 2 the strength, byte 6 the balance (above 100: more condition than technique)
|
||||
std::array<uint8_t, 9> side(int strength, int balance) {
|
||||
std::array<uint8_t, 9> r{};
|
||||
r[2] = uint8_t(strength), r[6] = uint8_t(balance);
|
||||
return r;
|
||||
}
|
||||
// a board with one setting; flat balls on a dry pitch for a technique side count +1 by themselves
|
||||
std::array<uint8_t, 8> board(int item, int value) {
|
||||
std::array<uint8_t, 8> b{};
|
||||
if (item >= 0) b[size_t(item)] = uint8_t(value);
|
||||
return b;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
using bmh::play_shift;
|
||||
try {
|
||||
const auto even = side(70, 100), strong = side(80, 100), weak = side(60, 100), runners = side(70, 130);
|
||||
const auto none = board(-1, 0);
|
||||
// no boards: nothing changes
|
||||
require(play_shift(even.data(), even.data(), nullptr, nullptr, 1, 2, 30, false) == 0, "computer sides are untouched");
|
||||
const int base = play_shift(even.data(), even.data(), none.data(), nullptr, 1, 1, 30, false);
|
||||
require(base == 1, "flat play suits a technique side on a dry pitch");
|
||||
require(play_shift(even.data(), even.data(), none.data(), nullptr, 1, 1, 30, true) == -2, "flat play suffers on a wet pitch");
|
||||
const auto high = board(4, 1);
|
||||
require(play_shift(even.data(), even.data(), high.data(), nullptr, 1, 1, 30, true) == 1, "high balls suit a wet pitch");
|
||||
require(play_shift(runners.data(), even.data(), high.data(), nullptr, 1, 1, 30, false) == 1, "high balls suit a condition side");
|
||||
require(play_shift(even.data(), even.data(), high.data(), nullptr, 1, 1, 30, false) == -1, "high balls cost a technique side");
|
||||
|
||||
const auto wings = board(1, 3);
|
||||
require(play_shift(strong.data(), weak.data(), wings.data(), nullptr, 1, 1, 30, false) > base, "wing play pays for the stronger side");
|
||||
require(play_shift(weak.data(), strong.data(), wings.data(), nullptr, 1, 1, 30, false) < base, "wing play costs the weaker side");
|
||||
|
||||
const auto through = board(2, 3);
|
||||
require(play_shift(even.data(), even.data(), through.data(), nullptr, 1, 3, 30, false) > base, "through balls pay against an attacking side");
|
||||
require(play_shift(even.data(), even.data(), through.data(), nullptr, 1, 0, 30, false) < base, "through balls fail against a deep side");
|
||||
|
||||
const auto kicks = board(3, 3);
|
||||
require(play_shift(even.data(), even.data(), kicks.data(), nullptr, 0, 1, 30, false) > base, "long goal kicks pay for a defensive side");
|
||||
require(play_shift(even.data(), even.data(), kicks.data(), nullptr, 3, 1, 30, false) < base, "long goal kicks cost an attacking side");
|
||||
|
||||
// the defender's settings count against the attacker (a computer side here)
|
||||
const auto trap = board(5, 1);
|
||||
require(play_shift(even.data(), even.data(), nullptr, trap.data(), 1, 3, 30, false) < 0, "the offside trap helps a side that stands high");
|
||||
require(play_shift(even.data(), even.data(), nullptr, trap.data(), 1, 0, 30, false) > 0, "the offside trap hurts a deep side");
|
||||
|
||||
const auto pressing = board(6, 1);
|
||||
require(play_shift(even.data(), even.data(), pressing.data(), nullptr, 1, 1, 30, false) > base, "pressing brings chances in the first hour");
|
||||
require(play_shift(even.data(), even.data(), pressing.data(), nullptr, 1, 1, 75, false) == base, "pressing brings nothing once the side is tired");
|
||||
require(play_shift(even.data(), even.data(), nullptr, pressing.data(), 1, 1, 30, false) == 0, "a pressing side defends as usual at first");
|
||||
require(play_shift(even.data(), even.data(), nullptr, pressing.data(), 1, 1, 75, false) > 0, "a tired pressing side lets the opponent through");
|
||||
|
||||
// everything at once stays within two steps of the chance roll
|
||||
std::array<uint8_t, 8> all{0, 3, 3, 3, 0, 1, 1, 0};
|
||||
for (int own_att = 0; own_att < 4; ++own_att)
|
||||
for (int opp_att = 0; opp_att < 4; ++opp_att)
|
||||
for (int minute : {10, 80}) {
|
||||
const int shift = play_shift(strong.data(), weak.data(), all.data(), all.data(), own_att, opp_att, minute, false);
|
||||
require(shift >= -4 && shift <= 4, "the shift is bounded");
|
||||
}
|
||||
std::puts("modern play shift tests passed");
|
||||
return 0;
|
||||
} catch (const std::exception& e) {
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "modern/app/modern_session.hpp"
|
||||
@@ -502,6 +503,14 @@ int main(int argc, char** argv) {
|
||||
int camp_stays = 0; // SIM_CAMP: training camp stays booked
|
||||
int sponsor_offers = 0, sponsor_started = 0, sponsor_queued = 0; // SIM_SPONSOR
|
||||
for (; played < turns; played++) {
|
||||
// SIM_TACTICS=a,b,c,d,e,f,g,h: the manager keeps these eight tactic settings
|
||||
// (manager record +0xd2..; -1 leaves a setting alone), to measure their effect
|
||||
if (const char* tactics = std::getenv("SIM_TACTICS")) {
|
||||
std::stringstream list(tactics);
|
||||
std::string item;
|
||||
for (size_t k = 0; k < 8 && std::getline(list, item, ','); ++k)
|
||||
if (const int v = std::atoi(item.c_str()); v >= 0) g.manager_records.at(0xd2 + k) = uint8_t(v);
|
||||
}
|
||||
// SIM_ADVERTISING=1: the manager keeps his advertising places filled, as every
|
||||
// player does (the largest income besides the gate): an expired contract is renewed
|
||||
// when the sponsor offers it (legacy routine), a free place takes the best acceptable
|
||||
|
||||
Reference in new issue
Block a user