ScummVM API documentation
goldbergpuzzle.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NANCY_ACTION_GOLDBERGPUZZLE_H
23 #define NANCY_ACTION_GOLDBERGPUZZLE_H
24 
25 #include "engines/nancy/commontypes.h"
26 #include "engines/nancy/action/actionrecord.h"
27 
28 namespace Nancy {
29 namespace Action {
30 
31 // Nancy17. Looks at a board the build puzzle left behind, and sends a stream to
32 // the scene of the first arrangement the board matches.
33 class GoldbergPuzzle : public ActionRecord {
34 public:
35  void readData(Common::SeekableReadStream &stream) override;
36  void execute() override;
37 
38 protected:
39  Common::String getRecordTypeName() const override { return "GoldbergPuzzle"; }
40 
41  static const int16 kEmptyZone = -1;
42 
43  struct Slot {
44  int16 zoneID = 0;
45  int16 pieceID = kEmptyZone;
46  };
47 
48  struct Arrangement {
49  Common::Array<Slot> slots;
50  Common::String sceneName;
51  };
52 
53  // The index of the first arrangement the board matches, -1 if there is none
54  int findArrangement() const;
55 
56  Common::String _saveKey;
57  FlagDescription _matchFlag;
58  FlagDescription _notFirstFlag; // for every outcome but the first arrangement
59  Common::String _streamName;
60  Common::Array<Arrangement> _arrangements;
61 };
62 
63 } // End of namespace Action
64 } // End of namespace Nancy
65 
66 #endif // NANCY_ACTION_GOLDBERGPUZZLE_H
Definition: str.h:59
Definition: goldbergpuzzle.h:48
Definition: goldbergpuzzle.h:43
Definition: stream.h:745
Definition: goldbergpuzzle.h:33
Definition: actionrecord.h:107
Definition: commontypes.h:201
Definition: actionmanager.h:32