Holiday switch in the debug menu; darker wood for the treasury chests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f670554c7
commit
4175ca7f97
24 files changed
+112
-8
No files matched your search
+17
-2
@@ -53,12 +53,27 @@ pub fn holiday_on(y: i64, m: i64, d: i64) -> u8 {
|
||||
}
|
||||
}
|
||||
|
||||
// today's holiday (worked out once); on the desktop DUNGEONCRAFT_HOLIDAY=halloween / christmas /
|
||||
// easter / none shows one at any time
|
||||
thread_local! {
|
||||
// the debug menu's choice: 0 by the date, else the holiday + 1
|
||||
static OVERRIDE: std::cell::Cell<u8> = const { std::cell::Cell::new(0) };
|
||||
}
|
||||
|
||||
// the debug menu's holiday setting (Settings::debug_holiday: 0 by the date, 1 none, 2 Halloween,
|
||||
// 3 Christmas, 4 Easter)
|
||||
pub fn set_override(v: u8) {
|
||||
OVERRIDE.with(|o| o.set(v.min(4)));
|
||||
}
|
||||
|
||||
// today's holiday (worked out once) unless the debug menu picks one; on the desktop
|
||||
// DUNGEONCRAFT_HOLIDAY=halloween / christmas / easter / none shows one at any time
|
||||
pub fn current() -> u8 {
|
||||
thread_local! {
|
||||
static HOLIDAY: std::cell::Cell<u8> = const { std::cell::Cell::new(255) };
|
||||
}
|
||||
let forced = OVERRIDE.with(|o| o.get());
|
||||
if forced > 0 {
|
||||
return forced - 1;
|
||||
}
|
||||
HOLIDAY.with(|h| {
|
||||
if h.get() == 255 {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
Reference in new issue
Block a user