File indexing completed on 2021-12-21 12:50:21

0001 /*
0002  *  ksokoban - a Sokoban game by KDE
0003  *  Copyright (C) 1998  Anders Widell  <d95-awi@nada.kth.se>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License
0016  *  along with this program; if not, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef LEVELMAP_H
0021 #define LEVELMAP_H
0022 
0023 #include <assert.h>
0024 #include <QString>
0025 
0026 #include "Map.h"
0027 class LevelCollection;
0028 
0029 //#define EXTERNAL_LEVEL 100
0030 
0031 class LevelMap : public Map {
0032 public:
0033   LevelMap();
0034   ~LevelMap();
0035 
0036   LevelCollection *collection() const { return collection_; }
0037   const QString &collectionName();
0038   void changeCollection(LevelCollection *_collection);
0039   int totalMoves() const { return totalMoves_; }
0040   int totalPushes() const { return totalPushes_; }
0041   void level(int _level);
0042   int level() const;
0043   int noOfLevels() const;
0044   int completedLevels() const;
0045   bool goodLevel() const { return goodLevel_; }
0046 
0047   bool step(int _x, int _y);
0048   bool push(int _x, int _y);
0049   bool unstep(int _x, int _y);
0050   bool unpush(int _x, int _y);
0051 
0052   //void random();
0053 
0054 protected:
0055   LevelCollection *collection_;
0056 
0057 
0058 private:
0059   int    totalMoves_;
0060   int    totalPushes_;
0061   bool   goodLevel_;
0062 
0063   static int distance(int x1, int y1, int x2, int y2);
0064 };
0065 
0066 #endif  /* LEVELMAP_H */