aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-22 22:55:54 +0200
committerEinar Johan Trøan Sømåen2012-07-22 22:55:54 +0200
commitf6a5a2a0d57d2e0829aa93ac0b30d3c0e1bf8838 (patch)
tree11fc0f9994c0e938027f767dc5e054bd42c921fd /engines
parent30ada3c13f63ef35ccdd21ca76fb45aa9fb1dc3c (diff)
downloadscummvm-rg350-f6a5a2a0d57d2e0829aa93ac0b30d3c0e1bf8838.tar.gz
scummvm-rg350-f6a5a2a0d57d2e0829aa93ac0b30d3c0e1bf8838.tar.bz2
scummvm-rg350-f6a5a2a0d57d2e0829aa93ac0b30d3c0e1bf8838.zip
WINTERMUTE: Wrap away base_script_holder's _filename field in getters/setters, avoiding direct writes.
Diffstat (limited to 'engines')
-rw-r--r--engines/wintermute/ad/ad_actor.cpp3
-rw-r--r--engines/wintermute/ad/ad_entity.cpp15
-rw-r--r--engines/wintermute/ad/ad_game.cpp5
-rw-r--r--engines/wintermute/ad/ad_inventory_box.cpp3
-rw-r--r--engines/wintermute/ad/ad_item.cpp15
-rw-r--r--engines/wintermute/ad/ad_layer.cpp3
-rw-r--r--engines/wintermute/ad/ad_node_state.cpp10
-rw-r--r--engines/wintermute/ad/ad_object.cpp2
-rw-r--r--engines/wintermute/ad/ad_region.cpp3
-rw-r--r--engines/wintermute/ad/ad_response_box.cpp15
-rw-r--r--engines/wintermute/ad/ad_rot_level.cpp3
-rw-r--r--engines/wintermute/ad/ad_scale_level.cpp3
-rw-r--r--engines/wintermute/ad/ad_scene.cpp12
-rw-r--r--engines/wintermute/ad/ad_sprite_set.cpp16
-rw-r--r--engines/wintermute/ad/ad_talk_def.cpp2
-rw-r--r--engines/wintermute/ad/ad_talk_holder.cpp16
-rw-r--r--engines/wintermute/ad/ad_waypoint_group.cpp3
-rw-r--r--engines/wintermute/base/base_game.cpp14
-rw-r--r--engines/wintermute/base/base_object.cpp4
-rw-r--r--engines/wintermute/base/base_region.cpp3
-rw-r--r--engines/wintermute/base/base_script_holder.cpp8
-rw-r--r--engines/wintermute/base/base_script_holder.h4
-rw-r--r--engines/wintermute/base/base_sprite.cpp6
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp3
-rw-r--r--engines/wintermute/base/font/base_font_storage.cpp4
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp3
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp5
-rw-r--r--engines/wintermute/ui/ui_button.cpp89
-rw-r--r--engines/wintermute/ui/ui_edit.cpp23
-rw-r--r--engines/wintermute/ui/ui_entity.cpp7
-rw-r--r--engines/wintermute/ui/ui_object.cpp4
-rw-r--r--engines/wintermute/ui/ui_text.cpp19
-rw-r--r--engines/wintermute/ui/ui_tiled_image.cpp3
-rw-r--r--engines/wintermute/ui/ui_window.cpp35
34 files changed, 171 insertions, 192 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index 1da28cd93d..c6a9b59420 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -132,8 +132,7 @@ bool AdActor::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ACTOR file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
index 06a551b252..df469b4321 100644
--- a/engines/wintermute/ad/ad_entity.cpp
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -93,8 +93,7 @@ bool AdEntity::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ENTITY file '%s'", filename);
@@ -914,8 +913,8 @@ bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
}
- if (_subtype == ENTITY_NORMAL && _sprite && _sprite->_filename)
- buffer->putTextIndent(indent + 2, "SPRITE=\"%s\"\n", _sprite->_filename);
+ if (_subtype == ENTITY_NORMAL && _sprite && _sprite->getFilename())
+ buffer->putTextIndent(indent + 2, "SPRITE=\"%s\"\n", _sprite->getFilename());
if (_subtype == ENTITY_SOUND && _sFX && _sFX->_soundFilename) {
buffer->putTextIndent(indent + 2, "SOUND=\"%s\"\n", _sFX->_soundFilename);
@@ -936,11 +935,11 @@ bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
if (_relativeScale != 0)
buffer->putTextIndent(indent + 2, "RELATIVE_SCALE = %d\n", (int)_relativeScale);
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
AdTalkHolder::saveAsText(buffer, indent + 2);
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp
index aa350b0e4c..8010a37864 100644
--- a/engines/wintermute/ad/ad_game.cpp
+++ b/engines/wintermute/ad/ad_game.cpp
@@ -251,7 +251,7 @@ bool AdGame::changeScene(const char *filename, bool fadeIn) {
_scene->applyEvent("SceneShutdown", true);
setPrevSceneName(_scene->_name);
- setPrevSceneFilename(_scene->_filename);
+ setPrevSceneFilename(_scene->getFilename());
if (!_tempDisableSaveState) _scene->saveState();
_tempDisableSaveState = false;
@@ -1112,8 +1112,7 @@ bool AdGame::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing GAME file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp
index f835dd22d4..d2bdcdde34 100644
--- a/engines/wintermute/ad/ad_inventory_box.cpp
+++ b/engines/wintermute/ad/ad_inventory_box.cpp
@@ -164,8 +164,7 @@ bool AdInventoryBox::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing INVENTORY_BOX file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
index 781b924513..0b85fdb9b3 100644
--- a/engines/wintermute/ad/ad_item.cpp
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -93,8 +93,7 @@ bool AdItem::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ITEM file '%s'", filename);
@@ -462,8 +461,8 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
else if (strcmp(name, "GetHoverSprite") == 0) {
stack->correctParams(0);
- if (!_spriteHover || !_spriteHover->_filename) stack->pushNULL();
- else stack->pushString(_spriteHover->_filename);
+ if (!_spriteHover || !_spriteHover->getFilename()) stack->pushNULL();
+ else stack->pushString(_spriteHover->getFilename());
return STATUS_OK;
}
@@ -504,8 +503,8 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
else if (strcmp(name, "GetNormalCursor") == 0) {
stack->correctParams(0);
- if (!_cursorNormal || !_cursorNormal->_filename) stack->pushNULL();
- else stack->pushString(_cursorNormal->_filename);
+ if (!_cursorNormal || !_cursorNormal->getFilename()) stack->pushNULL();
+ else stack->pushString(_cursorNormal->getFilename());
return STATUS_OK;
}
@@ -547,8 +546,8 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
else if (strcmp(name, "GetHoverCursor") == 0) {
stack->correctParams(0);
- if (!_cursorHover || !_cursorHover->_filename) stack->pushNULL();
- else stack->pushString(_cursorHover->_filename);
+ if (!_cursorHover || !_cursorHover->getFilename()) stack->pushNULL();
+ else stack->pushString(_cursorHover->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp
index 2cd7ac26ce..e59b5cde18 100644
--- a/engines/wintermute/ad/ad_layer.cpp
+++ b/engines/wintermute/ad/ad_layer.cpp
@@ -70,8 +70,7 @@ bool AdLayer::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing LAYER file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp
index 12bd275614..fca2600884 100644
--- a/engines/wintermute/ad/ad_node_state.cpp
+++ b/engines/wintermute/ad/ad_node_state.cpp
@@ -139,11 +139,11 @@ bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool s
for (int i = 0; i < 7; i++) {
if (entity->_caption[i]) setCaption(entity->_caption[i], i);
}
- if (!entity->_region && entity->_sprite && entity->_sprite->_filename) {
- if (includingSprites) setFilename(entity->_sprite->_filename);
+ if (!entity->_region && entity->_sprite && entity->_sprite->getFilename()) {
+ if (includingSprites) setFilename(entity->_sprite->getFilename());
else setFilename("");
}
- if (entity->_cursor && entity->_cursor->_filename) setCursor(entity->_cursor->_filename);
+ if (entity->_cursor && entity->_cursor->getFilename()) setCursor(entity->_cursor->getFilename());
_alphaColor = entity->_alphaColor;
_active = entity->_active;
} else {
@@ -151,11 +151,11 @@ bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool s
if (_caption[i]) entity->setCaption(_caption[i], i);
}
if (_filename && !entity->_region && includingSprites && strcmp(_filename, "") != 0) {
- if (!entity->_sprite || !entity->_sprite->_filename || scumm_stricmp(entity->_sprite->_filename, _filename) != 0)
+ if (!entity->_sprite || !entity->_sprite->getFilename() || scumm_stricmp(entity->_sprite->getFilename(), _filename) != 0)
entity->setSprite(_filename);
}
if (_cursor) {
- if (!entity->_cursor || !entity->_cursor->_filename || scumm_stricmp(entity->_cursor->_filename, _cursor) != 0)
+ if (!entity->_cursor || !entity->_cursor->getFilename() || scumm_stricmp(entity->_cursor->getFilename(), _cursor) != 0)
entity->setCursor(_cursor);
}
diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp
index 39593c482c..bac39f5ea6 100644
--- a/engines/wintermute/ad/ad_object.cpp
+++ b/engines/wintermute/ad/ad_object.cpp
@@ -339,7 +339,7 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFont") == 0) {
stack->correctParams(0);
- if (_font && _font->_filename) stack->pushString(_font->_filename);
+ if (_font && _font->getFilename()) stack->pushString(_font->getFilename());
else stack->pushNULL();
return STATUS_OK;
}
diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp
index 1bd6051bda..bac02f5dd6 100644
--- a/engines/wintermute/ad/ad_region.cpp
+++ b/engines/wintermute/ad/ad_region.cpp
@@ -63,8 +63,7 @@ bool AdRegion::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing REGION file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 5b7e441abc..212802ef3a 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -196,8 +196,7 @@ bool AdResponseBox::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing RESPONSE_BOX file '%s'", filename);
@@ -341,13 +340,13 @@ bool AdResponseBox::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "AREA { %d, %d, %d, %d }\n", _responseArea.left, _responseArea.top, _responseArea.right, _responseArea.bottom);
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontHover && _fontHover->_filename)
- buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontHover && _fontHover->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "HORIZONTAL=%s\n", _horizontal ? "TRUE" : "FALSE");
diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp
index e758eaa1f6..b9949d9f9b 100644
--- a/engines/wintermute/ad/ad_rot_level.cpp
+++ b/engines/wintermute/ad/ad_rot_level.cpp
@@ -62,8 +62,7 @@ bool AdRotLevel::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ROTATION_LEVEL file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp
index 65e0cc4663..539e9a8bb7 100644
--- a/engines/wintermute/ad/ad_scale_level.cpp
+++ b/engines/wintermute/ad/ad_scale_level.cpp
@@ -60,8 +60,7 @@ bool AdScaleLevel::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing SCALE_LEVEL file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
index 104fe6dd4d..958bf64ae5 100644
--- a/engines/wintermute/ad/ad_scene.cpp
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -509,15 +509,11 @@ bool AdScene::loadFile(const char *filename) {
bool ret;
- delete[] _filename;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing SCENE file '%s'", filename);
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
-
+ setFilename(filename);
delete [] buffer;
@@ -843,7 +839,7 @@ bool AdScene::loadBuffer(byte *buffer, bool complete) {
return STATUS_FAILED;
}
- if (_mainLayer == NULL) _gameRef->LOG(0, "Warning: scene '%s' has no main layer.", _filename);
+ if (_mainLayer == NULL) _gameRef->LOG(0, "Warning: scene '%s' has no main layer.", getFilename());
sortScaleLevels();
@@ -2480,7 +2476,7 @@ bool AdScene::persistState(bool saving) {
if (!_persistentState) return STATUS_OK;
AdGame *adGame = (AdGame *)_gameRef;
- AdSceneState *state = adGame->getSceneState(_filename, saving);
+ AdSceneState *state = adGame->getSceneState(getFilename(), saving);
if (!state) return STATUS_OK;
AdNodeState *nodeState;
diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp
index b594bd0467..34ea53481d 100644
--- a/engines/wintermute/ad/ad_sprite_set.cpp
+++ b/engines/wintermute/ad/ad_sprite_set.cpp
@@ -265,28 +265,28 @@ bool AdSpriteSet::saveAsText(BaseDynamicBuffer *buffer, int indent) {
if (_sprites[i]) {
switch (i) {
case DI_UP:
- buffer->putTextIndent(indent + 2, "UP=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "UP=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_UPRIGHT:
- buffer->putTextIndent(indent + 2, "UP_RIGHT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "UP_RIGHT=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_RIGHT:
- buffer->putTextIndent(indent + 2, "RIGHT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "RIGHT=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_DOWNRIGHT:
- buffer->putTextIndent(indent + 2, "DOWN_RIGHT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "DOWN_RIGHT=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_DOWN:
- buffer->putTextIndent(indent + 2, "DOWN=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "DOWN=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_DOWNLEFT:
- buffer->putTextIndent(indent + 2, "DOWN_LEFT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "DOWN_LEFT=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_LEFT:
- buffer->putTextIndent(indent + 2, "LEFT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "LEFT=\"%s\"\n", _sprites[i]->getFilename());
break;
case DI_UPLEFT:
- buffer->putTextIndent(indent + 2, "UP_LEFT=\"%s\"\n", _sprites[i]->_filename);
+ buffer->putTextIndent(indent + 2, "UP_LEFT=\"%s\"\n", _sprites[i]->getFilename());
break;
}
}
diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp
index 979e8b2698..2756b69467 100644
--- a/engines/wintermute/ad/ad_talk_def.cpp
+++ b/engines/wintermute/ad/ad_talk_def.cpp
@@ -78,7 +78,7 @@ bool AdTalkDef::loadFile(const char *filename) {
bool ret;
- BaseUtils::setString(&_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing TALK file '%s'", filename);
diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp
index bd48ac601c..17f7171cc3 100644
--- a/engines/wintermute/ad/ad_talk_holder.cpp
+++ b/engines/wintermute/ad/ad_talk_holder.cpp
@@ -159,8 +159,8 @@ bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS
else if (strcmp(name, "GetSprite") == 0) {
stack->correctParams(0);
- if (!_sprite || !_sprite->_filename) stack->pushNULL();
- else stack->pushString(_sprite->_filename);
+ if (!_sprite || !_sprite->getFilename()) stack->pushNULL();
+ else stack->pushString(_sprite->getFilename());
return STATUS_OK;
}
@@ -210,7 +210,7 @@ bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS
if (ex) {
for (int i = 0; i < _talkSpritesEx.getSize(); i++) {
- if (scumm_stricmp(_talkSpritesEx[i]->_filename, filename) == 0) {
+ if (scumm_stricmp(_talkSpritesEx[i]->getFilename(), filename) == 0) {
if (_currentSprite == _talkSpritesEx[i])
setCurrent = true;
if (_tempSprite2 == _talkSpritesEx[i])
@@ -222,7 +222,7 @@ bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS
}
} else {
for (int i = 0; i < _talkSprites.getSize(); i++) {
- if (scumm_stricmp(_talkSprites[i]->_filename, filename) == 0) {
+ if (scumm_stricmp(_talkSprites[i]->getFilename(), filename) == 0) {
if (_currentSprite == _talkSprites[i])
setCurrent = true;
if (_tempSprite2 == _talkSprites[i])
@@ -339,13 +339,13 @@ const char *AdTalkHolder::scToString() {
//////////////////////////////////////////////////////////////////////////
bool AdTalkHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) {
for (int i = 0; i < _talkSprites.getSize(); i++) {
- if (_talkSprites[i]->_filename)
- buffer->putTextIndent(indent + 2, "TALK=\"%s\"\n", _talkSprites[i]->_filename);
+ if (_talkSprites[i]->getFilename())
+ buffer->putTextIndent(indent + 2, "TALK=\"%s\"\n", _talkSprites[i]->getFilename());
}
for (int i = 0; i < _talkSpritesEx.getSize(); i++) {
- if (_talkSpritesEx[i]->_filename)
- buffer->putTextIndent(indent + 2, "TALK_SPECIAL=\"%s\"\n", _talkSpritesEx[i]->_filename);
+ if (_talkSpritesEx[i]->getFilename())
+ buffer->putTextIndent(indent + 2, "TALK_SPECIAL=\"%s\"\n", _talkSpritesEx[i]->getFilename());
}
return STATUS_OK;
diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp
index 25e5345ee7..4a8ab966e8 100644
--- a/engines/wintermute/ad/ad_waypoint_group.cpp
+++ b/engines/wintermute/ad/ad_waypoint_group.cpp
@@ -73,8 +73,7 @@ bool AdWaypointGroup::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing WAYPOINTS file '%s'", filename);
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 0adc938895..da2c01a17f 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -396,9 +396,8 @@ bool BaseGame::cleanup() {
_viewportSP = -1;
delete[] _name;
- delete[] _filename;
_name = NULL;
- _filename = NULL;
+ setFilename(NULL);
for (int i = 0; i < 7; i++) {
delete[] _caption[i];
_caption[i] = NULL;
@@ -679,8 +678,7 @@ bool BaseGame::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing GAME file '%s'", filename);
@@ -1662,8 +1660,8 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetActiveCursor") == 0) {
stack->correctParams(0);
- if (!_activeCursor || !_activeCursor->_filename) stack->pushNULL();
- else stack->pushString(_activeCursor->_filename);
+ if (!_activeCursor || !_activeCursor->getFilename()) stack->pushNULL();
+ else stack->pushString(_activeCursor->getFilename());
return STATUS_OK;
}
@@ -1938,8 +1936,8 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetWaitCursor") == 0) {
stack->correctParams(0);
- if (!_cursorNoninteractive || !_cursorNoninteractive->_filename) stack->pushNULL();
- else stack->pushString(_cursorNoninteractive->_filename);
+ if (!_cursorNoninteractive || !_cursorNoninteractive->getFilename()) stack->pushNULL();
+ else stack->pushString(_cursorNoninteractive->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
index 4ab121ded9..2002f01dc8 100644
--- a/engines/wintermute/base/base_object.cpp
+++ b/engines/wintermute/base/base_object.cpp
@@ -227,8 +227,8 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetCursor") == 0) {
stack->correctParams(0);
- if (!_cursor || !_cursor->_filename) stack->pushNULL();
- else stack->pushString(_cursor->_filename);
+ if (!_cursor || !_cursor->getFilename()) stack->pushNULL();
+ else stack->pushString(_cursor->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
index e336b92789..95fa163550 100644
--- a/engines/wintermute/base/base_region.cpp
+++ b/engines/wintermute/base/base_region.cpp
@@ -104,8 +104,7 @@ bool BaseRegion::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing REGION file '%s'", filename);
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
index f803a9191f..4235353c1e 100644
--- a/engines/wintermute/base/base_script_holder.cpp
+++ b/engines/wintermute/base/base_script_holder.cpp
@@ -72,8 +72,12 @@ bool BaseScriptHolder::cleanup() {
//////////////////////////////////////////////////////////////////////
void BaseScriptHolder::setFilename(const char *filename) {
- if (_filename != NULL) delete [] _filename;
-
+ if (_filename != NULL) {
+ delete [] _filename;
+ _filename = NULL;
+ }
+ if (filename == NULL)
+ return;
_filename = new char [strlen(filename) + 1];
if (_filename != NULL) strcpy(_filename, filename);
}
diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h
index 52711572c1..ef1c389dcb 100644
--- a/engines/wintermute/base/base_script_holder.h
+++ b/engines/wintermute/base/base_script_holder.h
@@ -52,8 +52,8 @@ public:
virtual bool listen(BaseScriptHolder *param1, uint32 param2);
bool applyEvent(const char *eventName, bool unbreakable = false);
void setFilename(const char *filename);
+ const char *getFilename() { return _filename; }
bool parseProperty(byte *buffer, bool complete = true);
- char *_filename;
bool _freezable;
bool _ready;
@@ -65,6 +65,8 @@ public:
virtual const char *scToString();
virtual void scDebuggerDesc(char *buf, int bufSize);
// IWmeObject
+private:
+ char *_filename;
public:
virtual bool sendEvent(const char *eventName);
};
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index 046a40bacf..f44e3d4024 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -66,7 +66,7 @@ void BaseSprite::setDefaults() {
_currentFrame = -1;
_looping = false;
_lastFrameTime = 0;
- _filename = NULL;
+ setFilename(NULL);
_finished = false;
_changed = false;
_paused = false;
@@ -160,9 +160,7 @@ bool BaseSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType c
}
}
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
-
+ setFilename(filename);
return ret;
}
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
index cb3468c4f3..9a3caf2669 100644
--- a/engines/wintermute/base/font/base_font_bitmap.cpp
+++ b/engines/wintermute/base/font/base_font_bitmap.cpp
@@ -252,8 +252,7 @@ bool BaseFontBitmap::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer))) _gameRef->LOG(0, "Error parsing FONT file '%s'", filename);
diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp
index 220a16e14f..9adc62c829 100644
--- a/engines/wintermute/base/font/base_font_storage.cpp
+++ b/engines/wintermute/base/font/base_font_storage.cpp
@@ -53,7 +53,7 @@ BaseFontStorage::~BaseFontStorage() {
//////////////////////////////////////////////////////////////////////////
bool BaseFontStorage::cleanup(bool warn) {
for (int i = 0; i < _fonts.getSize(); i++) {
- if (warn) _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->_filename);
+ if (warn) _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->getFilename());
delete _fonts[i];
}
_fonts.removeAll();
@@ -74,7 +74,7 @@ BaseFont *BaseFontStorage::addFont(const char *filename) {
if (!filename) return NULL;
for (int i = 0; i < _fonts.getSize(); i++) {
- if (scumm_stricmp(_fonts[i]->_filename, filename) == 0) {
+ if (scumm_stricmp(_fonts[i]->getFilename(), filename) == 0) {
_fonts[i]->_refCount++;
return _fonts[i];
}
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index bcf8621a40..9782d1d7db 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -416,8 +416,7 @@ bool BaseFontTT::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer))) _gameRef->LOG(0, "Error parsing TTFONT file '%s'", filename);
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
index 93b9f3659d..e36cec6f47 100644
--- a/engines/wintermute/base/particles/part_particle.cpp
+++ b/engines/wintermute/base/particles/part_particle.cpp
@@ -73,7 +73,7 @@ PartParticle::~PartParticle(void) {
//////////////////////////////////////////////////////////////////////////
bool PartParticle::setSprite(const char *filename) {
- if (_sprite && _sprite->_filename && scumm_stricmp(filename, _sprite->_filename) == 0) {
+ if (_sprite && _sprite->getFilename() && scumm_stricmp(filename, _sprite->getFilename()) == 0) {
_sprite->reset();
return STATUS_OK;
}
@@ -240,7 +240,8 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_fadeStartAlpha));
if (persistMgr->_saving) {
- persistMgr->transfer(TMEMBER(_sprite->_filename));
+ const char *filename = _sprite->getFilename();
+ persistMgr->transfer(TMEMBER(filename));
} else {
char *filename;
persistMgr->transfer(TMEMBER(filename));
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index af7e3262db..bb7d4d530d 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -104,8 +104,7 @@ bool UIButton::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing BUTTON file '%s'", filename);
@@ -448,41 +447,41 @@ bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
- if (_backHover && _backHover->_filename)
- buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->_filename);
- if (_backPress && _backPress->_filename)
- buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->_filename);
- if (_backDisable && _backDisable->_filename)
- buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->_filename);
- if (_backFocus && _backFocus->_filename)
- buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->_filename);
-
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
- if (_imageHover && _imageHover->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->_filename);
- if (_imagePress && _imagePress->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->_filename);
- if (_imageDisable && _imageDisable->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->_filename);
- if (_imageFocus && _imageFocus->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->_filename);
-
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontHover && _fontHover->_filename)
- buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->_filename);
- if (_fontPress && _fontPress->_filename)
- buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->_filename);
- if (_fontDisable && _fontDisable->_filename)
- buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->_filename);
- if (_fontFocus && _fontFocus->_filename)
- buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->_filename);
-
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ if (_backHover && _backHover->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_HOVER=\"%s\"\n", _backHover->getFilename());
+ if (_backPress && _backPress->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_PRESS=\"%s\"\n", _backPress->getFilename());
+ if (_backDisable && _backDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_DISABLE=\"%s\"\n", _backDisable->getFilename());
+ if (_backFocus && _backFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_FOCUS=\"%s\"\n", _backFocus->getFilename());
+
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ if (_imageHover && _imageHover->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_HOVER=\"%s\"\n", _imageHover->getFilename());
+ if (_imagePress && _imagePress->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_PRESS=\"%s\"\n", _imagePress->getFilename());
+ if (_imageDisable && _imageDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_DISABLE=\"%s\"\n", _imageDisable->getFilename());
+ if (_imageFocus && _imageFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_FOCUS=\"%s\"\n", _imageFocus->getFilename());
+
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontHover && _fontHover->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_HOVER=\"%s\"\n", _fontHover->getFilename());
+ if (_fontPress && _fontPress->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_PRESS=\"%s\"\n", _fontPress->getFilename());
+ if (_fontDisable && _fontDisable->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_DISABLE=\"%s\"\n", _fontDisable->getFilename());
+ if (_fontFocus && _fontFocus->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_FOCUS=\"%s\"\n", _fontFocus->getFilename());
+
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
@@ -762,8 +761,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDisabledImage") == 0) {
stack->correctParams(0);
- if (!_imageDisable || !_imageDisable->_filename) stack->pushNULL();
- else stack->pushString(_imageDisable->_filename);
+ if (!_imageDisable || !_imageDisable->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageDisable->getFilename());
return STATUS_OK;
}
@@ -803,8 +802,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHoverImage") == 0) {
stack->correctParams(0);
- if (!_imageHover || !_imageHover->_filename) stack->pushNULL();
- else stack->pushString(_imageHover->_filename);
+ if (!_imageHover || !_imageHover->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageHover->getFilename());
return STATUS_OK;
}
@@ -843,8 +842,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPressedImage") == 0) {
stack->correctParams(0);
- if (!_imagePress || !_imagePress->_filename) stack->pushNULL();
- else stack->pushString(_imagePress->_filename);
+ if (!_imagePress || !_imagePress->getFilename()) stack->pushNULL();
+ else stack->pushString(_imagePress->getFilename());
return STATUS_OK;
}
@@ -883,8 +882,8 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFocusedImage") == 0) {
stack->correctParams(0);
- if (!_imageFocus || !_imageFocus->_filename) stack->pushNULL();
- else stack->pushString(_imageFocus->_filename);
+ if (!_imageFocus || !_imageFocus->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageFocus->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp
index d9c6c6586a..b2e7b29284 100644
--- a/engines/wintermute/ui/ui_edit.cpp
+++ b/engines/wintermute/ui/ui_edit.cpp
@@ -100,8 +100,7 @@ bool UIEdit::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing EDIT file '%s'", filename);
@@ -308,19 +307,19 @@ bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontSelected && _fontSelected->_filename)
- buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontSelected && _fontSelected->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_SELECTED=\"%s\"\n", _fontSelected->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp
index acbcd2430f..a67ba6b29f 100644
--- a/engines/wintermute/ui/ui_entity.cpp
+++ b/engines/wintermute/ui/ui_entity.cpp
@@ -64,8 +64,7 @@ bool UIEntity::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing ENTITY container file '%s'", filename);
@@ -188,8 +187,8 @@ bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "DISABLED=%s\n", _disable ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
- if (_entity && _entity->_filename)
- buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->_filename);
+ if (_entity && _entity->getFilename())
+ buffer->putTextIndent(indent + 2, "ENTITY=\"%s\"\n", _entity->getFilename());
buffer->putTextIndent(indent + 2, "\n");
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 20fd6c363f..416ad1e114 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -187,8 +187,8 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetImage") == 0) {
stack->correctParams(0);
- if (!_image || !_image->_filename) stack->pushNULL();
- else stack->pushString(_image->_filename);
+ if (!_image || !_image->getFilename()) stack->pushNULL();
+ else stack->pushString(_image->getFilename());
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp
index fdf7f6287f..62ef968552 100644
--- a/engines/wintermute/ui/ui_text.cpp
+++ b/engines/wintermute/ui/ui_text.cpp
@@ -104,8 +104,7 @@ bool UIText::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing STATIC file '%s'", filename);
@@ -302,17 +301,17 @@ bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
if (_text)
buffer->putTextIndent(indent + 2, "TEXT=\"%s\"\n", _text);
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp
index fec30f46e9..6ee27bb411 100644
--- a/engines/wintermute/ui/ui_tiled_image.cpp
+++ b/engines/wintermute/ui/ui_tiled_image.cpp
@@ -128,8 +128,7 @@ bool UITiledImage::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index 0fedfdc87a..5a1caa9fd4 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -216,8 +216,7 @@ bool UIWindow::loadFile(const char *filename) {
bool ret;
- _filename = new char [strlen(filename) + 1];
- strcpy(_filename, filename);
+ setFilename(filename);
if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing WINDOW file '%s'", filename);
@@ -584,23 +583,23 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
- if (_back && _back->_filename)
- buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->_filename);
- if (_backInactive && _backInactive->_filename)
- buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->_filename);
+ if (_back && _back->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK=\"%s\"\n", _back->getFilename());
+ if (_backInactive && _backInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "BACK_INACTIVE=\"%s\"\n", _backInactive->getFilename());
- if (_image && _image->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_filename);
- if (_imageInactive && _imageInactive->_filename)
- buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->_filename);
+ if (_image && _image->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getFilename());
+ if (_imageInactive && _imageInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "IMAGE_INACTIVE=\"%s\"\n", _imageInactive->getFilename());
- if (_font && _font->_filename)
- buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->_filename);
- if (_fontInactive && _fontInactive->_filename)
- buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->_filename);
+ if (_font && _font->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT=\"%s\"\n", _font->getFilename());
+ if (_fontInactive && _fontInactive->getFilename())
+ buffer->putTextIndent(indent + 2, "FONT_INACTIVE=\"%s\"\n", _fontInactive->getFilename());
- if (_cursor && _cursor->_filename)
- buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename);
+ if (_cursor && _cursor->getFilename())
+ buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->getFilename());
buffer->putTextIndent(indent + 2, "\n");
@@ -758,8 +757,8 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInactiveImage") == 0) {
stack->correctParams(0);
- if (!_imageInactive || !_imageInactive->_filename) stack->pushNULL();
- else stack->pushString(_imageInactive->_filename);
+ if (!_imageInactive || !_imageInactive->getFilename()) stack->pushNULL();
+ else stack->pushString(_imageInactive->getFilename());
return STATUS_OK;
}