1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-07 16:48:40 +00:00

Cache liquid alternative IDs (#8053)

This commit is contained in:
Vitaliy 2020-05-21 00:52:10 +03:00 committed by GitHub
parent 42fcfb75e8
commit 82e4137893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 16 deletions

View file

@ -368,8 +368,10 @@ struct ContentFeatures
enum LiquidType liquid_type;
// If the content is liquid, this is the flowing version of the liquid.
std::string liquid_alternative_flowing;
content_t liquid_alternative_flowing_id;
// If the content is liquid, this is the source version of the liquid.
std::string liquid_alternative_source;
content_t liquid_alternative_source_id;
// Viscosity for fluid flow, ranging from 1 to 7, with
// 1 giving almost instantaneous propagation and 7 being
// the slowest possible
@ -428,7 +430,7 @@ struct ContentFeatures
}
bool sameLiquid(const ContentFeatures &f) const{
if(!isLiquid() || !f.isLiquid()) return false;
return (liquid_alternative_flowing == f.liquid_alternative_flowing);
return (liquid_alternative_flowing_id == f.liquid_alternative_flowing_id);
}
int getGroup(const std::string &group) const
@ -641,10 +643,11 @@ public:
void resetNodeResolveState();
/*!
* Resolves the IDs to which connecting nodes connect from names.
* Resolves (caches the IDs) cross-references between nodes,
* like liquid alternatives.
* Must be called after node registration has finished!
*/
void mapNodeboxConnections();
void resolveCrossrefs();
private:
/*!