diff options
author | Einar Johan Trøan Sømåen | 2013-04-17 21:43:35 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2013-04-18 10:13:02 +0200 |
commit | d926b47186813faed167ed7b82f879b54ff2ee3e (patch) | |
tree | 7534e96dcfcd35957523315da1d50b3de74812b7 /engines/wintermute/ad/ad_game.cpp | |
parent | e4ec07a6a1e6ad9f5f72912332ec47742b832f7f (diff) | |
download | scummvm-rg350-d926b47186813faed167ed7b82f879b54ff2ee3e.tar.gz scummvm-rg350-d926b47186813faed167ed7b82f879b54ff2ee3e.tar.bz2 scummvm-rg350-d926b47186813faed167ed7b82f879b54ff2ee3e.zip |
WINTERMUTE: Constify AdResponse/AdResponseBox/AdResponseContext.
Diffstat (limited to 'engines/wintermute/ad/ad_game.cpp')
-rw-r--r-- | engines/wintermute/ad/ad_game.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index 6042bda060..fac59dc473 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -519,9 +519,14 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, if (_responseBox) { AdResponse *res = new AdResponse(_gameRef); if (res) { - res->_iD = id; - res->setText(text); - expandStringByStringTable(&res->_text); + res->setID(id); + + char *expandedText = new char[strlen(text) + 1]; + Common::strlcpy(expandedText, text, strlen(text) + 1); + expandStringByStringTable(&expandedText); + res->setText(expandedText); + delete[] expandedText; + if (!val1->isNULL()) { res->setIcon(val1->getString()); } @@ -1742,7 +1747,7 @@ bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const ////////////////////////////////////////////////////////////////////////// bool AdGame::clearBranchResponses(char *name) { for (uint32 i = 0; i < _responsesBranch.size(); i++) { - if (scumm_stricmp(name, _responsesBranch[i]->_context) == 0) { + if (scumm_stricmp(name, _responsesBranch[i]->getContext()) == 0) { delete _responsesBranch[i]; _responsesBranch.remove_at(i); i--; @@ -1770,7 +1775,7 @@ bool AdGame::branchResponseUsed(int id) const { char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr; for (uint32 i = 0; i < _responsesBranch.size(); i++) { if (_responsesBranch[i]->_id == id) { - if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { + if ((context == nullptr && _responsesBranch[i]->getContext() == nullptr) || scumm_stricmp(context, _responsesBranch[i]->getContext()) == 0) { return true; } } @@ -1796,9 +1801,9 @@ bool AdGame::addGameResponse(int id) { bool AdGame::gameResponseUsed(int id) const { char *context = _dlgPendingBranches.size() > 0 ? _dlgPendingBranches[_dlgPendingBranches.size() - 1] : nullptr; for (uint32 i = 0; i < _responsesGame.size(); i++) { - AdResponseContext *respContext = _responsesGame[i]; + const AdResponseContext *respContext = _responsesGame[i]; if (respContext->_id == id) { - if ((context == nullptr && respContext->_context == nullptr) || ((context != nullptr && respContext->_context != nullptr) && scumm_stricmp(context, respContext->_context) == 0)) { + if ((context == nullptr && respContext->getContext() == nullptr) || ((context != nullptr && respContext->getContext() != nullptr) && scumm_stricmp(context, respContext->getContext()) == 0)) { return true; } } @@ -1813,7 +1818,7 @@ bool AdGame::resetResponse(int id) { for (uint32 i = 0; i < _responsesGame.size(); i++) { if (_responsesGame[i]->_id == id) { - if ((context == nullptr && _responsesGame[i]->_context == nullptr) || scumm_stricmp(context, _responsesGame[i]->_context) == 0) { + if ((context == nullptr && _responsesGame[i]->getContext() == nullptr) || scumm_stricmp(context, _responsesGame[i]->getContext()) == 0) { delete _responsesGame[i]; _responsesGame.remove_at(i); break; @@ -1823,7 +1828,7 @@ bool AdGame::resetResponse(int id) { for (uint32 i = 0; i < _responsesBranch.size(); i++) { if (_responsesBranch[i]->_id == id) { - if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || scumm_stricmp(context, _responsesBranch[i]->_context) == 0) { + if ((context == nullptr && _responsesBranch[i]->getContext() == nullptr) || scumm_stricmp(context, _responsesBranch[i]->getContext()) == 0) { delete _responsesBranch[i]; _responsesBranch.remove_at(i); break; |