mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 18:45:38 +00:00
load the AIDT (AI data) for creatures in the ESM loader, which also contains the Services enum.
This commit is contained in:
parent
8cc49ae2b9
commit
630241c8e2
5 changed files with 24 additions and 11 deletions
|
@ -145,6 +145,7 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
|||
{
|
||||
topicsList->addItem(*it);
|
||||
}
|
||||
topicsList->adjustSize();
|
||||
}
|
||||
|
||||
void DialogueWindow::removeKeyword(std::string keyWord)
|
||||
|
@ -154,6 +155,7 @@ void DialogueWindow::removeKeyword(std::string keyWord)
|
|||
topicsList->removeItem(keyWord);
|
||||
pTopicsText.erase(keyWord);
|
||||
}
|
||||
topicsList->adjustSize();
|
||||
}
|
||||
|
||||
void addColorInString(std::string& str, const std::string& keyword,std::string color1, std::string color2)
|
||||
|
|
|
@ -28,8 +28,6 @@ void MWList::initialiseOverride()
|
|||
void MWList::addItem(const std::string& name)
|
||||
{
|
||||
mItems.push_back(name);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void MWList::adjustSize()
|
||||
|
@ -67,7 +65,6 @@ void MWList::redraw(bool scrollbarShown)
|
|||
mItemHeight += height + spacing;
|
||||
}
|
||||
mScrollView->setCanvasSize(mClient->getSize().width + (_scrollBarWidth-scrollBarWidth), std::max(mItemHeight, mClient->getSize().height));
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0,0));
|
||||
|
||||
if (!scrollbarShown && mItemHeight > mClient->getSize().height)
|
||||
redraw(true);
|
||||
|
@ -93,15 +90,11 @@ void MWList::removeItem(const std::string& name)
|
|||
{
|
||||
assert( std::find(mItems.begin(), mItems.end(), name) != mItems.end() );
|
||||
mItems.erase( std::find(mItems.begin(), mItems.end(), name) );
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void MWList::clear()
|
||||
{
|
||||
mItems.clear();
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void MWList::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace MWGui
|
|||
EventHandle_String eventItemSelected;
|
||||
|
||||
/**
|
||||
* Call after the size of the list changed
|
||||
* Call after the size of the list changed, or items were inserted/removed
|
||||
*/
|
||||
void adjustSize();
|
||||
|
||||
|
|
|
@ -19,9 +19,15 @@ void Creature::load(ESMReader &esm, const std::string& id)
|
|||
|
||||
inventory.load(esm);
|
||||
|
||||
// More subrecords:
|
||||
if (esm.isNextSub("AIDT"))
|
||||
{
|
||||
esm.getHExact(&AI, sizeof(AI));
|
||||
hasAI = true;
|
||||
}
|
||||
else
|
||||
hasAI = false;
|
||||
|
||||
// AIDT - data (12 bytes, unknown)
|
||||
// More subrecords:
|
||||
// AI_W - wander (14 bytes, i don't understand it)
|
||||
// short distance
|
||||
// byte duration
|
||||
|
@ -33,8 +39,8 @@ void Creature::load(ESMReader &esm, const std::string& id)
|
|||
// AI_F - follow?
|
||||
// AI_E - escort?
|
||||
// AI_A - activate?
|
||||
|
||||
esm.skipRecord();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,6 +51,15 @@ struct Creature
|
|||
int gold;
|
||||
}; // 96 bytes
|
||||
|
||||
struct AIDTstruct
|
||||
{
|
||||
// These are probabilities
|
||||
char hello, u1, fight, flee, alarm, u2, u3, u4;
|
||||
// The last u's might be the skills that this NPC can train you
|
||||
// in?
|
||||
int services; // See the NPC::Services enum
|
||||
}; // 12 bytes
|
||||
|
||||
NPDTstruct data;
|
||||
|
||||
int flags;
|
||||
|
@ -61,6 +70,9 @@ struct Creature
|
|||
// Defined in loadcont.hpp
|
||||
InventoryList inventory;
|
||||
|
||||
bool hasAI;
|
||||
AIDTstruct AI;
|
||||
|
||||
std::string mId;
|
||||
|
||||
void load(ESMReader &esm, const std::string& id);
|
||||
|
|
Loading…
Reference in a new issue