client, server, tools for cross-platform mir2. Using asio, SDL, FLTK, libzip, etc..
- pkgviewer
- animaker
- shadowmaker
- mapeditor
- client
- monoserver
Try to make all I learned into practice, as the screenshot:
global variables:
- don't use global of build-in type or struct since no multithread control.
- don't use global of class instanse since confusing construction/distruction.
actually:
- only use class pointer;
- only reference it by ``extern g_VarXXX";
- no local function for operation on global variable only, means:
- all operations over global variables should be self-contained;
- all global variable pointers stay valid during the whole procedure;
Since I already have a powerful log system, I won't use exception. If un-recoverable error happens
- log system record the detailed info;
- then just let it crash, or use exit(0) to force killing;
The function who throws always think it's a fatal error so it just throw, but how to handle this ``fatal" error or do catch sub-clause really takes it as fatal is decided not by the thrower, but the catcher.
For modules like mapeditor which doesn't have a log system, always put assertion to check parameters. If functions invoked with invalid parameters, fail assertion and let it crash.
General rules for functions:
- put strict parameters check above doing actual logic;
- take invalid argument as severe error, just log the error and let it crash;
- never give assumption for argument;
- try best to make each memeber function self-contained to avoid first-half / second-half splitted functions;