Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RogueReborn
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mikhail Andrenkov
RogueReborn
Commits
ede568d5
Commit
ede568d5
authored
8 years ago
by
Ian Prins
Browse files
Options
Downloads
Patches
Plain Diff
add getter, utility func, change constructor, add constant
parent
58d68d05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/level.h
+4
-1
4 additions, 1 deletion
src/include/level.h
src/level.cpp
+10
-2
10 additions, 2 deletions
src/level.cpp
with
14 additions
and
3 deletions
src/include/level.h
+
4
−
1
View file @
ede568d5
...
...
@@ -10,13 +10,16 @@
class
Level
{
public:
Level
(
Coord
,
int
);
Level
(
int
);
Terrain
&
tileAt
(
Coord
);
Coord
getSize
();
Terrain
&
operator
[](
Coord
);
void
generate
(
PlayerChar
);
bool
contains
(
Coord
);
private:
const
int
MAX_ROOMS
=
9
;
const
double
GOLD_CHANCE
=
.333
;
const
Coord
SIZE
=
Coord
(
80
,
25
);
std
::
vector
<
std
::
vector
<
Terrain
>
>
tiles
;
std
::
vector
<
Mob
>
mobs
;
std
::
vector
<
GoldPile
>
golds
;
...
...
This diff is collapsed.
Click to expand it.
src/level.cpp
+
10
−
2
View file @
ede568d5
...
...
@@ -8,8 +8,8 @@
#include
"include/random.h"
#include
"include/playerchar.h"
Level
::
Level
(
Coord
size
,
int
depth
)
:
size
(
size
)
Level
::
Level
(
int
depth
)
:
size
(
SIZE
)
,
depth
(
depth
)
{
for
(
auto
x
=
0
;
x
<
size
[
0
];
x
++
)
{
...
...
@@ -28,6 +28,14 @@ Terrain& Level::tileAt(Coord coord) {
return
tiles
[
coord
[
0
]][
coord
[
1
]];
}
Coord
Level
::
getSize
()
{
return
size
;
}
bool
Level
::
contains
(
Coord
pos
)
{
return
pos
[
0
]
>=
0
&&
pos
[
1
]
>=
0
&&
pos
[
0
]
<
size
[
0
]
&&
pos
[
1
]
<
size
[
1
];
}
int
Level
::
genGoldAmount
(
Generator
gen
)
{
return
2
+
gen
.
intFromRange
(
0
,
50
+
10
*
depth
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment