[Scummvm-git-logs] scummvm master -> 7662e42aff7090559154dcb517c5e07b4d3460cb
dreammaster
paulfgilbert at gmail.com
Fri Apr 10 01:38:31 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
83ad49e1ba ULTIMA4: Field renames for conversation classes
7662e42aff ULTIMA4: Remove outstanding uses of time_t
Commit: 83ad49e1bab6707189d14db274af8cb0c2405864
https://github.com/scummvm/scummvm/commit/83ad49e1bab6707189d14db274af8cb0c2405864
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-09T18:36:55-07:00
Commit Message:
ULTIMA4: Field renames for conversation classes
Changed paths:
engines/ultima/ultima4/conversation/conversation.cpp
engines/ultima/ultima4/conversation/conversation.h
engines/ultima/ultima4/game/game.cpp
engines/ultima/ultima4/game/person.cpp
engines/ultima/ultima4/game/stats.h
diff --git a/engines/ultima/ultima4/conversation/conversation.cpp b/engines/ultima/ultima4/conversation/conversation.cpp
index 37f700737c..ad07101df6 100644
--- a/engines/ultima/ultima4/conversation/conversation.cpp
+++ b/engines/ultima/ultima4/conversation/conversation.cpp
@@ -42,34 +42,34 @@ const ResponsePart ResponsePart::STOPMUSIC("<STOPMUSIC>", "", true);
const ResponsePart ResponsePart::HAWKWIND("<HAWKWIND>", "", true);
const unsigned int Conversation::BUFFERLEN = 16;
-Response::Response(const Common::String &response) : references(0) {
+Response::Response(const Common::String &response) : _references(0) {
add(response);
}
void Response::add(const ResponsePart &part) {
- parts.push_back(part);
+ _parts.push_back(part);
}
const Std::vector<ResponsePart> &Response::getParts() const {
- return parts;
+ return _parts;
}
Response::operator Common::String() const {
Common::String result;
- for (Std::vector<ResponsePart>::const_iterator i = parts.begin(); i != parts.end(); i++) {
+ for (Std::vector<ResponsePart>::const_iterator i = _parts.begin(); i != _parts.end(); i++) {
result += *i;
}
return result;
}
Response *Response::addref() {
- references++;
+ _references++;
return this;
}
void Response::release() {
- references--;
- if (references <= 0)
+ _references--;
+ if (_references <= 0)
delete this;
}
@@ -112,16 +112,16 @@ const Std::vector<ResponsePart> &DynamicResponse::getParts() const {
* Dialogue::Question class
*/
Dialogue::Question::Question(const Common::String &txt, Response *yes, Response *no) :
- text(txt), yesresp(yes->addref()), noresp(no->addref()) {}
+ _text(txt), _yesResp(yes->addref()), _noResp(no->addref()) {}
Common::String Dialogue::Question::getText() {
- return text;
+ return _text;
}
Response *Dialogue::Question::getResponse(bool yes) {
if (yes)
- return yesresp;
- return noresp;
+ return _yesResp;
+ return _noResp;
}
@@ -129,30 +129,30 @@ Response *Dialogue::Question::getResponse(bool yes) {
* Dialogue::Keyword class
*/
Dialogue::Keyword::Keyword(const Common::String &kw, Response *resp) :
- keyword(kw), response(resp->addref()) {
- trim(keyword);
- lowercase(keyword);
+ _keyword(kw), _response(resp->addref()) {
+ trim(_keyword);
+ lowercase(_keyword);
}
Dialogue::Keyword::Keyword(const Common::String &kw, const Common::String &resp) :
- keyword(kw), response((new Response(resp))->addref()) {
- trim(keyword);
- lowercase(keyword);
+ _keyword(kw), _response((new Response(resp))->addref()) {
+ trim(_keyword);
+ lowercase(_keyword);
}
Dialogue::Keyword::~Keyword() {
- response->release();
+ _response->release();
}
bool Dialogue::Keyword::operator==(const Common::String &kw) const {
// minimum 4-character "guessing"
- int testLen = (keyword.size() < 4) ? keyword.size() : 4;
+ int testLen = (_keyword.size() < 4) ? _keyword.size() : 4;
// exception: empty keyword only matches empty Common::String (alias for 'bye')
if (testLen == 0 && kw.size() > 0)
return false;
- if (scumm_strnicmp(kw.c_str(), keyword.c_str(), testLen) == 0)
+ if (scumm_strnicmp(kw.c_str(), _keyword.c_str(), testLen) == 0)
return true;
return false;
}
@@ -230,7 +230,7 @@ Common::String Dialogue::dump(const Common::String &arg) {
* Conversation class
*/
-Conversation::Conversation() : state(INTRO), script(new Script()) {
+Conversation::Conversation() : _state(INTRO), _script(new Script()) {
#ifdef IOS
U4IOS::incrementConversationCount();
#endif
@@ -241,11 +241,11 @@ Conversation::~Conversation() {
#ifdef IOS
U4IOS::decrementConversationCount();
#endif
- delete script;
+ delete _script;
}
Conversation::InputType Conversation::getInputRequired(int *bufferlen) {
- switch (state) {
+ switch (_state) {
case BUY_QUANTITY:
case SELL_QUANTITY: {
*bufferlen = 2;
@@ -286,7 +286,7 @@ Conversation::InputType Conversation::getInputRequired(int *bufferlen) {
return INPUT_NONE;
}
- error("invalid state: %d", state);
+ error("invalid state: %d", _state);
return INPUT_NONE;
}
diff --git a/engines/ultima/ultima4/conversation/conversation.h b/engines/ultima/ultima4/conversation/conversation.h
index fcc24a30f5..d7a8a0a262 100644
--- a/engines/ultima/ultima4/conversation/conversation.h
+++ b/engines/ultima/ultima4/conversation/conversation.h
@@ -83,8 +83,8 @@ public:
void release();
private:
- int references;
- Std::vector<ResponsePart> parts;
+ int _references;
+ Std::vector<ResponsePart> _parts;
};
/**
@@ -128,8 +128,8 @@ public:
Response *getResponse(bool yes);
private:
- Common::String text;
- Response *yesresp, *noresp;
+ Common::String _text;
+ Response *_yesResp, *_noResp;
};
/**
@@ -149,15 +149,15 @@ public:
* Accessor methods
*/
const Common::String &getKeyword() {
- return keyword;
+ return _keyword;
}
Response *getResponse() {
- return response;
+ return _response;
}
private:
- Common::String keyword;
- Response *response;
+ Common::String _keyword;
+ Response *_response;
};
/**
@@ -296,14 +296,14 @@ public:
static const unsigned int BUFFERLEN; /**< The default maxixum length of input */
public:
- State state; /**< The state of the conversation */
- Common::String playerInput; /**< A Common::String holding the text the player inputs */
- Common::List<Common::String> reply; /**< What the talker says */
- class Script *script; /**< A script that this person follows during the conversation (may be NULL) */
- Dialogue::Question *question; /**< The current question the player is being asked */
- int quant; /**< For vendor transactions */
- int player; /**< For vendor transactions */
- int price; /**< For vendor transactions */
+ State _state; /**< The state of the conversation */
+ Common::String _playerInput; /**< A Common::String holding the text the player inputs */
+ Common::List<Common::String> _reply; /**< What the talker says */
+ class Script *_script; /**< A script that this person follows during the conversation (may be NULL) */
+ Dialogue::Question *_question; /**< The current question the player is being asked */
+ int _quant; /**< For vendor transactions */
+ int _player; /**< For vendor transactions */
+ int _price; /**< For vendor transactions */
};
} // End of namespace Ultima4
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index cc56ca53ed..a2297432a6 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -2469,12 +2469,12 @@ bool talkAt(const Coords &coords) {
}
Conversation conv;
- conv.script->addProvider("party", g_context->_party);
- conv.script->addProvider("context", g_context);
+ conv._script->addProvider("party", g_context->_party);
+ conv._script->addProvider("context", g_context);
- conv.state = Conversation::INTRO;
- conv.reply = talker->getConversationText(&conv, "");
- conv.playerInput.clear();
+ conv._state = Conversation::INTRO;
+ conv._reply = talker->getConversationText(&conv, "");
+ conv._playerInput.clear();
talkRunConversation(conv, talker, false);
return true;
@@ -2484,15 +2484,15 @@ bool talkAt(const Coords &coords) {
* Executes the current conversation until it is done.
*/
void talkRunConversation(Conversation &conv, Person *talker, bool showPrompt) {
- while (conv.state != Conversation::DONE) {
+ while (conv._state != Conversation::DONE) {
// TODO: instead of calculating linesused again, cache the
// result in person.cpp somewhere.
- int linesused = linecount(conv.reply.front(), TEXT_AREA_W);
- screenMessage("%s", conv.reply.front().c_str());
- conv.reply.pop_front();
+ int linesused = linecount(conv._reply.front(), TEXT_AREA_W);
+ screenMessage("%s", conv._reply.front().c_str());
+ conv._reply.pop_front();
/* if all chunks haven't been shown, wait for a key and process next chunk*/
- int size = conv.reply.size();
+ int size = conv._reply.size();
if (size > 0) {
#ifdef IOS
U4IOS::IOSConversationChoiceHelper continueDialog;
@@ -2503,19 +2503,19 @@ void talkRunConversation(Conversation &conv, Person *talker, bool showPrompt) {
}
/* otherwise, clear current reply and proceed based on conversation state */
- conv.reply.clear();
+ conv._reply.clear();
/* they're attacking you! */
- if (conv.state == Conversation::ATTACK) {
- conv.state = Conversation::DONE;
+ if (conv._state == Conversation::ATTACK) {
+ conv._state = Conversation::DONE;
talker->setMovementBehavior(MOVEMENT_ATTACK_AVATAR);
}
- if (conv.state == Conversation::DONE)
+ if (conv._state == Conversation::DONE)
break;
/* When Lord British heals the party */
- else if (conv.state == Conversation::FULLHEAL) {
+ else if (conv._state == Conversation::FULLHEAL) {
int i;
for (i = 0; i < g_context->_party->size(); i++) {
@@ -2524,12 +2524,12 @@ void talkRunConversation(Conversation &conv, Person *talker, bool showPrompt) {
}
gameSpellEffect('r', -1, SOUND_MAGIC); // same spell effect as 'r'esurrect
- conv.state = Conversation::TALK;
+ conv._state = Conversation::TALK;
}
/* When Lord British checks and advances each party member's level */
- else if (conv.state == Conversation::ADVANCELEVELS) {
+ else if (conv._state == Conversation::ADVANCELEVELS) {
gameLordBritishCheckLevels();
- conv.state = Conversation::TALK;
+ conv._state = Conversation::TALK;
}
if (showPrompt) {
@@ -2550,12 +2550,12 @@ void talkRunConversation(Conversation &conv, Person *talker, bool showPrompt) {
int maxlen;
switch (conv.getInputRequired(&maxlen)) {
case Conversation::INPUT_STRING: {
- conv.playerInput = gameGetInput(maxlen);
+ conv._playerInput = gameGetInput(maxlen);
#ifdef IOS
screenMessage("%s", conv.playerInput.c_str()); // Since we put this in a different window, we need to show it again.
#endif
- conv.reply = talker->getConversationText(&conv, conv.playerInput.c_str());
- conv.playerInput.clear();
+ conv._reply = talker->getConversationText(&conv, conv._playerInput.c_str());
+ conv._playerInput.clear();
showPrompt = true;
break;
}
@@ -2571,20 +2571,20 @@ void talkRunConversation(Conversation &conv, Person *talker, bool showPrompt) {
message[0] = choice;
message[1] = '\0';
- conv.reply = talker->getConversationText(&conv, message);
- conv.playerInput.clear();
+ conv._reply = talker->getConversationText(&conv, message);
+ conv._playerInput.clear();
showPrompt = true;
break;
}
case Conversation::INPUT_NONE:
- conv.state = Conversation::DONE;
+ conv._state = Conversation::DONE;
break;
}
}
- if (conv.reply.size() > 0)
- screenMessage("%s", conv.reply.front().c_str());
+ if (conv._reply.size() > 0)
+ screenMessage("%s", conv._reply.front().c_str());
}
/**
diff --git a/engines/ultima/ultima4/game/person.cpp b/engines/ultima/ultima4/game/person.cpp
index 37b7c9e1c7..6447267b71 100644
--- a/engines/ultima/ultima4/game/person.cpp
+++ b/engines/ultima/ultima4/game/person.cpp
@@ -162,12 +162,12 @@ Common::List<Common::String> Person::getConversationText(Conversation *cnv, cons
static const Common::String ids[] = {
"Weapons", "Armor", "Food", "Tavern", "Reagents", "Healer", "Inn", "Guild", "Stable"
};
- Script *script = cnv->script;
+ Script *script = cnv->_script;
/**
* We aren't currently running a script, load the appropriate one!
*/
- if (cnv->state == Conversation::INTRO) {
+ if (cnv->_state == Conversation::INTRO) {
// unload the previous script if it wasn't already unloaded
if (script->getState() != Script::STATE_UNLOADED)
script->unload();
@@ -248,7 +248,7 @@ Common::List<Common::String> Person::getConversationText(Conversation *cnv, cons
// Unload the script
script->unload();
- cnv->state = Conversation::DONE;
+ cnv->_state = Conversation::DONE;
}
/*
@@ -257,7 +257,7 @@ Common::List<Common::String> Person::getConversationText(Conversation *cnv, cons
else {
text = "\n\n\n";
- switch (cnv->state) {
+ switch (cnv->_state) {
case Conversation::INTRO:
text = getIntro(cnv);
break;
@@ -267,7 +267,7 @@ Common::List<Common::String> Person::getConversationText(Conversation *cnv, cons
break;
case Conversation::CONFIRMATION:
- ASSERT(_npcType == NPC_LORD_BRITISH, "invalid state: %d", cnv->state);
+ ASSERT(_npcType == NPC_LORD_BRITISH, "invalid state: %d", cnv->_state);
text += lordBritishGetQuestionResponse(cnv, inquiry);
break;
@@ -288,7 +288,7 @@ Common::List<Common::String> Person::getConversationText(Conversation *cnv, cons
break;
default:
- error("invalid state: %d", cnv->state);
+ error("invalid state: %d", cnv->_state);
}
}
@@ -300,13 +300,13 @@ Common::String Person::getPrompt(Conversation *cnv) {
return "";
Common::String prompt;
- if (cnv->state == Conversation::ASK)
+ if (cnv->_state == Conversation::ASK)
prompt = getQuestion(cnv);
- else if (cnv->state == Conversation::GIVEBEGGAR)
+ else if (cnv->_state == Conversation::GIVEBEGGAR)
prompt = "How much? ";
- else if (cnv->state == Conversation::CONFIRMATION)
+ else if (cnv->_state == Conversation::CONFIRMATION)
prompt = "\n\nHe asks: Art thou well?";
- else if (cnv->state != Conversation::ASKYESNO)
+ else if (cnv->_state != Conversation::ASKYESNO)
prompt = _dialogue->getPrompt();
return prompt;
@@ -314,9 +314,9 @@ Common::String Person::getPrompt(Conversation *cnv) {
const char *Person::getChoices(Conversation *cnv) {
if (isVendor())
- return cnv->script->getChoices().c_str();
+ return cnv->_script->getChoices().c_str();
- switch (cnv->state) {
+ switch (cnv->_state) {
case Conversation::CONFIRMATION:
case Conversation::CONTINUEQUESTION:
return "ny\015 \033";
@@ -325,7 +325,7 @@ const char *Person::getChoices(Conversation *cnv) {
return "012345678\015 \033";
default:
- error("invalid state: %d", cnv->state);
+ error("invalid state: %d", cnv->_state);
}
return NULL;
@@ -333,7 +333,7 @@ const char *Person::getChoices(Conversation *cnv) {
Common::String Person::getIntro(Conversation *cnv) {
if (_npcType == NPC_EMPTY) {
- cnv->state = Conversation::DONE;
+ cnv->_state = Conversation::DONE;
return Common::String("Funny, no\nresponse!\n");
}
@@ -345,7 +345,7 @@ Common::String Person::getIntro(Conversation *cnv) {
else
intro = _dialogue->getLongIntro();
- cnv->state = Conversation::TALK;
+ cnv->_state = Conversation::TALK;
Common::String text = processResponse(cnv, intro);
return text;
@@ -369,20 +369,20 @@ Common::String Person::processResponse(Conversation *cnv, Response *response) {
void Person::runCommand(Conversation *cnv, const ResponsePart &command) {
if (command == ResponsePart::ASK) {
- cnv->question = _dialogue->getQuestion();
- cnv->state = Conversation::ASK;
+ cnv->_question = _dialogue->getQuestion();
+ cnv->_state = Conversation::ASK;
} else if (command == ResponsePart::END) {
- cnv->state = Conversation::DONE;
+ cnv->_state = Conversation::DONE;
} else if (command == ResponsePart::ATTACK) {
- cnv->state = Conversation::ATTACK;
+ cnv->_state = Conversation::ATTACK;
} else if (command == ResponsePart::BRAGGED) {
g_context->_party->adjustKarma(KA_BRAGGED);
} else if (command == ResponsePart::HUMBLE) {
g_context->_party->adjustKarma(KA_HUMBLE);
} else if (command == ResponsePart::ADVANCELEVELS) {
- cnv->state = Conversation::ADVANCELEVELS;
+ cnv->_state = Conversation::ADVANCELEVELS;
} else if (command == ResponsePart::HEALCONFIRM) {
- cnv->state = Conversation::CONFIRMATION;
+ cnv->_state = Conversation::CONFIRMATION;
} else if (command == ResponsePart::STARTMUSIC_LB) {
musicMgr->lordBritish();
} else if (command == ResponsePart::STARTMUSIC_HW) {
@@ -414,7 +414,7 @@ Common::String Person::getResponse(Conversation *cnv, const char *inquiry) {
if (_npcType == NPC_TALKER_BEGGAR && scumm_strnicmp(inquiry, "give", 4) == 0) {
reply.clear();
- cnv->state = Conversation::GIVEBEGGAR;
+ cnv->_state = Conversation::GIVEBEGGAR;
}
else if (scumm_strnicmp(inquiry, "join", 4) == 0 &&
@@ -424,7 +424,7 @@ Common::String Person::getResponse(Conversation *cnv, const char *inquiry) {
if (join == JOIN_SUCCEEDED) {
reply += "I am honored to join thee!";
g_context->_location->_map->removeObject(this);
- cnv->state = Conversation::DONE;
+ cnv->_state = Conversation::DONE;
} else {
reply += "Thou art not ";
reply += (join == JOIN_NOT_VIRTUOUS) ? getVirtueAdjective(v) : "experienced";
@@ -463,22 +463,22 @@ Common::String Person::talkerGetQuestionResponse(Conversation *cnv, const char *
}
if (!valid) {
- cnv->state = Conversation::ASKYESNO;
+ cnv->_state = Conversation::ASKYESNO;
return "Yes or no!";
}
- cnv->state = Conversation::TALK;
- return "\n" + processResponse(cnv, cnv->question->getResponse(yes));
+ cnv->_state = Conversation::TALK;
+ return "\n" + processResponse(cnv, cnv->_question->getResponse(yes));
}
Common::String Person::beggarGetQuantityResponse(Conversation *cnv, const char *response) {
Common::String reply;
- cnv->quant = (int) strtol(response, NULL, 10);
- cnv->state = Conversation::TALK;
+ cnv->_quant = (int) strtol(response, NULL, 10);
+ cnv->_state = Conversation::TALK;
- if (cnv->quant > 0) {
- if (g_context->_party->donate(cnv->quant)) {
+ if (cnv->_quant > 0) {
+ if (g_context->_party->donate(cnv->_quant)) {
reply = "\n";
reply += _dialogue->getPronoun();
reply += " says: Oh Thank thee! I shall never forget thy kindness!\n";
@@ -495,7 +495,7 @@ Common::String Person::beggarGetQuantityResponse(Conversation *cnv, const char *
Common::String Person::lordBritishGetQuestionResponse(Conversation *cnv, const char *answer) {
Common::String reply;
- cnv->state = Conversation::TALK;
+ cnv->_state = Conversation::TALK;
if (tolower(answer[0]) == 'y') {
reply = "Y\n\nHe says: That is good.\n";
@@ -503,7 +503,7 @@ Common::String Person::lordBritishGetQuestionResponse(Conversation *cnv, const c
else if (tolower(answer[0]) == 'n') {
reply = "N\n\nHe says: Let me heal thy wounds!\n";
- cnv->state = Conversation::FULLHEAL;
+ cnv->_state = Conversation::FULLHEAL;
}
else
@@ -513,7 +513,7 @@ Common::String Person::lordBritishGetQuestionResponse(Conversation *cnv, const c
}
Common::String Person::getQuestion(Conversation *cnv) {
- return "\n" + cnv->question->getText() + "\n\nYou say: ";
+ return "\n" + cnv->_question->getText() + "\n\nYou say: ";
}
/**
diff --git a/engines/ultima/ultima4/game/stats.h b/engines/ultima/ultima4/game/stats.h
index 742e151639..e737c971f5 100644
--- a/engines/ultima/ultima4/game/stats.h
+++ b/engines/ultima/ultima4/game/stats.h
@@ -65,7 +65,8 @@ enum StatsView {
MIX_REAGENTS
};
-class StatsArea : public Observer<Aura *>, public Observer<Party *, PartyEvent &>, public Observer<Menu *, MenuEvent &>, public Observable<StatsArea *, Common::String> {
+class StatsArea : public Observer<Aura *>, public Observer<Party *, PartyEvent &>,
+ public Observer<Menu *, MenuEvent &>, public Observable<StatsArea *, Common::String> {
public:
StatsArea();
@@ -86,14 +87,15 @@ public:
/**
* Update the stats (ztats) box on the upper right of the screen.
*/
- void update(bool avatarOnly = false);
+ virtual void update(bool avatarOnly = false);
virtual void update(Aura *aura);
virtual void update(Party *party, PartyEvent &event) {
- update(); /* do a full update */
+ update(); // do a full update
}
virtual void update(Menu *menu, MenuEvent &event) {
- update(); /* do a full update */
+ update(); // do a full update
}
+
void highlightPlayer(int player);
/**
Commit: 7662e42aff7090559154dcb517c5e07b4d3460cb
https://github.com/scummvm/scummvm/commit/7662e42aff7090559154dcb517c5e07b4d3460cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-09T18:38:01-07:00
Commit Message:
ULTIMA4: Remove outstanding uses of time_t
Changed paths:
engines/ultima/ultima4/game/game.cpp
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index a2297432a6..20aca57937 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -81,7 +81,7 @@ void gameAdvanceLevel(PartyMember *player);
void gameInnHandler(void);
void gameLostEighth(Virtue virtue);
void gamePartyStarving(void);
-time_t gameTimeSinceLastCommand(void);
+uint32 gameTimeSinceLastCommand(void);
/* spell functions */
void gameCastSpell(unsigned int spell, int caster, int param);
@@ -2844,7 +2844,7 @@ void gameFixupObjects(Map *map) {
}
}
-time_t gameTimeSinceLastCommand() {
+uint32 gameTimeSinceLastCommand() {
return (g_system->getMillis() - g_context->_lastCommandTime) / 1000;
}
More information about the Scummvm-git-logs
mailing list