Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
AreaTableUtils.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRE_AREATABLEUTILS_H
7#define SKYFIRE_AREATABLEUTILS_H
8
9#include "Define.h"
10
11namespace Skyfire::AreaTable
12{
13 template<class ParentLookup>
14 uint32 ResolveRootZoneId(uint32 areaId, ParentLookup parentLookup)
15 {
16 uint32 rootId = areaId;
17
18 for (uint8 depth = 0; depth < 32; ++depth)
19 {
20 uint32 parentId = parentLookup(rootId);
21 if (!parentId || parentId == rootId)
22 return rootId;
23
24 rootId = parentId;
25 }
26
27 return rootId;
28 }
29
31}
32
33#endif
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
uint32 GetRootZoneId(uint32 areaId)
uint32 ResolveRootZoneId(uint32 areaId, ParentLookup parentLookup)