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

Revision 2, 3.8 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

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