victim = d->original ? d->original : d->character;
d->original
act_new( "$n gossips '$t'", ch,argument, d->character, TO_VICT,POS_SLEEPING );
#define act(format,ch,arg1,arg2,type)\ act_new((format),(ch),(arg1),(arg2),(type),POS_RESTING)
struct TestClass
{
int publicData;
private:
int privateData;
};
int main()
{
TestClass myTest;
myTest.publicData = 5;
myTest.privateData = 5;
}
So it's not necessarily bad form to say player.level++, it depends on the design. In languages like C++, you can define member visibility, and actually prevent people outside the class from being able to muck around with so-called private fields. In C, you can't prevent this. So let's say that you have something like this:
and you make it clear (in .h files, comments, whatever) that the interface to ch->level is via the level_up function. (This is contrived, but whatever.) If somebody then goes in and manually increments ch->level, they can violate the constraint imposed by the function, namely that level does not go above 50.
Here's a much more interesting example. Characters have equipped object lists – objects that are currently in use by the character. There is a very clear interface to equipment: you are supposed to use the equip/unequip functions. These functions take care of an awful lot of housekeeping, like effects, armor class, and so forth.
The consequences of bypassing this interface can be pretty bad, like not actually applying effects, or applying them but then not removing them when you unequip, etc.
Not following the interface means manually adding things into the equipment linked list.
Basically that is what I mean by "respecting the interface" – there is a clear set of functions you are supposed to use for certain state manipulations. C allows you to bypass that interface by directly editing the structure data members, which is a Very Bad Thing to do. C++ makes it much harder to bypass the interface because you can't access the data members directly.