settings.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. // settings.h
  19. // Project: Nostril (aka Postal)
  20. //
  21. ////////////////////////////////////////////////////////////////////////////////
  22. #ifndef SETTINGS_H
  23. #define SETTINGS_H
  24. #include "RSPiX.h"
  25. #ifdef PATHS_IN_INCLUDES
  26. #include "ORANGE/CDT/flist.h"
  27. #else
  28. #include "flist.h"
  29. #endif
  30. class RPrefs;
  31. class RFile;
  32. class CSettings
  33. {
  34. private:
  35. typedef RFList<CSettings*> SETTINGS;
  36. typedef enum
  37. {
  38. MemFileSize = 512
  39. };
  40. //---------------------------------------------------------------------------
  41. // This stuff deals with all CSettings objects
  42. //---------------------------------------------------------------------------
  43. private:
  44. static SETTINGS* ms_pSettings; // Pointer to list of all CSettings objects
  45. static void* ms_pMem; // Pointer to memory used for memory file
  46. SETTINGS::Pointer m_pointer; // Pointer to this object's location in list
  47. public:
  48. // Read settings that are stored in preference file
  49. static short LoadPrefs(
  50. char* pszFile);
  51. // Write settings that are stored in preference file
  52. static short SavePrefs(
  53. char* pszFile);
  54. // Load settings that are stored in game file
  55. static short LoadGame(
  56. char* pszFile);
  57. // Save settings that are stored in game file
  58. static short SaveGame(
  59. char* pszFile);
  60. // Temporarily set settings for demo mode
  61. static short PreDemo(
  62. void);
  63. // Restore settings to what they were prior to demo mode
  64. static short PostDemo(
  65. void);
  66. //---------------------------------------------------------------------------
  67. // This stuff applies to an individual CSettings object
  68. //---------------------------------------------------------------------------
  69. public:
  70. // Set settings to default values
  71. CSettings(void);
  72. // Destructor
  73. ~CSettings();
  74. // Read settings that are stored in preference file
  75. virtual short LoadPrefs(
  76. RPrefs* pPrefs) = 0;
  77. // Write settings that are stored in preference file
  78. virtual short SavePrefs(
  79. RPrefs* pPrefs) = 0;
  80. // Load settings that are stored in game file
  81. virtual short LoadGame(
  82. RFile* pFile) = 0;
  83. // Save settings that are stored in game file
  84. virtual short SaveGame(
  85. RFile* pFile) = 0;
  86. // Temporarily set settings for demo mode (file is for saving current settings)
  87. virtual short PreDemo(
  88. RFile* pFile) = 0;
  89. // Restore settings to what they were prior to demo mode
  90. virtual short PostDemo(
  91. RFile* pFile) = 0;
  92. };
  93. #endif // SETTINGS_H
  94. ////////////////////////////////////////////////////////////////////////////////
  95. // EOF
  96. ////////////////////////////////////////////////////////////////////////////////