Maybe I'm missing something (and I've not tested it just now), but I don't see how a pure virtual class would prevent you from throwing a class pointer into a hashmap.
cmake can even use visual studio compiler
Sure, but when I want to create a Windows build on my GNU/Linux box with a MinGW cross-compiler, I'll have to manually fiddle with the CMakeList instead of just setting a few environment variables.
And CMake can't create Visual Studio project files on non-Windows, though, which I always found pretty stupid.
Me, what I'd ideally would like for my personal projects is a program that can parse my automake files and create Visual Studio project files out of them. This is similar to
what ScummVM does.
pragma: Since I set the compiler to C++11, I suppose every compiler should support pragma once.
Just keep in mind that you're shutting out platforms with that (and with the reliance of C++11), like older versions of Mac OS X. Probably also the Nintendo DS and the PSP; at least from what I've seen in ScummVM, their toolchains are quite limited. Of course, it's entirely fine if you don't care about those.
Destructos for race and class: I don't understand that.
Well, your Character class stores a Race *, which might be a Human or an Elf or whathaveyou. If the ~Character() deletes the Race *, the Race destructor needs to be virtual. Otherwise, the Human/Elf/whathaveyou destructor won't be called and you're potentially leaking.
See also
http://www.parashift...tual-dtors.html
http://stackoverflow...ual-destructors
In fact, my plans for race and class is to be singleton
Ah, now I see where you're going with this. I don't think having singletons to represent the classes and races is such a good idea, to be honest.
I don't feel that is necessary any longer, since this-> already have all semantic you will ever need.
gcc and clang will still complain that you're shadowing the variables "name" and "race" in the constructor, though.
getters: How would you do?
I'd just do
Race *Character::get_race() {
return race;
}
Since you're not shadowing anything there.
But, eh, like I said, I just don't like to use this-> anyway. *shrug*
using namespace: The only way I'm using it is on the tests. And I'm including my own namespace: d20!
Sure. I'd just prefix every with "d20::", but your choice.