Advertisement
Guest User

(Uplink 1.2) game.h

a guest
Aug 9th, 2014
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.87 KB | None | 0 0
  1.  
  2. /*
  3.  
  4.   Game object
  5.  
  6.     Top level glue object of Uplink
  7.     Owns all of the other major components -
  8.     World, View, Interface and Player
  9.  
  10.   */
  11.  
  12.  
  13. #ifndef _included_game_h
  14. #define _included_game_h
  15.  
  16. #include <stdio.h>
  17. #include <time.h>
  18.  
  19. // ============================================================================
  20.  
  21. #include "uplink_h\app\uplinkobject.h"
  22.  
  23. class Interface;
  24. class View;
  25. class World;
  26. class GameObituary;
  27.  
  28. #define GAMESPEED_GAMEOVER      -1
  29. #define GAMESPEED_PAUSED        0
  30. #define GAMESPEED_NORMAL        1
  31. #define GAMESPEED_FAST          2
  32. #define GAMESPEED_MEGAFAST      3
  33. #define GAMESPEED_OHMYGOD       4                       // Only in DEBUG mode
  34.  
  35.  
  36. // ============================================================================
  37.  
  38.  
  39. class Game : public UplinkObject
  40. {
  41.  
  42. protected:
  43.  
  44.     Interface *ui;
  45.     View      *view;
  46.     World     *world;
  47.  
  48.     int gamespeed;
  49.  
  50.     GameObituary *gob;                     // Only used if this is a dead person
  51.     time_t lastsave;                       // Used in autosaving
  52.  
  53. public:
  54.  
  55.     Game ();
  56.     ~Game ();
  57.  
  58.     void NewGame ();
  59.     void ExitGame ();
  60.  
  61.     void SetGameSpeed ( int newspeed );
  62.     int  GameSpeed ();
  63.     bool IsRunning ();
  64.    
  65.     void GameOver ( char *reason );         //  Ends the current game
  66.     void DemoGameOver ();                   //  This demo game has come to an end
  67.     void WarezGameOver ();                  //  This WAREZ copy has come to an end
  68.  
  69.                                             //  These functions will
  70.     Interface *GetInterface ();             //  stop the program if their
  71.     View      *GetView ();                  //  values are NULL, so check
  72.     World     *GetWorld ();                 //  Game::IsRunning before using
  73.  
  74.     GameObituary *GetObituary ();           //  Asserts it exists
  75.  
  76.     bool LoadGame ( FILE *file );           //  Use this rather than Load
  77.  
  78.     // Common functions
  79.  
  80.     void Load   ( FILE *file );
  81.     void Save   ( FILE *file );
  82.     void Print  ();
  83.     void Update ();
  84.     char *GetID ();
  85.  
  86. };
  87.  
  88.  
  89. extern Game *game;
  90.  
  91.  
  92. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement