]> git.lizzy.rs Git - minetest.git/commitdiff
Remove a few unused functions reported by callcatcher (#11658)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Tue, 12 Oct 2021 18:12:20 +0000 (20:12 +0200)
committerGitHub <noreply@github.com>
Tue, 12 Oct 2021 18:12:20 +0000 (20:12 +0200)
24 files changed:
src/chat.cpp
src/chat.h
src/client/mesh.cpp
src/client/mesh.h
src/clientiface.cpp
src/clientiface.h
src/emerge.cpp
src/emerge.h
src/inventory.cpp
src/inventory.h
src/map.cpp
src/map.h
src/mapblock.cpp
src/mapblock.h
src/mapgen/mapgen_v6.cpp
src/mapgen/mapgen_v6.h
src/noise.cpp
src/noise.h
src/rollback.cpp
src/rollback.h
src/script/lua_api/l_inventory.cpp
src/script/lua_api/l_inventory.h
src/script/lua_api/l_nodemeta.cpp
src/settings.cpp

index d8b577aabe7026907e49382270e0d3134ec978f9..92df038e83ab0f69d42ab07c699d526fccfe271a 100644 (file)
@@ -142,11 +142,6 @@ u32 ChatBuffer::getRows() const
        return m_rows;
 }
 
-void ChatBuffer::scrollTop()
-{
-       m_scroll = getTopScrollPos();
-}
-
 void ChatBuffer::reformat(u32 cols, u32 rows)
 {
        if (cols == 0 || rows == 0)
index 696d805eb7b05eacb7728366de259c20fe39e333..fc080f64b9c87a0b9784dceb75dc3ec97abe9596 100644 (file)
@@ -110,8 +110,6 @@ class ChatBuffer
        void scrollAbsolute(s32 scroll);
        // Scroll to bottom of buffer (newest)
        void scrollBottom();
-       // Scroll to top of buffer (oldest)
-       void scrollTop();
 
        // Functions for keeping track of whether the lines were modified by any
        // preceding operations
index e4313921895505f64594fe403306641f16db3bc5..c56eba2e2fb381900ad2088c9a1dc9dec9193b81 100644 (file)
@@ -498,592 +498,3 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
        }
        return dst_mesh;
 }
