• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

QTreeLeafNode Help understanding!

danick10

Intermediate OT User
Joined
Apr 11, 2009
Messages
196
Solutions
4
Reaction score
141
Hello, Im trying to understand how does the GetTile function works in C++ cause I would like to use the function in another way, so here is the code :
Code:
Tile* Map::getTile(uint16_t x, uint16_t y, uint8_t z) const
78 {
79     if (z >= MAP_MAX_LAYERS) {
80         return nullptr;
81     }
82
 
83     const QTreeLeafNode* leaf = QTreeNode::getLeafStatic<const QTreeLeafNode*, const QTreeNode*>(&root, x, y);
84     if (!leaf) {
85         return nullptr;
86     }
87
 
88     const Floor* floor = leaf->getFloor(z);
89     if (!floor) {
90         return nullptr;
91     }
92     return floor->tiles[x & FLOOR_MASK][y & FLOOR_MASK];
93 }



I don't understand what the Qtreenode does here, and I would like to know how the server can refer to a tile using a x-y-z position, Im only able to do a linear search with a foreach, that iterate trough all the node of the map....
 
Back
Top