forked from Whales/Cataclysm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overmap.h
120 lines (111 loc) · 3.54 KB
/
overmap.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
#ifndef _OVERMAP_H_
#define _OVERMAP_H_
#include "enums.h"
#include "string.h"
#include "omdata.h"
#include "mongroup.h"
#include "settlement.h"
#include "npc.h"
#include <vector>
#include <curses.h>
struct settlement;
struct city {
int x;
int y;
int s;
city(int X = -1, int Y = -1, int S = -1) : x (X), y (Y), s (S) {}
};
struct om_note {
int x;
int y;
int num;
std::string text;
om_note(int X = -1, int Y = -1, int N = -1, std::string T = "") :
x (X), y (Y), num (N), text (T) {}
};
struct radio_tower {
int x;
int y;
int strength;
std::string message;
radio_tower(int X = -1, int Y = -1, int S = -1, std::string M = "") :
x (X), y (Y), strength (S), message (M) {}
};
class overmap
{
public:
overmap();
overmap(game *g, int x, int y, int z);
~overmap();
void save(std::string name);
void save(std::string name, int x, int y, int z);
void open(game *g, int x, int y, int z);
void generate(game *g, overmap* north, overmap* east, overmap* south,
overmap* west);
void generate_sub(overmap* above);
void make_tutorial();
void first_house(int &x, int &y);
/* Returns the closest point of terrain type [type, type + type_range)
* Use type_range of 4, for instance, to match all gun stores (4 rotations).
* dist is set to the distance between the two points.
* You can give dist a value, which will be used as the maximum distance; a
* value of 0 will search the entire overmap.
* Use must_be_seen=true if only terrain seen by the player should be searched.
* If no such tile can be found, (-1, -1) is returned.
*/
point find_closest(point origin, oter_id type, int type_range,
int &dist, bool must_be_seen);
// Interactive point choosing; used as the map screen
point choose_point(game *g);
oter_id& ter(int x, int y);
std::vector<mongroup> monsters_at(int x, int y);
bool& seen(int x, int y);
bool has_note(int x, int y);
std::string note(int x, int y);
void add_note(int x, int y, std::string message);
point find_note(point origin, std::string text);
std::vector<city> cities;
std::vector<city> roads_out;
std::vector<settlement> towns;
std::vector<mongroup> zg;
std::vector<radio_tower> radios;
int posx, posy, posz;
std::vector<npc> npcs;
private:
oter_id t[OMAPX][OMAPY];
oter_id nullret;
bool s[OMAPX][OMAPY];
bool nullbool;
std::vector<om_note> notes;
// Overall terrain
void place_river(point pa, point pb);
void place_forest();
void place_settlements(game *g);
void settlement_building(settlement &set, int x, int y);
// City Building
void place_cities(std::vector<city> &cities, int min);
void put_buildings(int x, int y, int dir, city town);
void make_road(int cx, int cy, int cs, int dir, city town);
void build_lab(int x, int y, int s);
void build_anthill(int x, int y, int s);
void build_tunnel(int x, int y, int s, int dir);
void build_slimepit(int x, int y, int s);
void place_rifts();
// Connection highways
void place_hiways(std::vector<city> cities, oter_id base);
void place_subways(std::vector<point> stations);
void make_hiway(int x1, int y1, int x2, int y2, oter_id base);
void building_on_hiway(int x, int y, int dir);
// Polishing
bool is_road(oter_id base, int x, int y); // Dependant on road type
bool is_road(int x, int y);
void polish(oter_id min = ot_null, oter_id max = ot_tutorial);
void good_road(oter_id base, int x, int y);
void good_river(int x, int y);
// Monsters, radios, etc.
void place_mongroups();
void place_radios();
void place_NPCs(game *g);
// File I/O
};
#endif