summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-01-18 02:41:41 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:39 +0100
commitb3170df09473e62a85c1c8cc5b95dc8740a22562 (patch)
tree8b2e82d87c0385281c4689d50640e75d4a09b37f
parent0437281ed7e08343a1f70bd3b02af145e6265e66 (diff)
downloadnevsky-b3170df09473e62a85c1c8cc5b95dc8740a22562.tar.gz
Fix disbanding past calendar track.
-rw-r--r--play.js4
-rw-r--r--rules.js102
2 files changed, 55 insertions, 51 deletions
diff --git a/play.js b/play.js
index 7a8ab71..6539957 100644
--- a/play.js
+++ b/play.js
@@ -1124,7 +1124,9 @@ function update_lord(ix) {
ui.lord_service[ix].classList.remove("hide")
update_lord_mat(ix)
} else {
- calendar_layout_cylinder[locale - 100].push(ui.lord_cylinder[ix])
+ let t = locale - 100
+ if (t > 17) t = 17
+ calendar_layout_cylinder[t].push(ui.lord_cylinder[ix])
ui.lord_cylinder[ix].classList.remove("hide")
ui.lord_service[ix].classList.add("hide")
}
diff --git a/rules.js b/rules.js
index 59f43e2..4a325a2 100644
--- a/rules.js
+++ b/rules.js
@@ -531,9 +531,15 @@ function get_lord_calendar(lord) {
return get_lord_service(lord)
}
+function set_lord_cylinder_on_calendar(lord, turn) {
+ if (turn < 0) turn = 0
+ if (turn > 17) turn = 17
+ set_lord_locale(lord, CALENDAR + turn)
+}
+
function set_lord_calendar(lord, turn) {
if (is_lord_on_calendar(lord))
- set_lord_locale(lord, CALENDAR + turn)
+ set_lord_cylinder_on_calendar(lord, turn)
else
set_lord_service(lord, turn)
}
@@ -1441,10 +1447,6 @@ function locale_distance_by_waterway(from, to) {
// === SETUP ===
-function setup_lord_on_calendar(lord, turn) {
- set_lord_locale(lord, CALENDAR + turn)
-}
-
function muster_lord_forces(lord) {
let info = data.lords[lord]
set_lord_forces(lord, KNIGHTS, info.forces.knights | 0)
@@ -1683,8 +1685,8 @@ function setup_pleskau() {
muster_lord(LORD_GAVRILO, LOC_PSKOV, 4)
muster_lord(LORD_VLADISLAV, LOC_NEVA, 3)
- setup_lord_on_calendar(LORD_RUDOLF, 1)
- setup_lord_on_calendar(LORD_DOMASH, 1)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 1)
+ set_lord_cylinder_on_calendar(LORD_DOMASH, 1)
}
function setup_watland_1st_ed() {
@@ -1703,13 +1705,13 @@ function setup_watland_1st_ed() {
muster_lord(LORD_YAROSLAV, LOC_PSKOV, 5)
muster_lord(LORD_DOMASH, LOC_NOVGOROD, 7)
- setup_lord_on_calendar(LORD_HEINRICH, 4)
- setup_lord_on_calendar(LORD_RUDOLF, 4)
- setup_lord_on_calendar(LORD_VLADISLAV, 4)
- setup_lord_on_calendar(LORD_KARELIANS, 4)
- setup_lord_on_calendar(LORD_ANDREY, 5)
- setup_lord_on_calendar(LORD_ALEKSANDR, 7)
- setup_lord_on_calendar(LORD_HERMANN, 8)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 4)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 4)
+ set_lord_cylinder_on_calendar(LORD_VLADISLAV, 4)
+ set_lord_cylinder_on_calendar(LORD_KARELIANS, 4)
+ set_lord_cylinder_on_calendar(LORD_ANDREY, 5)
+ set_lord_cylinder_on_calendar(LORD_ALEKSANDR, 7)
+ set_lord_cylinder_on_calendar(LORD_HERMANN, 8)
}
function setup_watland_2nd_ed() {
@@ -1728,13 +1730,13 @@ function setup_watland_2nd_ed() {
muster_lord(LORD_DOMASH, LOC_NOVGOROD, 7)
muster_lord(LORD_VLADISLAV, LOC_LADOGA, 6)
- setup_lord_on_calendar(LORD_RUDOLF, 4)
- setup_lord_on_calendar(LORD_KARELIANS, 4)
- setup_lord_on_calendar(LORD_YAROSLAV, 5)
- setup_lord_on_calendar(LORD_ANDREY, 5)
- setup_lord_on_calendar(LORD_HEINRICH, 7)
- setup_lord_on_calendar(LORD_ALEKSANDR, 7)
- setup_lord_on_calendar(LORD_HERMANN, 8)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 4)
+ set_lord_cylinder_on_calendar(LORD_KARELIANS, 4)
+ set_lord_cylinder_on_calendar(LORD_YAROSLAV, 5)
+ set_lord_cylinder_on_calendar(LORD_ANDREY, 5)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 7)
+ set_lord_cylinder_on_calendar(LORD_ALEKSANDR, 7)
+ set_lord_cylinder_on_calendar(LORD_HERMANN, 8)
}
function setup_peipus() {
@@ -1760,11 +1762,11 @@ function setup_peipus() {
muster_lord(LORD_DOMASH, LOC_NOVGOROD, 16)
muster_lord(LORD_KARELIANS, LOC_NOVGOROD, 14)
- setup_lord_on_calendar(LORD_HEINRICH, 13)
- setup_lord_on_calendar(LORD_KNUD_ABEL, 13)
- setup_lord_on_calendar(LORD_RUDOLF, 13)
- setup_lord_on_calendar(LORD_GAVRILO, 13)
- setup_lord_on_calendar(LORD_VLADISLAV, 15)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 13)
+ set_lord_cylinder_on_calendar(LORD_KNUD_ABEL, 13)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 13)
+ set_lord_cylinder_on_calendar(LORD_GAVRILO, 13)
+ set_lord_cylinder_on_calendar(LORD_VLADISLAV, 15)
}
function setup_return_of_the_prince() {
@@ -1788,16 +1790,16 @@ function setup_return_of_the_prince() {
muster_lord(LORD_ANDREAS, LOC_KOPORYE, 12)
muster_lord(LORD_ALEKSANDR, LOC_NOVGOROD, 14)
- setup_lord_on_calendar(LORD_HERMANN, 9)
- setup_lord_on_calendar(LORD_RUDOLF, 9)
- setup_lord_on_calendar(LORD_YAROSLAV, 9)
- setup_lord_on_calendar(LORD_ANDREY, 9)
- setup_lord_on_calendar(LORD_KARELIANS, 9)
- setup_lord_on_calendar(LORD_GAVRILO, 9)
- setup_lord_on_calendar(LORD_VLADISLAV, 10)
- setup_lord_on_calendar(LORD_HEINRICH, 11)
- setup_lord_on_calendar(LORD_KNUD_ABEL, 11)
- setup_lord_on_calendar(LORD_DOMASH, 11)
+ set_lord_cylinder_on_calendar(LORD_HERMANN, 9)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 9)
+ set_lord_cylinder_on_calendar(LORD_YAROSLAV, 9)
+ set_lord_cylinder_on_calendar(LORD_ANDREY, 9)
+ set_lord_cylinder_on_calendar(LORD_KARELIANS, 9)
+ set_lord_cylinder_on_calendar(LORD_GAVRILO, 9)
+ set_lord_cylinder_on_calendar(LORD_VLADISLAV, 10)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 11)
+ set_lord_cylinder_on_calendar(LORD_KNUD_ABEL, 11)
+ set_lord_cylinder_on_calendar(LORD_DOMASH, 11)
}
function setup_return_of_the_prince_nicolle() {
@@ -1820,13 +1822,13 @@ function setup_return_of_the_prince_nicolle() {
muster_lord(LORD_ALEKSANDR, LOC_NOVGOROD, 14)
muster_lord(LORD_GAVRILO, LOC_PSKOV, 12)
- setup_lord_on_calendar(LORD_RUDOLF, 9)
- setup_lord_on_calendar(LORD_YAROSLAV, 9)
- setup_lord_on_calendar(LORD_ANDREY, 9)
- setup_lord_on_calendar(LORD_KARELIANS, 9)
- setup_lord_on_calendar(LORD_VLADISLAV, 10)
- setup_lord_on_calendar(LORD_HEINRICH, 11)
- setup_lord_on_calendar(LORD_DOMASH, 11)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 9)
+ set_lord_cylinder_on_calendar(LORD_YAROSLAV, 9)
+ set_lord_cylinder_on_calendar(LORD_ANDREY, 9)
+ set_lord_cylinder_on_calendar(LORD_KARELIANS, 9)
+ set_lord_cylinder_on_calendar(LORD_VLADISLAV, 10)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 11)
+ set_lord_cylinder_on_calendar(LORD_DOMASH, 11)
}
function setup_crusade_on_novgorod() {
@@ -1841,13 +1843,13 @@ function setup_crusade_on_novgorod() {
muster_lord(LORD_GAVRILO, LOC_PSKOV, 4)
muster_lord(LORD_VLADISLAV, LOC_NEVA, 3)
- setup_lord_on_calendar(LORD_ANDREAS, 3)
- setup_lord_on_calendar(LORD_HEINRICH, 1)
- setup_lord_on_calendar(LORD_RUDOLF, 1)
- setup_lord_on_calendar(LORD_DOMASH, 1)
- setup_lord_on_calendar(LORD_KARELIANS, 3)
- setup_lord_on_calendar(LORD_ALEKSANDR, 5)
- setup_lord_on_calendar(LORD_ANDREY, 5)
+ set_lord_cylinder_on_calendar(LORD_ANDREAS, 3)
+ set_lord_cylinder_on_calendar(LORD_HEINRICH, 1)
+ set_lord_cylinder_on_calendar(LORD_RUDOLF, 1)
+ set_lord_cylinder_on_calendar(LORD_DOMASH, 1)
+ set_lord_cylinder_on_calendar(LORD_KARELIANS, 3)
+ set_lord_cylinder_on_calendar(LORD_ALEKSANDR, 5)
+ set_lord_cylinder_on_calendar(LORD_ANDREY, 5)
}
function setup_pleskau_quickstart() {