SelectionInfo.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: GameClient/ContextSensitiveTranslator.h //////////////////////////////////////////////////
  24. // Contains the SelectionInfo structure and the contextCommandForNewSelection
  25. // Author: John McDonald, Jr, October 2002
  26. #pragma once
  27. #ifndef __SELECTIONINFO_H__
  28. #define __SELECTIONINFO_H__
  29. #include "GameClient/InGameUI.h"
  30. // This structure gives you a rough idea about the counts of the kinds of guys in the
  31. // current selection, and in the selection that would be made.
  32. struct SelectionInfo
  33. {
  34. Int currentCountEnemies;
  35. Int currentCountCivilians;
  36. Int currentCountMine;
  37. Int currentCountMineInfantry;
  38. Int currentCountMineBuildings;
  39. Int currentCountFriends;
  40. Int newCountEnemies;
  41. Int newCountCivilians;
  42. Int newCountMine;
  43. Int newCountMineBuildings;
  44. Int newCountFriends;
  45. Int newCountGarrisonableBuildings;
  46. Int newCountCrates;
  47. Bool selectEnemies;
  48. Bool selectCivilians;
  49. Bool selectMine;
  50. Bool selectMineBuildings;
  51. Bool selectFriends;
  52. SelectionInfo();
  53. };
  54. //-------------------------------------------------------------------------------------------------
  55. struct PickDrawableStruct
  56. {
  57. // List to fill with Drawables. This should be provided by the caller.
  58. DrawableList *drawableListToFill;
  59. Bool forceAttackMode;
  60. // Note, this is OR'd with the things we are attempting to select.
  61. KindOfMaskType kindofsToMatch;
  62. PickDrawableStruct();
  63. };
  64. //-------------------------------------------------------------------------------------------------
  65. extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedDrawables,
  66. const DrawableList *newlySelectedDrawables,
  67. SelectionInfo *outSelectionInfo,
  68. Bool selectionIsPoint);
  69. //-------------------------------------------------------------------------------------------------
  70. // Returns ORed picktypes.
  71. extern UnsignedInt getPickTypesForContext(Bool forceAttackMode);
  72. //-------------------------------------------------------------------------------------------------
  73. // Returns ORed picktypes based on the current selection.
  74. extern UnsignedInt getPickTypesForCurrentSelection(Bool forceAttackMode);
  75. //-------------------------------------------------------------------------------------------------
  76. // expects ORed picktypes.
  77. extern void translatePickTypesToKindof(UnsignedInt pickTypes, KindOfMaskType& outmask);
  78. //-------------------------------------------------------------------------------------------------
  79. // Given a drawable, add it to an stl list. Useful for iterateDrawablesInRegion.
  80. // userData should be a pointer to a PickDrawableStruct, which is defined in
  81. // above.
  82. extern Bool addDrawableToList( Drawable *draw, void *userData );
  83. #endif /* __SELECTIONINFO_H__ */