TITANIC: Fields renaming

This commit is contained in:
Paul Gilbert 2016-05-20 07:12:32 -04:00
parent bb459dd5a8
commit 378c96736a
8 changed files with 43 additions and 12 deletions

View File

@ -51,7 +51,6 @@ class CScriptHandler {
private:
CTitleEngine *_owner;
TTscriptBase *_script;
TTvocab *_vocab;
CExeResources &_resources;
int _field10;
CScriptHandlerSub1 _sub1;
@ -62,6 +61,8 @@ private:
int _field28;
int _field2C;
int _field30;
public:
TTvocab *_vocab;
public:
CScriptHandler(CTitleEngine *owner, int val1, int val2);
~CScriptHandler();

View File

@ -478,8 +478,15 @@ int TTparser::findFrames(TTsentence *sentence) {
if (wordString.empty())
break;
//TTword *word = nullptr;
//_owner->_vocab.fn1(wordString, &word);
TTword *srcWord = nullptr;
TTword *word = _owner->_vocab->getWord(wordString, &word);
sentence->storeVocabHit(srcWord);
if (word) {
// TODO
} else {
}
}

View File

@ -87,7 +87,7 @@ void TTsentence::copyFrom(const TTsentence &src) {
// Source has processed nodes, so duplicate them
for (TTsentenceNode *node = src._nodesP; node;
node = static_cast<TTsentenceNode *>(node->_nextP)) {
TTsentenceNode *newNode = new TTsentenceNode(node->_val);
TTsentenceNode *newNode = new TTsentenceNode(node->_wordP);
if (_nodesP)
_nodesP->addNode(newNode);
else
@ -96,4 +96,18 @@ void TTsentence::copyFrom(const TTsentence &src) {
}
}
int TTsentence::storeVocabHit(TTword *word) {
if (!word)
return 0;
TTsentenceNode *node = new TTsentenceNode(word);
if (_nodesP) {
_nodesP->addNode(node);
} else {
_nodesP = node;
}
return 0;
}
} // End of namespace Titanic

View File

@ -31,6 +31,7 @@
namespace Titanic {
class CScriptHandler;
class TTword;
class TTsentenceSubBase {
public:
@ -89,6 +90,13 @@ public:
void set38(int v) { _field38 = v; }
int getStatus() const { return _status; }
/**
* Adds a found vocab word to the list of words representing
* the player's input
* @param word Word to node
*/
int storeVocabHit(TTword *word);
};
} // End of namespace Titanic

View File

@ -25,10 +25,10 @@
namespace Titanic {
TTsentenceNode::TTsentenceNode() : TTnode(), _val(0) {
TTsentenceNode::TTsentenceNode() : TTnode(), _wordP(nullptr) {
}
TTsentenceNode::TTsentenceNode(int val) : TTnode(), _val(val) {
TTsentenceNode::TTsentenceNode(TTword *word) : TTnode(), _wordP(word) {
}
} // End of namespace Titanic

View File

@ -24,15 +24,16 @@
#define TITANIC_TT_SENTENCE_NODE_H
#include "titanic/true_talk/tt_node.h"
#include "titanic/true_talk/tt_word.h"
namespace Titanic {
class TTsentenceNode : public TTnode {
public:
int _val;
TTword *_wordP;
public:
TTsentenceNode();
TTsentenceNode(int val);
TTsentenceNode(TTword *word);
};
} // End of namespace Titanic

View File

@ -27,7 +27,7 @@
namespace Titanic {
TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str),
_wordMode(mode), _field1C(val2), _field20(0), _field24(0),
_wordMode(mode), _field1C(val2), _tag(0), _field24(0),
_field28(0), _synP(nullptr), _nextP(nullptr) {
_status = str.getStatus() == SS_VALID ? SS_VALID : SS_5;
}
@ -41,7 +41,7 @@ TTword::TTword(TTword *src) {
_string = src->_string;
_wordMode = src->_wordMode;
_field1C = src->_field1C;
_field20 = src->_field20;
_tag = src->_tag;
_synP = nullptr;
TTsynonym *priorSyn = nullptr;
@ -140,7 +140,7 @@ int TTword::load(SimpleFile *file, WordMode mode) {
if (file->scanf("%d %s %s", &val, &str1, &str2)) {
_string = str1;
_field1C = val;
_field20 = readNumber(str2.c_str());
_tag = readNumber(str2.c_str());
_wordMode = mode;
return 0;
} else {

View File

@ -37,7 +37,6 @@ enum WordMode {
class TTword {
protected:
TTstringStatus _status;
int _field20;
int _field24;
int _field28;
protected:
@ -54,6 +53,7 @@ public:
TTstring _string;
WordMode _wordMode;
int _field1C;
uint _tag;
public:
TTword(TTstring &str, WordMode mode, int val2);
TTword(TTword *src);