From a650fe7faf40b2101cae11895c201e17b3561ef8 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 21 Mar 2024 22:49:50 +0100 Subject: [PATCH] YASC codes work better if killed on a 10+ tile --- checkmove.cpp | 7 ++++++- quit.cpp | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/checkmove.cpp b/checkmove.cpp index 8cf3ba10..f6917ccb 100644 --- a/checkmove.cpp +++ b/checkmove.cpp @@ -399,6 +399,11 @@ EX void create_yasc_message() { println(hlog, "YASC_MESSAGE: ", yasc_message); } +int yasc_recode(int x) { + if(cwt.at->type < 10 || x == 0) return x; + return yasc_recode(x / 10) * 100 + (x % 10); + }; + EX void checkmove() { if(dual::state == 2) return; @@ -443,7 +448,7 @@ EX void checkmove() { yasc_code = 0; for(int i=0; itype; i++) - yasc_code += move_issues[i].type; + yasc_code += yasc_recode(move_issues[i].type); if(!canmove && bow::crossbow_mode() && !items[itCrossbow]) canmove = bow::have_bow_target(); diff --git a/quit.cpp b/quit.cpp index ea6ae16d..8610e204 100644 --- a/quit.cpp +++ b/quit.cpp @@ -32,6 +32,17 @@ EX string getgametime_s(int timespent IS(getgametime())) { EX bool display_yasc_codes; +string formatted_yasc_code() { + if(yasc_code < 100000) return its(yasc_code); + int y = yasc_code; + string out; + while(y >= 100) { + out = "-" + its(y%100) + out; + y /= 100; + } + return its(y) + out; + } + string timeline() { string s; if(shmup::on) @@ -39,7 +50,7 @@ string timeline() { else { s = XLAT("%1 turns (%2)", its(turncount), getgametime_s()); if(display_yasc_codes) - s+= XLAT(" YASC code: ") + its(yasc_code); + s+= XLAT(" YASC code: ") + formatted_yasc_code(); } return s; }