FULLPIPE: Change _objCommandName and _queueName to Common::String

This commit is contained in:
Filippos Karapetis 2016-12-20 02:17:58 +02:00
parent 8a16f9d785
commit b4514bfe92
4 changed files with 6 additions and 13 deletions

View File

@ -519,7 +519,7 @@ int global_messageHandler3(ExCommand *cmd) {
if (cmd->_objtype == kObjTypeObjstateCommand) {
ObjstateCommand *c = (ObjstateCommand *)cmd;
result = 1;
g_fp->setObjectState(c->_objCommandName, c->_value);
g_fp->setObjectState(c->_objCommandName.c_str(), c->_value);
}
return result;
default:

View File

@ -232,20 +232,17 @@ Message::Message(int16 parentId, int messageKind, int x, int y, int a6, int a7,
ObjstateCommand::ObjstateCommand() {
_value = 0;
_objCommandName = 0;
_objtype = kObjTypeObjstateCommand;
}
ObjstateCommand::ObjstateCommand(ObjstateCommand *src) : ExCommand(src) {
_value = src->_value;
_objCommandName = (char *)calloc(strlen(src->_objCommandName) + 1, 1);
_objtype = kObjTypeObjstateCommand;
strncpy(_objCommandName, src->_objCommandName, strlen(src->_objCommandName));
_objCommandName = src->_objCommandName;
}
ObjstateCommand::~ObjstateCommand() {
free(_objCommandName);
}
bool ObjstateCommand::load(MfcArchive &file) {
@ -273,7 +270,6 @@ MessageQueue::MessageQueue() {
_id = 0;
_isFinished = 0;
_flags = 0;
_queueName = 0;
_counter = 0;
_field_38 = 0;
_flag1 = 0;
@ -286,7 +282,6 @@ MessageQueue::MessageQueue(int dataId) {
_id = g_fp->_globalMessageQueueList->compact();
_isFinished = 0;
_flags = 0;
_queueName = 0;
_counter = 0;
_field_38 = 0;
_flag1 = 0;
@ -312,7 +307,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
_id = g_fp->_globalMessageQueueList->compact();
_dataId = src->_dataId;
_flags = src->_flags;
_queueName = 0;
_queueName = "";
g_fp->_globalMessageQueueList->addMessageQueue(this);
@ -338,8 +333,6 @@ MessageQueue::~MessageQueue() {
}
finish();
free(_queueName);
}
bool MessageQueue::load(MfcArchive &file) {

View File

@ -94,7 +94,7 @@ class ExCommand2 : public ExCommand {
class ObjstateCommand : public ExCommand {
public:
char *_objCommandName;
Common::String _objCommandName;
int _value;
public:
@ -111,7 +111,7 @@ class MessageQueue : public CObject {
public:
int _id;
int _flags;
char *_queueName;
Common::String _queueName;
int16 _dataId;
CObject *_field_14;
int _counter;

View File

@ -400,7 +400,7 @@ MessageQueue *Scene::getMessageQueueById(int messageId) {
MessageQueue *Scene::getMessageQueueByName(char *name) {
for (uint i = 0; i < _messageQueueList.size(); i++)
if (!strcmp(_messageQueueList[i]->_queueName, name))
if (!strcmp(_messageQueueList[i]->_queueName.c_str(), name))
return _messageQueueList[i];
return 0;