Browse Source

make monster lights compatible with vanilla

pull/3325/head
qndel 4 years ago committed by Anders Jenbo
parent
commit
bee45d61d6
  1. 8
      Source/loadsave.cpp

8
Source/loadsave.cpp

@ -625,7 +625,7 @@ void LoadMonster(LoadHelper *file, Monster &monster)
monster.leaderRelation = static_cast<LeaderRelation>(file->NextLE<uint8_t>());
monster.packsize = file->NextLE<uint8_t>();
monster.mlid = file->NextLE<int8_t>();
if (monster.mlid == Players[MyPlayerId]._plid)
if (monster.mlid == 0)
monster.mlid = NO_LIGHT; // Correct incorect values in old saves
if ((monster._mFlags & MFLAG_BERSERK) != 0) {
@ -1305,7 +1305,11 @@ void SaveMonster(SaveHelper *file, Monster &monster)
file->WriteLE<uint8_t>(monster.leader);
file->WriteLE<uint8_t>(static_cast<std::uint8_t>(monster.leaderRelation));
file->WriteLE<uint8_t>(monster.packsize);
file->WriteLE<int8_t>(monster.mlid);
// vanilla compatibility
if (monster.mlid == NO_LIGHT)
file->WriteLE<int8_t>(0);
else
file->WriteLE<int8_t>(monster.mlid);
// Omit pointer mName;
// Omit pointer MType;

Loading…
Cancel
Save