aboutsummaryrefslogtreecommitdiff
path: root/engines/toon
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toon')
-rw-r--r--engines/toon/audio.cpp1
-rw-r--r--engines/toon/character.cpp1
-rw-r--r--engines/toon/detection.cpp7
-rw-r--r--engines/toon/drew.cpp1
-rw-r--r--engines/toon/hotspot.cpp1
-rw-r--r--engines/toon/path.cpp29
-rw-r--r--engines/toon/script.cpp1
-rw-r--r--engines/toon/script.h1
8 files changed, 19 insertions, 23 deletions
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 0bf3316209..4a4a84e62c 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -613,4 +613,3 @@ void AudioManager::updateAmbientSFX()
}
} // End of namespace Toon
-
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 022214157a..7d9a31c170 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -1109,4 +1109,3 @@ void Character::updateIdle() {
}
}
} // End of namespace Toon
-
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index 810a37720a..ac4caae8b2 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -224,12 +224,7 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s
SaveStateDescriptor desc(slot, saveName);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*file, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp
index 89438fb35c..df5cfcfa03 100644
--- a/engines/toon/drew.cpp
+++ b/engines/toon/drew.cpp
@@ -129,4 +129,3 @@ void CharacterDrew::resetScale()
setPosition(_x, _y);
}
} // End of namespace Toon
-
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 62458ad800..ee81b87417 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -149,4 +149,3 @@ HotspotData *Hotspots::Get(int32 id) {
}
} // End of namespace Toon
-
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index 785b84a78e..60ca007930 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -33,15 +33,15 @@ PathFindingHeap::PathFindingHeap() {
}
PathFindingHeap::~PathFindingHeap() {
- delete[] _data;
+ free(_data);
}
void PathFindingHeap::init(int32 size) {
debugC(1, kDebugPath, "init(%d)", size);
_size = size;
- delete[] _data;
- _data = new HeapDataGrid[_size];
+ free(_data);
+ _data = (HeapDataGrid *)malloc(sizeof(HeapDataGrid) * _size);
memset(_data, 0, sizeof(HeapDataGrid) * _size);
_count = 0;
}
@@ -49,7 +49,7 @@ void PathFindingHeap::init(int32 size) {
void PathFindingHeap::unload() {
_count = 0;
_size = 0;
- delete[] _data;
+ free(_data);
_data = NULL;
}
@@ -64,8 +64,19 @@ void PathFindingHeap::push(int32 x, int32 y, int32 weight) {
debugC(2, kDebugPath, "push(%d, %d, %d)", x, y, weight);
if (_count == _size) {
- warning("Aborting attempt to push onto PathFindingHeap at maximum size: %d", _count);
- return;
+ // Increase size by 50%
+ int newSize = _size + (_size >> 1) + 1;
+ HeapDataGrid *newData;
+
+ newData = (HeapDataGrid *)realloc(_data, sizeof(HeapDataGrid) * newSize);
+ if (newData == NULL) {
+ warning("Aborting attempt to push onto PathFindingHeap at maximum size: %d", _count);
+ return;
+ }
+
+ memset(newData + _size, 0, sizeof(HeapDataGrid) * (newSize - _size));
+ _data = newData;
+ _size = newSize;
}
_data[_count]._x = x;
@@ -427,11 +438,7 @@ void PathFinding::init(Picture *mask) {
_height = mask->getHeight();
_currentMask = mask;
_heap->unload();
- // In order to reduce memory fragmentation on small devices, we use the maximum
- // possible size here which is TOON_BACKBUFFER_WIDTH. Even though this is
- // 1280 as opposed to the possible 640, it actually helps memory allocation on
- // those devices.
- _heap->init(TOON_BACKBUFFER_WIDTH * _height); // should really be _width
+ _heap->init(500);
delete[] _gridTemp;
_gridTemp = new int32[_width*_height];
}
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index eed781295a..69ae727bb5 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -502,4 +502,3 @@ void EMCInterpreter::loadState(EMCState *script, Common::ReadStream *stream) {
}
} // End of namespace Toon
-
diff --git a/engines/toon/script.h b/engines/toon/script.h
index 9dd00dca80..8ef085f383 100644
--- a/engines/toon/script.h
+++ b/engines/toon/script.h
@@ -148,4 +148,3 @@ private:
} // End of namespace Toon
#endif
-