2005-02-05 12:14:56 +01:00
|
|
|
/*****************************************************************************
|
2008-01-08 14:52:32 +01:00
|
|
|
* Eliot
|
2012-10-07 16:25:41 +02:00
|
|
|
* Copyright (C) 2005-2012 Olivier Teulière & Antoine Fraboulet
|
2008-01-08 14:52:32 +01:00
|
|
|
* Authors: Olivier Teulière <ipkiss @@ gmail.com>
|
|
|
|
* Antoine Fraboulet <antoine.fraboulet @@ free.fr>
|
2005-02-05 12:14:56 +01:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-23 16:53:42 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-02-05 12:14:56 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2009-11-29 17:01:31 +01:00
|
|
|
#ifndef CROSS_H_
|
|
|
|
#define CROSS_H_
|
2005-02-05 12:14:56 +01:00
|
|
|
|
|
|
|
#include <set>
|
2006-01-22 13:23:52 +01:00
|
|
|
#include "tile.h"
|
2012-02-18 22:26:52 +01:00
|
|
|
#include "logging.h"
|
2005-02-05 12:14:56 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************
|
|
|
|
*
|
|
|
|
*************************/
|
|
|
|
|
2009-06-28 12:55:24 +02:00
|
|
|
// TODO: implement using the bitset class
|
2005-02-05 12:14:56 +01:00
|
|
|
class Cross
|
|
|
|
{
|
2012-02-18 22:26:52 +01:00
|
|
|
DEFINE_LOGGER();
|
2005-02-05 12:14:56 +01:00
|
|
|
public:
|
|
|
|
Cross();
|
|
|
|
|
2008-01-08 14:52:32 +01:00
|
|
|
void setAny();
|
|
|
|
void setNone() { m_mask = 0; }
|
2006-11-05 14:30:06 +01:00
|
|
|
|
|
|
|
bool isAny() const;
|
2008-01-08 14:52:32 +01:00
|
|
|
bool isNone() const { return m_mask == 0; }
|
2006-11-05 14:30:06 +01:00
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
bool check(const Tile& iTile) const;
|
|
|
|
|
2005-04-02 19:59:07 +02:00
|
|
|
bool operator==(const Cross &iOther) const;
|
|
|
|
bool operator!=(const Cross &iOther) const { return !(*this == iOther); }
|
|
|
|
|
2005-02-05 12:14:56 +01:00
|
|
|
// Standard set methods (almost)
|
2006-11-05 14:30:06 +01:00
|
|
|
void insert(const Tile& iTile);
|
2005-02-05 12:14:56 +01:00
|
|
|
|
2006-11-05 14:30:06 +01:00
|
|
|
string getHexContent() const;
|
2005-04-02 23:03:45 +02:00
|
|
|
private:
|
2006-01-22 13:23:52 +01:00
|
|
|
/// Mask indicating which tiles are accepted for the cross check
|
|
|
|
unsigned int m_mask;
|
2005-02-05 12:14:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2006-01-01 20:49:35 +01:00
|
|
|
|