-- Hunger, thirst, fullness and drink -- ROM's pcdata->condition[4].
--
-- The author, 20 August: "Yes that's a treat way to do it. We can execute eat/drink/drunk next."
-- These are the four numbers `eat` and `drink` move, and without them the two commands would work
-- perfectly until you logged out and then hand you back a character who had never eaten.
--
-- FOUR COLUMNS RATHER THAN ONE PACKED WORD, which is the opposite of what 0015 did with
-- player_flags, and the difference is that these are QUANTITIES and those were bits. Packing four
-- numbers into an integer means shifting and masking on every read for no gain, and it would make
-- `SELECT name, hunger FROM characters ORDER BY hunger` -- exactly the query somebody debugging a
-- report of "I keep getting hungry" would want -- impossible.
--
-- ROM writes them as one line, `Cond %d %d %d %d`, for the same reason it writes everything on one
-- line: it is a text file with no schema. That is not an argument for doing it here.
--
-- ---------------------------------------------------------------------------------------------
-- WHY THE DEFAULTS ARE 0, 48, 48, 48 AND NOT ALL 48
-- ---------------------------------------------------------------------------------------------
--
-- save.c:857-859 sets thirst, full and hunger to 48 on a new character and leaves drunk alone at
-- zero, so a new character is fed, watered and sober. Defaulting drunk to 48 would hand every
-- existing row a character who is falling-down drunk and cannot drink, speak clearly, or work out
-- why -- and the only cure is waiting 48 ticks. Every row in this table predates the feature, so
-- every one of them takes the default; getting it wrong here is not a hypothetical.
--
-- 48 IS ROM'S CEILING, from URANGE(0, condition + value, 48) in gain_condition. Nothing writes
-- higher and nothing needs to; a CHECK constraint is deliberately not added because sqlite would
-- then reject a save rather than clamping it, and a rejected save loses a whole character over a
-- number that only affects how fast they heal.
--
-- -1 IS LEGAL AND MEANS "NEVER CHANGES" -- ROM's exemption marker, `if (condition == -1) return`.
-- Nothing in this codebase writes it. It is named here so that a -1 found in this table later is
-- recognised as deliberate rather than as corruption.

ALTER TABLE characters ADD COLUMN cond_drunk  INTEGER NOT NULL DEFAULT 0;
ALTER TABLE characters ADD COLUMN cond_full   INTEGER NOT NULL DEFAULT 48;
ALTER TABLE characters ADD COLUMN cond_thirst INTEGER NOT NULL DEFAULT 48;
ALTER TABLE characters ADD COLUMN cond_hunger INTEGER NOT NULL DEFAULT 48;
