1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_PlacementTypeh_INCLUDE__)
22 #define __INCLUDE_PlacementTypeh_INCLUDE__
23 
24 #include <common/FixedVector.h>
25 #include <string>
26 #include <list>
27 
28 class XMLNode;
29 class ScorchedContext;
30 class ProgressCounter;
31 class RandomGenerator;
32 class PlacementObject;
33 class PlacementType
34 {
35 public:
36 	enum Type
37 	{
38 		eMask,
39 		eCount,
40 		eTree,
41 		eDirect,
42 		eBounds,
43 		eTankStart
44 	};
45 	struct Position
46 	{
47 		FixedVector position;
48 		FixedVector velocity;
49 	};
50 
51 	static PlacementType *create(const char *type);
52 
53 	PlacementType();
54 	virtual ~PlacementType();
55 
56 	void createObjects(ScorchedContext &context,
57 		RandomGenerator &generator,
58 		unsigned int &playerId,
59 		ProgressCounter *counter = 0);
60 
61 	virtual Type getType() = 0;
62 	virtual bool readXML(XMLNode *node);
63 	virtual void getPositions(ScorchedContext &context,
64 		RandomGenerator &generator,
65 		std::list<Position> &returnPositions,
66 		ProgressCounter *counter = 0) = 0;
67 
68 protected:
69 	PlacementObject *placementobject;
70 
71 	bool checkCloseness(FixedVector &position,
72 		ScorchedContext &context,
73 		std::list<Position> &returnPositions,
74 		fixed mincloseness);
75 };
76 
77 #endif // __INCLUDE_PlacementTypeh_INCLUDE__
78