Files
TrinityCore/src/game/WaypointManager.h
megamage 8fc07d443a *Change waypoint data structure. Use creature db guid as path id. If a creature uses waypoint movement as default movement type, the path id should be DBGUID*10. For paths of script use, the path id should be DBGUID*10+1 ~ DBGUID*10+9.
*Two sql queries are included. Converter is used to convert the existing path id to new path id. "...creature_add..." is used to change table structure. You can first run the converter, then run the other one. Or run the other one directly and get the new data from the db team. Because it may take hours to run the converter.
*If you have custom data, you may need to run the converter. We suggest you use console to run it It is extremely slow to run the query. If you have multiple paths for a creature in your db, you need to do more work to convert it. However, if you know how to use multiple paths, you should already have more db knowledge than I do and you should know how to convert it.
*There may be a faster query to convert the db. If you know, please tell us. I am no sql expert.
*Backup your db first!
*Thanks to X-Savior and subhuman_bob.

--HG--
branch : trunk
2009-05-11 13:27:10 -05:00

66 lines
1.7 KiB
C++

/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_WAYPOINTMANAGER_H
#define TRINITY_WAYPOINTMANAGER_H
#include <vector>
struct WaypointData
{
uint32 id;
float x,y,z;
bool run;
uint32 delay;
uint32 event_id;
uint8 event_chance;
};
typedef std::vector<WaypointData*> WaypointPath;
typedef UNORDERED_MAP<uint32, WaypointPath*> WaypointPathMap;
extern WaypointPathMap WaypointPathHolder;
class WaypointStore
{
private :
uint32 records;
public:
void UpdatePath(uint32 id);
void Load();
void Free();
WaypointPath* GetPath(uint32 id)
{
WaypointPathMap::iterator itr = WaypointPathHolder.find(id);
if(itr != WaypointPathHolder.end())
return itr->second;
return NULL;
}
inline uint32 GetRecordsCount() { return records; }
};
extern WaypointStore WaypointMgr;
#endif