Start of a timeout handing framework.
As of this commit, LORD2 keeps track of the last time a key was pressed, and a timeout occurs five minutes after that if it's waiting for a key. This has issues as the getstr() timeout does not behave in this manner. However, if the timeout callback style works, getstr() and the other dk functions can grow callback support pretty easily, and this seems like it may be the best way forward. Further, disconnect handling should be tied up in this, and dorkit does not have very robust features for this. In most cases, a disconnect will be treated the same as a timeout, so the same solution should likely be usable by both. The biggest challenge is preventing the need for all the code to have exceptional condition handling, which can be quite tricky as battles can end by running a REF file (For example, the training centre). This would mean all code paths reachable via REF calls would need to fail nicely in the face of a connection loss/timeout.
Showing with 138 additions and 64 deletions