-
-struct vcache
-{
-       core::array<u32> tris;
-       float score;
-       s16 cachepos;
-       u16 NumActiveTris;
-};
-
-struct tcache
-{
-       u16 ind[3];
-       float score;
-       bool drawn;
-};
-
-const u16 cachesize = 32;
-
-float FindVertexScore(vcache *v)
-{
-       const float CacheDecayPower = 1.5f;
-       const float LastTriScore = 0.75f;
-       const float ValenceBoostScale = 2.0f;
-       const float ValenceBoostPower = 0.5f;
-       const float MaxSizeVertexCache = 32.0f;
-
-       if (v->NumActiveTris == 0)
-       {
-               // No tri needs this vertex!
-               return -1.0f;
-       }
-
-       float Score = 0.0f;
-       int CachePosition = v->cachepos;
-       if (CachePosition < 0)
-       {
-               // Vertex is not in FIFO cache - no score.
-       }
-       else
-       {
-               if (CachePosition < 3)
-               {
-                       // This vertex was used in the last triangle,
-                       // so it has a fixed score.
-                       Score = LastTriScore;
-               }
-               else
-               {
-                       // Points for being high in the cache.
-                       const float Scaler = 1.0f / (MaxSizeVertexCache - 3);
-                       Score = 1.0f - (CachePosition - 3) * Scaler;
-                       Score = powf(Score, CacheDecayPower);
-               }
-       }
-
-       // Bonus points for having a low number of tris still to
-       // use the vert, so we get rid of lone verts quickly.
-       float ValenceBoost = powf(v->NumActiveTris,
-                               -ValenceBoostPower);
-       Score += ValenceBoostScale * ValenceBoost;
-
-       return Score;
-}
-
-/*
-       A specialized LRU cache for the Forsyth algorithm.
-*/
-
-class f_lru
-{
-
-public:
-       f_lru(vcache *v, tcache *t): vc(v), tc(t)
-       {
-               for (int &i : cache) {
-                       i = -1;
-               }
-       }
-
-       // Adds this vertex index and returns the highest-scoring triangle index
-       u32 add(u16 vert, bool updatetris = false)
-       {
-               bool found = false;
-
-               // Mark existing pos as empty
-               for (u16 i = 0; i < cachesize; i++)
-               {
-                       if (cache[i] == vert)
-                       {
-                               // Move everything down
-                               for (u16 j = i; j; j--)
-                               {
-                                       cache[j] = cache[j - 1];
-                               }
-
-                               found = true;
-                               break;
-                       }
-               }
-
-               if (!found)
-               {
-                       if (cache[cachesize-1] != -1)
-                               vc[cache[cachesize-1]].cachepos = -1;
-
-                       // Move everything down
-                       for (u16 i = cachesize - 1; i; i--)
-                       {
-                               cache[i] = cache[i - 1];
-                       }
-               }
-
-               cache[0] = vert;
-
-               u32 highest = 0;
-               float hiscore = 0;
-
-               if (updatetris)
-               {
-                       // Update cache positions
-                       for (u16 i = 0; i < cachesize; i++)
-                       {
-                               if (cache[i] == -1)
-                                       break;
-
-                               vc[cache[i]].cachepos = i;
-                               vc[cache[i]].score = FindVertexScore(&vc[cache[i]]);
-                       }
-
-                       // Update triangle scores
-                       for (int i : cache) {
-                               if (i == -1)
-                                       break;
-
-                               const u16 trisize = vc[i].tris.size();
-                               for (u16 t = 0; t < trisize; t++)
-                               {
-                                       tcache *tri = &tc[vc[i].tris[t]];
-
-                                       tri->score =
-                                               vc[tri->ind[0]].score +
-                                               vc[tri->ind[1]].score +
-                                               vc[tri->ind[2]].score;
-
-                                       if (tri->score > hiscore)
-                                       {
-                                               hiscore = tri->score;
-                                               highest = vc[i].tris[t];
-                                       }
-                               }
-                       }
-               }
-
-               return highest;
-       }
-
-private:
-       s32 cache[cachesize];
-       vcache *vc;
-       tcache *tc;
-};
-
-/**
-Vertex cache optimization according to the Forsyth paper:
-http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
-
-The function is thread-safe (read: you can optimize several meshes in different threads)
-
-\param mesh Source mesh for the operation.  */
-scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh)
-{
-       if (!mesh)
-               return 0;
-
-       scene::SMesh *newmesh = new scene::SMesh();
-       newmesh->BoundingBox = mesh->getBoundingBox();
-
-       const u32 mbcount = mesh->getMeshBufferCount();
-
-       for (u32 b = 0; b < mbcount; ++b)
-       {
-               const scene::IMeshBuffer *mb = mesh->getMeshBuffer(b);
-
-               if (mb->getIndexType() != video::EIT_16BIT)
-               {
-                       //os::Printer::log("Cannot optimize a mesh with 32bit indices", ELL_ERROR);
-                       newmesh->drop();
-                       return 0;
-               }
-
-               const u32 icount = mb->getIndexCount();
-               const u32 tcount = icount / 3;
-               const u32 vcount = mb->getVertexCount();
-               const u16 *ind = mb->getIndices();
-
-               vcache *vc = new vcache[vcount];
-               tcache *tc = new tcache[tcount];
-
-               f_lru lru(vc, tc);
-
-               // init
-               for (u16 i = 0; i < vcount; i++)
-               {
-                       vc[i].score = 0;
-                       vc[i].cachepos = -1;
-                       vc[i].NumActiveTris = 0;
-               }
-
-               // First pass: count how many times a vert is used
-               for (u32 i = 0; i < icount; i += 3)
-               {
-                       vc[ind[i]].NumActiveTris++;
-                       vc[ind[i + 1]].NumActiveTris++;
-                       vc[ind[i + 2]].NumActiveTris++;
-
-                       const u32 tri_ind = i/3;
-                       tc[tri_ind].ind[0] = ind[i];
-                       tc[tri_ind].ind[1] = ind[i + 1];
-                       tc[tri_ind].ind[2] = ind[i + 2];
-               }
-
-               // Second pass: list of each triangle
-               for (u32 i = 0; i < tcount; i++)
-               {
-                       vc[tc[i].ind[0]].tris.push_back(i);
-                       vc[tc[i].ind[1]].tris.push_back(i);
-                       vc[tc[i].ind[2]].tris.push_back(i);
-
-                       tc[i].drawn = false;
-               }
-
-               // Give initial scores
-               for (u16 i = 0; i < vcount; i++)
-               {
-                       vc[i].score = FindVertexScore(&vc[i]);
-               }
-               for (u32 i = 0; i < tcount; i++)
-               {
-                       tc[i].score =
-                                       vc[tc[i].ind[0]].score +
-                                       vc[tc[i].ind[1]].score +
-                                       vc[tc[i].ind[2]].score;
-               }
-
-               switch(mb->getVertexType())
-               {
-                       case video::EVT_STANDARD:
-                       {
-                               video::S3DVertex *v = (video::S3DVertex *) mb->getVertices();
-
-                               scene::SMeshBuffer *buf = new scene::SMeshBuffer();
-                               buf->Material = mb->getMaterial();
-
-                               buf->Vertices.reallocate(vcount);
-                               buf->Indices.reallocate(icount);
-
-                               core::map<const video::S3DVertex, const u16> sind; // search index for fast operation
-                               typedef core::map<const video::S3DVertex, const u16>::Node snode;
-
-                               // Main algorithm
-                               u32 highest = 0;
-                               u32 drawcalls = 0;
-                               for (;;)
-                               {
-                                       if (tc[highest].drawn)
-                                       {
-                                               bool found = false;
-                                               float hiscore = 0;
-                                               for (u32 t = 0; t < tcount; t++)
-                                               {
-                                                       if (!tc[t].drawn)
-                                                       {
-                                                               if (tc[t].score > hiscore)
-                                                               {
-                                                                       highest = t;
-                                                                       hiscore = tc[t].score;
-                                                                       found = true;
-                                                               }
-                                                       }
-                                               }
-                                               if (!found)
-                                                       break;
-                                       }
-
-                                       // Output the best triangle
-                                       u16 newind = buf->Vertices.size();
-
-                                       snode *s = sind.find(v[tc[highest].ind[0]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[0]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[0]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[1]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[1]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[1]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[2]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[2]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[2]], newind);
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       vc[tc[highest].ind[0]].NumActiveTris--;
-                                       vc[tc[highest].ind[1]].NumActiveTris--;
-                                       vc[tc[highest].ind[2]].NumActiveTris--;
-
-                                       tc[highest].drawn = true;
-
-                                       for (u16 j : tc[highest].ind) {
-                                               vcache *vert = &vc[j];
-                                               for (u16 t = 0; t < vert->tris.size(); t++)
-                                               {
-                                                       if (highest == vert->tris[t])
-                                                       {
-                                                               vert->tris.erase(t);
-                                                               break;
-                                                       }
-                                               }
-                                       }
-
-                                       lru.add(tc[highest].ind[0]);
-                                       lru.add(tc[highest].ind[1]);
-                                       highest = lru.add(tc[highest].ind[2], true);
-                                       drawcalls++;
-                               }
-
-                               buf->setBoundingBox(mb->getBoundingBox());
-                               newmesh->addMeshBuffer(buf);
-                               buf->drop();
-                       }
-                       break;
-                       case video::EVT_2TCOORDS:
-                       {
-                               video::S3DVertex2TCoords *v = (video::S3DVertex2TCoords *) mb->getVertices();
-
-                               scene::SMeshBufferLightMap *buf = new scene::SMeshBufferLightMap();
-                               buf->Material = mb->getMaterial();
-
-                               buf->Vertices.reallocate(vcount);
-                               buf->Indices.reallocate(icount);
-
-                               core::map<const video::S3DVertex2TCoords, const u16> sind; // search index for fast operation
-                               typedef core::map<const video::S3DVertex2TCoords, const u16>::Node snode;
-
-                               // Main algorithm
-                               u32 highest = 0;
-                               u32 drawcalls = 0;
-                               for (;;)
-                               {
-                                       if (tc[highest].drawn)
-                                       {
-                                               bool found = false;
-                                               float hiscore = 0;
-                                               for (u32 t = 0; t < tcount; t++)
-                                               {
-                                                       if (!tc[t].drawn)
-                                                       {
-                                                               if (tc[t].score > hiscore)
-                                                               {
-                                                                       highest = t;
-                                                                       hiscore = tc[t].score;
-                                                                       found = true;
-                                                               }
-                                                       }
-                                               }
-                                               if (!found)
-                                                       break;
-                                       }
-
-                                       // Output the best triangle
-                                       u16 newind = buf->Vertices.size();
-
-                                       snode *s = sind.find(v[tc[highest].ind[0]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[0]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[0]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[1]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[1]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[1]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[2]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[2]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[2]], newind);
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       vc[tc[highest].ind[0]].NumActiveTris--;
-                                       vc[tc[highest].ind[1]].NumActiveTris--;
-                                       vc[tc[highest].ind[2]].NumActiveTris--;
-
-                                       tc[highest].drawn = true;
-
-                                       for (u16 j : tc[highest].ind) {
-                                               vcache *vert = &vc[j];
-                                               for (u16 t = 0; t < vert->tris.size(); t++)
-                                               {
-                                                       if (highest == vert->tris[t])
-                                                       {
-                                                               vert->tris.erase(t);
-                                                               break;
-                                                       }
-                                               }
-                                       }
-
-                                       lru.add(tc[highest].ind[0]);
-                                       lru.add(tc[highest].ind[1]);
-                                       highest = lru.add(tc[highest].ind[2]);
-                                       drawcalls++;
-                               }
-
-                               buf->setBoundingBox(mb->getBoundingBox());
-                               newmesh->addMeshBuffer(buf);
-                               buf->drop();
-
-                       }
-                       break;
-                       case video::EVT_TANGENTS:
-                       {
-                               video::S3DVertexTangents *v = (video::S3DVertexTangents *) mb->getVertices();
-
-                               scene::SMeshBufferTangents *buf = new scene::SMeshBufferTangents();
-                               buf->Material = mb->getMaterial();
-
-                               buf->Vertices.reallocate(vcount);
-                               buf->Indices.reallocate(icount);
-
-                               core::map<const video::S3DVertexTangents, const u16> sind; // search index for fast operation
-                               typedef core::map<const video::S3DVertexTangents, const u16>::Node snode;
-
-                               // Main algorithm
-                               u32 highest = 0;
-                               u32 drawcalls = 0;
-                               for (;;)
-                               {
-                                       if (tc[highest].drawn)
-                                       {
-                                               bool found = false;
-                                               float hiscore = 0;
-                                               for (u32 t = 0; t < tcount; t++)
-                                               {
-                                                       if (!tc[t].drawn)
-                                                       {
-                                                               if (tc[t].score > hiscore)
-                                                               {
-                                                                       highest = t;
-                                                                       hiscore = tc[t].score;
-                                                                       found = true;
-                                                               }
-                                                       }
-                                               }
-                                               if (!found)
-                                                       break;
-                                       }
-
-                                       // Output the best triangle
-                                       u16 newind = buf->Vertices.size();
-
-                                       snode *s = sind.find(v[tc[highest].ind[0]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[0]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[0]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[1]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[1]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[1]], newind);
-                                               newind++;
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       s = sind.find(v[tc[highest].ind[2]]);
-
-                                       if (!s)
-                                       {
-                                               buf->Vertices.push_back(v[tc[highest].ind[2]]);
-                                               buf->Indices.push_back(newind);
-                                               sind.insert(v[tc[highest].ind[2]], newind);
-                                       }
-                                       else
-                                       {
-                                               buf->Indices.push_back(s->getValue());
-                                       }
-
-                                       vc[tc[highest].ind[0]].NumActiveTris--;
-                                       vc[tc[highest].ind[1]].NumActiveTris--;
-                                       vc[tc[highest].ind[2]].NumActiveTris--;
-
-                                       tc[highest].drawn = true;
-
-                                       for (u16 j : tc[highest].ind) {
-                                               vcache *vert = &vc[j];
-                                               for (u16 t = 0; t < vert->tris.size(); t++)
-                                               {
-                                                       if (highest == vert->tris[t])
-                                                       {
-                                                               vert->tris.erase(t);
-                                                               break;
-                                                       }
-                                               }
-                                       }
-
-                                       lru.add(tc[highest].ind[0]);
-                                       lru.add(tc[highest].ind[1]);
-                                       highest = lru.add(tc[highest].ind[2]);
-                                       drawcalls++;
-                               }
-
-                               buf->setBoundingBox(mb->getBoundingBox());
-                               newmesh->addMeshBuffer(buf);
-                               buf->drop();
-                       }
-                       break;
-               }
-
-               delete [] vc;
-               delete [] tc;
-
-       } // for each meshbuffer
-
-       return newmesh;
-}
index dbc091a06fd716ca64987ab5752d9f77d3fd717c..1ed753c0134101eba9eb4c7579ced9722ee7278d 100644 (file)
@@ -133,10 +133,3 @@ void recalculateBoundingBox(scene::IMesh *src_mesh);
        We assume normal to be valid when it's 0 < length < Inf. and not NaN
  */
 bool checkMeshNormals(scene::IMesh *mesh);
