Cleanup +find-or-create-ship-state

This commit is contained in:
Ted Blackman 2018-03-16 04:09:14 -07:00
parent 846439b88d
commit 164504d0a1

View File

@ -1044,14 +1044,18 @@
::+|
::
++ this .
:: +find-or-create-ship-state: find or create a ford-state for a @p
::
:: Accesses and modifies :state-by-ship.
::
++ find-or-create-ship-state
|= our=@p
^- [ford-state _state-by-ship]
::
=/ existing (~(get by state-by-ship) our)
?^ existing [u.existing state-by-ship]
=? state-by-ship
!(~(has by state-by-ship) our)
(~(put by state-by-ship) our *ford-state)
[(~(got by state-by-ship) our) state-by-ship]
?^ existing
[u.existing state-by-ship]
::
=| new-state=ford-state
[new-state (~(put by state-by-ship) our new-state)]
--