diff --git a/cmake/PCHSupport.cmake b/cmake/PCHSupport.cmake index 17ebc294..7b1f6c78 100644 --- a/cmake/PCHSupport.cmake +++ b/cmake/PCHSupport.cmake @@ -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} diff --git a/contrib/convertConditions/ConvertConditions.py b/contrib/convertConditions/ConvertConditions.py index 056a661e..29e50ad5 100644 --- a/contrib/convertConditions/ConvertConditions.py +++ b/contrib/convertConditions/ConvertConditions.py @@ -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): diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile deleted file mode 100644 index fcc6e04a..00000000 --- a/contrib/docker/Dockerfile +++ /dev/null @@ -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 \ No newline at end of file diff --git a/contrib/docker/README.md b/contrib/docker/README.md deleted file mode 100644 index d72e31f8..00000000 --- a/contrib/docker/README.md +++ /dev/null @@ -1,15 +0,0 @@ -

Documentation for example docker-compose instance

- -- Install mangos as single instance with mangos-zero - -- The "if and way" about the mangos docker-compose.yml - -- Realmd Dockerfile - -- Mangos world Dockerfile - -
-

Please read up in single instance.

- -Do not run the build.sh outside the container.
-It is written to be run in the build container as documented *single instance*. \ No newline at end of file diff --git a/contrib/docker/build.sh b/contrib/docker/build.sh deleted file mode 100755 index 9e336c68..00000000 --- a/contrib/docker/build.sh +++ /dev/null @@ -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 diff --git a/contrib/docker/doc/DOCKERCOMPOSE.md b/contrib/docker/doc/DOCKERCOMPOSE.md deleted file mode 100644 index f0af5d34..00000000 --- a/contrib/docker/doc/DOCKERCOMPOSE.md +++ /dev/null @@ -1,111 +0,0 @@ -

The "if and why" about the mangos docker-compose.yml


-There a many ways to write an docker-compose.

- -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
- "restart: unless-stopped" -- localtime is mapped into the container and also define in mangos.env
- This is absolute recommend, because container can run in different timezones. - -

Alle containers depends on the database

-The mariadb:latest is a debian based container.
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.
-
-

Next moangos login server

- -``` - 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".

-Why? All streams are transported into the container and ip address is changed.
How you wanne ban clients with the right ip address?
The mode "host" makes it possible. In this case it can be define only onces at running the host.

-The configuration and logs are mapped as volume into the container. -
-

Lets jump into the world server

- -``` - 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.
-In additional we need the world data as volume. - -

The mangos network adapter

- -At the end we define an network adapter for the inner communication. - -``` -networks: - mangos: - name: mangos - driver: bridge -``` - -Cheers \ No newline at end of file diff --git a/contrib/docker/doc/SINGLE.md b/contrib/docker/doc/SINGLE.md deleted file mode 100644 index 0b3c4c68..00000000 --- a/contrib/docker/doc/SINGLE.md +++ /dev/null @@ -1,154 +0,0 @@ -

Example container for the mangos zero

- -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.

-We use a build container? Because realm and world should be small as possible and shippes only -we the nessery binaries. - -

1) Create the build container on ubuntu:focal


- - ``` - git clone git clone https://github.com/mangoszero/server.git mangos --recursive - - docker build mangos/contrib/docker/ -t mangos-zero-build - ``` -

2) Build the source and create directory structur


- - 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 - - ``` -

3) (Optional) Extract needed data from client


- - 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.
- Now wee need a data directory. - ``` - mkdir data - cd WoW1.12.1 - cp -r Buildings dbc maps mmaps vmaps ../data - ``` -

4) If everything went fine we create our container by


- - ``` - docker-compose build - ``` - -

5) Intialize the database


- - 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 - ``` -

6) Configure container


- - ``` - 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)
- -> 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)
- -> 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 ../.. - ``` - -

7) Start the realmd & mangos-one container detached


- - ``` - docker-compose up -d mangos-realm mangos-one - ``` - take a look with "docker stats". Hopefully all container stay and not reloaded all the time. - -

8) Join the world container to create an admin user


- - ``` - 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 - ``` - -

9) Don't forget to change the realmlist.wtf from WoW client to localhost.

