mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Fix Server triggering wrong errors if environment init fails
This commit is contained in:
parent
4f9ccd89b3
commit
650168cada
@ -624,6 +624,9 @@ PlayerSAO *ServerEnvironment::loadPlayer(RemotePlayer *player, bool *new_player,
|
|||||||
|
|
||||||
void ServerEnvironment::saveMeta()
|
void ServerEnvironment::saveMeta()
|
||||||
{
|
{
|
||||||
|
if (!m_meta_loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
std::string path = m_path_world + DIR_DELIM "env_meta.txt";
|
std::string path = m_path_world + DIR_DELIM "env_meta.txt";
|
||||||
|
|
||||||
// Open file and serialize
|
// Open file and serialize
|
||||||
@ -650,6 +653,9 @@ void ServerEnvironment::saveMeta()
|
|||||||
|
|
||||||
void ServerEnvironment::loadMeta()
|
void ServerEnvironment::loadMeta()
|
||||||
{
|
{
|
||||||
|
SANITY_CHECK(!m_meta_loaded);
|
||||||
|
m_meta_loaded = true;
|
||||||
|
|
||||||
// If file doesn't exist, load default environment metadata
|
// If file doesn't exist, load default environment metadata
|
||||||
if (!fs::PathExists(m_path_world + DIR_DELIM "env_meta.txt")) {
|
if (!fs::PathExists(m_path_world + DIR_DELIM "env_meta.txt")) {
|
||||||
infostream << "ServerEnvironment: Loading default environment metadata"
|
infostream << "ServerEnvironment: Loading default environment metadata"
|
||||||
|
@ -440,6 +440,8 @@ private:
|
|||||||
IntervalLimiter m_active_blocks_management_interval;
|
IntervalLimiter m_active_blocks_management_interval;
|
||||||
IntervalLimiter m_active_block_modifier_interval;
|
IntervalLimiter m_active_block_modifier_interval;
|
||||||
IntervalLimiter m_active_blocks_nodemetadata_interval;
|
IntervalLimiter m_active_blocks_nodemetadata_interval;
|
||||||
|
// Whether the variables below have been read from file yet
|
||||||
|
bool m_meta_loaded = false;
|
||||||
// Time from the beginning of the game in seconds.
|
// Time from the beginning of the game in seconds.
|
||||||
// Incremented in step().
|
// Incremented in step().
|
||||||
u32 m_game_time = 0;
|
u32 m_game_time = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user