refactor(packages): 0.R5 - a question no longer starts its state - 64 lazy starts ('if st.x == null { st.x = ... }' inside a getter) are the state's defaults, gear__ensure is gone, and ludic migrate state --tighten took mut off 208 package parameters: things_all, thing_find, gear_charge, gear_level, jobs_state and the rest read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
54f5efb23f
commit
9862ec82e3
102 changed files with 320 additions and 351 deletions
|
|
@ -54,17 +54,16 @@ export state PhotoState {
|
|||
pht_pending_stars: bool = false
|
||||
pht_comp: []float = null # size, framing, light, moment of the last subject scored
|
||||
pht_comp_have: bool = false
|
||||
pht_fact_q: Queue<PhotoFact> = null
|
||||
pht_fact_q: Queue<PhotoFact> = pht_fact_q__new()
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function photo_facts(photo_st: mut PhotoState) -> Queue<PhotoFact> {
|
||||
if photo_st.pht_fact_q == null { photo_st.pht_fact_q = queue_new("photo.facts") }
|
||||
export function photo_facts(photo_st: PhotoState) -> Queue<PhotoFact> {
|
||||
return photo_st.pht_fact_q
|
||||
}
|
||||
|
||||
function pht_fact(photo_st: mut PhotoState, what: int, i: int) -> PhotoFact {
|
||||
function pht_fact(photo_st: PhotoState, what: int, i: int) -> PhotoFact {
|
||||
let f = new PhotoFact
|
||||
f.what = what
|
||||
f.index = i
|
||||
|
|
@ -100,3 +99,4 @@ function pht_blank(photo_st: mut PhotoState) -> void {
|
|||
photo_st.pht_comp = pht_floats(4)
|
||||
photo_st.pht_comp_have = false
|
||||
}
|
||||
function pht_fact_q__new() -> Queue<PhotoFact> { return queue_new("photo.facts") }
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ program PhotoTest {
|
|||
photo_test_st.sun_z = 0.0
|
||||
photo_test_st.behaviour = false
|
||||
}
|
||||
function facts(photo_st: mut PhotoState) -> []PhotoFact { return q_drain(photo_facts(photo_st)) }
|
||||
function facts(photo_st: PhotoState) -> []PhotoFact { return q_drain(photo_facts(photo_st)) }
|
||||
function count(fs: []PhotoFact, what: int) -> int {
|
||||
var n = 0
|
||||
for i in 0 .. len(fs) { if fs[i].what == what { n += 1 } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue