forked from mirror/openmw-tes3mp
Remove redundant Services enum
This commit is contained in:
parent
f8ffd85146
commit
19e07fad30
4 changed files with 14 additions and 63 deletions
|
@ -360,47 +360,8 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the available services of this actor
|
|
||||||
int services = mActor.getClass().getServices(mActor);
|
|
||||||
|
|
||||||
int windowServices = 0;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Weapon
|
|
||||||
|| services & ESM::NPC::Armor
|
|
||||||
|| services & ESM::NPC::Clothing
|
|
||||||
|| services & ESM::NPC::Books
|
|
||||||
|| services & ESM::NPC::Ingredients
|
|
||||||
|| services & ESM::NPC::Picks
|
|
||||||
|| services & ESM::NPC::Probes
|
|
||||||
|| services & ESM::NPC::Lights
|
|
||||||
|| services & ESM::NPC::Apparatus
|
|
||||||
|| services & ESM::NPC::RepairItem
|
|
||||||
|| services & ESM::NPC::Misc)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
|
||||||
|
|
||||||
if((mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->getTransport().empty())
|
|
||||||
|| (mActor.getTypeName() == typeid(ESM::Creature).name() && !mActor.get<ESM::Creature>()->mBase->getTransport().empty()))
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Spells)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_BuySpells;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Spellmaking)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_CreateSpells;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Training)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Training;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Enchanting)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Enchant;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Repair)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Repair;
|
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
|
|
||||||
win->setServices (windowServices);
|
|
||||||
|
|
||||||
// sort again, because the previous sort was case-sensitive
|
// sort again, because the previous sort was case-sensitive
|
||||||
keywordList.sort(Misc::StringUtils::ciLess);
|
keywordList.sort(Misc::StringUtils::ciLess);
|
||||||
win->setKeywords(keywordList);
|
win->setKeywords(keywordList);
|
||||||
|
|
|
@ -237,7 +237,6 @@ namespace MWGui
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow()
|
DialogueWindow::DialogueWindow()
|
||||||
: WindowBase("openmw_dialogue_window.layout")
|
: WindowBase("openmw_dialogue_window.layout")
|
||||||
, mServices(0)
|
|
||||||
, mEnabled(false)
|
, mEnabled(false)
|
||||||
, mGoodbye(false)
|
, mGoodbye(false)
|
||||||
, mPersuasionDialog()
|
, mPersuasionDialog()
|
||||||
|
@ -411,6 +410,11 @@ namespace MWGui
|
||||||
mTopicLinks.clear();
|
mTopicLinks.clear();
|
||||||
mKeywordSearch.clear();
|
mKeywordSearch.clear();
|
||||||
|
|
||||||
|
int services = mPtr.getClass().getServices(mPtr);
|
||||||
|
|
||||||
|
bool travel = (mPtr.getTypeName() == typeid(ESM::NPC).name() && !mPtr.get<ESM::NPC>()->mBase->getTransport().empty())
|
||||||
|
|| (mPtr.getTypeName() == typeid(ESM::Creature).name() && !mPtr.get<ESM::Creature>()->mBase->getTransport().empty());
|
||||||
|
|
||||||
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
||||||
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
||||||
|
|
||||||
|
@ -420,25 +424,25 @@ namespace MWGui
|
||||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
mTopicsList->addItem(gmst.find("sPersuasion")->getString());
|
mTopicsList->addItem(gmst.find("sPersuasion")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Trade)
|
if (services & ESM::NPC::AllItems)
|
||||||
mTopicsList->addItem(gmst.find("sBarter")->getString());
|
mTopicsList->addItem(gmst.find("sBarter")->getString());
|
||||||
|
|
||||||
if (mServices & Service_BuySpells)
|
if (services & ESM::NPC::Spells)
|
||||||
mTopicsList->addItem(gmst.find("sSpells")->getString());
|
mTopicsList->addItem(gmst.find("sSpells")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Travel)
|
if (services & travel)
|
||||||
mTopicsList->addItem(gmst.find("sTravel")->getString());
|
mTopicsList->addItem(gmst.find("sTravel")->getString());
|
||||||
|
|
||||||
if (mServices & Service_CreateSpells)
|
if (services & ESM::NPC::Spellmaking)
|
||||||
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Enchant)
|
if (services & ESM::NPC::Enchanting)
|
||||||
mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Training)
|
if (services & ESM::NPC::Training)
|
||||||
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Repair)
|
if (services & ESM::NPC::Repair)
|
||||||
mTopicsList->addItem(gmst.find("sRepair")->getString());
|
mTopicsList->addItem(gmst.find("sRepair")->getString());
|
||||||
|
|
||||||
if (isCompanion)
|
if (isCompanion)
|
||||||
|
|
|
@ -122,20 +122,6 @@ namespace MWGui
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
void clear() { resetReference(); }
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
// make sure to call these before setKeywords()
|
|
||||||
void setServices(int services) { mServices = services; }
|
|
||||||
|
|
||||||
enum Services
|
|
||||||
{
|
|
||||||
Service_Trade = 0x01,
|
|
||||||
Service_BuySpells = 0x02,
|
|
||||||
Service_CreateSpells = 0x04,
|
|
||||||
Service_Enchant = 0x08,
|
|
||||||
Service_Training = 0x10,
|
|
||||||
Service_Travel = 0x20,
|
|
||||||
Service_Repair = 0x40
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onSelectTopic(const std::string& topic, int id);
|
void onSelectTopic(const std::string& topic, int id);
|
||||||
void onByeClicked(MyGUI::Widget* _sender);
|
void onByeClicked(MyGUI::Widget* _sender);
|
||||||
|
@ -152,8 +138,6 @@ namespace MWGui
|
||||||
void updateOptions();
|
void updateOptions();
|
||||||
void restock();
|
void restock();
|
||||||
|
|
||||||
int mServices;
|
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
||||||
bool mGoodbye;
|
bool mGoodbye;
|
||||||
|
|
|
@ -43,6 +43,8 @@ struct NPC
|
||||||
Misc = 0x00400,
|
Misc = 0x00400,
|
||||||
Potions = 0x02000,
|
Potions = 0x02000,
|
||||||
|
|
||||||
|
AllItems = Weapon|Armor|Clothing|Books|Ingredients|Picks|Probes|Lights|Apparatus|RepairItem|Misc|Potions,
|
||||||
|
|
||||||
// Other services
|
// Other services
|
||||||
Spells = 0x00800,
|
Spells = 0x00800,
|
||||||
MagicItems = 0x01000,
|
MagicItems = 0x01000,
|
||||||
|
|
Loading…
Reference in a new issue