2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
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.
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.
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
19 #ifndef MANGOS_WAYPOINTMANAGER_H
20 #define MANGOS_WAYPOINTMANAGER_H
24 #include "Utilities/UnorderedMap.h"
26 #define MAX_WAYPOINT_TEXT 5
27 struct WaypointBehavior
31 int32 textid
[MAX_WAYPOINT_TEXT
];
37 WaypointBehavior(const WaypointBehavior
&b
);
47 WaypointBehavior
* behavior
;
48 WaypointNode() : x(0.0f
), y(0.0f
), z(0.0f
), orientation(0.0f
), delay(0), behavior(NULL
) {}
49 WaypointNode(float _x
, float _y
, float _z
, float _o
, uint32 _delay
, WaypointBehavior
* _behavior
)
50 : x(_x
), y(_y
), z(_z
), orientation(_o
), delay(_delay
), behavior(_behavior
) {}
53 typedef std::vector
<WaypointNode
> WaypointPath
;
59 ~WaypointManager() { Unload(); }
66 WaypointPath
*GetPath(uint32 id
)
68 WaypointPathMap::iterator itr
= m_pathMap
.find(id
);
69 return itr
!= m_pathMap
.end() ? &itr
->second
: NULL
;
72 void AddLastNode(uint32 id
, float x
, float y
, float z
, float o
, uint32 delay
, uint32 wpGuid
);
73 void AddAfterNode(uint32 id
, uint32 point
, float x
, float y
, float z
, float o
, uint32 delay
, uint32 wpGuid
);
74 uint32
GetLastPoint(uint32 id
, uint32 default_notfound
);
75 void DeleteNode(uint32 id
, uint32 point
);
76 void DeletePath(uint32 id
);
77 void SetNodePosition(uint32 id
, uint32 point
, float x
, float y
, float z
);
78 void SetNodeText(uint32 id
, uint32 point
, const char *text_field
, const char *text
);
79 void CheckTextsExistance(std::set
<int32
>& ids
);
82 void _addNode(uint32 id
, uint32 point
, float x
, float y
, float z
, float o
, uint32 delay
, uint32 wpGuid
);
83 void _clearPath(WaypointPath
&path
);
85 typedef UNORDERED_MAP
<uint32
, WaypointPath
> WaypointPathMap
;
86 WaypointPathMap m_pathMap
;
89 #define WaypointMgr MaNGOS::Singleton<WaypointManager>::Instance()