refactor(packages): 0.R5 - jobs, session, settings, hints and net make their tables when the state is made, not on the first question (jobs__ensure, session__init and ply_init, sg_init, hn_mute_ensure, net__init gone); their questions read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
63c30b9ebe
commit
9e4f4edb92
21 changed files with 98 additions and 163 deletions
|
|
@ -1,12 +1,12 @@
|
|||
# posts.ludic - what is on a board, slot by slot, and a board as the host says it
|
||||
export function jobs_post_kind(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pk[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_param(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pp[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_need(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pn[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_have(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__ph[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_money(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pm[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_rep(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pr[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_state(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__ps[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_day(jobs_st: mut JobsState, b: int, s: int) -> int { return jobs_st.jobs__pd[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_kind(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pk[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_param(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pp[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_need(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pn[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_have(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__ph[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_money(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pm[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_rep(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pr[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_state(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__ps[jobs__at(jobs_st, b, s)] }
|
||||
export function jobs_post_day(jobs_st: JobsState, b: int, s: int) -> int { return jobs_st.jobs__pd[jobs__at(jobs_st, b, s)] }
|
||||
|
||||
export function jobs_slots(b: int) -> int {
|
||||
if not jobs_board_ok(b) { return 0 }
|
||||
|
|
@ -14,21 +14,20 @@ export function jobs_slots(b: int) -> int {
|
|||
}
|
||||
|
||||
# the slots with something posted, in order
|
||||
export function jobs_posted(jobs_st: mut JobsState, b: int) -> []int {
|
||||
export function jobs_posted(jobs_st: JobsState, b: int) -> []int {
|
||||
let out = new []int
|
||||
for s in 0 .. jobs_slots(b) { if jobs_post_kind(jobs_st, b, s) >= 0 { push(out, s) } }
|
||||
return out
|
||||
}
|
||||
|
||||
# how many of a board's posts are paid
|
||||
export function jobs_posts_done(jobs_st: mut JobsState, b: int) -> int {
|
||||
export function jobs_posts_done(jobs_st: JobsState, b: int) -> int {
|
||||
var n = 0
|
||||
for s in 0 .. jobs_slots(b) { if jobs_post_kind(jobs_st, b, s) >= 0 and jobs_post_state(jobs_st, b, s) == JOBS_DONE { n += 1 } }
|
||||
return n
|
||||
}
|
||||
|
||||
export function jobs_total(jobs_st: mut JobsState, b: int) -> int {
|
||||
jobs__ensure(jobs_st)
|
||||
export function jobs_total(jobs_st: JobsState, b: int) -> int {
|
||||
return jobs_st.jobs__total[b]
|
||||
}
|
||||
|
||||
|
|
@ -46,6 +45,5 @@ export function jobs_post_set(jobs_st: mut JobsState, b: int, s: int, kind: int,
|
|||
}
|
||||
|
||||
export function jobs_set_total(jobs_st: mut JobsState, b: int, n: int) -> void {
|
||||
jobs__ensure(jobs_st)
|
||||
jobs_st.jobs__total[b] = n
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue