[Core/vmap] Standardise functions and codestyle (#181)

* Removed deprecated docker build

* [Core] Several codestyle/standardization fixes

* [vmap] Remove unused functions

* [core/vmap] Standardise functions and codestyle

* [Docker] Cmake double install fix

Co-authored-by: PargeLenis <dead.man.walkin@hotmail.de>
This commit is contained in:
PargeLenis 2022-10-19 11:55:19 +02:00 committed by GitHub
parent bffa2dcf6a
commit 76b2ee5e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 63 additions and 686 deletions

View File

@ -84,10 +84,10 @@ function(ADD_CXX_PCH TARGET_NAME PRECOMPILED_HEADER PRECOMPILED_SOURCE)
add_custom_command(
OUTPUT ${OUTPUT_NAME}
COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -std=${CXX_STD} -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER}
DEPENDS ${PRECOMPILED_HEADER}
DEPENDS ${PRECOMPILED_HEADER} ${PRECOMPILED_SOURCE}
)
add_custom_target(${TARGET_NAME}_${SFX} DEPENDS ${OUTPUT_NAME})
add_custom_target(${TARGET_NAME}_${SFX} DEPENDS ${OUTPUT_NAME} ${PRECOMPILED_HEADER})
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_${SFX})
target_compile_options(${TARGET_NAME}

View File

@ -284,7 +284,7 @@ def doTables(db):
if (db[1] >= 1):
progressTable("prospecting_loot_template", "entry", "item", "lootcondition, condition_value1, condition_value2", 1)
if (db[1] >= 2):
#progressTable("spell_loot_template", "entry", "item", "lootcondition, condition_value1, condition_value2", 1)
progressTable("spell_loot_template", "entry", "item", "lootcondition, condition_value1, condition_value2", 1)
progressTable("milling_loot_template", "entry", "item", "lootcondition, condition_value1, condition_value2", 1)
if (processNumConditions < 3):

View File

@ -1,13 +0,0 @@
from ubuntu:focal
RUN apt update && apt dist-upgrade -y
# we need to setup tzdata otherwise focal ask for time zone
RUN DEBIAN_FRONTEND=noninteractive \
TZ=Europe/Berlin \
apt install -y build-essential cmake git-core libbz2-dev \
libmariadb-dev libmariadbclient-dev libmariadb-dev-compat \
libssl-dev
WORKDIR /work
ENTRYPOINT /bin/bash

View File

@ -1,15 +0,0 @@
<h3>Documentation for example docker-compose instance</h3>
- <a href="https://github.com/mangoszero/server/blob/master/contrib/docker/doc/SINGLE.md" >Install mangos as single instance with mangos-zero</a>
- <a href="https://github.com/mangoszero/server/blob/master/contrib/docker/doc/DOCKERCOMPOSE.md" >The "if and way" about the mangos docker-compose.yml</a>
- <a href="https://github.com/mangoszero/server/tree/master/contrib/docker/realm#readme" >Realmd Dockerfile</a>
- <a href="https://github.com/mangoszero/server/tree/master/contrib/docker/world#readme" >Mangos world Dockerfile</a>
<br>
<h3>Please read up in single instance.</h3>
Do not run the build.sh outside the container.<br>
It is written to be run in the build container as documented *single instance*.

View File

@ -1,44 +0,0 @@
#!/bin/bash
CMAKE_COMMANDS='-DCMAKE_INSTALL_PREFIX=/app -DCONF_INSTALL_DIR=/app/etc -DBUILD_EXTRACTORS=ON -DBUILD_PLAYERBOT=ON'
# container application
if [ ! -d "app/bin" ]; then
mkdir -p app/bin
fi
# needed for mangos container - from docker-compose build
if [ ! -f "app/bin/mangosd-entrypoint.sh" ]; then
cp mangos/contrib/docker/world/mangosd-entrypoint.sh app/bin/mangosd-entrypoint.sh
fi
# docker env
if [ ! -f "mangos.env" ]; then
cp mangos/contrib/docker/mangos.env .
fi
# the compose file for all 3 containers (db /realm /world)
if [ ! -f "docker-compose.yml" ]; then
cp mangos/contrib/docker/docker-compose.yml .
fi
# update git source
if [ -d "mangos" ]; then
cd mangos
git pull
cd ..
fi
#create a build directory
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake $CMAKE_COMMANDS ../mangos
# build mangos with all available cores
make -j$(nproc --all)
# install binaries and default configurations into
# /app/bin/{tools}
# /app/etc
make install

View File

@ -1,111 +0,0 @@
<h1>The "if and why" about the mangos docker-compose.yml</h1><br>
There a many ways to write an docker-compose.<br><br>
For best practice
- keep it simple as possible
- all container named
- network is defined as mangos
- every container starts automatical, but can be stopped at any time<br>
"restart: unless-stopped"
- localtime is mapped into the container and also define in mangos.env<br>
This is absolute recommend, because container can run in different timezones.
<h1>Alle containers depends on the database</h1>
The mariadb:latest is a debian based container.<br> Nothing needs to be rethink - debian and ubuntu - use the same command lines.
```
mangos-db:
container_name: mangos-db
image: mariadb:latest
restart: unless-stopped
env_file:
- mangos.env
networks:
- mangos
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mariadb/:/var/lib/mysql
- ./zero-database:/zero-database
```
As you can see at the last line the source from database is mapped into the container. This is normal needed once for initialization.<br>
<br>
<h1>Next moangos login server</h1>
```
mangos-realm:
image: mangos-realm
build:
context: ./app
dockerfile: ../mangos/contrib/docker/realm/Dockerfile
container_name: mangos-realm
restart: unless-stopped
ports:
- target: 3724
published: 3724
protocol: tcp
mode: host
env_file:
- mangos.env
volumes:
- /etc/localtime:/etc/localtime:ro
- ./app/etc:/app/etc
- ./logs:/app/logs
depends_on:
- mangos-db
networks:
- mangos
```
The part of ports is a little bit different and live on "host".<br><br>
Why? All streams are transported into the container and ip address is changed.<br>How you wanne ban clients with the right ip address?<br> The mode "host" makes it possible. In this case it can be define only onces at running the host.<br><br>
The configuration and logs are mapped as volume into the container.
<br>
<h1>Lets jump into the world server</h1>
```
mangos:
image: mangos
build:
context: app
dockerfile: ../mangos/contrib/docker/world/Dockerfile
container_name: mangos
restart: unless-stopped
ports:
- target: 8085
published: 8085
protocol: tcp
mode: host
- 7878:7878
env_file:
- mangos.env
volumes:
- /etc/localtime:/etc/localtime:ro
- ./app/etc:/app/etc
- ./data:/app/data
- ./logs:/app/logs
depends_on:
- mangos-db
- mangos-realm
networks:
- mangos
```
In principal same stuff as on the realm service.<br>
In additional we need the world data as volume.
<h1>The mangos network adapter</h1>
At the end we define an network adapter for the inner communication.
```
networks:
mangos:
name: mangos
driver: bridge
```
Cheers

View File

@ -1,154 +0,0 @@
<h1>Example container for the mangos zero</h1>
What you need to know:
- How docker works (docker.io - https://www.docker.com/)
- linux commandline standards
- sql statments
This example works only on local(host) machine. For the cloud the database must be changed.
Not here documented.<br><br>
We use a build container? Because realm and world should be small as possible and shippes only
we the nessery binaries.
<h3>1) Create the build container on ubuntu:focal</h3><br>
```
git clone git clone https://github.com/mangoszero/server.git mangos --recursive
docker build mangos/contrib/docker/ -t mangos-zero-build
```
<h3>2) Build the source and create directory structur</h3><br>
Create a build script
```
echo "docker run -v$(pwd)/app:/app -v $(pwd):/work " \
"--rm -it --entrypoint ./mangos/contrib/docker/build.sh \
mangos-zero-build" > build.sh
chmod +x build.sh
```
For a rebuild next time we only need
```
./build.sh (&& docker-compose build && docker-compose restart)
```
(Optional) Create an extractor container script for the maps
```
echo "docker run -v$(pwd)/app:/app -v $(pwd):/work " \
"--rm -it mangos-zero-build bash" > extract.sh
```
<h3>3) (Optional) Extract needed data from client</h3><br>
Copy the full client into you work directory like
(here from linux lutris)
```
cp -r /home/XXX/Games/WorldOfWarcraft/drive_c/WoW1.12.1 .
```
Join into the extractor container (build)
```
./extract.sh
(container) cd WoW1.12.1
(container) cp -r ../app/bin/tools/* .
(container) chmod +x Extractor.sh
(container) ./Extractor.sh
(container) exit
```
This may take a while.<br>
Now wee need a data directory.
```
mkdir data
cd WoW1.12.1
cp -r Buildings dbc maps mmaps vmaps ../data
```
<h3>4) If everything went fine we create our container by</h3><br>
```
docker-compose build
```
<h3>5) Intialize the database</h3><br>
We need the right database for the server.
```
git clone https://github.com/mangoszero/database zero-database --recursive
```
Now we can start the database container.
```
docker-compose up -d mangos-db
docker exec -it mangos-db bash
(container) cd zero-database
(container) ./InstallDatabases.sh
Database (root for now)
- host: localhost
- user: "root"
- password: "mangos"
(container) exit
```
<h3>6) Configure container</h3><br>
```
cd app/etc
sudo cp realmd.conf.dist realmd.conf
sudo cp mangosd.conf.dist mangosd.conf
sudo cp ahbot.conf.dist ahbot.conf
```
For realmd change follow lines in realmd.conf (wee need to root)<br>
-> sudo nano realmd.conf
```
LoginDatabaseInfo = "localhost;3306;root;mangos;realmd"
LogsDir = ""
```
into
```
LoginDatabaseInfo = "mangos-db;3306;root;mangos;realmd"
LogsDir = "/app/logs"
```
For mangosd we update mangosd.conf (wee need to root)<br>
-> sudo nano mangosd.conf
```
DataDir = ""
LogsDir = ""
LoginDatabaseInfo = "127.0.0.1;3306;root;mangos;realmd"
WorldDatabaseInfo = "127.0.0.1;3306;root;mangos;mangos0"
CharacterDatabaseInfo = "127.0.0.1;3306;root;mangos;character0"
```
into
```
DataDir = "/app/data"
LogsDir = "/app/logs"
LoginDatabaseInfo = "mangos-db;3306;root;mangos;realmd"
WorldDatabaseInfo = "mangos-db;3306;root;mangos;mangos0"
CharacterDatabaseInfo = "mangos-db;3306;root;mangos;character0"
```
Back to the workspace
```
cd ../..
```
<h3>7) Start the realmd & mangos-one container detached</h3><br>
```
docker-compose up -d mangos-realm mangos-one
```
take a look with "docker stats". Hopefully all container stay and not reloaded all the time.
<h3>8) Join the world container to create an admin user</h3><br>
```
docker exec -it mangos-zero bash
(container) screen -r (go into screen)
(container - screen) account create testuser mypassword
(container - screen) strg + a + d (detache from screen)
(container) exit
```
<h3>9) Don't forget to change the realmlist.wtf from WoW client to localhost.</h3>
```
set realmlist localhost
```

