ToME 2 maintenance

Everything about ToME 2.x.x. No spoilers, please

Moderator: Moderator

Post Reply
Message
Author
AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#91 Post by AnonymousHero »

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.

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#92 Post by AnonymousHero »

Status Update:

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've pushed the latest updates.

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#93 Post by AnonymousHero »

Moar status update:

Everything from scpt/* has been moved to C++! (Well, there are a couple of variables left, but that's trivial.)

That means that a few utility functions (callouts from C to Lua) from core/* and the Automatizer is all that's left.

/me has a Young's Double Chocolate Stout to celebrate this milestone. :)

madmonk
Reaper
Posts: 2257
Joined: Wed Dec 12, 2007 12:21 am
Location: New Zealand

Re: ToME 2 maintenance

#94 Post by madmonk »

AnonymousHero wrote:/me has a Young's Double Chocolate Stout to celebrate this milestone. :)
I prefer Ramrod and Special myself.

Great achievement!
Regards

Jon.

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#95 Post by AnonymousHero »

Just a quick status update:

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 :).

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#96 Post by Lord Estraven »

Awesome work. 8)

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#97 Post by Lord Estraven »

Hmm.

Code: Select all

/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
This is with the latest revision.

Edit: on a 32-bit Intel Atom machine.

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#98 Post by AnonymousHero »

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

Code: Select all

   max<int>(0, min<int>(3, p_ptr->grace / 10000))
and see if that compiles?

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#99 Post by Lord Estraven »

Yeah, it compiles if I cast it as an int.

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#100 Post by Lord Estraven »

Also there seem to be some scope issues...

Code: Select all


/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

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#101 Post by AnonymousHero »

Hum...

Which version of G++, Boost, etc. are you running?

EDIT: Ha! I just got that same error while trying a little move to C++0x mode -- so the problem is that your compiler is running in C++0x mode :).

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#102 Post by Lord Estraven »

Hmm. How can I tell if G++ is using 0x mode by default? I don't think it should be doing that...

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#103 Post by AnonymousHero »

If this compiles, you are:

Code: Select all

#include <vector>

int main(int argc, char argv[]) {
   vector<int> v = { 1, 2 ,3 };
}
:)

Lord Estraven
Uruivellas
Posts: 718
Joined: Tue Dec 13, 2005 12:35 am

Re: ToME 2 maintenance

#104 Post by Lord Estraven »

Doesn't compile.

Code: Select all

$ 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’

AnonymousHero
Spiderkin
Posts: 482
Joined: Sat Mar 18, 2006 12:48 pm

Re: ToME 2 maintenance

#105 Post by AnonymousHero »

Ho-hum. Then we're back to your library, gcc, etc. versions. :)

Post Reply