Serious Shrinkage

The connection state management code in the socket layer of Basternae has always been what I call “spaghetti code”.  It was a single method containing a huge switch statement with pretty sizable blocks of code for each case.  Tracing program flow for characters that were not actively playing was always difficult due to the complexity and verbosity of this 1600-line function.

Today I refactored it into a bunch of more sensible pieces that go together a lot more smoothly.  The 1600-line function is now 80 lines, I can actually tell what’s going on during program execution, and a handful of confusing and unused variables have been eliminated.  Huzzah!