summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-02-16 13:37:02 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commit47bad1e560b1b39d5d7c9768284e0d3fda8e0995 (patch)
tree703a635624e3b7b6e2617374dfb61762f653a01c
parent4ba0e3b5a53717f0d854877417365c7381202ea0 (diff)
downloadwilderness-war-47bad1e560b1b39d5d7c9768284e0d3fda8e0995.tar.gz
WIP DEBUG SUPPLY LINES
-rw-r--r--rules.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 31eb917..3d141b1 100644
--- a/rules.js
+++ b/rules.js
@@ -1923,6 +1923,25 @@ function search_supply_spaces() {
}
}
+function goto_debug_supply(role) {
+ if (game.state === 'debug_supply') {
+ pop_undo();
+ } else {
+ push_undo();
+ set_active(role);
+ game.state = 'debug_supply';
+ }
+}
+
+states.debug_supply = {
+ prompt() {
+ search_supply_spaces();
+ view.prompt = "Showing supply lines.";
+ supply_cache.forEach(gen_action_space);
+ },
+ space: pop_undo
+}
+
function is_in_supply(space) {
if (!supply_cache)
search_supply_spaces();
@@ -8087,6 +8106,8 @@ exports.action = function (state, current, action, arg) {
} else {
if (action === 'undo' && game.undo && game.undo.length > 0)
pop_undo();
+ else if (action === 'supply')
+ goto_debug_supply(current);
else
throw new Error("Invalid action: " + action);
}