From 2ada5a8dd7d953d35ddb8ad56a6827cc95daa1cb Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 00:43:57 -0500 Subject: ZVISION: Split puzzleControl into two files. Add ResultAction enum After further investigation, puzzles and controls don't really share any structs. So it makes more sense to keep them seperate. --- engines/zvision/puzzle.h | 119 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 engines/zvision/puzzle.h (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h new file mode 100644 index 0000000000..cb44a440e1 --- /dev/null +++ b/engines/zvision/puzzle.h @@ -0,0 +1,119 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef ZVISION_PUZZLE_H +#define ZVISION_PUZZLE_H + +#include "common/list.h" + +#include "zvision/object.h" + +namespace ZVision { + +/** How criteria should be decided */ +enum CriteriaOperator { + EQUAL_TO, + NOT_EQUAL_TO, + GREATER_THAN, + LESS_THAN +}; + +/** Criteria for a Puzzle result to be fired */ +struct Criteria { + /** The id of a global state */ + uint32 id; + /** + * What we're comparing the value of the global state against + * This can either be a pure value or it can be the id of another global state + */ + uint32 argument; + /** How to do the comparison */ + CriteriaOperator criteriaOperator; + /** Is 'argument' the id of a global state or a pure value */ + bool argumentIsAnId; +}; + +/** What happens when Puzzle criteria are met */ +enum ResultAction { + ADD, + ANIM_PLAY, + ANIM_PRELOAD, + ANIM_UNLOAD, + ATTENUATE, + ASSIGN, + CHANGE_LOCATION, + CROSSFADE, + DEBUG, + DELAY_RENDER, + DISABLE_CONTROL, + DISABLE_VENUS, + DISPLAY_MESSAGE, + DISSOLVE, + DISTORT, + ENABLE_CONTROL, + FLUSH_MOUSE_EVENTS, + INVENTORY, + KILL, + MENU_BAR_ENABLE, + MUSIC, + PAN_TRACK, + PLAY_PRELOAD, + PREFERENCES, + QUIT, + RANDOM, + REGION, + RESTORE_GAME, + ROTATE_TO, + SAVE_GAME, + SET_PARTIAL_SCREEN, + SET_SCREEN, + SET_VENUS, + STOP, + STREAM_VIDEO, + SYNC_SOUND, + TIMER, + TTY_TEXT, + UNIVERSE_MUSIC, +}; + +/** What happens when Puzzle criteria are met */ +struct Result { + ResultAction action; + Common::List arguments; +}; + +enum StateFlags : byte { + ONCE_PER_INST = 0x01, + DO_ME_NOW = 0x02, + DISABLED = 0x04 +}; + +struct Puzzle { + uint32 id; + Common::List criteriaList; + Common::List resultList; + byte flags; +}; + +} + +#endif -- cgit v1.2.3 From cf7c04a001d99081d73e4340acb8065ad593030a Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 24 Jun 2013 13:38:40 -0500 Subject: ZVISION: Fix code formatting to follow the convention --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index cb44a440e1..6961fde45a 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -114,6 +114,6 @@ struct Puzzle { byte flags; }; -} +} // End of namespace ZVision #endif -- cgit v1.2.3 From d5fa6612ed8f48ce33dd9f3576c450fe80a7526d Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 27 Jun 2013 13:41:24 -0500 Subject: ZVISION: Modify utility and puzzle comments to make them more clear --- engines/zvision/puzzle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 6961fde45a..1133adac47 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -48,8 +48,8 @@ struct Criteria { uint32 argument; /** How to do the comparison */ CriteriaOperator criteriaOperator; - /** Is 'argument' the id of a global state or a pure value */ - bool argumentIsAnId; + /** Whether 'argument' is the id of a global state (true) or a pure value (false) */ + bool isArgumentAnId; }; /** What happens when Puzzle criteria are met */ -- cgit v1.2.3 From 464cc44a8204134681aadbe68645fd4efe6d04d4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:16:32 -0500 Subject: ZVISION: Convert ScriptManager methods to use ResultAction classes logic --- engines/zvision/puzzle.h | 61 +++++------------------------------------------- 1 file changed, 6 insertions(+), 55 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 1133adac47..1a456ef6e2 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/object.h" +#include "zvision/resultAction.h" namespace ZVision { @@ -39,11 +39,11 @@ enum CriteriaOperator { /** Criteria for a Puzzle result to be fired */ struct Criteria { - /** The id of a global state */ - uint32 id; + /** The key of a global state */ + uint32 key; /** * What we're comparing the value of the global state against - * This can either be a pure value or it can be the id of another global state + * This can either be a pure value or it can be the key of another global state */ uint32 argument; /** How to do the comparison */ @@ -52,55 +52,6 @@ struct Criteria { bool isArgumentAnId; }; -/** What happens when Puzzle criteria are met */ -enum ResultAction { - ADD, - ANIM_PLAY, - ANIM_PRELOAD, - ANIM_UNLOAD, - ATTENUATE, - ASSIGN, - CHANGE_LOCATION, - CROSSFADE, - DEBUG, - DELAY_RENDER, - DISABLE_CONTROL, - DISABLE_VENUS, - DISPLAY_MESSAGE, - DISSOLVE, - DISTORT, - ENABLE_CONTROL, - FLUSH_MOUSE_EVENTS, - INVENTORY, - KILL, - MENU_BAR_ENABLE, - MUSIC, - PAN_TRACK, - PLAY_PRELOAD, - PREFERENCES, - QUIT, - RANDOM, - REGION, - RESTORE_GAME, - ROTATE_TO, - SAVE_GAME, - SET_PARTIAL_SCREEN, - SET_SCREEN, - SET_VENUS, - STOP, - STREAM_VIDEO, - SYNC_SOUND, - TIMER, - TTY_TEXT, - UNIVERSE_MUSIC, -}; - -/** What happens when Puzzle criteria are met */ -struct Result { - ResultAction action; - Common::List arguments; -}; - enum StateFlags : byte { ONCE_PER_INST = 0x01, DO_ME_NOW = 0x02, @@ -108,9 +59,9 @@ enum StateFlags : byte { }; struct Puzzle { - uint32 id; + uint32 key; Common::List criteriaList; - Common::List resultList; + Common::List resultActions; byte flags; }; -- cgit v1.2.3 From 1710468121648d494a393f7176c81027fec573c4 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 15:45:46 -0500 Subject: ZVISION: Fix includes to use new underscore names --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 1a456ef6e2..75d3dc0826 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/resultAction.h" +#include "zvision/result_action.h" namespace ZVision { -- cgit v1.2.3 From 3822de2aec0d41df7c2beeb5a1269577e9c3df84 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 3 Jul 2013 18:24:06 -0500 Subject: ZVISION: Change Puzzle::resultActions to a List of pointers instead of ResultAction objects ResultAction is abstract, therefore, it can't be directly stored in the list --- engines/zvision/puzzle.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 75d3dc0826..fd9c61e8bc 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -61,7 +61,8 @@ enum StateFlags : byte { struct Puzzle { uint32 key; Common::List criteriaList; - Common::List resultActions; + // This has to be list of pointers because ResultAction is abstract + Common::List resultActions; byte flags; }; -- cgit v1.2.3 From 258ecb0aebc21d84c2e81b9b82e9c49a24e6d41b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 16:32:38 +0300 Subject: ZVISION: Remove nonstandard C type declaration from the StateFlags enum --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index fd9c61e8bc..d3b7536e8d 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -52,7 +52,7 @@ struct Criteria { bool isArgumentAnId; }; -enum StateFlags : byte { +enum StateFlags { ONCE_PER_INST = 0x01, DO_ME_NOW = 0x02, DISABLED = 0x04 -- cgit v1.2.3 From a8e5e1e2dbd8a3fcf438966383172866a90b835e Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 6 Jul 2013 12:30:54 -0500 Subject: ZVISION: Rename result_action.h/.cpp files to actions.h/.cpp --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index d3b7536e8d..9dab606f54 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,7 +25,7 @@ #include "common/list.h" -#include "zvision/result_action.h" +#include "zvision/actions.h" namespace ZVision { -- cgit v1.2.3 From 4e55d7ba9476cd47a3118ecdeb0d0618e6d32211 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:08:00 -0500 Subject: ZVISION: Clean up includes --- engines/zvision/puzzle.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 9dab606f54..7a2755fd69 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -25,10 +25,10 @@ #include "common/list.h" -#include "zvision/actions.h" - namespace ZVision { +class ResultAction; + /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, @@ -48,8 +48,8 @@ struct Criteria { uint32 argument; /** How to do the comparison */ CriteriaOperator criteriaOperator; - /** Whether 'argument' is the id of a global state (true) or a pure value (false) */ - bool isArgumentAnId; + /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ + bool argumentIsAKey; }; enum StateFlags { -- cgit v1.2.3 From 29061acd4ebeef2686b2ee2ff9c97d6ee4f11e91 Mon Sep 17 00:00:00 2001 From: richiesams Date: Thu, 11 Jul 2013 00:44:23 -0500 Subject: ZVISION: Add operator< to the Puzzle struct ScriptManager does a unique-fication of a container of Puzzles using a sort with some other logic. The sort uses operator< --- engines/zvision/puzzle.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 7a2755fd69..b3831d4665 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,6 +64,13 @@ struct Puzzle { // This has to be list of pointers because ResultAction is abstract Common::List resultActions; byte flags; + + // Used by the ScriptManager to allow unique-ification of _referenceTable + // The unique-ification is done by sorting, then iterating and removing duplicates + // The sort uses operator< + const bool operator<(const Puzzle &other) const { + return key < other.key; + } }; } // End of namespace ZVision -- cgit v1.2.3 From 73f02759f914327732bac2f1a750f3a95efe17ce Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 24 Jul 2013 11:36:53 -0500 Subject: ZVISION: Remove supurflouous 'const' and add 'inline' --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index b3831d4665..06c228d367 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -68,7 +68,7 @@ struct Puzzle { // Used by the ScriptManager to allow unique-ification of _referenceTable // The unique-ification is done by sorting, then iterating and removing duplicates // The sort uses operator< - const bool operator<(const Puzzle &other) const { + inline bool operator<(const Puzzle &other) const { return key < other.key; } }; -- cgit v1.2.3 From 7d58ebf2819562893df2f07b916c9712d5b7413f Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 21:43:49 -0500 Subject: ZVISION: Convert Puzzle to a class It needed a copy constructor and destructor to handle the heap memory ResultActions --- engines/zvision/puzzle.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 06c228d367..08d8a5cfd7 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -58,7 +58,27 @@ enum StateFlags { DISABLED = 0x04 }; -struct Puzzle { +class Puzzle { +public: + ~Puzzle() { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + delete (*iter); + } + } + + Puzzle() {} + + // Copy constructor + Puzzle(const Puzzle &other) + : key(other.key), + criteriaList(other.criteriaList), + flags(flags) { + // We have to clone the ResultActions since they are on the heap + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + resultActions.push_back((*iter)->clone()); + } + } + uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract -- cgit v1.2.3 From f975fbe52190ccc0ca1264d6aa63a897ad784f31 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 22:15:24 -0500 Subject: ZVISION: Move Puzzle logic into a .cpp file --- engines/zvision/puzzle.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 08d8a5cfd7..a0c4e9d758 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -60,24 +60,9 @@ enum StateFlags { class Puzzle { public: - ~Puzzle() { - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - delete (*iter); - } - } - Puzzle() {} - - // Copy constructor - Puzzle(const Puzzle &other) - : key(other.key), - criteriaList(other.criteriaList), - flags(flags) { - // We have to clone the ResultActions since they are on the heap - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - resultActions.push_back((*iter)->clone()); - } - } + ~Puzzle(); + Puzzle(const Puzzle &other); uint32 key; Common::List criteriaList; -- cgit v1.2.3 From f39e1fdc43a97c0d06bfcda0e5c6dfdfb4e95ef7 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 22:16:21 -0500 Subject: ZVISION: Move CriteriaOperator, Criteria, and StateFlag inside the Puzzle class --- engines/zvision/puzzle.h | 60 +++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index a0c4e9d758..fba139c0a6 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -29,41 +29,43 @@ namespace ZVision { class ResultAction; -/** How criteria should be decided */ -enum CriteriaOperator { - EQUAL_TO, - NOT_EQUAL_TO, - GREATER_THAN, - LESS_THAN -}; - -/** Criteria for a Puzzle result to be fired */ -struct Criteria { - /** The key of a global state */ - uint32 key; - /** - * What we're comparing the value of the global state against - * This can either be a pure value or it can be the key of another global state - */ - uint32 argument; - /** How to do the comparison */ - CriteriaOperator criteriaOperator; - /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ - bool argumentIsAKey; -}; - -enum StateFlags { - ONCE_PER_INST = 0x01, - DO_ME_NOW = 0x02, - DISABLED = 0x04 -}; - class Puzzle { public: Puzzle() {} ~Puzzle(); Puzzle(const Puzzle &other); + +public: + /** How criteria should be decided */ + enum CriteriaOperator { + EQUAL_TO, + NOT_EQUAL_TO, + GREATER_THAN, + LESS_THAN + }; + + /** Criteria for a Puzzle result to be fired */ + struct Criteria { + /** The key of a global state */ + uint32 key; + /** + * What we're comparing the value of the global state against + * This can either be a pure value or it can be the key of another global state + */ + uint32 argument; + /** How to do the comparison */ + CriteriaOperator criteriaOperator; + /** Whether 'argument' is the key of a global state (true) or a pure value (false) */ + bool argumentIsAKey; + }; + enum StateFlags { + ONCE_PER_INST = 0x01, + DO_ME_NOW = 0x02, + DISABLED = 0x04 + }; + +public: uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract -- cgit v1.2.3 From f1135292d0d714187b719988dba8d5a7d487fe94 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 30 Jul 2013 14:25:31 -0500 Subject: ZVISION: Optimize integer type usages The general thought is int is faster than int16 or byte. So if you can afford the space, use it over int16 or byte. Also, only use int32 when you specifically need the 32 bits. --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index fba139c0a6..c73a345c3a 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -70,7 +70,7 @@ public: Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract Common::List resultActions; - byte flags; + uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable // The unique-ification is done by sorting, then iterating and removing duplicates -- cgit v1.2.3 From 2faaf8488bb5bdace2c017b37f825bc38f41ef84 Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 2 Aug 2013 15:30:02 -0500 Subject: ZVISION: Convert ResultAction pointers to SharePtr This gets rid of the need for specific destruction as well as making the copy swap operations in the ScriptManger _referenceTable more efficient --- engines/zvision/puzzle.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index c73a345c3a..5e060c009a 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -23,19 +23,15 @@ #ifndef ZVISION_PUZZLE_H #define ZVISION_PUZZLE_H + #include "common/list.h" +#include "common/ptr.h" namespace ZVision { class ResultAction; -class Puzzle { -public: - Puzzle() {} - ~Puzzle(); - Puzzle(const Puzzle &other); - -public: +struct Puzzle { /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, @@ -65,11 +61,10 @@ public: DISABLED = 0x04 }; -public: uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List resultActions; + Common::List> resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable -- cgit v1.2.3 From 9dec0adcdc20e0a31594f9971a0c828255a36874 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 11:49:47 -0500 Subject: ZVISION: Conform to gcc template spacing requirements --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 5e060c009a..18dfcb821c 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,7 +64,7 @@ struct Puzzle { uint32 key; Common::List criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List> resultActions; + Common::List > resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable -- cgit v1.2.3 From 30afe1a81532f19c7ab872ff20e2b04c582ff221 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 5 Aug 2013 19:08:44 -0500 Subject: ZVISION: Add some comments concerning StateFlag::DO_ME_NOW --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 18dfcb821c..e7846f5296 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -57,7 +57,7 @@ struct Puzzle { enum StateFlags { ONCE_PER_INST = 0x01, - DO_ME_NOW = 0x02, + DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria DISABLED = 0x04 }; -- cgit v1.2.3 From 46ab3557660221b2896c0d5cd4a7d3fb0464d1d1 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 15:38:56 -0500 Subject: ZVISION: Allow Puzzles to have mutiple 'sets' of CriteriaEntries --- engines/zvision/puzzle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index e7846f5296..36787e7ba1 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -41,7 +41,7 @@ struct Puzzle { }; /** Criteria for a Puzzle result to be fired */ - struct Criteria { + struct CriteriaEntry { /** The key of a global state */ uint32 key; /** @@ -62,7 +62,7 @@ struct Puzzle { }; uint32 key; - Common::List criteriaList; + Common::List > criteriaList; // This has to be list of pointers because ResultAction is abstract Common::List > resultActions; uint flags; -- cgit v1.2.3 From b0635edff8c0d5b05cef8a22c74c569921a8346b Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 18 Aug 2013 19:51:27 -0500 Subject: ZVISION: Revert to normal pointers instead of shared pointers --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 36787e7ba1..227183ab02 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -64,7 +64,7 @@ struct Puzzle { uint32 key; Common::List > criteriaList; // This has to be list of pointers because ResultAction is abstract - Common::List > resultActions; + Common::List resultActions; uint flags; // Used by the ScriptManager to allow unique-ification of _referenceTable -- cgit v1.2.3 From ad5756fa31113b88fb486c679adfe2197daeca08 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 20:48:34 -0500 Subject: ZVISION: Add a destructor to Puzzle --- engines/zvision/puzzle.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 227183ab02..371af83d91 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -27,11 +27,17 @@ #include "common/list.h" #include "common/ptr.h" -namespace ZVision { +#include "zvision/actions.h" -class ResultAction; +namespace ZVision { struct Puzzle { + ~Puzzle() { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + delete (*iter); + } + } + /** How criteria should be decided */ enum CriteriaOperator { EQUAL_TO, -- cgit v1.2.3 From fa7fb2e029adec318cf963292b4b9b375189b487 Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 20 Aug 2013 21:26:53 -0500 Subject: ZVISION: Initialize Puzzle::key and Puzzle::flags Some Puzzles don't have flags, which caused it to never be initialized --- engines/zvision/puzzle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 371af83d91..512a9636b9 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -32,6 +32,8 @@ namespace ZVision { struct Puzzle { + Puzzle() : key(0), flags(0) {} + ~Puzzle() { for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { delete (*iter); -- cgit v1.2.3 From 239493305d1662c38c015e5cc1d321b6fe5baef7 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:15:44 -0500 Subject: ZVISION: Replace all occurances of (*iter). with iter-> --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 512a9636b9..679a017262 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -36,7 +36,7 @@ struct Puzzle { ~Puzzle() { for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { - delete (*iter); + delete *iter; } } -- cgit v1.2.3 From ffaffa2bc4163fcc72c40416ba713076ba9e8a01 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 17:27:03 -0500 Subject: ZVISION: Convert all for-loops to use pre-increment instead of post-increment --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 679a017262..75ea9541d2 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -35,7 +35,7 @@ struct Puzzle { Puzzle() : key(0), flags(0) {} ~Puzzle() { - for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) { + for (Common::List::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) { delete *iter; } } -- cgit v1.2.3 From 1c8a5582a2dd23c01bda6002e746a4e5749b21b6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:47:16 -0500 Subject: ZVISION: Remove unnesessary operator overload --- engines/zvision/puzzle.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 75ea9541d2..97b839f9a7 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -74,13 +74,6 @@ struct Puzzle { // This has to be list of pointers because ResultAction is abstract Common::List resultActions; uint flags; - - // Used by the ScriptManager to allow unique-ification of _referenceTable - // The unique-ification is done by sorting, then iterating and removing duplicates - // The sort uses operator< - inline bool operator<(const Puzzle &other) const { - return key < other.key; - } }; } // End of namespace ZVision -- cgit v1.2.3 From bad28dc15872e208bf21f1e6fa2ab906bca598c4 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 20:08:41 -0500 Subject: ZVISION: Standardize includes order and format Format is: common/scummsys.h (Only if a .cpp file) header file for this file (Only if a .cpp file) zengine includes other includes, grouped by module --- engines/zvision/puzzle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/puzzle.h') diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 97b839f9a7..1e730365dc 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -23,11 +23,11 @@ #ifndef ZVISION_PUZZLE_H #define ZVISION_PUZZLE_H +#include "zvision/actions.h" #include "common/list.h" #include "common/ptr.h" -#include "zvision/actions.h" namespace ZVision { -- cgit v1.2.3