home *** CD-ROM | disk | FTP | other *** search
- // HighScoreServer.h
-
- // This class is the actual high score server for any given game.
- // You shouldn't need to subclass it: Just change the class of
- // HighScoreSlot used and change the GameInfo object's parameters.
-
-
- #import <appkit/appkit.h>
- #import <machkit/senderIsInvalid.h> // superclass
-
- @interface HighScoreServer:Object <HighScoreServer, NXSenderIsInvalid>
- {
- id table; // a HighScoreTable list to hold all the slots
- id template; // a template cleared table
- id clientList; // a List of all current clients
- id connList; // a List of all current connections to clients
- id clientAuth; // a Storage of BOOLs: is client authorized?
- id emptySlot; // returned when no slot in table
- id gameInfo; // holds info about the client
- id gameName; // name of the game we are serving (DAYString)
- id scoreFile; // name of the file where we save highscores (DAYString)
- BOOL haveNonTemplateTable; // True if we have an empty table and no
- // template from the client. If we get a template before this empty
- // table is modified, then we'll re-send the template to all the
- // clients as the current table.
- }
-
- + turnLoggingOn:(BOOL)flag; // allows your server to log all transactions
- + makeLogFile; // override to change where loggin goes to.
- // Just return a DAYLogFile instance!
-
- // methods used internally, etc. NOT for clients to call!
- - init; // NEVER use this method; use -initForGame:
- - initForGame:(const char *)name; // initializes with a game name
- - (const char *)pathToTables; // override to change where file is stored
- - free; // free server and associated objects
- - save; // save the highscore file
- - load; // load the highscore file
- - _makeTableRatherThanLoad; // builds an empty table if can't load one
- - (BOOL)authorize:(id <HighScoreClient>)client; // gets a password from
- // the client to see if client is authorized. Checks password
- // against the encoded password in the gameinfo object.
- - (BOOL)validateClient:(id <HighScoreClient>)client; // returns YES if
- // client is validated for editing and clearing the table;
- // attempts to authorize the client if not already authorized.
-
- @end