From 451865ac699fd03d9834903199870aeb46bd13b2 Mon Sep 17 00:00:00 2001 From: darkrose Date: Sat, 2 Sep 2017 21:38:27 +1000 Subject: [PATCH] assorted tweaks --- src/config_default.c | 1 + src/environment.cpp | 2 +- src/environment.h | 13 +++++++++++++ src/mapblock_mesh.cpp | 9 ++++++--- src/plantgrowth.cpp | 8 ++++---- src/tile.cpp | 8 +++----- 6 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/config_default.c b/src/config_default.c index 5d412a4..c58cf90 100644 --- a/src/config_default.c +++ b/src/config_default.c @@ -152,6 +152,7 @@ void config_default_init() config_set_default("world.game.environment.footprints","true",NULL); config_set_default("world.game.environment.fire.spread","false",NULL); config_set_default("world.game.environment.time.speed","96",NULL); + config_set_default("world.game.environment.season","auto",NULL); config_set_default("world.game.motd","",NULL); config_set_default("world.map.type","default",NULL); diff --git a/src/environment.cpp b/src/environment.cpp index 5cee451..db47c98 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -3057,6 +3057,7 @@ void ServerEnvironment::step(float dtime) if ( coldzone + && biome != BIOME_BEACH && ( content_features(n).draw_type == CDT_CUBELIKE || content_features(n).draw_type == CDT_GLASSLIKE @@ -4538,7 +4539,6 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object) void ClientEnvironment::addActiveObject(u16 id, u8 type, const std::string &init_data) { - // TODO: convert old to new ClientActiveObject* obj = ClientActiveObject::create(type); if (obj == NULL) { infostream<<"ClientEnvironment::addActiveObject(): " diff --git a/src/environment.h b/src/environment.h index d3ce01f..8456987 100644 --- a/src/environment.h +++ b/src/environment.h @@ -37,6 +37,8 @@ - etc. */ +#include "common.h" + #include #include #include @@ -198,6 +200,17 @@ public: u32 getSeason() { + char* s = config_get("world.game.environment.season"); + if (s) { + if (!strcmp(s,"summer")) + return ENV_SEASON_SUMMER; + if (!strcmp(s,"autumn") || !strcmp(s,"fall")) + return ENV_SEASON_AUTUMN; + if (!strcmp(s,"winter")) + return ENV_SEASON_WINTER; + if (!strcmp(s,"spring")) + return ENV_SEASON_SPRING; + } return (m_time%240)/60; } diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 6e2c8de..9f8b8fd 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -500,6 +500,9 @@ void MapBlockMesh::animate(float time) m_animation_data[it->first].frame = frame; + u16 mc = m_mesh->getMeshBufferCount(); + if (mc <= it->first) + continue; scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(it->first); // Create new texture name from original @@ -536,7 +539,7 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut #if USE_AUDIO == 1 - { + if (data->m_sounds != NULL) { std::string snd = content_features(n).sound_ambient; std::map::iterator i = data->m_sounds->find(p); if (snd != "") { @@ -730,9 +733,9 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut if (mutex != NULL) mutex->Lock(); - if (m_mesh) + if (m_mesh != NULL) m_mesh->drop(); - if (m_farmesh) + if (m_farmesh != NULL) m_farmesh->drop(); m_mesh = mesh; m_farmesh = fmesh; diff --git a/src/plantgrowth.cpp b/src/plantgrowth.cpp index 74e25e9..cf73df0 100644 --- a/src/plantgrowth.cpp +++ b/src/plantgrowth.cpp @@ -608,22 +608,22 @@ void plantgrowth_grass(ServerEnvironment *env, v3s16 p0) u8 p = n.param2&0xF0; if ((p&(1<<7)) == 0) { MapNode nn = env->getMap().getNodeNoEx(p0+v3s16(0,0,-1)); - if (nn.getContent() == c && (nn.param1&0x0F) == p1mask) + if (nn.getContent() == c && (nn.param1&0x0F) == p1mask && nn.param2 == 0) p |= 1<<7; } if ((p&(1<<6)) == 0) { MapNode nn = env->getMap().getNodeNoEx(p0+v3s16(0,0,1)); - if (nn.getContent() == c && (nn.param1&0x0F) == p1mask) + if (nn.getContent() == c && (nn.param1&0x0F) == p1mask && nn.param2 == 0) p |= 1<<6; } if ((p&(1<<5)) == 0) { MapNode nn = env->getMap().getNodeNoEx(p0+v3s16(-1,0,0)); - if (nn.getContent() == c && (nn.param1&0x0F) == p1mask) + if (nn.getContent() == c && (nn.param1&0x0F) == p1mask && nn.param2 == 0) p |= 1<<5; } if ((p&(1<<4)) == 0) { MapNode nn = env->getMap().getNodeNoEx(p0+v3s16(1,0,0)); - if (nn.getContent() == c && (nn.param1&0x0F) == p1mask) + if (nn.getContent() == c && (nn.param1&0x0F) == p1mask && nn.param2 == 0) p |= 1<<4; } if (!n.param2 && p == 0 && myrand_range(0,20) != 0) diff --git a/src/tile.cpp b/src/tile.cpp index 47f3504..7ffd790 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -72,8 +72,7 @@ void TextureSource::processQueue() /* Fetch textures */ - if(m_get_texture_queue.size() > 0) - { + if (m_get_texture_queue.size() > 0) { GetRequest request = m_get_texture_queue.pop(); @@ -82,12 +81,11 @@ void TextureSource::processQueue() <<"name=\""< - result; + GetResult result; result.key = request.key; result.callers = request.callers; result.item = getTextureIdDirect(request.key); - + /* TODO: segv right about here */ request.dest->push_back(result); } }