First off - when you are submitting code to us, do not open the file in pico - pico truncates the lines if they are too long:
Code:
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED($
We can't tell what this line ends with.
Instead, open the file with
less or
cat - both will wrap long lines.
Secondly - I suggest you simplify the code a bit. Instead of the long if statement, use something like:
Code:
above point_update():
static int isLitLocation(char_data *ch ) {
return !ROOM_FLAGGED(IN_ROOM(ch), ROOM_DARK) &&
!ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS) &&
!ROOM_FLAGGED(IN_ROOM(ch), ROOM_TUNNEL);
// perhaps make sure this only triggers at day?
}
static int isLightSensitive(char_data *ch) {
return GET_RACE(i) == RACE_DROW
&& !IS_AFFECTED(ch, SPELL_GLOBE_OF_DARKNESS);
}
Then rewrite the check to something like this:
if (isLightSensitive(i) && isLitLocation(i))
if (damage(i, i, GET_LEVEL(i), SPELL_MAGIC_MISSILE) == -1)
continue;
This kind of simple refactoring makes the code easier to read. It also removes some of the parenthesis so it is easier to understand what is going on.