1 /*
2 This file is part of "Avanor, the Land of Mystery" roguelike game
3 Home page: http://www.avanor.com/
4 Copyright (C) 2000-2003 Vadim Gaidukevich
5 
6 This program 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 This program 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
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef __XGEN_H
22 #define __XGEN_H
23 
24 #include "map.h"
25 #include "xmapobj.h"
26 
27 class XGenerator : public XMapObject
28 {
29 protected:
XGenerator()30 	XGenerator () {}
31 public:
32 	DECLARE_CREATOR(XGenerator, XMapObject);
XGenerator(int run_time)33 	XGenerator(int run_time)
34 	{
35 		ttmb = run_time;
36 		ttm = ttmb;
37 		x = -1;
38 		y = -1;
39 		im = IM_OTHER;
40 	}
Run()41 	int Run() {assert(0); return 0;}
Compare(XObject * o)42 	virtual int Compare(XObject * o) {return 1;}
43 };
44 /*
45 class XDebugGen : public XGenerator
46 {
47 public:
48 	XDebugGen() : XGenerator(5000) {}
49 	virtual void Run();
50 };
51 */
52 
53 class XUniversalGen : public XGenerator
54 {
55 protected:
XUniversalGen()56 	XUniversalGen() {}
57 public:
58 	DECLARE_CREATOR(XUniversalGen, XGenerator);
XGenerator(refresh_time)59 	XUniversalGen(XLocation * loc, CREATURE_CLASS _crc, CREATURE_LEVEL _crl, unsigned int _max_creature = 8, int refresh_time = 15000) : XGenerator(refresh_time)
60 	{
61 		l   = loc;
62 		crl = _crl;
63 		crc = _crc;
64 		max_creature = _max_creature;
65 	}
66 	int Run();
67 	virtual void Store(XFile * f);
68 	virtual void Restore(XFile * f);
69 protected:
70 	CREATURE_LEVEL crl;
71 	CREATURE_CLASS crc;
72 	unsigned int max_creature;
73 };
74 
75 
76 class XMainLocationGen : public XGenerator
77 {
78 public:
79 	DECLARE_CREATOR(XMainLocationGen, XGenerator);
XMainLocationGen(XLocation * loc)80 	XMainLocationGen(XLocation * loc) : XGenerator(1000)
81 	{
82 		l           = loc;
83 		turns_count = 0;
84 	}
85 	int Run();
86 	virtual void Store(XFile * f);
87 	virtual void Restore(XFile * f);
88 protected:
89 	int turns_count;
90 };
91 
92 #endif
93