Up to Main Index                          Up to Journal for November, 2015

                    JOURNAL FOR MONDAY 16TH NOVEMBER, 2015
______________________________________________________________________________

SUBJECT: More BRL and parser status
   DATE: Mon 16 Nov 20:15:40 GMT 2015

Discovered a bit of a blunder with the git status on the download page[1]. I
thought it would be nice to use relative times like: 2 days ago. However
wolfmud.org is a statically generated site. Unless I generate the site at
least once a day it will always show e.g. 2 days ago. Doh! I've now updated it
to just show the date and time of the last commit :(

WolfMUD Wednesday (and Thursday) were very productive again. The BRL - Big
Room Lock - changes have been going well. The implementation of the BRL itself
is nicely tucked away in an internal directory. This is because it 'just
works' and programmers don't need to worry about it.

All of the actual locking, using the BRL, is contained in a new state type.
I've managed to keep the parser uncluttered, with the state type handling
locking, unlocking and other bookkeeping. Nearly all of the bookkeeping is now
automatic, so the programmer does not have to worry about it - but they can if
they want.

All in all I'm quite happy with these changes. I think this iteration of the
code is much cleaner and simpler.

This is a much better state of affairs than before - where all of the pieces
for locking and command processing were dotted about in several packages.
Getting your head around it was not as easy as it could have been. Now for the
simple case of something going on in a single location - it just works. For
something happening in multiple locations, say next door, you need an extra
four lines of code:


  if !s.CanLock(l) {
    s.AddLock(l)
    return
  }


Where s is the current *state for the command and l is the additional location
you want to lock on. The first time the command is processed CanLock(l) will
return false. So you add the additional lock you want and return. The locks
will be taken and the command will be processed again and this time CanLock(l)
will return true so you just carry on. All of the locking and unlocking is
handled for you. If you need more than two locations, for example all
locations along a line of sight, you can just add them.

As usual I've just been 'banging out the code'. Now I tidying everything up,
writing informative comments, documenting and cleaning up my git commits. I've
also been reworking the commands implemented so far to use the new parser
state type.

Question is, how long before it hits the public git repository so you can have
a play? The BRL and status types have been documented. Some commands have been
migrated to use status. I just have to finish the command migration and make
some git commits. Based on that I should be happy enough with the code to push
an update out this week sometime :)

--
Diddymus

  [1] ../../../downloads/index.html


  Up to Main Index                          Up to Journal for November, 2015