Up to Main Index                             Up to Journal for April, 2018

                    JOURNAL FOR THURSDAY 19TH APRIL, 2018
______________________________________________________________________________

SUBJECT: Another player loading bug fixed
   DATE: Thu 19 Apr 22:25:52 BST 2018

Hrm, so I screwed up again :(

I my haste to fix the player loading bug, I just couldn’t resist squeezing in
one last, quick fix:


  9f028c3 frontend: Restore player inventory with Thing copies from temp store

        i.Lock()
        for _, ref := range decode.KeywordList(record["INVENTORY"]) {
  -       i.Add(store[ref])
  +       i.Add(store[ref].Copy())
          i.Enable(store[ref])
        }
        i.Unlock()


The problem with this quick ‘fix’ is that while a player’s inventory is
populated with a copy of the Thing in the store, it’s the item in the store
that is enabled! This results in the player still ending up with an empty
inventory. So another fix has just landed on the public dev branch:


  d8a091e frontend: login.assemblePlayer - enable copied, not store items


Now we end up with:


  i.Lock()
  for _, ref := range decode.KeywordList(record["INVENTORY"]) {
    t := store[ref].Copy()
    i.Add(t)
    i.Enable(t)
  }
  i.Unlock()


I’ve been testing, and re-testing, for the last couple of hours and everything
seems to be working as expected.

There is one other change on the public dev branch — made before the above
fix, so included in my testing! I’ve re-written the recordjar.Read method so
that the code is cleaner and less convoluted. There are a bunch of tests
already written for this method, and the new version passes all of the
existing tests. I even spotted an error in one of the tests which is now
fixed. It does not include my commented regular expression code yet[1].

--
Diddymus

  [1] Discussed last Wednesday: 11.html


  Up to Main Index                             Up to Journal for April, 2018