View File

@ -1,70 +0,0 @@
version: '3'
services:
mangos-db:
container_name: mangos-db
image: mariadb:latest
restart: unless-stopped
env_file:
- mangos.env
networks:
- mangos
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mariadb/:/var/lib/mysql
- ./zero-database:/zero-database
mangos-realm:
image: mangos-realm
build:
context: ./app
dockerfile: ../mangos/contrib/docker/realm/Dockerfile
container_name: mangos-realm
restart: unless-stopped
ports:
- target: 3724
published: 3724
protocol: tcp
mode: host
env_file:
- mangos.env
volumes:
- /etc/localtime:/etc/localtime:ro
- ./app/etc:/app/etc
- ./logs:/app/logs
depends_on:
- mangos-db
networks:
- mangos
mangos-zero:
image: mangos-zero
build:
context: app
dockerfile: ../mangos/contrib/docker/world/Dockerfile
container_name: mangos-zero
restart: unless-stopped
ports:
- target: 8085
published: 8085
protocol: tcp
mode: host
- 7878:7878
env_file:
- mangos.env
volumes:
- /etc/localtime:/etc/localtime:ro
- ./app/etc:/app/etc
- ./data:/app/data
- ./logs:/app/logs
depends_on:
- mangos-db
- mangos-realm
networks:
- mangos
networks:
mangos:
name: mangos
driver: bridge

