Just as an amusing "proof" of why turning off warnings is a bad idea..... Here's a bug I JUST fixed from my old mud, which has been there since 1995.
WileyMUD was written before Smaug existed, and so all the spell code is usually cut and pasted from one spell to another (no generic spell_smaug yet). Well, there are both spell_blah() routines to do the actual spell, and cast_blah() routines as the API to cast the spell. When you call cast_, it checks to see how the spell is being invoked, as in cast as a spell, read from a scroll, etc... so there's a case statement for that.
With that as background, this will make sense:
void cast_weakness(char level, struct char_data *ch, char *arg, int type,
struct char_data *victim, struct obj_data *tar_obj)
{
if (DEBUG > 1)
dlog("called %s with %d, %s, %s, %d, %s, %s", __PRETTY_FUNCTION__, level, SAFE_NAME(ch), VNULL(arg), type, SAFE_NAME(victim), SAFE_ONAME(tar_obj));
switch (type) {
case SPELL_TYPE_SPELL:
spell_weakness(level, ch, victim, 0);
break;
case SPELL_TYPE_POTION:
spell_weakness(level, ch, ch, 0);
break;
case SPELL_TYPE_SCROLL:
if (tar_obj)
return;
if (!victim)
victim = ch;
spell_weakness(level, ch, victim, 0);
break;
case SPELL_TYPE_STAFF:
for (victim = real_roomp(ch->in_room)->people; victim; victim = victim->next_in_room)
==> if (!in_group) <==
spell_weakness(level, ch, victim, 0);
break;
default:
bug("Serious screw-up in weakness!"
;
break;
}
}
I was recompiling to see how many things had broken due to gcc upgrades over the last year or so, and gcc 4.1.2 spat this warning out at me today:
spells.c: In function 'cast_weakness':
spells.c:2768: warning: the address of 'in_group', will always evaluate as 'true'
The line that I highlighted should have read:
if(!in_group(victim, ch))
SO... IF someone had actually tried to use a staff which had the weakness spell associated with it, the game would not have crashed, but the spell would not actually have been cast on anyone, since it would have spun through the loop of people in the room and decided they were ALL in the caster's group.
Warnings are good.
Even the annoying "use of sigsetmask() is depreciated, go learn another API old fart!" one.