2010-10-07 15:54:07 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
|
|
|
|
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
|
|
|
|
*
|
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
2008-10-02 16:23:55 -05:00
|
|
|
*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-14 11:57:03 -05:00
|
|
|
#ifndef TRINITY_GRIDSTATES_H
|
|
|
|
|
#define TRINITY_GRIDSTATES_H
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
#include "Map.h"
|
2008-12-19 02:24:08 +02:00
|
|
|
#include "Object.h"
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
class GridState
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2008-10-14 11:57:03 -05:00
|
|
|
#ifdef TRINITY_DEBUG
|
2008-10-02 16:23:55 -05:00
|
|
|
#define MAGIC_TESTVAL 0xFBE823BA
|
|
|
|
|
GridState() { i_Magic = MAGIC_TESTVAL; }
|
|
|
|
|
bool checkMagic()
|
|
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_Magic != MAGIC_TESTVAL)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
sLog.outError("!!! GridState: Magic value gone !!!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
void setMagic() { i_Magic = MAGIC_TESTVAL; }
|
|
|
|
|
unsigned int i_Magic;
|
|
|
|
|
#endif
|
|
|
|
|
virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0;
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
class InvalidState : public GridState
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
class ActiveState : public GridState
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
class IdleState : public GridState
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
class RemovalState : public GridState
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
|
|
|
|
};
|
|
|
|
|
#endif
|
2009-02-17 20:07:49 -06:00
|
|
|
|