]> jfr.im git - irc/gameservirc.git/commitdiff
Took out all #include lines from the extern.h, and changed them to forward declaratio...
authorkainazzzo <redacted>
Thu, 2 Nov 2006 02:04:35 +0000 (02:04 +0000)
committerkainazzzo <redacted>
Thu, 2 Nov 2006 02:04:35 +0000 (02:04 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@464 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/extern.h
gameserv/gameserv.cpp
gameserv/script.cpp
gameserv/tcpclient.cpp
gameserv/toplist.cpp

index 43ae018340934f487702dd8147a63c23dcabd42c..af9cce68065692f0d4c3989a4bc2c7515decc400 100644 (file)
 
 #include <stdarg.h>
 #include <list>
-#include "player.h"
-#include "level.h"
+#include <string>
+
 #include "config.h"
 #include "options.h"
-#include "item.h"
+
 
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # endif
 #endif
 
+// Forward declarations
+class toplist;
+class Player;
+class aClient;
+class Level;
+class item;
+class itemContainer;
+class weapon;
+class armor;
+class potion;
+class tavernItem;
+class Monster;
+
 // Hash.cpp stuff start
 #define U_TABLE_SIZE 1999
 E unsigned long sHASH(const unsigned char *name);
@@ -143,6 +156,7 @@ E void gameserv(char *source, char *buf);
 E Level levels[LEVELS];
 E list<item*> Items;
 E list<tavernItem> tavern;
+E toplist myToplist;
 
 /** forest.cpp **/
 E void forest(char *source, char *buf);
index 64987fa6ece76e216a9b5f930043109cf9a97f4b..30145320c24a00329d4e9d62fa19c0b6805cb674 100644 (file)
@@ -8,6 +8,7 @@
 #include "sockhelp.h"
 #include "item.h"
 #include "script.h"
+#include "toplist.h"
 
 #include <algorithm>
 #include <cctype>
@@ -33,6 +34,7 @@ Level levels[LEVELS];                 // The newest way to store monsters
 list<item*> Items;                      // The master list of items
 list<tavernItem> tavern;                // The list of items available at the tavern
 list<item*> store;                      // The list of items available at the store
+toplist myToplist;          // List of the top 10 players
 
 // Database functions
 int save_gs_dbase();
@@ -1294,6 +1296,10 @@ void do_register(char *u)
 
                  // Add the player to the list
                  players[hv].push_back(user->stats);
+
+                 // Attempt to add the player to the top list
+                 // The class takes care of pruning the user out if they don't deserve to be in the list
+                 myToplist.insertPlayer(user->stats);
                }
          else
                {
index 6ddfd69965e8edaadd7240adca5bb05234ae4794..f2b6c2c7504424283a4e86f40c04e63aa0155691 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "script.h"
 #include "extern.h"
+#include "player.h"
 #include <fstream>
 #include <string>
 
index df342342e73fe4620a8f6428bb57383f41577a7b..098b939c6cb7ebe8842d120b6f4f20b35e5fd51f 100644 (file)
@@ -17,6 +17,7 @@
 #include "aClient.h"
 #include "extern.h"
 #include "flags.h"
+#include "item.h"
 #include "toplist.h"
 #include <stdio.h>
 #include <unistd.h>
index c3a82ab4ef88f06f8c9853a7f0a85919dc9f7bcb..d982f53dc761c365e5962ab2bb1ec028a13dc1fd 100644 (file)
@@ -26,6 +26,9 @@ void toplist::insertPlayer(Player *p)
 {
   myList.push_front(*p);
   sort();
+
+  // Reverse the list since list::sort() uses the < operator
+  myList.reverse();
   prune();
 }