Solmyr - H3M File Manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

91 lines
2.6 KiB

  1. /* Solmyr - H3M manager
  2. * Copyright (C) 2009 Xavier Gendre
  3. *
  4. * This file is part of Solmyr.
  5. *
  6. * Solmyr is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Solmyr is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Solmyr. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef H_XG_H3MFILE_1408091444
  20. #define H_XG_H3MFILE_1408091444
  21. #include "config.hpp"
  22. #include <glibmm/ustring.h>
  23. #ifdef HAVE_LIBZ
  24. #include <zlib.h>
  25. #endif // HAVE_LIBZ
  26. namespace Solmyr
  27. {
  28. class H3mFile
  29. {
  30. public:
  31. H3mFile();
  32. virtual ~H3mFile();
  33. int open(const char *, const char *);
  34. void close();
  35. // Accessors
  36. Glib::ustring get_error() {return m_log;}
  37. guint32 get_version() {return m_version;}
  38. guint32 get_size() {return m_size;}
  39. guint32 get_underground() {return m_underground;}
  40. Glib::ustring get_name() {return m_name;}
  41. Glib::ustring get_description() {return m_description;}
  42. guint8 get_difficulty() {return m_difficulty;}
  43. guint8 get_max_level() {return m_max_level;}
  44. guint8 get_player_number() {return m_player_number;}
  45. guint8 get_human_number() {return m_human_number;}
  46. guint8 get_victory_condition() {return m_victory_condition;}
  47. guint8 get_loss_condition() {return m_loss_condition;}
  48. bool get_allies() {return m_allies;}
  49. protected:
  50. int get_info();
  51. int get_header();
  52. int victory_info_size(guint8);
  53. int loss_info_size(guint8);
  54. void set_log(const Glib::ustring str)
  55. {m_log = m_filename + ": " + str;}
  56. // Informations
  57. guint32 m_version;
  58. guint32 m_size;
  59. bool m_underground;
  60. Glib::ustring m_name;
  61. Glib::ustring m_description;
  62. guint8 m_difficulty;
  63. guint8 m_max_level;
  64. guint8 m_player_number;
  65. guint8 m_human_number;
  66. guint8 m_victory_condition;
  67. guint8 m_loss_condition;
  68. bool m_allies;
  69. private:
  70. gzFile m_ptrh3m;
  71. Glib::ustring m_folder;
  72. Glib::ustring m_filename;
  73. Glib::ustring m_log;
  74. };
  75. } // namespace Solmyr
  76. #endif // H_XG_H3MFILE_1408091444