Time and weather is saved, part of #1058
Also fixed unreliability in Health and LootPickup loading.
This commit is contained in:
parent
9c7a6bc443
commit
ea49abd113
@ -11,6 +11,7 @@
|
||||
#include "ChunkMap.h"
|
||||
#include "Generating/ChunkDesc.h"
|
||||
#include "OSSupport/Timer.h"
|
||||
#include <sstream>
|
||||
|
||||
// Serializers
|
||||
#include "WorldStorage/ScoreboardSerializer.h"
|
||||
@ -569,6 +570,11 @@ void cWorld::Start(void)
|
||||
m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true);
|
||||
m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true);
|
||||
int GameMode = IniFile.GetValueSetI("General", "Gamemode", (int)m_GameMode);
|
||||
int Weather = IniFile.GetValueSetI("General", "Weather", (int)m_Weather);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << m_TimeOfDay;
|
||||
Int64 TimeOfDay = _atoi64(IniFile.GetValueSet("General", "TimeInTicks", ss.str()).c_str());
|
||||
|
||||
if ((GetDimension() != dimNether) && (GetDimension() != dimEnd))
|
||||
{
|
||||
@ -581,6 +587,7 @@ void cWorld::Start(void)
|
||||
// Adjust the enum-backed variables into their respective bounds:
|
||||
m_GameMode = (eGameMode) Clamp(GameMode, (int)gmSurvival, (int)gmAdventure);
|
||||
m_TNTShrapnelLevel = (eShrapnelLevel)Clamp(TNTShrapnelLevel, (int)slNone, (int)slAll);
|
||||
m_Weather = (eWeather) Clamp(Weather, (int)wSunny, (int)wStorm);
|
||||
|
||||
switch (GetDimension())
|
||||
{
|
||||
@ -759,6 +766,11 @@ void cWorld::Stop(void)
|
||||
IniFile.SetValueI("Physics", "TNTShrapnelLevel", (int)m_TNTShrapnelLevel);
|
||||
IniFile.SetValueB("Mechanics", "CommandBlocksEnabled", m_bCommandBlocksEnabled);
|
||||
IniFile.SetValueB("Mechanics", "UseChatPrefixes", m_bUseChatPrefixes);
|
||||
IniFile.SetValueI("General", "Weather", (int)m_Weather);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << m_TimeOfDay;
|
||||
IniFile.SetValue("General", "TimeInTicks", ss.str());
|
||||
IniFile.WriteFile(m_IniFileName);
|
||||
|
||||
m_TickThread.Stop();
|
||||
|
@ -2454,9 +2454,16 @@ bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT &
|
||||
a_Monster.SetDropChanceChestplate(DropChance[2]);
|
||||
a_Monster.SetDropChanceLeggings(DropChance[3]);
|
||||
a_Monster.SetDropChanceBoots(DropChance[4]);
|
||||
bool CanPickUpLoot = (a_NBT.GetByte(a_NBT.FindChildByName(a_TagIdx, "CanPickUpLoot")) == 1);
|
||||
a_Monster.SetCanPickUpLoot(CanPickUpLoot);
|
||||
a_Monster.SetHealth(a_NBT.GetShort(a_NBT.FindChildByName(a_TagIdx, "Health")));
|
||||
|
||||
int LootTag = a_NBT.FindChildByName(a_TagIdx, "CanPickUpLoot");
|
||||
if (LootTag > 0)
|
||||
{
|
||||
bool CanPickUpLoot = (a_NBT.GetByte(LootTag) == 1);
|
||||
a_Monster.SetCanPickUpLoot(CanPickUpLoot);
|
||||
}
|
||||
|
||||
int HealthTag = a_NBT.FindChildByName(a_TagIdx, "Health");
|
||||
a_Monster.SetHealth(HealthTag > 0 ? a_NBT.GetShort(HealthTag) : a_Monster.GetMaxHealth());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user