red_kangaroo wrote
Hm, okay, I'll try that.
If I may bother you further,
here I slightly changed priest::BeTalkedTo to allow for various replies for different priests based on char.dat
Yup and all you need to do is add the hostile replies to char.dat : )
red_kangaroo wrote
I just wonder what is the difference between humanoid::BeTalkedTo and character::BeTalkedTo, how does its function differ?
[/quote]
A programming question! There is a hierarchy between characters and humanoids, just as there is between, for example, items and meleeweapons.
carnivorous plants, priests, hedgehogs and bananagrowers are all characters. Carnivorous plants and hedgehogs are both non-human, (see nonhuman.h for their instantiations), while priests and bananagrowers are both humans (see human.h). Both humans and non-humans are characters, and they derive their base attributes and functions from characters, unless those functions are overridden by downstream functions.
All characters should have a character::BeTalkedTo. Bizarrely, you sometimes see humanoid::BeTalkedTo() in human.cpp. It seems weird, but it just defaults to character::BeTalkedTo, that holds for all characters.
priest::BeTalkedTo is, for example, a special case of npc responses devoted to all humanoid characters that are priests. The replies in that function vary by their divine configuration, and in general, by their relation with the player character.
If we don't specify any special humanoid::BeTalkedTo for a human character, then because a humanoid is a <C++>
derived class</C++> of a character, it will look upward in the hierarchy tree and use character::BeTalkedTo as a default case. Conversely, priest::BeTalkedTo
overrides character::BeTalkedTo, unless you want to access the default behaviours of character::BeTalkedTo by writing either humanoid::BeTalkedTo(); or character::BeTalkedTo(); inside the priest::BeTalkedTo() function.
Might be time for some Stroustrup? Get a linux virtual machine and compile IVAN!