I was just wondering if my theory here works. After the place
where height is determined in db.c for new characters, i added a
switch(GET_RACE(ch)) because i added races and i want the heights to
differ. Can i just use:
switch (GET_RACE(ch)) {
case RACE_HUMAN;
break;
case RACE_BLAH;
ch->player.height *= .75;
break;
etc..
This is just an example but will the multiplying by decimal work or am i
doing this wrong?
Well, first of all, I'm not sure if the *= operator exists, but assuming it
does, this could work. However, I'd suggest making a racial modifier table
that has all the modifications for each race. Then you could reference it
like this:
GET_STRENGTH(ch) += racial_modifiers[GET_RACE(ch)].str_mod;
...
ch->player.height = some_function(ch, racial_modifiers[GET_RACE(ch)].height_mod);
(just examples, but you get the picture...)
This eliminates the need for switch statements everytime you want to modify
something based on race.
This archive was generated by hypermail 2b30 : 12/07/00 PST