Welcome to the Builder Academy

Question suffering from poison

More
03 May 2017 19:29 #6684 by JTP
Replied by JTP on topic suffering from poison/Sun light
I use pico on UNIX.

How would i know If that is the case ?

Please Log in or Create an account to join the conversation.

More
03 May 2017 19:59 #6685 by krell
Reduce your conditional statements to the simplest case possible that still works, then add a condition, test, repeat ad nauseum.

Please Log in or Create an account to join the conversation.

More
03 May 2017 20:15 #6686 by thomas
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.

Please Log in or Create an account to join the conversation.

More
03 May 2017 21:26 #6687 by JTP
Replied by JTP on topic suffering from poison/Sun light
Thanks wil try that.

I have tried to grep something with time to add so They only suffer at Day time.

Havent had luck finding something usefull. You Got Any idea on that ?

Please Log in or Create an account to join the conversation.

More
03 May 2017 21:58 #6688 by JTP
Replied by JTP on topic suffering from poison/Sun light
limits.c:411: error: invalid storage class for function ‘isLitLocation’
limits.c:416: error: invalid storage class for function ‘isLightSensitive’

Please Log in or Create an account to join the conversation.

More
03 May 2017 22:02 #6689 by krell
Are you copying thomas's code suggestions verbatim ore are you checking to see if they make sense and modifying them to work in the cosebase?

Please Log in or Create an account to join the conversation.

Time to create page: 0.413 seconds