-
Notifications
You must be signed in to change notification settings - Fork 1
/
level.h
154 lines (113 loc) · 3.83 KB
/
level.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#ifndef LEVEL_H
#define LEVEL_H
#pragma warning (disable: 4786)
#pragma warning (disable: 4788)
// disable warning (compare bool with int)
#pragma warning (disable: 4805)
#pragma warning (disable: 4503)
#include "fov.h"
#include "map.h"
#include "monster.h"
#include <string>
#include "attrib.h"
typedef map < int , int > map_of_probabilities;
typedef pair < int, int > pair_of_probabilities;
class LEVEL_DEFINITION
{
public:
string name;
string type;
string music;
int fov_range;
int number_of_items;
int number_of_items_deviation;
int number_of_monsters;
int number_of_monsters_deviation;
int max_number_of_monsters;
int monster_every_n_turns;
int items_param1;
int items_param2;
int items_concentration;
map_of_probabilities item_probability;
map_of_probabilities monster_probability;
int sum_of_monster_probabilities;
int sum_of_items_probabilities;
void reset() {
name="";
type="";
fov_range = 12;
monster_every_n_turns = 99999999;
number_of_monsters = 0;
number_of_items = 0;
max_number_of_monsters = 0;
sum_of_monster_probabilities = 0;
sum_of_items_probabilities = 0;
number_of_monsters_deviation = 0;
number_of_items_deviation = 0;
item_probability.clear();
monster_probability.clear();
items_param1=0;
items_param2=0;
items_concentration=0;
};
};
typedef map < string , list < string > > map_of_level_links;
typedef map < string , LEVEL_DEFINITION > map_of_levels;
class LEVEL : public TOSAVE {
private:
void CreateItemOnLevel(string type,int x, int y);
void CreateMonsterOnLevel(string type,int x, int y, bool create_not_moving);
void time_for_items();
void time_for_monsters();
void time_for_gases();
void time_for_level();
void remove_monsters();
public:
bool find_empty_place(int &x, int &y);
bool find_empty_not_visible_place(int &x, int &y);
bool is_player_on_level; // must not be saved!
string ID; // ID (text) of this level
int fov_range;
HERO *player;
MUTUAL_FOV fov;
MAP map;
unsigned long turn;
ptr_list monsters;
ptr_list items_on_map;
ptr_list gases_on_map;
ptr_list all_items; // all, jakie istnieja na tym poziomie
ptr_list monsters_to_delete; // po kazdej turze jest zwalniana pamiec
ptr_list items_to_delete; // po kazdej turze jest zwalniana pamiec
ptr_list gases_to_delete;
void add_to_items_on_map(ITEM *item);
void remove_from_items_on_map(ITEM *item);
void remove_last_item_on_map();
void clear_lists_to_delete();
void list_of_items_from_cell(ptr_list *items,int x,int y);
LEVEL();
void TimePass(); // up³ynê³a w grze chwilka
bool entering_on_cell_possible(int x,int y);
MONSTER *monster_on_cell(int x,int y);
// w def_mons.cpp
MONSTER *create_monster(int x, int y, string name, int param1, int param2);
HERO *create_player(int x, int y, string name, int param1, int param2);
// w def_item.cpp
ITEM *create_base_item(string ClassName);
ITEM *create_item(int x, int y, string name, int param1, int param2);
int get_gas_density(int x, int y);
bool add_gas(int x,int y, PROPERTIES properties, int density);
map_of_level_links stairs_up;
map_of_level_links stairs_down;
map_of_levels levels;
void FreeLevelMemory();
void CreateLevel(string type);
void CreateItemsOnLevel(string id);
void CreateMonstersOnLevel(string id);
ITEM *CreateRandomItemFromCategory(int category,int x,int y,int parametr1,int parametr2);
void AddMonstersFollowingPlayerToNewLevel();
void ChangeLevelTo(string ID_new_one);
/// INHERITED FROM ToSave
virtual unsigned long SaveObject();
virtual bool LoadObject();
};
#endif