-
-/*
-       Vertex cache optimization according to the Forsyth paper:
-       http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
-       Ported from irrlicht 1.8
-*/
-scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh);
index f35dcd0ebf4e1da9dc0a3ea4c05e0bb55bed7eeb..a1c3e1187384349de0717b8bef79b2459423c792 100644 (file)
@@ -714,31 +714,6 @@ void ClientInterface::sendToAll(NetworkPacket *pkt)
        }
 }
 
-void ClientInterface::sendToAllCompat(NetworkPacket *pkt, NetworkPacket *legacypkt,
-               u16 min_proto_ver)
-{
-       RecursiveMutexAutoLock clientslock(m_clients_mutex);
-       for (auto &client_it : m_clients) {
-               RemoteClient *client = client_it.second;
-               NetworkPacket *pkt_to_send = nullptr;
-
-               if (client->net_proto_version >= min_proto_ver) {
-                       pkt_to_send = pkt;
-               } else if (client->net_proto_version != 0) {
-                       pkt_to_send = legacypkt;
-               } else {
-                       warningstream << "Client with unhandled version to handle: '"
-                               << client->net_proto_version << "'";
-                       continue;
-               }
-
-               m_con->Send(client->peer_id,
-                       clientCommandFactoryTable[pkt_to_send->getCommand()].channel,
-                       pkt_to_send,
-                       clientCommandFactoryTable[pkt_to_send->getCommand()].reliable);
-       }
-}
-
 RemoteClient* ClientInterface::getClientNoEx(session_t peer_id, ClientState state_min)
 {
        RecursiveMutexAutoLock clientslock(m_clients_mutex);
index dfd97674137c249d0dcb6a3d7cdeba2152f0a9d1..b1591ddb027332181be646e3ca0a90e8478ba03b 100644 (file)
@@ -465,7 +465,6 @@ class ClientInterface {
 
        /* send to all clients */
        void sendToAll(NetworkPacket *pkt);
-       void sendToAllCompat(NetworkPacket *pkt, NetworkPacket *legacypkt, u16 min_proto_ver);
 
        /* delete a client */
        void DeleteClient(session_t peer_id);
index 9234fe6d394d6b67798b9af41bb672101a61e3ff..be64d744a065013f78461089c39969adc04d6881 100644 (file)
@@ -367,12 +367,6 @@ bool EmergeManager::isBlockInQueue(v3s16 pos)
 //
 
 
-// TODO(hmmmm): Move this to ServerMap
-v3s16 EmergeManager::getContainingChunk(v3s16 blockpos)
-{
-       return getContainingChunk(blockpos, mgparams->chunksize);
-}
-
 // TODO(hmmmm): Move this to ServerMap
 v3s16 EmergeManager::getContainingChunk(v3s16 blockpos, s16 chunksize)
 {
@@ -396,17 +390,6 @@ int EmergeManager::getSpawnLevelAtPoint(v2s16 p)
 }
 
 
-int EmergeManager::getGroundLevelAtPoint(v2s16 p)
-{
-       if (m_mapgens.empty() || !m_mapgens[0]) {
-               errorstream << "EmergeManager: getGroundLevelAtPoint() called"
-                       " before mapgen init" << std::endl;
-               return 0;
-       }
-
-       return m_mapgens[0]->getGroundLevelAtPoint(p);
-}
-
 // TODO(hmmmm): Move this to ServerMap
 bool EmergeManager::isBlockUnderground(v3s16 blockpos)
 {
index e2d7279735394e30f9602feb5a098043a90d4473..61e7bda63e25f4d0e47e4c4752a2d34aea7d96c7 100644 (file)
@@ -176,13 +176,10 @@ class EmergeManager {
 
        bool isBlockInQueue(v3s16 pos);
 
-       v3s16 getContainingChunk(v3s16 blockpos);
-
        Mapgen *getCurrentMapgen();
 
        // Mapgen helpers methods
        int getSpawnLevelAtPoint(v2s16 p);
-       int getGroundLevelAtPoint(v2s16 p);
        bool isBlockUnderground(v3s16 blockpos);
 
        static v3s16 getContainingChunk(v3s16 blockpos, s16 chunksize);
index 029fcbf4fe85079a12c8ab46d7cf90a4d19564ca..d14b12f9dae90371db2210ca851fd2d7ed781804 100644 (file)
@@ -560,11 +560,6 @@ u32 InventoryList::getUsedSlots() const
        return num;
 }
 
-u32 InventoryList::getFreeSlots() const
-{
-       return getSize() - getUsedSlots();
-}
-
 const ItemStack& InventoryList::getItem(u32 i) const
 {
        assert(i < m_size); // Pre-condition
index 276002d280e72bea102eda43688ad1122bb866d5..eb063d4ad89bac4621ddfe1e5f25b316d6095f04 100644 (file)
@@ -211,7 +211,6 @@ class InventoryList
        u32 getWidth() const;
        // Count used slots
        u32 getUsedSlots() const;
-       u32 getFreeSlots() const;
 
        // Get reference to item
        const ItemStack& getItem(u32 i) const;
index 30ce064d6a00410edfee53d2b6c01ef1e557f016..77031e17dfa4f885f5e301ccd69b924336b1912b 100644 (file)
@@ -139,13 +139,6 @@ MapBlock * Map::getBlockNoCreate(v3s16 p3d)
        return block;
 }
 
-bool Map::isNodeUnderground(v3s16 p)
-{
-       v3s16 blockpos = getNodeBlockPos(p);
-       MapBlock *block = getBlockNoCreateNoEx(blockpos);
-       return block && block->getIsUnderground();
-}
-
 bool Map::isValidPosition(v3s16 p)
 {
        v3s16 blockpos = getNodeBlockPos(p);
index 8d20c4a44855a6129534cc443dba0394a9beef7c..fe580b20f8bccf9fbc35ca4a42466c37c109defe 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -167,9 +167,6 @@ class Map /*: public NodeContainer*/
 
        inline const NodeDefManager * getNodeDefManager() { return m_nodedef; }
 
-       // Returns InvalidPositionException if not found
-       bool isNodeUnderground(v3s16 p);
-
        bool isValidPosition(v3s16 p);
 
        // throws InvalidPositionException if not found
index 4958d3a65a36ca2bcfed0d1bc72e2836d21d1b4e..e3a6caa199616f6e416e1dc2c044dea12e1a0c17 100644 (file)
@@ -218,31 +218,6 @@ void MapBlock::expireDayNightDiff()
        m_day_night_differs_expired = true;
 }
 
-s16 MapBlock::getGroundLevel(v2s16 p2d)
-{
-       if(isDummy())
-               return -3;
-       try
-       {
-               s16 y = MAP_BLOCKSIZE-1;
-               for(; y>=0; y--)
-               {
-                       MapNode n = getNodeRef(p2d.X, y, p2d.Y);
-                       if (m_gamedef->ndef()->get(n).walkable) {
-                               if(y == MAP_BLOCKSIZE-1)
-                                       return -2;
-
-                               return y;
-                       }
-               }
-               return -1;
-       }
-       catch(InvalidPositionException &e)
-       {
-               return -3;
-       }
-}
-
 /*
        Serialization
 */
index 8de631a2925fbae3f6537d6daf2e3733ffb96f58..e729fdb1cc2eacf8300406b58845b275ac6feb9c 100644 (file)
@@ -363,20 +363,6 @@ class MapBlock
                return m_day_night_differs;
        }
 
-       ////
-       //// Miscellaneous stuff
-       ////
-
-       /*
-               Tries to measure ground level.
-               Return value:
-                       -1 = only air
-                       -2 = only ground
-                       -3 = random fail
-                       0...MAP_BLOCKSIZE-1 = ground level
-       */
-       s16 getGroundLevel(v2s16 p2d);
-
        ////
        //// Timestamp (see m_timestamp)
        ////
index bce9cee8123100f14e208dcfc2037fc0fc2f06be..a418acaceae0001fae5b85f124474997bad58b0a 100644 (file)
@@ -360,19 +360,6 @@ int MapgenV6::getSpawnLevelAtPoint(v2s16 p)
 
 //////////////////////// Noise functions
 
-float MapgenV6::getMudAmount(v2s16 p)
-{
-       int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
-       return getMudAmount(index);
-}
-
-
-bool MapgenV6::getHaveBeach(v2s16 p)
-{
-       int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
-       return getHaveBeach(index);
-}
-
 
 BiomeV6Type MapgenV6::getBiome(v2s16 p)
 {
index a6e6da8c6ea8acdcb2b2f4dd9ebf8b77af3fbce3..b0eb67893c7e6f865640806c483f7df0feb74b88 100644 (file)
@@ -154,9 +154,7 @@ class MapgenV6 : public Mapgen {
        float getHumidity(v2s16 p);
        float getTreeAmount(v2s16 p);
        bool getHaveAppleTree(v2s16 p);
-       float getMudAmount(v2s16 p);
-       virtual float getMudAmount(int index);
-       bool getHaveBeach(v2s16 p);
+       float getMudAmount(int index);
        bool getHaveBeach(int index);
        BiomeV6Type getBiome(v2s16 p);
        BiomeV6Type getBiome(int index, v2s16 p);
index a10efa3c4c110e0b1d10ec1fac0f03d0e838b124..2f4de6855ac0afb1331c9a818f3519fdc1b18cea 100644 (file)
@@ -312,51 +312,6 @@ float noise2d_perlin(float x, float y, s32 seed,
 }
 
 
-float noise2d_perlin_abs(float x, float y, s32 seed,
-       int octaves, float persistence, bool eased)
-{
-       float a = 0;
-       float f = 1.0;
-       float g = 1.0;
-       for (int i = 0; i < octaves; i++) {
-               a += g * std::fabs(noise2d_gradient(x * f, y * f, seed + i, eased));
-               f *= 2.0;
-               g *= persistence;
-       }
-       return a;
-}
-
-
-float noise3d_perlin(float x, float y, float z, s32 seed,
-       int octaves, float persistence, bool eased)
-{
-       float a = 0;
-       float f = 1.0;
-       float g = 1.0;
-       for (int i = 0; i < octaves; i++) {
-               a += g * noise3d_gradient(x * f, y * f, z * f, seed + i, eased);
-               f *= 2.0;
-               g *= persistence;
-       }
-       return a;
-}
-
-
-float noise3d_perlin_abs(float x, float y, float z, s32 seed,
-       int octaves, float persistence, bool eased)
-{
-       float a = 0;
-       float f = 1.0;
-       float g = 1.0;
-       for (int i = 0; i < octaves; i++) {
-               a += g * std::fabs(noise3d_gradient(x * f, y * f, z * f, seed + i, eased));
-               f *= 2.0;
-               g *= persistence;
-       }
-       return a;
-}
-
-
 float contour(float v)
 {
        v = std::fabs(v);
index 854781731b9cc19920e963d5d71e0da167aaf600..e4a9ed6c76013130dadb12d5adb1bb6deadfac26 100644 (file)
@@ -224,15 +224,6 @@ float noise3d_gradient(float x, float y, float z, s32 seed, bool eased=false);
 float noise2d_perlin(float x, float y, s32 seed,
                int octaves, float persistence, bool eased=true);
 
-float noise2d_perlin_abs(float x, float y, s32 seed,
-               int octaves, float persistence, bool eased=true);
-
-float noise3d_perlin(float x, float y, float z, s32 seed,
-               int octaves, float persistence, bool eased=false);
-
-float noise3d_perlin_abs(float x, float y, float z, s32 seed,
-               int octaves, float persistence, bool eased=false);
-
 inline float easeCurve(float t)
 {
        return t * t * t * (t * (6.f * t - 15.f) + 10.f);
index 3cd9c7ce7c63c2e4ca748480dc7a2191924a1d99..33b7958b9acccb2994e12cd86e28b58ca89a9e6d 100644 (file)
@@ -941,12 +941,6 @@ void RollbackManager::addAction(const RollbackAction & action)
        }
 }
 
-std::list<RollbackAction> RollbackManager::getEntriesSince(time_t first_time)
-{
-       flush();
-       return getActionsSince(first_time);
-}
-
 std::list<RollbackAction> RollbackManager::getNodeActors(v3s16 pos, int range,
                time_t seconds, int limit)
 {
index 1d9949d1520676094d5c548dc0a9dc3de8ee5f26..ff96e513f5453938cc4df0bcd4f73f3351801855 100644 (file)
@@ -46,7 +46,6 @@ class RollbackManager: public IRollbackManager
        void flush();
 
        void addAction(const RollbackAction & action);
-       std::list<RollbackAction> getEntriesSince(time_t first_time);
        std::list<RollbackAction> getNodeActors(v3s16 pos, int range,
                        time_t seconds, int limit);
        std::list<RollbackAction> getRevertActions(
index 0dd4184621dd0d13576180157fd18b10be3bfd83..b0a4ee1943b95315469ad5bab5aa30060276e9e6 100644 (file)
@@ -421,19 +421,6 @@ void InvRef::create(lua_State *L, const InventoryLocation &loc)
        luaL_getmetatable(L, className);
        lua_setmetatable(L, -2);
 }
-void InvRef::createPlayer(lua_State *L, RemotePlayer *player)
-{
-       NO_MAP_LOCK_REQUIRED;
-       InventoryLocation loc;
-       loc.setPlayer(player->getName());
-       create(L, loc);
-}
-void InvRef::createNodeMeta(lua_State *L, v3s16 p)
-{
-       InventoryLocation loc;
-       loc.setNodeMeta(p);
-       create(L, loc);
-}
 
 void InvRef::Register(lua_State *L)
 {
index 94f670c9d51d0dce1ce7d157b0e50a7952b62634..6a75bac0f38e4e8a4fcd080dab8462e6ec1294e0 100644 (file)
@@ -111,8 +111,6 @@ class InvRef : public ModApiBase {
        // Creates an InvRef and leaves it on top of stack
        // Not callable from Lua; all references are created on the C side.
        static void create(lua_State *L, const InventoryLocation &loc);
-       static void createPlayer(lua_State *L, RemotePlayer *player);
-       static void createNodeMeta(lua_State *L, v3s16 p);
        static void Register(lua_State *L);
 };
 
index 60d14f8f2029b26e121bb27a71217a80bc2300e0..34760157d5a07b25431c1d9142b65d419cad416f 100644 (file)
@@ -89,7 +89,10 @@ int NodeMetaRef::l_get_inventory(lua_State *L)
 
        NodeMetaRef *ref = checkobject(L, 1);
        ref->getmeta(true);  // try to ensure the metadata exists
-       InvRef::createNodeMeta(L, ref->m_p);
+
+       InventoryLocation loc;
+       loc.setNodeMeta(ref->m_p);
+       InvRef::create(L, loc);
        return 1;
 }
 
index f4de5bec90d755edc86e684517f678bb8512a902..818d2bc41460e8422d949ac34f27d9eb24c1c023 100644 (file)
@@ -104,8 +104,7 @@ Settings *Settings::createLayer(SettingsLayer sl, const std::string &end_tag)
 
 Settings *Settings::getLayer(SettingsLayer sl)
 {
-       sanity_check((int)sl >= 0 && sl < SL_TOTAL_COUNT);
-       return g_hierarchy.layers[(int)sl];
+       return g_hierarchy.getLayer(sl);
 }