View File

@ -1,4 +0,0 @@
MYSQL_ROOT_PASSWORD=mangos
MYSQL_USER=mangos
MYSQL_PASSWORD=mangos
TZ=Europe/Berlin

View File

@ -1,16 +0,0 @@
from ubuntu:focal
RUN apt update && apt dist-upgrade -y --no-install-recommends \
openssl \
libmariadb3
RUN mkdir -p /app/bin
COPY bin/realmd /app/bin/
RUN mkdir /app/etc
COPY etc/realmd.conf.dist /app/etc/
EXPOSE 3724
WORKDIR "/app/bin"
CMD [ "./realmd"]

View File

@ -1,41 +0,0 @@
<h1>The realmd Dockerfile</h1>
This Dockerfile only is used on running the realmd service.
As you know we got a build container.<br>Most docker instance
not use this way, but this is the cleanest way.
We use ubuntu focal as base system because of longterm
```
from ubuntu:focal
```
Update the container and add neccesary parts to run the realmd binary
```
RUN apt update && apt dist-upgrade -y --no-install-recommends \
openssl \
libmariadb3
```
Create the bin directory and copy in realmd service
```
RUN mkdir -p /app/bin
COPY bin/realmd /app/bin/
```
We save the configuration in the container. It will not be used in
our process, but we got it handy in te container.
```
RUN mkdir /app/etc
COPY etc/realmd.conf.dist /app/etc/
```
Now we expose the port that the client login will looking for
```
EXPOSE 3724
```
Define the app/bin as start point ...
```
WORKDIR "/app/bin"
```
The run command is the realmd for sure.
```
CMD [ "./realmd"]
```
We can protect the server more if we run the realmd as seperate user.
In the matter of simplicty this is a future step.

