ScummVM API documentation
Node.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/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_NODE_H
29#define HPL_NODE_H
30
31#include "common/list.h"
32#include "hpl1/engine/game/SaveGame.h"
33#include "hpl1/engine/math/MathTypes.h"
34#include "hpl1/engine/scene/Entity.h"
35#include "hpl1/engine/system/Container.h"
36
37namespace hpl {
38
39class iNode;
40
41typedef Common::List<iNode *> tNodeList;
42typedef tNodeList::iterator tNodeListIt;
43
44typedef cSTLIterator<iNode *, tNodeList, tNodeListIt> cNodeIterator;
45
46//------------------------------------
47
48kSaveData_BaseClass(iNode) {
49 kSaveData_ClassInit(iNode) public : cContainerList<int> mlstEntities;
50 cContainerList<int> mlstNodes;
51};
52
53//------------------------------------
54
55class iNode : public iSaveObject {
56 typedef iSaveObject super;
57
58public:
59 iNode() : mbActive(true) {}
60 virtual ~iNode();
61
62 int SetVisible(bool abX, bool abCascade);
63 bool AddEntity(iEntity *apEntity);
64 bool RemoveEntity(iEntity *apEntity);
65 void ClearEntities();
66
67 void SetActive(bool abX) { mbActive = abX; }
68 bool IsActive() { return mbActive; }
69
70 virtual iNode *CreateChild() = 0;
71
72 cNodeIterator GetChildIterator();
73 cEntityIterator GetEntityIterator();
74
75 // SaveObject implementation
76 virtual iSaveData *CreateSaveData() { return NULL; }
77 virtual void SaveToSaveData(iSaveData *apSaveData);
78 virtual void LoadFromSaveData(iSaveData *apSaveData);
79 virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
80
81protected:
82 tEntityList mlstEntity;
83 tNodeList mlstNode;
84
85 bool mbActive;
86};
87
88} // namespace hpl
89
90#endif // HPL_NODE_H
ListInternal::Iterator< iNode * > iterator
Definition: list.h:52
Definition: Game.h:91
Definition: SystemTypes.h:411
Definition: SaveGame.h:183
Definition: Entity.h:50
Definition: Node.h:55
virtual void SaveToSaveData(iSaveData *apSaveData)
virtual void LoadFromSaveData(iSaveData *apSaveData)
virtual iSaveData * CreateSaveData()
Definition: Node.h:76
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
Definition: SaveGame.h:111
Definition: SaveGame.h:130