The bank's services as sheets with charts and readings

Every service has the house's head and tabs to the others. The overview shows the
club's wealth as a ring by where it lies and the stock market's change per company;
stocks carry a spark line, the change on the day before, the course with a five-day
average, high and low, and a reading of trend and swing; properties compare the six
prices. Stocks and properties are named in full by the bank read: the company from the
game's texts, the property from its stem and singular ending. Soft shadows inside
windows are gone, they drew stray lines in the Direct3D renderer.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 20:24:52 +01:00
1 parent 143e45e3a2
commit e3edd2f9ed
13 files changed
+422 -84

No files matched your search

+29 -7
View File
@@ -98,22 +98,44 @@ bool App::engine_bank_action(const std::string &action, Rml::Element *target) {
open_amount(std::move(request)); return true;
}
std::string App::engine_credit_view() {
std::string out = "<h2>Kredit</h2><div class=\"credit-portrait\">" + img("art.bank-adviser-v1.png", 620, 515, false, false, 1000) + "</div>";
std::string out = "<div class=\"credit-portrait\">" + img("art.bank-adviser-v1.png", 620, 515, false, false, 1000) + "</div>";
Json data;
try { data = engine_credit_projection(engine_data_, engine_credit_); }
catch (const std::exception &) { return out + "<p class=\"bank-note\">Der Bankkredit ist in diesem Kontext nicht verfügbar.</p>"; }
out += "<div class=\"credit-facts\" style=\"top:135dp;height:520dp;\">";
// the original's labels arrive in capitals: one capital per word reads calmer
const auto calm = [](std::string text) {
bool first = true;
for (size_t i = 0; i < text.size(); ++i) {
const unsigned char c = static_cast<unsigned char>(text[i]);
if (c == 0xc3 && i + 1 < text.size()) {
unsigned char next = static_cast<unsigned char>(text[i + 1]);
if (!first && (next == 0x84 || next == 0x96 || next == 0x9c)) text[i + 1] = static_cast<char>(next + 0x20);
++i; first = false;
} else if (std::isalpha(c)) { if (!first) text[i] = static_cast<char>(std::tolower(c)); first = false; }
else if (c == ' ' || c == '-') first = true;
}
return text;
};
out += "<div class=\"credit-facts engine-credit\">";
int64_t total = 0, paid = 0;
for (size_t i = 0; i < 8; ++i) {
const auto &f = data.at("fields")[i]; const auto value = f.at("value").get<int64_t>();
if (i == 1) total = value;
if (i == 5) paid = value;
const auto text = i == 3 || i == 4 ? number(value) + " Monate" : money(value * 100, {{"code", "EUR"}, {"minor_units", 2}});
out += "<div class=\"credit-fact\" style=\"top:" + std::to_string(i * 65) + "dp;font-size:30dp;\"><span>" + esc(engine_text(f.at("label"))) + "</span><strong>";
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += btn("engine-credit-edit", esc(text), "bank-control", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\" style=\"width:780dp;height:56dp;font-size:30dp;\"");
out += "<div class=\"credit-fact\" style=\"top:" + std::to_string(i * 64) + "dp;\"><span>" + esc(calm(engine_text(f.at("label")))) + "</span><strong>";
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += btn("engine-credit-edit", esc(text), "bank-control", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"");
else out += esc(text);
out += "</strong></div>";
}
out += "</div><figure class=\"credit-schedule\"><div class=\"credit-schedule-caption\"><h3>Kreditvorschau</h3></div>";
out += "<div style=\"position:absolute;top:140dp;left:60dp;right:60dp;font-size:39dp;line-height:1.8;\"><p>Gebühren: " + esc(engine_price(data.at("fees"))) + "</p><p>Erstattung: " + esc(engine_price(data.at("refund"))) + "</p><p>Bereits getilgter Betrag: " + esc(engine_price(data.at("principalPaid"))) + "</p></div>";
out += "<p class=\"credit-schedule-note\">" + std::string(data.at("saved")[0] == 0 ? "Die Engine berechnet Laufzeit, Raten und Gebühren. Änderungen erst nach Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</p></figure>";
out += "</div><figure class=\"credit-schedule engine-credit\"><div class=\"credit-schedule-caption\"><h3>Kreditvorschau</h3></div><div class=\"stock-tiles credit-tiles\">";
for (const auto &[label, key] : std::array<std::pair<const char *, const char *>, 3>{{{"Gebühren", "fees"}, {"Erstattung", "refund"}, {"Bereits getilgt", "principalPaid"}}})
out += "<div class=\"stock-tile\"><strong>" + esc(engine_price(data.at(key))) + "</strong><span>" + label + "</span></div>";
// how much of the whole sum is paid back
const double done = total > 0 ? std::clamp(double(paid) * 100.0 / double(total), 0.0, 100.0) : 0;
out += "</div><div class=\"credit-progress\"><div class=\"credit-progress-label\"><span>Zurückgezahlt</span><strong>" + (total > 0 ? std::to_string(int(std::lround(done))) + " %" : std::string("kein Kredit")) +
"</strong></div><div class=\"bank-part-track\"><div style=\"width:" + scalar(done) + "%;\"></div></div></div>";
out += "<p class=\"credit-schedule-note\">" + std::string(data.at("saved")[0] == 0 ? "Die Bank berechnet Laufzeit, Raten und Gebühren. Gebucht wird erst nach deiner Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</p></figure>";
out += "<nav class=\"bank-actions\">" + btn("engine-credit-reset", "Zurücksetzen", "bank-control", "id=\"engine-credit-reset\"") + btn("engine-credit-apply", "Verbindlich buchen", "bank-control", "id=\"engine-credit-apply\" " + std::string(engine_credit_edits_.empty() ? "disabled" : "")) + "</nav>";
return out;
}