ludic.things: a Thing's seats (a run of the game's seat rows, saved; a bit per seat taken, not); ludic.character: char_sit takes the seat's top and its height above the feet, char_sit_leave names where standing up goes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 19:39:43 +03:00
parent e84a59aeff
commit a22b8a572b
12 changed files with 107 additions and 11 deletions

View file

@ -266,4 +266,30 @@ program ThingsTest {
expect(r2 == r0)
expect_eq(third[0].kind, TH_LURE)
}
test "a Thing's seats: taken one at a time, left, saved without who sits in them" (things_st: mut ThingsState) {
things_clear(things_st)
let l = put(things_st, TH_LURE, 3.0, 4.0)
thing_set_seats(l, 7, 2)
expect_eq(thing_seat_free(l), 0)
expect(thing_seat_take(l, 0))
expect(not thing_seat_take(l, 0))
expect(not thing_seat_take(l, 2))
expect_eq(thing_seat_free(l), 1)
expect(thing_seat_take(l, 1))
expect_eq(thing_seat_free(l), -1)
thing_seat_leave(l, 0)
thing_seat_leave(l, 0)
expect_eq(thing_seat_free(l), 0)
let root = save_tree()
save_section(root, "things", 1, things_save(things_st))
let text = save_encode(root)
things_clear(things_st)
let n = load_section(save_decode(text), "things")
things_load(things_st, n.data, n.version)
let t = thing_find(things_st, TH_LURE, -1)
expect_eq(t.seat, 7)
expect_eq(t.seats, 2)
expect_eq(t.taken, 0)
}
}