File indexing completed on 2024-04-21 04:04:03

0001 /*
0002     KShisen - A japanese game similar to Mahjongg
0003     SPDX-FileCopyrightText: 2016 Frederik Schwarzer <schwarzer@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KSHISEN_POSSIBLEMOVE_H
0009 #define KSHISEN_POSSIBLEMOVE_H
0010 
0011 #include "types.h"
0012 
0013 namespace KShisen
0014 {
0015 /**
0016  * @brief Class holding a possible move and its functions
0017  *
0018  * A PossibleMove is a connection Path between two tiles
0019  * and optionally a slide Path.
0020  * Sometimes for a couple of tiles to match there may be multiple
0021  * possible moves for the player to choose between.
0022  */
0023 class PossibleMove
0024 {
0025 public:
0026     explicit PossibleMove(Path & path);
0027     PossibleMove(Path & path, Slide & slide);
0028 
0029     bool isInPath(TilePos tilePos) const;
0030 
0031     void Debug() const;
0032 
0033     Path path() const;
0034     bool hasSlide() const;
0035     Slide slide() const;
0036     void prependTile(TilePos const tilePos);
0037 
0038 private:
0039     Path m_path; ///< path used to connect the two tiles
0040     bool m_hasSlide; ///< flag set if the move requires a slide
0041     Slide m_slide; ///< representing the movement of the last sliding tile
0042 };
0043 } // namespace KShisen
0044 
0045 #endif // KSHISEN_POSSIBLEMOVE_H
0046 
0047 // vim: expandtab:tabstop=4:shiftwidth=4
0048 // kate: space-indent on; indent-width 4