Four further properties at the bank; the tactics sketch sits a little higher

Town house, penthouse, estate house and old terraced house join the six
properties of the original: bought and sold at the day's price, moving by
a few percent every month and paying a monthly rent. The property board
shows all ten.

Engine: estates.hpp, bank read funds fund:6-9, bank.commit trades them;
saved in state/modern.json.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 17:18:31 +01:00
1 parent 72e06aabdb
commit 57b8b0f371
18 files changed
+302 -7

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ bool App::bank_action(const std::string &action, Rml::Element *target) {
if (action == "bank-property" && target) {
// a house on the board is chosen: it is the one bought and sold
const auto index = target->GetAttribute<int>("data-id", -1);
if (bank_view_ != "properties" || index < 0 || index > 5) return true;
if (bank_view_ != "properties" || index < 0 || index > 9) return true;
bank_property_ = bank_owned_ = index;
focus_after_render_ = "bank-property-" + std::to_string(index);
refresh();
+1 -1
View File
@@ -146,7 +146,7 @@ std::string App::render_bank() {
const auto price = offer.at("price").get<int64_t>();
out += "</div><div class=\"pg-row pg-grow\" style=\"align-items:stretch;\"><div class=\"pg-panel pg-row pg-grow\" style=\"" + pg_css("gap:22px;padding:10px 16px;") + "\"><div style=\"width:" + pg(300) + ";\">" + pg_kicker("Ausgewählt") +
"<h3 class=\"pg-h\" style=\"font-size:" + pg(24) + ";line-height:" + pg(30) + ";\">" + esc(calm_name(offer.at("name").get<std::string>())) + "</h3><strong class=\"pg-big\">" + esc(bank_money(price)) + "</strong></div><div class=\"pg-grow\">" +
kv("Im Bestand", number(held) + " Stück") + kv("Wert heute", esc(bank_money(held * price))) + kv("Anteil am Konto", in_cash > 0 ? one(price * 100.0 / in_cash) + " %" : std::string("—")) +
kv("Im Bestand", number(held) + " Stück") + kv("Wert heute", esc(bank_money(held * price))) + (offer.contains("rent") ? kv("Miete je Stück", esc(bank_money(offer.at("rent").get<int64_t>())) + " / Monat") : std::string()) + kv("Anteil am Konto", in_cash > 0 ? one(price * 100.0 / in_cash) + " %" : std::string("—")) +
(offer.contains("maxToBuy") ? kv("Bezahlbar", number(offer.at("maxToBuy").get<int64_t>()) + " Stück") : kv("Auf dem Konto", esc(bank_money(in_cash)))) + "</div></div><div class=\"pg-col\" style=\"width:" + pg(300) + ";flex:none;justify-content:center;" + pg_css("gap:8px;") + "\">" +
calc("Kaufen", "property-buy", "primary bk-wide") + calc("Verkaufen", "property-sell", "bk-wide", held > 0) + "<span class=\"pg-mut\" style=\"display:block;text-align:center;font-size:" + pg(12.5) + ";\">Ein Haus am Brett anklicken, dann kaufen oder verkaufen.</span></div></div>";
} else if (bank_view_ == "stocks") {
+3 -2
View File
@@ -378,12 +378,12 @@ Json engine_bank_projection(const Json &bundle) {
const bool stock = std::string(key) == "stocks";
const auto dest = stock ? "stocks" : "properties";
const auto &rows = data.at(key);
require(rows.is_array() && !rows.empty() && rows.size() <= size_t(stock ? 12 : 6), "Ungültiger Bankkatalog.");
require(rows.is_array() && !rows.empty() && rows.size() <= size_t(stock ? 12 : 10), "Ungültiger Bankkatalog."); // six properties of the original, four of Modern
std::set<std::string> ids;
for (const auto &row : rows) {
const auto id = row.at("id").get<std::string>();
bool known = false;
for (int i = 0; i < (stock ? 12 : 6); ++i) known |= id == std::string(stock ? "stock:" : "fund:") + std::to_string(i);
for (int i = 0; i < (stock ? 12 : 10); ++i) known |= id == std::string(stock ? "stock:" : "fund:") + std::to_string(i);
require(known && ids.insert(id).second, "Unbekannte oder doppelte Bankanlage.");
const auto price = engine_money_minor(row.at("price"));
const int owned = whole_in_range(row.at("owned"), 0, 65535), max = whole_in_range(row.at("maxToBuy"), 0, 99999999);
@@ -402,6 +402,7 @@ Json engine_bank_projection(const Json &bundle) {
stocks += price * owned;
} else {
item["image"] = "bank.property." + id.substr(5);
if (row.contains("monthlyRent")) item["rent"] = engine_money_minor(row.at("monthlyRent"));
properties += price * owned;
}
assets[dest].push_back(item); finance[dest].push_back(owned);
+1 -1
View File
@@ -136,7 +136,7 @@ std::string App::render_tactics() {
// --- the page ---
std::string out = "<div class=\"pg-page\"><div class=\"pg-body\"><div class=\"tk-sketch\" id=\"tactics-sketch\" role=\"group\" aria-label=\"Taktikskizze\" style=\"width:" + scalar(sketch_w) + "dp;height:" + scalar(sketch_h) + "dp;margin-top:" +
scalar((1620 - sketch_h) / 2) + "dp;\">" + picture(renderer_.diagram("tactics-sketch-" + theme_, svg, 2088), sketch_w, sketch_h) + over + "</div><div class=\"pg-col pg-grow\"><strong class=\"tk-title\">Meine Taktik</strong><div class=\"pg-col pg-grow\" style=\"gap:0dp;\">";
scalar((1620 - sketch_h) / 2 - 62) + "dp;\">" + picture(renderer_.diagram("tactics-sketch-" + theme_, svg, 2088), sketch_w, sketch_h) + over + "</div><div class=\"pg-col pg-grow\"><strong class=\"tk-title\">Meine Taktik</strong><div class=\"pg-col pg-grow\" style=\"gap:0dp;\">";
for (size_t i = 0; i < 7; ++i) {
const bool toggle = i >= 5, on = values[i] > minima[i];
out += btn("tactic-cycle", pg_kicker(names[i], "width:122px;font-size:10px;") + "<span class=\"tk-value" + std::string(toggle && !on ? " off" : "") + "\">" + esc(toggle ? (on ? "an" : "aus") : text_of(i)) + "</span>", "tk-row",