Parcourir la source

Increased possible storage limit (#5972)

Disallowing the compiler to add padding to the structures allows more items in storage again.
Lemongrass3110 il y a 4 ans
Parent
commit
5d92d1a000
1 fichiers modifiés avec 17 ajouts et 7 suppressions
  1. 17 7
      src/common/mmo.hpp

+ 17 - 7
src/common/mmo.hpp

@@ -249,12 +249,6 @@ struct quest {
 	e_quest_state state;             ///< Current quest state
 };
 
-struct s_item_randomoption {
-	short id;
-	short value;
-	char param;
-};
-
 /// Achievement log entry
 struct achievement {
 	int achievement_id;                    ///< Achievement ID
@@ -264,6 +258,17 @@ struct achievement {
 	int score;                             ///< Amount of points achievement is worth
 };
 
+// NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
+#if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
+	#pragma pack( push, 1 )
+#endif
+
+struct s_item_randomoption {
+	short id;
+	short value;
+	char param;
+} __attribute__((packed));
+
 struct item {
 	int id;
 	t_itemid nameid;
@@ -279,7 +284,12 @@ struct item {
 	uint64 unique_id;
 	unsigned int equipSwitch; // location(s) where item is equipped for equip switching (using enum equip_pos for bitmasking)
 	uint8 enchantgrade;
-};
+} __attribute__((packed));
+
+// NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
+#if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
+	#pragma pack( pop )
+#endif
 
 //Equip position constants
 enum equip_pos : uint32 {