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
325ff34a
Commit
325ff34a
authored
8 years ago
by
Ian Prins
Browse files
Options
Downloads
Patches
Plain Diff
add dig function to rooms
parent
e75ba8e1
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/room.h
+1
-1
1 addition, 1 deletion
src/include/room.h
src/room.cpp
+10
-0
10 additions, 0 deletions
src/room.cpp
with
11 additions
and
1 deletion
src/include/room.h
+
1
−
1
View file @
325ff34a
...
...
@@ -5,9 +5,9 @@ class Room {
public:
Room
(
Coord
,
Coord
);
Coord
operator
[](
int
);
void
dig
(
Level
&
);
Coord
getPosition1
();
Coord
getPosition2
();
void
dig
(
Level
);
private:
Coord
topLeft
;
Coord
bottomRight
;
...
...
This diff is collapsed.
Click to expand it.
src/room.cpp
+
10
−
0
View file @
325ff34a
#include
"include/room.h"
#include
"include/coord.h"
#include
"include/tiles.h"
#include
<stdexcept>
#include
<string>
...
...
@@ -16,3 +17,12 @@ Coord Room::operator[](int corner) {
}
throw
std
::
invalid_argument
(
"param must be 0 or 1, not "
+
std
::
to_string
(
corner
));
}
void
Room
::
dig
(
Level
&
level
)
{
for
(
auto
x
=
topLeft
[
0
];
x
<=
bottomRight
[
0
];
x
++
)
{
for
(
auto
y
=
topLeft
[
1
];
y
<=
bottomRight
[
1
];
y
++
)
{
level
[
Coord
(
x
,
y
)]
=
Floor
();
}
}
}
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