chiark / gitweb /
Ian Jackson [Sat, 30 Apr 2022 15:43:44 +0000 (16:43 +0100)]
Introduce and use PiceTrait downcaste_piece extension methoc
This is more convenient.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 15:32:35 +0000 (16:32 +0100)]
gamestate: Add divider comment
We're going to add more above here, and it's getting big.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:28:43 +0000 (13:28 +0100)]
fastsplit: Move Z check from multigrab into fastsplit impl
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:24:21 +0000 (13:24 +0100)]
fastsplit: Correct z order
This was back to front.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:21:34 +0000 (13:21 +0100)]
Reorganise Z setting into two phases
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:21:00 +0000 (13:21 +0100)]
Move op_do_set_z to gamestate
This is preparatory, to reduce diff noise. We're going to change the
way this works in a moment.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 11:05:12 +0000 (12:05 +0100)]
fastsplit: Move a comment to its right place
Some time in the development of this, pre-squash, kthe modperm was
acquired within the infallible closure. But when it was moved,
evidently the comment didn't move with it. Fix that.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 09:58:53 +0000 (10:58 +0100)]
fastsplit: Fix recovery
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 01:24:13 +0000 (02:24 +0100)]
currency: Fix and improve multigrab (splitting) log message
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 01:21:05 +0000 (02:21 +0100)]
multigrab/fastsplit: Plumb ShowUnocculted and &PieceTrait
The implementation doesn't really want PieceRenderingInstructions,
just permission to get at trait objects.
The currency fastsplit implementation callback is going to want to
look at its Banknote so that it can make a nice log message. I think
fastsplit piece impls are entitled access to their concret piece type.
So downcast it, and pass it down the layers.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 01:21:13 +0000 (02:21 +0100)]
PieceTrait: impl Downcast
We're going to want this in a moment.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:13:12 +0000 (13:13 +0100)]
currency: Many fixes to splitting
This was quite broken.
* Actually set the value of the new (change) piece.
* Set the value of tghe taken piece correctly.
* Set the WRC so that clients see the taken piece value.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:13:07 +0000 (13:13 +0100)]
currency: Move some assignments about
Tidying up. No functional change.
(Was originally part of the next, bugfix, commit.)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 12:10:38 +0000 (13:10 +0100)]
currency: Rename value
Having the two pieces here is confusing. All the variables should say
which piece they are.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 15:32:20 +0000 (16:32 +0100)]
currency: wip test
So far we test that splitting appears to succeed, but not what the
results look like.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 23:01:39 +0000 (00:01 +0100)]
currency: Implement op_multigrab and therefore splitting
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
ng
Ian Jackson [Sat, 30 Apr 2022 10:14:23 +0000 (11:14 +0100)]
fastsplit: Implement splitting
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 22:58:31 +0000 (23:58 +0100)]
currency: Make currency pieces be fastsplit
The actual machinery does all the hard work.
This shouldn't have any overall visible functional change. It just
engages new contraptions during piece creation and load/save, but
right now they shouldn't have any work to do because we don't actually
ever split (or merge) currency.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 10:14:17 +0000 (11:14 +0100)]
fastsplit: Add some imprecations about not dropping FastSplitId
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 20 Apr 2022 08:40:03 +0000 (09:40 +0100)]
fastsplit: Introduce fastsplit concept
This has all the relevant data structures and support code, but does
not yet implemnet the actual splitting and deleting/merging
operations which will be needed for the piece api op impls.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 11:46:08 +0000 (12:46 +0100)]
Drop an unneeded lifetime argument
This is not needed. (I'm not sure whether I did this because
ambassador didn't like the lifetime argument, or just because I saw it
in passing.)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Apr 2022 19:19:23 +0000 (20:19 +0100)]
ambassador: Introduce dependency and make some traits delegatiable
fastsplit pieces are going to want to delegate everything. Not only
is this a lot of typing, open-coding it risks bugs when new trait
methods are added.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 11:42:01 +0000 (12:42 +0100)]
multigrab: Set the z coordinate
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 22:13:20 +0000 (23:13 +0100)]
Break out op_do_set_z
We're going to make multigrab do z setting too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 30 Apr 2022 10:43:45 +0000 (11:43 +0100)]
multigrab: Check that the piece is not held
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 23:54:02 +0000 (00:54 +0100)]
Have OpOutcomeThunk::Deferrecd take &mut InstanceGuard
That way it can call modify_pieces_not_necessarily_saving_aux, which
the fastsplit_split implementaion wants.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 22:13:33 +0000 (23:13 +0100)]
api: setz: Avoid an unwrap
Panicking is worse than failing. Spotted this in passing.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 21:17:10 +0000 (22:17 +0100)]
ModifyingPieces: Provide on-your-own-head constructors, and doc
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 20:37:17 +0000 (21:37 +0100)]
Document z coordinate sense convention
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 21:52:01 +0000 (22:52 +0100)]
script: multigrab: swap two if arms
This seems clearer, by putting the usual case first.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 21:46:17 +0000 (22:46 +0100)]
script: piece_raise: allow overriding the actual implementation
We're going to need to do something else for multigrab.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 22:49:16 +0000 (23:49 +0100)]
Change type of UnpreparedPreparedUpdates
We're going to want to compose this in an additional place. And all
this Option and None is awkward.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 23:05:35 +0000 (00:05 +0100)]
Introduce and use PrepareUpdatesBuffer::only_unprepared_with
This saves us writing `if unprepared.len() != 0`. I think that
pattern is asking for a reversed conditional at one random site.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 22:54:05 +0000 (23:54 +0100)]
Introduce and use methods for applying UnpreparedUpdates
There are quite a few call sites where the nature of an
UnpreparedUpdates is open-coded.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 29 Apr 2022 22:49:08 +0000 (23:49 +0100)]
Use default() for empty UnpreparedUpdates, not None
We are going to make this into a vec![]. Doing this change now will
reduce the textual impact a lot.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Apr 2022 08:51:01 +0000 (09:51 +0100)]
Drop use of fehler in PieceTrait definition, for ambassador
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Apr 2022 09:36:51 +0000 (10:36 +0100)]
occult ilks: Provide clone_id and clone_iilk
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 19 Apr 2022 18:58:32 +0000 (19:58 +0100)]
Introduce OpOutcomeThunk
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 22 Apr 2022 18:26:29 +0000 (19:26 +0100)]
Introduce PieceLoadArgs
So that we can add more parameters to PieceTrait::load() without
having to edit everywhere *again*.
In fact it turns out I don't need to do this right now (for currency
and fastsplit) but I think it's worth keeping.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Apr 2022 00:58:32 +0000 (01:58 +0100)]
PieceUpdateOps: Tabular formattint
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Apr 2022 22:55:48 +0000 (23:55 +0100)]
Introduce non-Quiet PUO::Insert
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Apr 2022 00:46:07 +0000 (01:46 +0100)]
ts: Break out insert_piece function.
We'll reuse this for non-Quiet Insert. Have it return p for
convenience.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Apr 2022 00:43:30 +0000 (01:43 +0100)]
Rename PUO::Insert to InsertQuiet
This doesn't produce a halo, so it's Quiet. We're going to want one
which *does* produce a halo, so we must make room.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Apr 2022 00:15:01 +0000 (01:15 +0100)]
Introduce and use xdata_init
Using get_mut for this seems slightly less careful.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 21:33:35 +0000 (22:33 +0100)]
Document what PUO::*Quiet mean
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Apr 2022 18:09:51 +0000 (19:09 +0100)]
Document OccultOwningId serialisation and refcount rules
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 22:49:40 +0000 (23:49 +0100)]
fix serde_with_compat attribute syntax
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Apr 2022 20:49:20 +0000 (21:49 +0100)]
Switch to Rust 2021
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 22:45:18 +0000 (23:45 +0100)]
PROTOCOL.md: fix a typo
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 00:26:28 +0000 (01:26 +0100)]
hidden: Add checks for un-notched to vpid::consistency_check
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 21:12:40 +0000 (22:12 +0100)]
fake rng: Remove an Arc
We don't in fact need this to be Clone, now that ServerConfig isn't.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 00:02:21 +0000 (01:02 +0100)]
at-hidden: Add some more synch, just to complete things
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 22:29:41 +0000 (23:29 +0100)]
at-hidden: Add more test, completing repro of unnotched bug
This test fails without the unnotched piece tracking.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 00:01:20 +0000 (01:01 +0100)]
hidden: Fix handling of unnotched (Distinct) pieces
We need to un-occult them. But we were tracking what to recompute by
looking in occ.notches. Un-notched pieces aren't there.
Introduce a new HashSet for these.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 23:41:55 +0000 (00:41 +0100)]
hidden: Refactor a bit in preparation for unnotched pieces fix
In both of these places, we're going to want to do something if there
is an occultation but notch is None.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Apr 2022 00:01:05 +0000 (01:01 +0100)]
hidden: Have active_total_ppieces return usize
The fix for the un-notched pieces bug is going to want to add a
HashMap len to this, and that's usize.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 23:50:13 +0000 (00:50 +0100)]
hidden: Introduce Occultation::pieces
This is going to want to return un-notched pieces too. Fix both sites
where we iterate over the notches.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 22:12:17 +0000 (23:12 +0100)]
at-hidden: Engage fake time feature
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 21:16:47 +0000 (22:16 +0100)]
tests: Enable the fake time feature
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 22:41:13 +0000 (23:41 +0100)]
fake time: Make fields pub that should be
We want this for FakeTimeSpec in a test case.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 21:47:15 +0000 (22:47 +0100)]
fake time: Fix config deserialisation
Option works weirdly, empirically. This (via a Vec) is what we want.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 21:19:49 +0000 (22:19 +0100)]
dice: Honour fake time feature
Really we should make this more pervasive, but this is what we need
right now.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 20:18:58 +0000 (21:18 +0100)]
fake time: Introduce new feature
Needs a little work still, and not used.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 21:10:41 +0000 (22:10 +0100)]
Make ServerConfig not be Clone
We're going to put GlobalClock in it. It doesn't actually want to be
Clone since it's a singleton.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 15:25:19 +0000 (16:25 +0100)]
tests: at-hidden: wip test
This currently passes, and therefore didn't repro the un-notched piece
bug which I have been trying to repro and fix. But it's a start.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 23:10:48 +0000 (00:10 +0100)]
logging: In api_piece_op, log the form too
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 23:10:42 +0000 (00:10 +0100)]
tests: Increase debug traceing of hidden and updates
I wanted this for debugging the unnotched piece crash. It seems fine
to keep it.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 20:02:23 +0000 (21:02 +0100)]
dice: Allow loading old savefiles with no desc field
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 18:34:14 +0000 (19:34 +0100)]
apitest: Break out filter_by_desc_glob etc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 15:45:01 +0000 (16:45 +0100)]
demo game: Give the dice descriptions
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 15:44:46 +0000 (16:44 +0100)]
dice: Support specifying the html description in the spec
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 15:40:29 +0000 (16:40 +0100)]
dice: Refactor describe_html to prep for desc
Break out showing so that we don't have combinatorical description
formats.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 15:35:14 +0000 (16:35 +0100)]
demo game: Make the 2-sided die a disc
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 11:36:23 +0000 (12:36 +0100)]
Fix many dbgc calls to be trace_dbg instead
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 11:37:32 +0000 (12:37 +0100)]
Fix trace_dbg to tolerate call without any value parameters
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 11:26:57 +0000 (12:26 +0100)]
Move logging::setup out of main.rs
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Apr 2022 11:18:11 +0000 (12:18 +0100)]
logging: Change output formats
Format is like that from flexi_logger but with only the level
coloured.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 19:03:38 +0000 (20:03 +0100)]
currency: Move qty into xdata
When we multigrab, we must split, which involves mutating the value of
the grabbed piece. So the value must be in xdata, not ipc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 16:10:58 +0000 (17:10 +0100)]
at-otter: Fix a ref to PIA that ought to be PIB.
I think.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 15:23:47 +0000 (16:23 +0100)]
currency: Abolish min_unit
We can instead just rely on the players to Not Do That, or to tell
each other off. It's easy to recover from, too: just move money until
the amounts are right.
This also avoids any question of what to do if people try to combine
banknotes with the same currency but different min_qty. (GCD?)
Suggested-by: Gareth Taylor
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 15:22:05 +0000 (16:22 +0100)]
Multigrab: Provide in initial load
This was broken by the special refactoring.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 15:20:46 +0000 (16:20 +0100)]
Multigrab: allow to multigrab occulters
I don't expect any pieces to exist that can both be active occulter,
and multigrab. But if it does it should probably do the thing, rather
than mysteriously not work. And this simplifies the code.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 15:17:50 +0000 (16:17 +0100)]
JS: Add a comment about PieceInfo vs SessionPieceLoadJson
I made a bug due to not realising this needed to be updated too.
Maybe at some point the common bits should be combined, at least on
the Rust side.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 11:38:14 +0000 (12:38 +0100)]
Currency: Declare to be multigrab
We don't actually implement the PieceTrait method, so that just
returns Inapplicable. Ie, after this you can try to multiselect a
banknote but you get
Problem manipulating piece: UI operation not valid in the curret piece state
in the log.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 12:20:30 +0000 (13:20 +0100)]
JS: Implement multigrab
Check the multigrab boolean, and if appropriate make a single
multigrab API call rather than trying to grab multiple pieces.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 12:00:56 +0000 (13:00 +0100)]
Plumbing for "multigrab" piece API call
We can now pass this through to a piece.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 11:22:24 +0000 (12:22 +0100)]
Elide angle in game save file, when it's just North
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 11:02:11 +0000 (12:02 +0100)]
Elide some fields from save game state where we can
This saves writing out the field names as well as just the vslues.
We would like to do this for the updates sent to the client, but that
would really depend on the JS nullable coalesce operator "??" which is
not available the version of typescript I'm using, nor our ES
compatibility target. Newer typescript would do a polyfill but that
maybe wouldn't be super-fast? So postpone that.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 10:59:42 +0000 (11:59 +0100)]
Fix type of PreparedPieceState.held in the JS
I was comparing the JS and Rust versions, and spotted this
discrepancy.
In fact it is assigned to internal fields and variables which are all
nullable, so there is no other code change needed.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 10:42:26 +0000 (11:42 +0100)]
Provide is_default() function
We're going to use this to elide some fields from the game save state.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 09:10:37 +0000 (10:10 +0100)]
Provide and plumb multigtab piece property from Rust to JS
Currently nothing sets this (on the Rust side) nor uses it (on the JS
side).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 12:20:17 +0000 (13:20 +0100)]
script: Add a missing comma in a type definition
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 09:18:00 +0000 (10:18 +0100)]
Add "p" argument to mouse_clicked_one
Almost the callers have it and the one that doesn't (mouse_find_clicked)
is about to need it in another of its branches.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 10:20:12 +0000 (11:20 +0100)]
Move special rendering instructions to PieceSpecialProperties
This gets rid of an ipc method (meaning we get rid of one method call
during piece rendering) and is also more principled, than a call which
might conceivably give different answers at different times.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 10:12:56 +0000 (11:12 +0100)]
Add special field to SpecLoaded
This is currently empty.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 10:07:55 +0000 (11:07 +0100)]
split PieceSpecLoaded
We are goint to want to add a field to only the non-inert version, so
this generic is not applicable any more.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 12:08:44 +0000 (13:08 +0100)]
api: Introduce and use ApiPieceOpArgs::pri
We're going to have a new call site, too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 12:01:34 +0000 (13:01 +0100)]
api: Replace open-coded calculation with call to fully_visible
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 00:07:42 +0000 (01:07 +0100)]
ui: Disable pointer events on text in dice and currency
Otherwise you can end up with bits of the displayed text (currency
value, or die face) selected.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 18 Apr 2022 00:02:15 +0000 (01:02 +0100)]
ui: Break out HTML_TEXT_LABEL_ELEM_START from clock.rs
We actually need this in other places too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>