1 #ifndef _UnlockableItem_h_ 2 #define _UnlockableItem_h_ 3 4 5 #include <GG/Enum.h> 6 #include "../util/Export.h" 7 8 9 /** types of items that can be unlocked for empires */ 10 GG_ENUM(UnlockableItemType, 11 INVALID_UNLOCKABLE_ITEM_TYPE = -1, 12 UIT_BUILDING, ///< a kind of Building 13 UIT_SHIP_PART, ///< a kind of ship part (which are placed into hulls to make designs) 14 UIT_SHIP_HULL, ///< a ship hull (into which parts are placed) 15 UIT_SHIP_DESIGN, ///< a complete ship design 16 UIT_TECH, ///< a technology 17 NUM_UNLOCKABLE_ITEM_TYPES ///< keep last, the number of types of unlockable item 18 ) 19 20 21 //! Specifies single item of game content that may be unlocked for an empire. 22 //! The @a type field stores the type of item that is being unlocked, such as 23 //! building or ship component, and the @a name field contains the name of the 24 //! actual item (e.g. (UIT_BUILDING, "Superfarm") or 25 //! (UIT_SHIP_PART, "Death Ray")). 26 struct FO_COMMON_API UnlockableItem { 27 UnlockableItem(); UnlockableItemUnlockableItem28 UnlockableItem(UnlockableItemType type_, const std::string& name_) : 29 type(type_), 30 name(name_) 31 {} 32 33 //! Returns a data file format representation of this object 34 auto Dump(unsigned short ntabs = 0) const -> std::string; 35 36 //! Returns a number, calculated from the contained data, which should be 37 //! different for different contained data, and must be the same for 38 //! the same contained data, and must be the same on different platforms 39 //! and executions of the program and the function. Useful to verify that 40 //! the parsed content is consistent without sending it all between 41 //! clients and server. 42 auto GetCheckSum() const -> unsigned int; 43 44 //! The kind of item this is 45 UnlockableItemType type; 46 47 //! the exact item this is 48 std::string name; 49 }; 50 51 52 FO_COMMON_API bool operator==(const UnlockableItem& lhs, const UnlockableItem& rhs); 53 54 bool operator!=(const UnlockableItem& lhs, const UnlockableItem& rhs); 55 56 57 namespace CheckSums { 58 FO_COMMON_API void CheckSumCombine(unsigned int& sum, const UnlockableItem& item); 59 } 60 61 #endif // _UnlockableItem_h_ 62