View File

@ -1,25 +0,0 @@
from ubuntu:focal
RUN apt update && apt dist-upgrade -y --no-install-recommends init \
libmariadb3 mariadb-client screen \
openssl \
procps nano less
COPY bin/mangosd-entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
RUN mkdir -p /app/bin/tools
COPY bin/mangosd /app/bin/
COPY bin/tools/* /app/bin/tools/
RUN mkdir /app/etc
COPY etc/mangosd.conf.dist /app/etc/
COPY etc/ahbot.conf.dist /app/etc/
EXPOSE 8085
EXPOSE 7878
WORKDIR "/app"
ENTRYPOINT ["/usr/bin/entrypoint.sh"]

View File

@ -1,69 +0,0 @@
<h1>The mangosd (world) Dockerfile</h1>
This Dockerfile only is used on running the mangosd service.
As you know we got a build container.<br>Most docker instance
not use this way, but this is the cleanest way.
We use ubuntu focal as base system because of longterm
```
from ubuntu:focal
```
Update the container and add neccesary parts to run the realmd binary
```
RUN apt update && apt dist-upgrade -y --no-install-recommends \
openssl \
libmariadb3
```
Create the bin directory, copy in mangosd service and tools
```
RUN mkdir -p /app/bin/tools
COPY bin/mangosd /app/bin/
COPY bin/tools/* /app/bin/tools/
```
We save the configuration the container.<br> It will not be used in
our process, but we got it handy in te container.
```
RUN mkdir /app/etc
COPY etc/mangosd.conf.dist /app/etc/
COPY etc/ahbot.conf.dist /app/etc/
```
Now we expose the ports that the client listen on the first one for the world game play. (8085). <br>This has to be declared in the database realmd
```
EXPOSE 8085
EXPOSE 7878
```
Define the app/bin as start point ...
```
WORKDIR "/app/bin"
```
We got a diffrent entrypoint - the run script.
```
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
```
We can protect the server more if we run the mangosd as seperate user.
In the matter of simplicty this is a future step.
<br><br>
<h1>The mangosd-entrypoint.sh</h1>
What the script is just simple. Fire up an screen command with the daemon
and watch over it until it ends.<br>
In case there is no daemon the container will stop.<br><br>Please got in mind:<br>docker-compose "restart: unless-stopped" the container restart endless.<br><br>
```
#!/bin/bash
DAEMON=mangosd
cd /app/bin
# run daemon as mangos user
screen -dmS mangos-zero "./$DAEMON"
echo "MaNGOS zero world daemon started"
UP_AND_RUNNING=2
# mangos server still up?
while [ $UP_AND_RUNNING -gt 1 ] ;
do
sleep 1;
UP_AND_RUNNING="$(ps uax | grep $DAEMON | wc -l)";
done
```

View File

@ -1,17 +0,0 @@
#!/bin/bash
DAEMON=mangosd
cd /app/bin
# run daemon as mangos user
screen -dmS mangos-zero "./$DAEMON"
echo "MaNGOS zero world daemon started"
UP_AND_RUNNING=2
# mangos server still up?
while [ $UP_AND_RUNNING -gt 1 ] ;
do
sleep 1;
UP_AND_RUNNING="$(ps uax | grep $DAEMON | wc -l)";
done

View File

@ -9,14 +9,6 @@ RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/nul
apt-get update
RUN apt-get -y install cmake
# CMake needs an update to compile on 18.04
RUN apt purge --auto-remove cmake -y
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
RUN apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
RUN apt-get -y update
RUN apt-get -y install cmake
COPY . /mangoserver
RUN mkdir /mangoserver/build
WORKDIR /mangoserver/build
@ -33,8 +25,8 @@ RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install libmysqlclient20 openssl
COPY --from=build-step /mangos /mangos
COPY --from=build-step /etc/mangosd.conf.dist ../etc/mangosd.conf.dist
WORKDIR /mangos/bin
RUN cp ../etc/mangosd.conf.dist ../etc/mangosd.conf
RUN chmod +x mangosd
EXPOSE 8085

View File

@ -34,7 +34,7 @@
CommandTable : commandTable
/***********************************************************************/
// global announce
// global announce
bool ChatHandler::HandleAnnounceCommand(char* args)
{
if (!*args)
@ -306,7 +306,7 @@ bool ChatHandler::HandleNpcTextEmoteCommand(char* args)
return false;
}
pCreature->MonsterTextEmote(args, NULL);
pCreature->MonsterTextEmote(args, m_session->GetPlayer());
return true;
}
@ -380,4 +380,3 @@ bool ChatHandler::HandleSendMessageCommand(char* args)
PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), args);
return true;
}

