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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ZVISION_PUZZLE_H 24 #define ZVISION_PUZZLE_H 25 26 #include "zvision/scripting/actions.h" 27 28 #include "common/list.h" 29 #include "common/ptr.h" 30 31 namespace ZVision { 32 33 struct Puzzle { PuzzlePuzzle34 Puzzle() : key(0), addedBySetState(false) {} 35 ~PuzzlePuzzle36 ~Puzzle() { 37 for (Common::List<ResultAction *>::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) { 38 delete *iter; 39 } 40 } 41 42 /** How criteria should be decided */ 43 enum CriteriaOperator { 44 EQUAL_TO, 45 NOT_EQUAL_TO, 46 GREATER_THAN, 47 LESS_THAN 48 }; 49 50 /** Criteria for a Puzzle result to be fired */ 51 struct CriteriaEntry { 52 /** The key of a global state */ 53 uint32 key; 54 /** 55 * What we're comparing the value of the global state against 56 * This can either be a pure value or it can be the key of another global state 57 */ 58 uint32 argument; 59 /** How to do the comparison */ 60 CriteriaOperator criteriaOperator; 61 /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ 62 bool argumentIsAKey; 63 }; 64 65 enum StateFlags { 66 ONCE_PER_INST = 0x01, 67 DISABLED = 0x02, 68 DO_ME_NOW = 0x04 69 }; 70 71 uint32 key; 72 Common::List<Common::List <CriteriaEntry> > criteriaList; 73 // This has to be list of pointers because ResultAction is abstract 74 Common::List<ResultAction *> resultActions; 75 bool addedBySetState; 76 }; 77 78 } // End of namespace ZVision 79 80 #endif 81