aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/chat.cpp5
-rw-r--r--src/chat.h2
-rw-r--r--src/client/mesh.cpp589
-rw-r--r--src/client/mesh.h7
-rw-r--r--src/clientiface.cpp25
-rw-r--r--src/clientiface.h1
-rw-r--r--src/emerge.cpp17
-rw-r--r--src/emerge.h3
-rw-r--r--src/inventory.cpp5
-rw-r--r--src/inventory.h1
-rw-r--r--src/map.cpp7
-rw-r--r--src/map.h3
-rw-r--r--src/mapblock.cpp25
-rw-r--r--src/mapblock.h14
-rw-r--r--src/mapgen/mapgen_v6.cpp13
-rw-r--r--src/mapgen/mapgen_v6.h4
-rw-r--r--src/noise.cpp45
-rw-r--r--src/noise.h9
-rw-r--r--src/rollback.cpp6
-rw-r--r--src/rollback.h1
-rw-r--r--src/script/lua_api/l_inventory.cpp13
-rw-r--r--src/script/lua_api/l_inventory.h2
-rw-r--r--src/script/lua_api/l_nodemeta.cpp5
-rw-r--r--src/settings.cpp3
24 files changed, 6 insertions, 799 deletions
diff --git a/src/chat.cpp b/src/chat.cpp
index d8b577aab..92df038e8 100644
--- a/src/chat.cpp
+++ b/src/chat.cpp
@@ -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)
diff --git a/src/chat.h b/src/chat.h
index 696d805eb..fc080f64b 100644
--- a/src/chat.h
+++ b/src/chat.h
@@ -110,8 +110,6 @@ public:
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
diff --git a/src/client/mesh.cpp b/src/client/mesh.cpp
index e43139218..c56eba2e2 100644
--- a/src/client/mesh.cpp
+++ b/src/client/mesh.cpp
@@ -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;
-}
diff --git a/src/client/mesh.h b/src/client/mesh.h
index dbc091a06..1ed753c01 100644
--- a/src/client/mesh.h
+++ b/src/client/mesh.h
@@ -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);
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index f35dcd0eb..a1c3e1187 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -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);
diff --git a/src/clientiface.h b/src/clientiface.h
index dfd976741..b1591ddb0 100644
--- a/src/clientiface.h
+++ b/src/clientiface.h
@@ -465,7 +465,6 @@ public:
/* 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);
diff --git a/src/emerge.cpp b/src/emerge.cpp
index 9234fe6d3..be64d744a 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -368,12 +368,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)
{
s16 coff = -chunksize / 2;
@@ -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)
{
diff --git a/src/emerge.h b/src/emerge.h
index e2d727973..61e7bda63 100644
--- a/src/emerge.h
+++ b/src/emerge.h
@@ -176,13 +176,10 @@ public:
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);
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 029fcbf4f..d14b12f9d 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -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
diff --git a/src/inventory.h b/src/inventory.h
index 276002d28..eb063d4ad 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -211,7 +211,6 @@ public:
u32 getWidth() const;
// Count used slots
u32 getUsedSlots() const;
- u32 getFreeSlots() const;
// Get reference to item
const ItemStack& getItem(u32 i) const;
diff --git a/src/map.cpp b/src/map.cpp
index 30ce064d6..77031e17d 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -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);
diff --git a/src/map.h b/src/map.h
index 8d20c4a44..fe580b20f 100644
--- a/src/map.h
+++ b/src/map.h
@@ -167,9 +167,6 @@ public:
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
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 4958d3a65..e3a6caa19 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -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
*/
diff --git a/src/mapblock.h b/src/mapblock.h
index 8de631a29..e729fdb1c 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -364,20 +364,6 @@ public:
}
////
- //// 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)
////
diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp
index bce9cee81..a418acace 100644
--- a/src/mapgen/mapgen_v6.cpp
+++ b/src/mapgen/mapgen_v6.cpp
@@ -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)
{
diff --git a/src/mapgen/mapgen_v6.h b/src/mapgen/mapgen_v6.h
index a6e6da8c6..b0eb67893 100644
--- a/src/mapgen/mapgen_v6.h
+++ b/src/mapgen/mapgen_v6.h
@@ -154,9 +154,7 @@ public:
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);
diff --git a/src/noise.cpp b/src/noise.cpp
index a10efa3c4..2f4de6855 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -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);
diff --git a/src/noise.h b/src/noise.h
index 854781731..e4a9ed6c7 100644
--- a/src/noise.h
+++ b/src/noise.h
@@ -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);
diff --git a/src/rollback.cpp b/src/rollback.cpp
index 3cd9c7ce7..33b7958b9 100644
--- a/src/rollback.cpp
+++ b/src/rollback.cpp
@@ -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)
{
diff --git a/src/rollback.h b/src/rollback.h
index 1d9949d15..ff96e513f 100644
--- a/src/rollback.h
+++ b/src/rollback.h
@@ -46,7 +46,6 @@ public:
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(
diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp
index 0dd418462..b0a4ee194 100644
--- a/src/script/lua_api/l_inventory.cpp
+++ b/src/script/lua_api/l_inventory.cpp
@@ -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)
{
diff --git a/src/script/lua_api/l_inventory.h b/src/script/lua_api/l_inventory.h
index 94f670c9d..6a75bac0f 100644
--- a/src/script/lua_api/l_inventory.h
+++ b/src/script/lua_api/l_inventory.h
@@ -111,8 +111,6 @@ public:
// 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);
};
diff --git a/src/script/lua_api/l_nodemeta.cpp b/src/script/lua_api/l_nodemeta.cpp
index 60d14f8f2..34760157d 100644
--- a/src/script/lua_api/l_nodemeta.cpp
+++ b/src/script/lua_api/l_nodemeta.cpp
@@ -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;
}
diff --git a/src/settings.cpp b/src/settings.cpp
index f4de5bec9..818d2bc41 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -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);
}