root/trunk/src/shared/vmap/IVMapManager.h @ 102

Revision 102, 3.9 kB (checked in by yumileroy, 17 years ago)

[svn] Fixed copyright notices to comply with GPL.

Original author: w12x
Date: 2008-10-23 03:29:52-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
4 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _IVMAPMANAGER_H
22#define _IVMAPMANAGER_H
23
24#include<string>
25
26//===========================================================
27
28/**
29This is the minimum interface to the VMapMamager.
30*/
31
32namespace VMAP
33{
34
35    enum VMAP_LOAD_RESULT
36    {
37        VMAP_LOAD_RESULT_ERROR,
38        VMAP_LOAD_RESULT_OK,
39        VMAP_LOAD_RESULT_IGNORED,
40    };
41
42    #define VMAP_INVALID_HEIGHT       -100000.0f            // for check
43    #define VMAP_INVALID_HEIGHT_VALUE -200000.0f            // real assigned value in unknown height case
44
45    //===========================================================
46    class IVMapManager
47    {
48        private:
49            bool iEnableLineOfSightCalc;
50            bool iEnableHeightCalc;
51
52        public:
53            IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) {}
54
55            virtual ~IVMapManager(void) {}
56
57            virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0;
58
59            virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0;
60
61            virtual void unloadMap(unsigned int pMapId, int x, int y) = 0;
62            virtual void unloadMap(unsigned int pMapId) = 0;
63
64            virtual bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) = 0;
65            virtual float getHeight(unsigned int pMapId, float x, float y, float z) = 0;
66            /**
67            test if we hit an object. return true if we hit one. rx,ry,rz will hold the hit position or the dest position, if no intersection was found
68            return a position, that is pReduceDist closer to the origin
69            */
70            virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist) = 0;
71            /**
72            send debug commands
73            */
74            virtual bool processCommand(char *pCommand)= 0;
75
76            /**
77            Enable/disable LOS calculation
78            It is enabled by default. If it is enabled in mid game the maps have to loaded manualy
79            */
80            void setEnableLineOfSightCalc(bool pVal) { iEnableLineOfSightCalc = pVal; }
81            /**
82            Enable/disable model height calculation
83            It is enabled by default. If it is enabled in mid game the maps have to loaded manualy
84            */
85            void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; }
86
87            bool isLineOfSightCalcEnabled() const { return(iEnableLineOfSightCalc); }
88            bool isHeightCalcEnabled() const { return(iEnableHeightCalc); }
89            bool isMapLoadingEnabled() const { return(iEnableLineOfSightCalc || iEnableHeightCalc  ); }
90
91            virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0;
92            /**
93            Block maps from being used.
94            parameter: String of map ids. Delimiter = ","
95            e.g.: "0,1,530"
96            */
97            virtual void preventMapsFromBeingUsed(const char* pMapIdString) =0;
98    };
99
100}
101#endif
Note: See TracBrowser for help on using the browser.