forked from Mirrorlandia_minetest/minetest
map.cpp: Initialize NodeNeighbor, set NeighborType to u8 & cleanup
Cleanup: * Drop unused Map::transforming_liquid_size() * NodeNeighbor must use const ref for v3s16 * Add a missing default in a switch case
This commit is contained in:
parent
3face01a20
commit
359c8f82ce
14
src/map.cpp
14
src/map.cpp
@ -512,22 +512,22 @@ void Map::PrintInfo(std::ostream &out)
|
|||||||
|
|
||||||
#define WATER_DROP_BOOST 4
|
#define WATER_DROP_BOOST 4
|
||||||
|
|
||||||
enum NeighborType {
|
enum NeighborType : u8 {
|
||||||
NEIGHBOR_UPPER,
|
NEIGHBOR_UPPER,
|
||||||
NEIGHBOR_SAME_LEVEL,
|
NEIGHBOR_SAME_LEVEL,
|
||||||
NEIGHBOR_LOWER
|
NEIGHBOR_LOWER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NodeNeighbor {
|
struct NodeNeighbor {
|
||||||
MapNode n;
|
MapNode n;
|
||||||
NeighborType t;
|
NeighborType t;
|
||||||
v3s16 p;
|
v3s16 p;
|
||||||
bool l; //can liquid
|
|
||||||
|
|
||||||
NodeNeighbor()
|
NodeNeighbor()
|
||||||
: n(CONTENT_AIR)
|
: n(CONTENT_AIR), t(NEIGHBOR_SAME_LEVEL)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
NodeNeighbor(const MapNode &node, NeighborType n_type, v3s16 pos)
|
NodeNeighbor(const MapNode &node, NeighborType n_type, const v3s16 &pos)
|
||||||
: n(node),
|
: n(node),
|
||||||
t(n_type),
|
t(n_type),
|
||||||
p(pos)
|
p(pos)
|
||||||
@ -538,10 +538,6 @@ void Map::transforming_liquid_add(v3s16 p) {
|
|||||||
m_transforming_liquid.push_back(p);
|
m_transforming_liquid.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Map::transforming_liquid_size() {
|
|
||||||
return m_transforming_liquid.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
|
void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
|
||||||
ServerEnvironment *env)
|
ServerEnvironment *env)
|
||||||
{
|
{
|
||||||
@ -645,6 +641,8 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
|
|||||||
case 4:
|
case 4:
|
||||||
nt = NEIGHBOR_LOWER;
|
nt = NEIGHBOR_LOWER;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
v3s16 npos = p0 + dirs[i];
|
v3s16 npos = p0 + dirs[i];
|
||||||
NodeNeighbor nb(getNodeNoEx(npos), nt, npos);
|
NodeNeighbor nb(getNodeNoEx(npos), nt, npos);
|
||||||
|
@ -289,7 +289,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void transforming_liquid_add(v3s16 p);
|
void transforming_liquid_add(v3s16 p);
|
||||||
s32 transforming_liquid_size();
|
|
||||||
|
|
||||||
bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes);
|
bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes);
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user