-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathregion.cpp
84 lines (70 loc) · 1.86 KB
/
region.cpp
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
//
// region.cpp
// Undiscovered Worlds
//
// Created by Jonathan Hill on 27/10/2019.
//
// Please see functions.hpp for notes.
#include "region.hpp"
#include "functions.hpp"
region::region() //constructor
{
}
region::~region()
{
}
bool region::outline(int x, int y) const
{
if (y<1 || y>itsrheight - 1)
return 0;
if (sea(x, y) == 0)
{
if (x > 0 && sea(x - 1, y) == 1)
return 1;
if (sea(x, y - 1) == 1)
return 1;
if (x < itsrwidth && sea(x + 1, y) == 1)
return 1;
if (sea(x, y + 1) == 1)
return 1;
}
return 0;
}
// Other public functions
void region::clear()
{
for (int i = 0; i <= itsrwidth; i++) // Set all the maps to 0.
{
for (int j = 0; j <= itsrheight; j++)
{
rmap[i][j] = 0;
rjantempmap[i][j] = 0;
rjultempmap[i][j] = 0;
rjanrainmap[i][j] = 0;
rjulrainmap[i][j] = 0;
rclimatemap[i][j] = 0;
rlakemap[i][j] = 0;
rrivermapdir[i][j] = 0;
rrivermapjan[i][j] = 0;
rrivermapjul[i][j] = 0;
rseaicemap[i][j] = 0;
rfakeriversdir[i][j] = 0;
rfakeriversjan[i][j] = 0;
rfakeriversjul[i][j] = 0;
rspecials[i][j] = 0;
rdeltamapdir[i][j] = 0;
rdeltamapjan[i][j] = 0;
rdeltamapjul[i][j] = 0;
rmountainsdone[i][j] = 0;
rvolcanomap[i][j] = 0;
rtidalmap[i][j] = 0;
rmudmap[i][j] = 0;
rsandmap[i][j] = 0;
rshinglemap[i][j] = 0;
rbarrierislandmap[i][j] = 0;
//testmap[i][j] = 0;
//testmap2[i][j] = 0;
//testmapfloat[i][j] = 0;
}
}
}