- - ``` - set realmlist localhost - ``` \ No newline at end of file diff --git a/contrib/docker/docker-compose.yml b/contrib/docker/docker-compose.yml deleted file mode 100644 index 6f4260d3..00000000 --- a/contrib/docker/docker-compose.yml +++ /dev/null @@ -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 diff --git a/contrib/docker/mangos.env b/contrib/docker/mangos.env deleted file mode 100644 index 0cb5ee36..00000000 --- a/contrib/docker/mangos.env +++ /dev/null @@ -1,4 +0,0 @@ -MYSQL_ROOT_PASSWORD=mangos -MYSQL_USER=mangos -MYSQL_PASSWORD=mangos -TZ=Europe/Berlin \ No newline at end of file diff --git a/contrib/docker/realm/Dockerfile b/contrib/docker/realm/Dockerfile deleted file mode 100644 index b1a27e0c..00000000 --- a/contrib/docker/realm/Dockerfile +++ /dev/null @@ -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"] diff --git a/contrib/docker/realm/README.md b/contrib/docker/realm/README.md deleted file mode 100644 index 26a6620e..00000000 --- a/contrib/docker/realm/README.md +++ /dev/null @@ -1,41 +0,0 @@ -

The realmd Dockerfile

- -This Dockerfile only is used on running the realmd service. -As you know we got a build container.
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. \ No newline at end of file diff --git a/contrib/docker/world/Dockerfile b/contrib/docker/world/Dockerfile deleted file mode 100644 index 91b77a18..00000000 --- a/contrib/docker/world/Dockerfile +++ /dev/null @@ -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"] diff --git a/contrib/docker/world/README.md b/contrib/docker/world/README.md deleted file mode 100644 index a214320e..00000000 --- a/contrib/docker/world/README.md +++ /dev/null @@ -1,69 +0,0 @@ -

The mangosd (world) Dockerfile

- -This Dockerfile only is used on running the mangosd service. -As you know we got a build container.
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.
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).
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. -

-

The mangosd-entrypoint.sh

-What the script is just simple. Fire up an screen command with the daemon -and watch over it until it ends.
-In case there is no daemon the container will stop.

Please got in mind:
docker-compose "restart: unless-stopped" the container restart endless.