View File

@ -272,7 +272,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
}
}
bool BIH::writeToFile(FILE* wf) const
bool BIH::WriteToFile(FILE* wf) const
{
uint32 treeSize = tree.size();
uint32 check = 0;
@ -286,7 +286,7 @@ bool BIH::writeToFile(FILE* wf) const
return check == (3 + 3 + 2 + treeSize + count);
}
bool BIH::readFromFile(FILE* rf)
bool BIH::ReadFromFile(FILE* rf)
{
uint32 treeSize;
Vector3 lo, hi;

View File

@ -453,14 +453,14 @@ class BIH
* @param wf
* @return bool
*/
bool writeToFile(FILE* wf) const;
bool WriteToFile(FILE* wf) const;
/**
* @brief
*
* @param rf
* @return bool
*/
bool readFromFile(FILE* rf);
bool ReadFromFile(FILE* rf);
protected:
std::vector<uint32> tree; /**< TODO */

View File

@ -202,35 +202,3 @@ bool GameObjectModel::IntersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto
}
return hit;
}
bool GameObjectModel::GetIntersectPoint(const G3D::Vector3& srcPoint, G3D::Vector3& dstPoint, bool absolute) const
{
G3D::Vector3 p;
if (absolute)
{
p = (iQuat.conj() * G3D::Quat((srcPoint - iPos) * iInvScale) * iQuat).imag();
}
else
{
p = srcPoint;
}
float dist;
bool hit = iModel->GetContactPoint(p, G3D::Vector3(0.0f, 0.0f, -1.0f), dist);
if (hit)
{
dstPoint = p;
dstPoint.z -= dist;
}
return hit;
}
void GameObjectModel::GetLocalCoords(const G3D::Vector3& worldCoords, G3D::Vector3& localCoords)
{
}
void GameObjectModel::GetWorldCoords(const G3D::Vector3& localCoords, G3D::Vector3& worldCoords)
{
}

View File

@ -79,15 +79,6 @@ class GameObjectModel
bool IntersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit) const;
// returns the intersection point given from srcPoint down.
// If absolute is true, srcPoint is in world space, else srcPoint is assumed in local space.
// If method succeeds, dstPoint will be filled with local space coordinates of the intersection
// else will be untouched
bool GetIntersectPoint(const G3D::Vector3& srcPoint, G3D::Vector3& dstPoint, bool absolute = true) const;
void GetLocalCoords(const G3D::Vector3& worldCoords, G3D::Vector3& localCoords); //NYI
void GetWorldCoords(const G3D::Vector3& localCoords, G3D::Vector3& worldCoords); //NYI
static GameObjectModel* Create(const GameObject* const pGo);
};
#endif

