From d1a48b9d6f43fb5a69eb474dc509c3dcd49253b1 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 22 Jun 2019 22:19:41 +0530 Subject: [PATCH] HDB: Fix CineCommand string and title values --- engines/hdb/ai-cinematic.cpp | 12 ++++++------ engines/hdb/ai.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/hdb/ai-cinematic.cpp b/engines/hdb/ai-cinematic.cpp index 46754e17d57..819b9e2c5b3 100644 --- a/engines/hdb/ai-cinematic.cpp +++ b/engines/hdb/ai-cinematic.cpp @@ -210,14 +210,14 @@ void AI::processCines() { } case C_USEENTITY: for (Common::Array::iterator it = _ents->begin(); it != _ents->end(); it++) { - if (Common::matchString((*it)->entityName, _cine[i]->string)) { + if ((*it)->entityName && Common::matchString((*it)->entityName, _cine[i]->string)) { g_hdb->useEntity((*it)); } } warning("STUB: PROCESSCINES: USEENTITY: CheckActionList required;"); #if 0 for (int i = 0;i < kMaxAutoActions;i++) { - if (Common::matchString(_autoActions[i].entityName, _cine[i]->string) && !_autoActions[i].activated) + if (_autoActions[i].entityName && Common::matchString(_autoActions[i].entityName, _cine[i]->string) && !_autoActions[i].activated) checkAutoList(&_dummyPlayer, _autoActions[i].x, _autoActions[i].y); } #endif @@ -335,7 +335,7 @@ void AI::cineWaitUntilDone() { void AI::cineSetEntity(const char *entName, int x, int y, int level) { CineCommand *cmd = new CineCommand; - cmd->string = entName; + strcpy(cmd->string, entName); cmd->x = x * kTileWidth; cmd->y = y * kTileHeight; cmd->x2 = level; @@ -350,14 +350,14 @@ void AI::cineMoveEntity(const char *entName, int x, int y, int level, int speed) cmd->x2 = level; cmd->start = 0; cmd->speed = speed; - cmd->title = entName; + strcpy(cmd->title, entName); cmd->cmdType = C_MOVEENTITY; _cine.push_back(cmd); } void AI::cineEntityFace(const char *luaName, double dir) { CineCommand *cmd = new CineCommand; - cmd->title = luaName; + strcpy(cmd->title, luaName); cmd->x = dir; cmd->cmdType = C_ENTITYFACE; _cine.push_back(cmd); @@ -365,7 +365,7 @@ void AI::cineEntityFace(const char *luaName, double dir) { void AI::cineUse(const char *entName) { CineCommand *cmd = new CineCommand; - cmd->string = entName; + strcpy(cmd->string, entName); cmd->cmdType = C_USEENTITY; _cine.push_back(cmd); } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 2a1206107e0..012ed912826 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -590,13 +590,13 @@ struct CineCommand { int start, end; uint32 delay; int speed; - const char *title; - const char *string; + char title[32]; + char string[32]; char *id; AIEntity *e; CineCommand() : cmdType(C_NO_COMMAND), x(0.0), y(0.0), x2(0.0), y2(0.0), xv(0.0), yv(0.0), - start(0), end(0), delay(0), speed(0), title(NULL), string(NULL), id(NULL), e(NULL) {} + start(0), end(0), delay(0), speed(0), title(""), string(""), id(NULL), e(NULL) {} }; #define onEvenTile(x, y) ( !(x & 31) && !(y & 31) )