| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) RedWolf Design |
| 5 | * Copyright (c) 2008, Sven2 |
| 6 | * Copyright (c) 2017-2020, The LegacyClonk Team and contributors |
| 7 | * |
| 8 | * Distributed under the terms of the ISC license; see accompanying file |
| 9 | * "COPYING" for details. |
| 10 | * |
| 11 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 12 | * See accompanying file "TRADEMARK" for details. |
| 13 | * |
| 14 | * To redistribute this file separately, substitute the full license texts |
| 15 | * for the above references. |
| 16 | */ |
| 17 | |
| 18 | // Menus attached to objects; script created or internal |
| 19 | // These menus are shown to players if the target object is the current cursor |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include "C4DeletionTrackable.h" |
| 24 | #include "C4Menu.h" |
| 25 | |
| 26 | enum |
| 27 | { |
| 28 | C4MN_None = 0, |
| 29 | C4MN_Construction = 1, |
| 30 | /*C4MN_Bridge = 2, obsolete, now reserved */ |
| 31 | C4MN_Take = 3, |
| 32 | C4MN_Buy = 4, |
| 33 | C4MN_Sell = 5, |
| 34 | C4MN_Activate = 6, |
| 35 | /*C4MN_Hostility = 7, now defined in C4MainMenu*/ |
| 36 | /*C4MN_Surrender = 8, obsolete, now reserved*/ |
| 37 | /*C4MN_Put = 9, obsolete, now reserved*/ |
| 38 | /*C4MN_Magic = 10, obsolete, now reserved*/ |
| 39 | /*C4MN_Main = 12, now defined in C4MainMenu*/ |
| 40 | C4MN_Get = 13, |
| 41 | C4MN_Context = 14, |
| 42 | C4MN_Info = 15, |
| 43 | /*C4MN_TeamSelection = 16, now defined in C4MainMenu */ |
| 44 | /*C4MN_TeamSwitch = 17, now defined in C4MainMenu */ |
| 45 | C4MN_Contents = 18 |
| 46 | }; |
| 47 | |
| 48 | class : public C4Menu, private C4DeletionTrackable |
| 49 | { |
| 50 | public: |
| 51 | (); |
| 52 | (); |
| 53 | |
| 54 | virtual void () override; |
| 55 | |
| 56 | enum { = 0, , }; |
| 57 | |
| 58 | protected: |
| 59 | C4Object *; |
| 60 | C4Object *; |
| 61 | C4Object *; |
| 62 | C4Object **{nullptr}; |
| 63 | int32_t ; |
| 64 | CallbackType ; |
| 65 | bool ; // set for script created menus; user menus do CloseQuery and MenuSelection callbacks |
| 66 | bool ; // recursion check for close query callback |
| 67 | |
| 68 | void (C4Object *pObject, bool ); |
| 69 | |
| 70 | public: |
| 71 | void (C4Object *pObj); |
| 72 | void (C4Object *pObj); |
| 73 | bool (C4FacetExSurface &fctSymbol, const char *szEmpty, C4Object *pObject, int32_t = C4MN_Extra_None, int32_t = 0, int32_t iId = 0, int32_t iStyle = C4MN_Style_Normal, bool = false); |
| 74 | void (); |
| 75 | |
| 76 | virtual C4Object *() override; |
| 77 | bool () const { return !!CloseQuerying; } |
| 78 | |
| 79 | protected: |
| 80 | virtual bool MenuCommand(const char *szCommand, bool fIsCloseCommand) override; |
| 81 | |
| 82 | virtual bool (bool &rfRefilled) override; |
| 83 | virtual void (int32_t iNewSelection) override; // do object callbacks if selection changed in user menus |
| 84 | virtual bool () override; // do MenuQueryCancel-callbacks for user menus |
| 85 | virtual bool () override; // determine whether the menu is just viewed by an observer, and should not issue any calls |
| 86 | virtual void (int32_t Player, int32_t iIndex) override; |
| 87 | virtual void (int32_t Player, int32_t iIndex, bool fRight) override; |
| 88 | virtual void () override; |
| 89 | virtual int32_t () override; |
| 90 | |
| 91 | private: |
| 92 | int32_t (C4Object *pTarget, bool fCountOnly = false); |
| 93 | }; |
| 94 | |