View File

@ -62,6 +62,9 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#ifdef VMAP_DEBUG
DEBUG_LOG("trying to intersect '%s'", prims[entry].name.c_str());
#endif
prims[entry].GetAreaInfo(point, aInfo);
}
@ -76,6 +79,9 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#ifdef VMAP_DEBUG
DEBUG_LOG("trying to intersect '%s'", prims[entry].name.c_str());
#endif
if (prims[entry].GetLocationInfo(point, locInfo))
{
result = true;
@ -222,8 +228,12 @@ namespace VMAP
{
pResultHitPos = pResultHitPos + dir * pModifyDist;
}
return true;
}
else
{
pResultHitPos = pPos2;
}
pResultHitPos = pPos2;
return false;
}
@ -320,7 +330,7 @@ namespace VMAP
}
if (success)
{
success = iTree.readFromFile(rf);
success = iTree.ReadFromFile(rf);
}
if (success)
{
@ -338,7 +348,7 @@ namespace VMAP
#ifdef VMAP_DEBUG
DEBUG_LOG("Map isTiled: %u", static_cast<uint32>(iIsTiled));
#endif
if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
if (!iIsTiled && ModelSpawn::ReadFromFile(rf, spawn))
{
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags);
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "StaticMapTree::InitMap(): loading %s", spawn.name.c_str());
@ -412,7 +422,7 @@ namespace VMAP
{
// read model spawns
ModelSpawn spawn;
result = ModelSpawn::readFromFile(tf, spawn);
result = ModelSpawn::ReadFromFile(tf, spawn);
if (result)
{
// acquire model instance
@ -494,7 +504,7 @@ namespace VMAP
{
// read model spawns
ModelSpawn spawn;
result = ModelSpawn::readFromFile(tf, spawn);
result = ModelSpawn::ReadFromFile(tf, spawn);
if (result)
{
// release model instance

View File

@ -232,11 +232,11 @@ namespace VMAP
* @return uint32
*/
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
#ifdef MMAP_GENERATOR
public:
void getModelInstances(ModelInstance*& models, uint32& count);
#endif
};
/**

View File

@ -162,7 +162,7 @@ namespace VMAP
return false;
}
bool ModelSpawn::readFromFile(FILE* rf, ModelSpawn& spawn)
bool ModelSpawn::ReadFromFile(FILE* rf, ModelSpawn& spawn)
{
uint32 check = 0, nameLen;
check += fread(&spawn.flags, sizeof(uint32), 1, rf);
@ -210,7 +210,7 @@ namespace VMAP
return true;
}
bool ModelSpawn::writeToFile(FILE* wf, const ModelSpawn& spawn)
bool ModelSpawn::WriteToFile(FILE* wf, const ModelSpawn& spawn)
{
uint32 check = 0;
check += fwrite(&spawn.flags, sizeof(uint32), 1, wf);

View File

@ -90,7 +90,7 @@ namespace VMAP
* @param spawn
* @return bool
*/
static bool readFromFile(FILE* rf, ModelSpawn& spawn);
static bool ReadFromFile(FILE* rf, ModelSpawn& spawn);
/**
* @brief
*
@ -98,7 +98,7 @@ namespace VMAP
* @param spawn
* @return bool
*/
static bool writeToFile(FILE* rw, const ModelSpawn& spawn);
static bool WriteToFile(FILE* rw, const ModelSpawn& spawn);
};
/**

View File

@ -153,7 +153,7 @@ namespace VMAP
}
if (success)
{
success = pTree.writeToFile(mapfile);
success = pTree.WriteToFile(mapfile);
}
// global map spawns (WDT), if any (most instances)
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1)
@ -163,7 +163,7 @@ namespace VMAP
for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob)
{
success = ModelSpawn::writeToFile(mapfile, map_iter->second->UniqueEntries[glob->second]);
success = ModelSpawn::WriteToFile(mapfile, map_iter->second->UniqueEntries[glob->second]);
}
fclose(mapfile);
@ -206,7 +206,7 @@ namespace VMAP
++tile;
}
const ModelSpawn& spawn2 = map_iter->second->UniqueEntries[tile->second];
success = success && ModelSpawn::writeToFile(tilefile, spawn2);
success = success && ModelSpawn::WriteToFile(tilefile, spawn2);
// MapTree nodes to update when loading tile:
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1)
@ -266,7 +266,7 @@ namespace VMAP
}
check += fread(&tileX, sizeof(uint32), 1, dirf);
check += fread(&tileY, sizeof(uint32), 1, dirf);
if (!ModelSpawn::readFromFile(dirf, spawn))
if (!ModelSpawn::ReadFromFile(dirf, spawn))
{
break;
}

View File

@ -25,14 +25,15 @@
#ifndef MANGOS_H_TILEASSEMBLER
#define MANGOS_H_TILEASSEMBLER
#include "ModelInstance.h"
#include "WorldModel.h"
#include <G3D/Vector3.h>
#include <G3D/Matrix3.h>
#include <map>
#include <set>
#include "ModelInstance.h"
#include "WorldModel.h"
namespace VMAP
{
/**
@ -218,12 +219,6 @@ namespace VMAP
* @return bool
*/
bool convertRawFile(const std::string& pModelFilename, const char *RAW_VMAP_MAGIC);
/**
* @brief
*
* @param )
*/
void setModelNameFilterMethod(bool (*pFilterMethod)(char* pName)) { iFilterMethod = pFilterMethod; }
};
}
#endif

