GroveTool.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // GroveTool.h
  19. // Author: John Ahlquist, May 2001
  20. #pragma once
  21. #ifndef GroveTool_H
  22. #define GroveTool_H
  23. #include "lib/Basetype.h"
  24. #include "Tool.h"
  25. #include "common/MapObject.h"
  26. class WorldHeightMapEdit;
  27. /*************************************************************************/
  28. /** GroveTool
  29. Does the add a grove of trees tool operation.
  30. ***************************************************************************/
  31. /// Add a grove of trees tool.
  32. class GroveTool : public Tool
  33. {
  34. protected:
  35. enum {HYSTERESIS = 3};
  36. CPoint m_downPt;
  37. Bool m_dragging;
  38. MapObject *m_headMapObj;
  39. protected:
  40. void plantTree( Coord3D *pos );
  41. void plantShrub( Coord3D *pos );
  42. void plantGrove( Coord3D pos, Coord3D prevDir, Real baseHeight, Int level, CPoint bounds );
  43. void _plantGroveInBox(CPoint tl, CPoint br, WbView* pView);
  44. void addObj(Coord3D *pos, AsciiString name);
  45. void activate();
  46. public:
  47. GroveTool(void);
  48. ~GroveTool(void);
  49. public:
  50. /// Perform tool on mouse down.
  51. virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  52. virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  53. virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  54. };
  55. #endif //TOOL_H