File indexing completed on 2024-12-01 03:47:32

0001 /*
0002     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef COORD_H
0008 #define COORD_H
0009 
0010 #include <QMetaType>
0011 #include "knavalbattle_debug.h"
0012 
0013 class Coord
0014 {
0015 public:
0016     int x;
0017     int y;
0018     
0019     Coord(int x, int y);
0020     Coord():x(0),y(0) { }
0021     
0022     Coord operator+(const Coord& other) const;
0023     Coord operator-(const Coord& other) const;
0024     Coord operator*(int n) const;
0025     Coord& operator+=(const Coord& other);
0026     Coord& operator-=(const Coord& other);
0027     bool operator==(const Coord& other) const;
0028     bool operator!=(const Coord& other) const;
0029     bool valid() const;
0030     
0031     static Coord invalid();
0032 };
0033 
0034 QDebug& operator<<(QDebug& os, const Coord& c);
0035 uint qHash(const Coord& c);
0036 Q_DECLARE_METATYPE(Coord)
0037 
0038 #endif // COORD_H
0039