View File

@ -398,7 +398,7 @@ namespace VMAP
}
if (result)
{
result = meshTree.writeToFile(wf);
result = meshTree.WriteToFile(wf);
}
// write liquid data
@ -504,7 +504,7 @@ namespace VMAP
}
if (result)
{
result = meshTree.readFromFile(rf);
result = meshTree.ReadFromFile(rf);
}
// read liquid data
@ -755,7 +755,7 @@ namespace VMAP
}
if (result)
{
result = groupTree.writeToFile(wf);
result = groupTree.WriteToFile(wf);
}
}
@ -819,7 +819,7 @@ namespace VMAP
}
if (result)
{
result = groupTree.readFromFile(rf);
result = groupTree.ReadFromFile(rf);
}
}

View File

@ -368,15 +368,15 @@ namespace VMAP
bool ReadFile(const std::string& filename);
uint32 Flags;
protected:
uint32 RootWMOID;
std::vector<GroupModel> groupModels;
BIH groupTree;
uint32 RootWMOID; /**< TODO */
std::vector<GroupModel> groupModels; /**< TODO */
BIH groupTree; /**< TODO */
#ifdef MMAP_GENERATOR
public:
void getGroupModels(std::vector<GroupModel>& groupModels);
#endif
};
}
} // namespace VMAP
#endif // _WORLDMODEL_H

View File

@ -108,7 +108,17 @@ class Field
* @return bool
*/
bool GetBool() const { return mValue ? atoi(mValue) > 0 : false; }
/**
* @brief
*
* @return double
*/
double GetDouble() const { return mValue ? static_cast<double>(atof(mValue)) : 0.0f; }
/**
* @brief
*
* @return int8
*/
int8 GetInt8() const { return mValue ? static_cast<int8>(atol(mValue)) : int8(0); }
/**
* @brief
@ -155,7 +165,11 @@ class Field
return value;
}
/**
* @brief
*
* @return int64
*/
uint64 GetInt64() const
{
int64 value = 0;

View File

@ -35,19 +35,9 @@
#include "TypeContainer.h"
template<class VISITOR, class CONTAINER>
/**
* @brief
*
*/
class TypeContainerVisitor
{
public:
/**
* @brief
*
* @param v
*/
TypeContainerVisitor(VISITOR& v) : i_visitor(v){}
void Visit(CONTAINER& c)
{
@ -57,10 +47,8 @@ class TypeContainerVisitor
{
c.template accept<VISITOR>(std::forward<VISITOR>(i_visitor));
}
private:
VISITOR& i_visitor; /**< TODO */
VISITOR& i_visitor;
};
#endif

View File

@ -49,8 +49,7 @@ namespace ACE_Based
* @brief Create a LockedQueue.
*
*/
LockedQueue()
: _lock(), _queue()
LockedQueue() : _lock(), _queue()
{
}