Server Help

ASSS Questions - Periodic.c

Hakaku - Mon Feb 09, 2009 7:28 am
Post subject: Periodic.c
Concerning periodic.c; I don't really understand how it works, but how would it be possible for it not to send a player/frequency the periodic reward packet if the reward returns 0 points? Subgame never announced the reward when it was 0, so it's really a nuisanced.
D1st0rt - Mon Feb 09, 2009 10:55 am
Post subject:
The way it works right now is that it sends one packet containing the periodic reward values for all frequencies as 4 repeating bytes.

This patch should do it, but I haven't tested

Code: Show/Hide
--- periodic.c  2009-02-09 11:53:14.000000000 -0500
+++ periodic.c.2        2009-02-09 11:53:04.000000000 -0500
@@ -80,14 +80,21 @@
                        fd = (freq_data*)TrGet(fdata, freq);
                        if (fd == NULL)
                        {
-                               fd = amalloc(sizeof(*fd));
-                               fd->head.key = freq;
-                               fd->players = 0;
-                               fd->flags = flagcore->CountFreqFlags(set->arena, freq);
-                               TrPut(&fdata, &fd->head);
-                               freqcount++;
+                               int flags = flagcore->CountFreqFlags(set->arena, freq);
+                               if(flags)
+                               {
+                                       fd = amalloc(sizeof(*fd));
+                                       fd->head.key = freq;
+                                       fd->players = 1;
+                                       fd->flags = flags;
+                                       TrPut(&fdata, &fd->head);
+                                       freqcount++;
+                               }
+                       }
+                       else
+                       {
+                               fd->players++;
                        }
-                       fd->players++;
                        totalplayers++;
                }
        pd->Unlock();

Hakaku - Tue Feb 10, 2009 4:41 pm
Post subject:
Thanks D1st0rt, I'll give it a shot and see how it goes.



Edit: Yep, it works as hoped it would.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group