Merge branch 'lang/memory-burn3' into lang/foundations
This commit is contained in:
commit
858544e231
11 changed files with 42 additions and 9 deletions
|
|
@ -76,7 +76,10 @@ export function update_translocated() -> bool {
|
|||
}
|
||||
|
||||
# can this copy update itself? A copy Velopack did not install downloads the game again instead.
|
||||
export function update_installed(update_st: UpdateState) -> bool {
|
||||
export function update_installed(update_st: UpdateState) -> bool { return update_st.update__installed }
|
||||
|
||||
@alloc_ok("once, when the updater is configured")
|
||||
function update__installed_now(update_st: UpdateState) -> bool {
|
||||
if len(update__conf(update_st).root) > 0 { return true }
|
||||
if update_translocated() { return false }
|
||||
if update__mac() { return Fs.exists(update_dir() + "/UpdateMac") }
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
# played are kept too (a launcher shows them)
|
||||
export function update_check_tick(update_st: mut UpdateState, show_current: bool) -> void {
|
||||
if update_st.update__ask == UPDATE_ASK_IDLE {
|
||||
@alloc_ok("the feed's address: once, when the check starts")
|
||||
update_st.update__ask_h = UpdateNet.get(update__conf(update_st).feed + "/" + update__conf(update_st).latest)
|
||||
update_st.update__ask = UPDATE_ASKING
|
||||
if update_st.update__ask_h < 0 { update_st.update__ask = UPDATE_NONE }
|
||||
|
|
@ -36,16 +37,23 @@ export function update_latest(update_st: UpdateState) -> string { return update_
|
|||
export function update_shown(update_st: UpdateState) -> bool { return update_st.update__ask == UPDATE_NEWER or update_st.update__ask == UPDATE_CURRENT }
|
||||
export function update_fresh(update_st: UpdateState) -> bool { return update_st.update__ask == UPDATE_NEWER }
|
||||
|
||||
# the notes in this language, else English, else none
|
||||
export function update_notes(update_st: UpdateState, lang: string) -> []string {
|
||||
let out = new []string
|
||||
if update_st.update__notes == null or Value.kind(update_st.update__notes) != 6 { return out }
|
||||
# the notes in the language the game asked for (update_notes_for), else English, else none
|
||||
export function update_notes(update_st: UpdateState, lang: string) -> []string { return update_st.update__notes_list }
|
||||
|
||||
# the notes kept for this language: filled when the version or the language changes, so the panel
|
||||
# reading them every frame makes nothing
|
||||
export function update_notes_for(update_st: mut UpdateState, lang: string) -> void {
|
||||
if (update_st.update__notes_lang == lang) and (update_st.update__notes_of == update_st.update__latest) { return }
|
||||
update_st.update__notes_lang = lang
|
||||
update_st.update__notes_of = update_st.update__latest
|
||||
let out = update_st.update__notes_list
|
||||
List.clear(out)
|
||||
if update_st.update__notes == null or Value.kind(update_st.update__notes) != 6 { return }
|
||||
var key = lang
|
||||
if Value.has(update_st.update__notes, key) == 0 { key = "en" }
|
||||
if Value.has(update_st.update__notes, key) == 0 { return out }
|
||||
if Value.has(update_st.update__notes, key) == 0 { return }
|
||||
let l = Value.get(update_st.update__notes, key)
|
||||
for i in 0 .. Value.count(l) { push(out, Value.as_str(Value.at(l, i))) }
|
||||
return out
|
||||
for i in 0 .. Value.count(l) { push(update_st.update__notes_list, Value.as_str(Value.at(l, i))) }
|
||||
}
|
||||
|
||||
# back to before anything was asked or installed (tests)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ export state UpdateState {
|
|||
update__ask_h: int = -1
|
||||
update__latest: string = ""
|
||||
update__notes: Val = null
|
||||
update__installed: bool = false # worked out when configured: the panel asks every frame
|
||||
@max(256) update__notes_list: []string = new []string # the notes in the language last asked, kept
|
||||
update__notes_lang: string = ""
|
||||
update__notes_of: string = "" # ... for this version
|
||||
update__cfg: UpdateConfig = new UpdateConfig
|
||||
update__state: int = 0
|
||||
update__err: int = 0
|
||||
|
|
@ -80,7 +84,10 @@ export state UpdateState {
|
|||
update__facts: Queue<UpdateFact> = update__facts__new()
|
||||
}
|
||||
|
||||
export function update_config(update_st: mut UpdateState, c: UpdateConfig) -> void { update_st.update__cfg = c }
|
||||
export function update_config(update_st: mut UpdateState, c: UpdateConfig) -> void {
|
||||
update_st.update__cfg = c
|
||||
update_st.update__installed = update__installed_now(update_st)
|
||||
}
|
||||
|
||||
function update__conf(update_st: UpdateState) -> UpdateConfig {
|
||||
return update_st.update__cfg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue