aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/regions.cpp
diff options
context:
space:
mode:
authorPeter Kohaut2018-01-14 12:12:06 +0100
committerPeter Kohaut2018-01-28 10:57:16 +0100
commit1e5f9d3078f236f306b5d868bcd52f4e47f7b512 (patch)
tree0d402af27d75064d60e4674ab3bd4c9ad08759f1 /engines/bladerunner/regions.cpp
parent3a937f19c0a5e347c801c62d345475be082f9e41 (diff)
downloadscummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.tar.gz
scummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.tar.bz2
scummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.zip
BLADERUNNER: Added basic KIA interface
Settings works Help works Clue database works Fixed code for inserting objects into scene Reorganization of few files Unification & code formatting of few older files
Diffstat (limited to 'engines/bladerunner/regions.cpp')
-rw-r--r--engines/bladerunner/regions.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/engines/bladerunner/regions.cpp b/engines/bladerunner/regions.cpp
index 55a1aa14aa..80dabf2989 100644
--- a/engines/bladerunner/regions.cpp
+++ b/engines/bladerunner/regions.cpp
@@ -26,14 +26,10 @@ namespace BladeRunner {
Regions::Regions() {
_enabled = true;
- _regions = new Region[10];
+ _regions.resize(10);
clear();
}
-Regions::~Regions() {
- delete[] _regions;
-}
-
void BladeRunner::Regions::clear() {
for (int i = 0; i < 10; ++i)
remove(i);
@@ -43,12 +39,12 @@ bool Regions::add(int index, Common::Rect rect, int type) {
if (index < 0 || index >= 10)
return false;
- if (_regions[index]._present)
+ if (_regions[index].present)
return false;
- _regions[index]._rectangle = rect;
- _regions[index]._type = type;
- _regions[index]._present = 1;
+ _regions[index].rectangle = rect;
+ _regions[index].type = type;
+ _regions[index].present = 1;
return true;
}
@@ -57,34 +53,34 @@ bool Regions::remove(int index) {
if (index < 0 || index >= 10)
return false;
- _regions[index]._rectangle = Common::Rect(-1, -1, -1, -1);
- _regions[index]._type = -1;
- _regions[index]._present = 0;
+ _regions[index].rectangle = Common::Rect(-1, -1, -1, -1);
+ _regions[index].type = -1;
+ _regions[index].present = 0;
return true;
}
-int Regions::getTypeAtXY(int x, int y) {
+int Regions::getTypeAtXY(int x, int y) const {
int index = getRegionAtXY(x, y);
if (index == -1)
return -1;
- return _regions[index]._type;
+ return _regions[index].type;
}
-int Regions::getRegionAtXY(int x, int y) {
+int Regions::getRegionAtXY(int x, int y) const {
if (!_enabled)
return -1;
for (int i = 0; i != 10; ++i) {
- if (!_regions[i]._present)
+ if (!_regions[i].present)
continue;
// Common::Rect::contains is exclusive of right and bottom but
// Blade Runner wants inclusive, so we adjust the edges.
// TODO: Roll our own rect class?
- Common::Rect r = _regions[i]._rectangle;
+ Common::Rect r = _regions[i].rectangle;
r.right++;
r.bottom++;