13 Mar, 2010, jurdendurden wrote in the 1st comment:
Votes: 0
Using the ftick command, I've been able to simulate time passing in my mud in order to test out some of my new climate/area based weather code. Now the only issue I'm really having is that sometimes a character will receive two announcements regarding the state of the clouds (I have broken it up into clouds, wind, temperature, and precipitation.) So the cloud function open up into a loop through the areas like so:

for (pArea = area_first; pArea; pArea = pArea->next)
{


then further down once it determines what's going on with the clouds in that area, it outputs the buffer to each descriptor (supposed to be only descriptors in the corresponding area, but that's where things are getting weird.)

if (buf[0] != '\0')
{
for (d = descriptor_list; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && IS_OUTSIDE (d->character) && IS_AWAKE (d->character) && d->character->in_room->area == pArea)
SEND (buf, d->character);
}
}


So as you can see the output is basically the exact same as stock rom with one exception, the last bit of the if check where it tries to make sure the character is in the same area as is being updated, which works sometimes, and sometimes i will get double outputs for two different areas. I've thrown a debug line in the mix to output exactly which areas are getting outputted when it doubles up, but it seems to be just at random. Any ideas as to what I could be doing wrong?
13 Mar, 2010, jurdendurden wrote in the 2nd comment:
Votes: 0
Nevermind, got it figured out. The loops were working just fine, I just forgot to reset the buffer after each iteration, so it was strcat'ing two or more buffers together and spitting them back out.
0.0/2