-
Notifications
You must be signed in to change notification settings - Fork 17
/
EggManager.h
79 lines (64 loc) · 2.05 KB
/
EggManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __EggManager_h__
#define __EggManager_h__
/*
* EggManager.h
* Nuvie
*
* Created by Eric Fry on Sun Dec 07 2003.
* Copyright (c) 2003. All rights reserved.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <string>
#include <list>
#include "ObjManager.h"
struct Egg
{
bool seen_egg;
Obj *obj;
Egg() { seen_egg = false; obj = NULL; };
};
class Configuration;
class ActorManager;
class Actor;
class Map;
class EggManager
{
Configuration *config;
Map *map;
ActorManager *actor_manager;
ObjManager *obj_manager;
nuvie_game_t gametype; // what game is being played?
std::list<Egg *> egg_list;
public:
EggManager(Configuration *cfg, nuvie_game_t type, Map *m);
~EggManager();
void set_actor_manager(ActorManager *am) { actor_manager = am; }
void set_obj_manager(ObjManager *om) { obj_manager = om; }
void clean(bool keep_obj=true);
void add_egg(Obj *egg);
void remove_egg(Obj *egg, bool keep_egg=true);
void set_egg_visibility(bool show_eggs);
bool spawn_egg(Obj *egg, uint8 hatch_probability);
void spawn_eggs(uint16 x, uint16 y, uint8 z, bool teleport = false);
std::list<Egg *> *get_egg_list() { return &egg_list; };
bool is_spawning_actors(){ return !not_spawning_actors; }
void set_spawning_actors(bool spawning) { not_spawning_actors = !spawning; }
protected:
uint8 get_worktype(Obj *embryo);
bool not_spawning_actors;
};
#endif /* __EggManager_h__ */