From 8570a62235e5e9b6a6d719fd8b92cedc91a1d511 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Sat, 29 Feb 2020 01:03:46 -0500 Subject: Implement the causal.agency/consumer capability --- ui.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index d6f79c2..b3f3b09 100644 --- a/ui.c +++ b/ui.c @@ -960,7 +960,8 @@ void uiRead(void) { static const time_t Signatures[] = { 0x6C72696774616301, // no heat, unread, unreadWarm - 0x6C72696774616302, + 0x6C72696774616302, // no self.pos + 0x6C72696774616303, }; static size_t signatureVersion(time_t signature) { @@ -981,7 +982,8 @@ int uiSave(const char *name) { FILE *file = dataOpen(name, "w"); if (!file) return -1; - if (writeTime(file, Signatures[1])) return -1; + if (writeTime(file, Signatures[2])) return -1; + if (writeTime(file, self.pos)) return -1; for (uint num = 0; num < windows.len; ++num) { const struct Window *window = windows.ptrs[num]; if (writeString(file, idNames[window->id])) return -1; @@ -1032,6 +1034,10 @@ void uiLoad(const char *name) { } size_t version = signatureVersion(signature); + if (version > 1) { + self.pos = readTime(file); + } + char *buf = NULL; size_t cap = 0; while (0 < readString(file, &buf, &cap)) { -- cgit 1.4.1-2-gfad0