Lord Estraven wrote:BTW AH, what do you intend to do with the debug command for entering Lua code? Just remove it?
Yup. AFAIK there isn't really any way to support that kind of thing in C++. Of course any specific uses of the command that might be useful can be added as a new debug command. For example, I couldn't find any way to increase/set piety directly -- that would be a useful addition.
I do intend to reorganise the header files so that you don't have to recompile almost everything for every single header file change -- I think having a shorter test+fix+recompile+retest cycle would be generally useful for debugging. However, TBH I haven't actually found the recompile cycle to be a huge problem -- it's just a lot easier to avoid "trivial" errors when using C++. There are things that could be done to avoid errors by introducing more compile-time sanity/consistency checking. For example, the data files could be preprocessed automatically to produce symbolic constants for all valid TVAL/SVAL combinations, all valid monster IDs (e.g. M_FIRE_GOLEM instead of 1043, and MN_SHELOB_SPIDER_OF_DARKNESS instead of "Shelob, Spider of Darkness"), etc. That kind of thing could drastically reduce the number of "magic numbers" in the code. I'm not sure how far I'll take this -- I probably depends on what kind of errors I actually encounter in practise.
Of the game-related stuff there is now only a few variables (ToME) and a few variables+monster.lua (Theme) left. In terms of LoC that's 11 lines of ToME Lua code and 149 lines of Theme Lua code.
I have now pushed the latest version of the code where I've disabled the Automatizer and removed all the remaining code which relied on Lua.
I intend to bring in some form of Automatizer implementation soonish; I'm just waiting for feedback on what people want/need from the automatizer.
The Lua source code which was shipped along with ToME has also been removed.
In other words:
LUA IS OFFICIALLY GONE FROM ToME 2.x!
I'll hold off merging back to 'master' pending the implementation of a new Automatizer and fixing the FIXMEs that I've left strewn about in the new code .
/home/proteus/Games/miramors-tome2/src/gods.cc: In function ‘void<unnamed>::eru_calculate_bonuses_hook()’:
/home/proteus/Games/miramors-tome2/src/gods.cc:186:49: error: no matching function for call to ‘min(int, long int)’
/home/proteus/Games/miramors-tome2/src/gods.cc: In function ‘void<unnamed>::eru_calculate_mana_pre_hook(int*)’:
/home/proteus/Games/miramors-tome2/src/gods.cc:195:37: error: no matching function for call to ‘min(s32b&, int)’
/home/proteus/Games/miramors-tome2/src/gods.cc: In function ‘void<unnamed>::tulkas_calculate_bonuses_hook()’:
/home/proteus/Games/miramors-tome2/src/gods.cc:336:52: error: no matching function for call to ‘min(int, long int)’
/home/proteus/Games/miramors-tome2/src/gods.cc:337:58: error: no matching function for call to ‘min(int, long int)’
/home/proteus/Games/miramors-tome2/src/gods.cc: In function ‘void<unnamed>::melkor_calculate_bonuses_hook()’:
/home/proteus/Games/miramors-tome2/src/gods.cc:384:49: error: no matching function for call to ‘min(int, long int)’
/home/proteus/Games/miramors-tome2/src/gods.cc: In function ‘void<unnamed>::aule_calculate_bonuses_hook()’:
/home/proteus/Games/miramors-tome2/src/gods.cc:577:42: error: no matching function for call to ‘min(int, long int)’
make[2]: *** [src/CMakeFiles/tome.dir/gods.cc.o] Error 1
make[1]: *** [src/CMakeFiles/tome.dir/all] Error 2
I am developing on a 64-bit machine, so I probably will inadvertently introduce some of these 32/64-bit errors from time to time. The god part is that it was caught at compile time rather than leading to obscure runtime errors .
Anyway, the reason is for the error is that std::min and std::max are a bit extreme in that they require the exact same type because of the their templated nature. Can you try doing replacing the first instance with
/home/proteus/Games/miramors-tome2/src/help.cc:18:35: error: template argument 1 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:18:35: error: template argument 2 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:18:37: error: expected unqualified-id before ‘>’ token
/home/proteus/Games/miramors-tome2/src/help.cc: In function ‘int<unnamed>::get_entry_index(const help::entry_type*)’:
/home/proteus/Games/miramors-tome2/src/help.cc:24:36: error: template argument 1 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:24:36: error: template argument 2 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:24:38: error: expected unqualified-id before ‘>’ token
/home/proteus/Games/miramors-tome2/src/help.cc:25:19: error: ‘e’ was not declared in this scope
/home/proteus/Games/miramors-tome2/src/help.cc: At global scope:
/home/proteus/Games/miramors-tome2/src/help.cc:527:35: error: template argument 1 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:527:35: error: template argument 2 is invalid
/home/proteus/Games/miramors-tome2/src/help.cc:527:37: error: expected unqualified-id before ‘>’ token
/home/proteus/Games/miramors-tome2/src/help.cc: In function ‘void help::initialize_help()’:
/home/proteus/Games/miramors-tome2/src/help.cc:559:11: error: ‘entries’ was not declared in this scope
make[2]: *** [src/CMakeFiles/tome.dir/help.cc.o] Error 1
make[1]: *** [src/CMakeFiles/tome.dir/all] Error 2
make: *** [all] Error 2
$ g++ -Wall -g foo.cpp -o foo
foo.cpp:3:5: warning: second argument of ‘int main(int, char*)’ should be ‘char **’
foo.cpp: In function ‘int main(int, char*)’:
foo.cpp:4:4: error: ‘vector’ was not declared in this scope
foo.cpp:4:11: error: expected primary-expression before ‘int’
foo.cpp:4:11: error: expected ‘;’ before ‘int’