Cleanup dat loading, fix version 8.6+

This commit is contained in:
Sam 2014-07-30 17:06:05 +02:00
parent e9352fe811
commit fe585d27d8
1 changed files with 28 additions and 13 deletions

View File

@ -147,6 +147,11 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
attr = ThingAttrNoMoveAnimation; attr = ThingAttrNoMoveAnimation;
else if(attr > 16) else if(attr > 16)
attr -= 1; attr -= 1;
} else if(g_game.getProtocolVersion() >= 860) {
/* Default attribute values follow
* the format of 8.6-9.86.
* Therefore no changes here.
*/
} else if(g_game.getProtocolVersion() >= 780) { } else if(g_game.getProtocolVersion() >= 780) {
/* In 7.80-8.54 all attributes from 8 and higher were /* In 7.80-8.54 all attributes from 8 and higher were
* incremented by 1 to make space for 8 as * incremented by 1 to make space for 8 as
@ -162,28 +167,38 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
if(attr == 23) if(attr == 23)
attr = ThingAttrFloorChange; attr = ThingAttrFloorChange;
} else if(g_game.getProtocolVersion() >= 740) { } else if(g_game.getProtocolVersion() >= 740) {
/* 7.4-7.5 */ /* In 7.4-7.5 attribute "Ground Border" did not exist
* attributes 1-15 have to be adjusted.
* Several other changes in the format.
*/
if(attr > 0 && attr <= 15) if(attr > 0 && attr <= 15)
attr += 1; attr += 1;
else if(attr == 16)
attr = ThingAttrLight;
else if(attr == 17) else if(attr == 17)
attr = ThingAttrFloorChange; attr = ThingAttrFloorChange;
else if(attr == 18) else if(attr == 18)
attr += 12; attr = ThingAttrFullGround;
else if(attr == 19 || attr == 22) else if(attr == 19)
attr += 6; attr = ThingAttrElevation;
else if(attr == 16)
attr += 5;
else if(attr == 20) else if(attr == 20)
attr += 4; attr = ThingAttrDisplacement;
else if(attr == 24) else if(attr == 22)
attr += 2; attr = ThingAttrMinimapColor;
else if(attr >= 25 && attr <= 27)
attr -= 8;
else if(attr == 23) else if(attr == 23)
attr -= 3; attr = ThingAttrRotateable;
else if(attr == 24)
attr = ThingAttrLyingCorpse;
else if(attr == 25)
attr = ThingAttrHangable;
else if(attr == 26)
attr = ThingAttrHookSouth;
else if(attr == 27)
attr = ThingAttrHookEast;
else if(attr == 28) else if(attr == 28)
attr -= 1; attr = ThingAttrAnimateAlways;
/* "Multi Use" and "Force Use" are swapped */
if(attr == ThingAttrMultiUse) if(attr == ThingAttrMultiUse)
attr = ThingAttrForceUse; attr = ThingAttrForceUse;
else if(attr == ThingAttrForceUse) else if(attr == ThingAttrForceUse)