GroveOptions.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GROVEOPTIONS_H
  19. #define GROVEOPTIONS_H
  20. #pragma once
  21. #include <map>
  22. #include <vector>
  23. #include "worldbuilder.h"
  24. #include "OptionsPanel.h"
  25. #include "Common/STLTypedefs.h"
  26. // Used to store Display names in conjunction with internal names.
  27. typedef std::pair<AsciiString, UnicodeString> PairNameDisplayName;
  28. typedef std::vector<PairNameDisplayName> VecPairNameDisplayName;
  29. typedef std::vector<PairNameDisplayName>::iterator VecPairNameDisplayNameIt;
  30. // This is a utility function useful to get a display string from a pair of AsciiString
  31. // UnicodeStrings. It attempts to use the UnicodeString, and if that fails then turns
  32. // to the AsciiString
  33. // As a last resort, it returns the EmptyString.
  34. UnicodeString GetDisplayNameFromPair(const PairNameDisplayName *pNamePair);
  35. class GroveOptions : public COptionsPanel
  36. {
  37. protected:
  38. std::vector<std::pair<Int, Int> > mVecGroup;
  39. VecPairNameDisplayName mVecDisplayNames;
  40. Int mNumTrees;
  41. public:
  42. GroveOptions(CWnd* pParent = NULL);
  43. ~GroveOptions();
  44. void makeMain(void);
  45. virtual BOOL OnInitDialog();
  46. int getNumTrees(void);
  47. int getNumType(int type);
  48. AsciiString getTypeName(int type);
  49. int getTotalTreePerc(void);
  50. Bool getCanPlaceInWater(void);
  51. Bool getCanPlaceOnCliffs(void);
  52. protected:
  53. void _setTreesToLists(void);
  54. void _buildTreeList(void);
  55. void _setDefaultRatios(void);
  56. void _setDefaultNumTrees(void);
  57. void _setDefaultPlacementAllowed(void);
  58. afx_msg void _updateTreeWeights(void);
  59. afx_msg void _updateTreeCount(void);
  60. afx_msg void _updateGroveMakeup(void);
  61. afx_msg void _updatePlacementAllowed(void);
  62. virtual void OnOK();
  63. virtual void OnClose();
  64. DECLARE_MESSAGE_MAP()
  65. };
  66. extern GroveOptions *TheGroveOptions;
  67. #endif