- -``` -#!/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 -``` \ No newline at end of file diff --git a/contrib/docker/world/mangosd-entrypoint.sh b/contrib/docker/world/mangosd-entrypoint.sh deleted file mode 100755 index 76129529..00000000 --- a/contrib/docker/world/mangosd-entrypoint.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/dockercontainer/DockerFile-mangosd b/dockercontainer/DockerFile-mangosd index ccb0163c..b3acdcd6 100644 --- a/dockercontainer/DockerFile-mangosd +++ b/dockercontainer/DockerFile-mangosd @@ -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 diff --git a/src/game/ChatCommands/CommunicationCommands.cpp b/src/game/ChatCommands/CommunicationCommands.cpp index 811c7ce7..c384378d 100644 --- a/src/game/ChatCommands/CommunicationCommands.cpp +++ b/src/game/ChatCommands/CommunicationCommands.cpp @@ -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; } @@ -379,5 +379,4 @@ bool ChatHandler::HandleSendMessageCommand(char* args) std::string nameLink = GetNameLink(rPlayer); PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), args); return true; -} - +} \ No newline at end of file diff --git a/src/game/vmap/BIH.cpp b/src/game/vmap/BIH.cpp index 5834339d..3436d977 100644 --- a/src/game/vmap/BIH.cpp +++ b/src/game/vmap/BIH.cpp @@ -272,7 +272,7 @@ void BIH::subdivide(int left, int right, std::vector& 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; diff --git a/src/game/vmap/BIH.h b/src/game/vmap/BIH.h index 22c99ab4..12570e36 100644 --- a/src/game/vmap/BIH.h +++ b/src/game/vmap/BIH.h @@ -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 tree; /**< TODO */ diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index 9f183bbb..6afa4750 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -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) -{ - -} diff --git a/src/game/vmap/GameObjectModel.h b/src/game/vmap/GameObjectModel.h index a362481f..121f5160 100644 --- a/src/game/vmap/GameObjectModel.h +++ b/src/game/vmap/GameObjectModel.h @@ -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 diff --git a/src/game/vmap/MapTree.cpp b/src/game/vmap/MapTree.cpp index 62f63333..fd3e1520 100644 --- a/src/game/vmap/MapTree.cpp +++ b/src/game/vmap/MapTree.cpp @@ -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(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 diff --git a/src/game/vmap/MapTree.h b/src/game/vmap/MapTree.h index c963a042..45a40647 100644 --- a/src/game/vmap/MapTree.h +++ b/src/game/vmap/MapTree.h @@ -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 - }; /** diff --git a/src/game/vmap/ModelInstance.cpp b/src/game/vmap/ModelInstance.cpp index 6ed0edca..dbfdb2f7 100644 --- a/src/game/vmap/ModelInstance.cpp +++ b/src/game/vmap/ModelInstance.cpp @@ -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); diff --git a/src/game/vmap/ModelInstance.h b/src/game/vmap/ModelInstance.h index 69856ea5..ee5d197f 100644 --- a/src/game/vmap/ModelInstance.h +++ b/src/game/vmap/ModelInstance.h @@ -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); }; /** diff --git a/src/game/vmap/TileAssembler.cpp b/src/game/vmap/TileAssembler.cpp index 4df444bf..d15373a8 100644 --- a/src/game/vmap/TileAssembler.cpp +++ b/src/game/vmap/TileAssembler.cpp @@ -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::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; } diff --git a/src/game/vmap/TileAssembler.h b/src/game/vmap/TileAssembler.h index 7c144bdb..936849e1 100644 --- a/src/game/vmap/TileAssembler.h +++ b/src/game/vmap/TileAssembler.h @@ -25,14 +25,15 @@ #ifndef MANGOS_H_TILEASSEMBLER #define MANGOS_H_TILEASSEMBLER -#include "ModelInstance.h" -#include "WorldModel.h" #include #include #include #include +#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 diff --git a/src/game/vmap/WorldModel.cpp b/src/game/vmap/WorldModel.cpp index 4007ebdd..f3bea32a 100644 --- a/src/game/vmap/WorldModel.cpp +++ b/src/game/vmap/WorldModel.cpp @@ -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); } } diff --git a/src/game/vmap/WorldModel.h b/src/game/vmap/WorldModel.h index 39a860eb..d2d4d353 100644 --- a/src/game/vmap/WorldModel.h +++ b/src/game/vmap/WorldModel.h @@ -368,15 +368,15 @@ namespace VMAP bool ReadFile(const std::string& filename); uint32 Flags; protected: - uint32 RootWMOID; - std::vector groupModels; - BIH groupTree; + uint32 RootWMOID; /**< TODO */ + std::vector groupModels; /**< TODO */ + BIH groupTree; /**< TODO */ #ifdef MMAP_GENERATOR public: void getGroupModels(std::vector& groupModels); #endif }; -} +} // namespace VMAP #endif // _WORLDMODEL_H diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index 8f9563be..3e4b8919 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -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(atof(mValue)) : 0.0f; } + /** + * @brief + * + * @return int8 + */ int8 GetInt8() const { return mValue ? static_cast(atol(mValue)) : int8(0); } /** * @brief @@ -155,7 +165,11 @@ class Field return value; } - + /** + * @brief + * + * @return int64 + */ uint64 GetInt64() const { int64 value = 0; diff --git a/src/shared/GameSystem/TypeContainerVisitor.h b/src/shared/GameSystem/TypeContainerVisitor.h index f70b4c83..685f6841 100644 --- a/src/shared/GameSystem/TypeContainerVisitor.h +++ b/src/shared/GameSystem/TypeContainerVisitor.h @@ -35,19 +35,9 @@ #include "TypeContainer.h" template -/** - * @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(std::forward(i_visitor)); } - private: - - VISITOR& i_visitor; /**< TODO */ + VISITOR& i_visitor; }; #endif diff --git a/src/shared/LockedQueue/LockedQueue.h b/src/shared/LockedQueue/LockedQueue.h index f0044b87..3bd5bcc7 100644 --- a/src/shared/LockedQueue/LockedQueue.h +++ b/src/shared/LockedQueue/LockedQueue.h @@ -49,8 +49,7 @@ namespace ACE_Based * @brief Create a LockedQueue. * */ - LockedQueue() - : _lock(), _queue() + LockedQueue() : _lock(), _queue() { }