1
0
Fork 0
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:
scrawl 2012-05-17 13:12:38 +02:00
parent 8cc49ae2b9
commit 630241c8e2
5 changed files with 24 additions and 11 deletions

View file

@ -145,6 +145,7 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
{ {
topicsList->addItem(*it); topicsList->addItem(*it);
} }
topicsList->adjustSize();
} }
void DialogueWindow::removeKeyword(std::string keyWord) void DialogueWindow::removeKeyword(std::string keyWord)
@ -154,6 +155,7 @@ void DialogueWindow::removeKeyword(std::string keyWord)
topicsList->removeItem(keyWord); topicsList->removeItem(keyWord);
pTopicsText.erase(keyWord); pTopicsText.erase(keyWord);
} }
topicsList->adjustSize();
} }
void addColorInString(std::string& str, const std::string& keyword,std::string color1, std::string color2) void addColorInString(std::string& str, const std::string& keyword,std::string color1, std::string color2)

View file

@ -28,8 +28,6 @@ void MWList::initialiseOverride()
void MWList::addItem(const std::string& name) void MWList::addItem(const std::string& name)
{ {
mItems.push_back(name); mItems.push_back(name);
redraw();
} }
void MWList::adjustSize() void MWList::adjustSize()
@ -67,7 +65,6 @@ void MWList::redraw(bool scrollbarShown)
mItemHeight += height + spacing; mItemHeight += height + spacing;
} }
mScrollView->setCanvasSize(mClient->getSize().width + (_scrollBarWidth-scrollBarWidth), std::max(mItemHeight, mClient->getSize().height)); 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) if (!scrollbarShown && mItemHeight > mClient->getSize().height)
redraw(true); redraw(true);
@ -93,15 +90,11 @@ void MWList::removeItem(const std::string& name)
{ {
assert( std::find(mItems.begin(), mItems.end(), name) != mItems.end() ); assert( std::find(mItems.begin(), mItems.end(), name) != mItems.end() );
mItems.erase( std::find(mItems.begin(), mItems.end(), name) ); mItems.erase( std::find(mItems.begin(), mItems.end(), name) );
redraw();
} }
void MWList::clear() void MWList::clear()
{ {
mItems.clear(); mItems.clear();
redraw();
} }
void MWList::onMouseWheel(MyGUI::Widget* _sender, int _rel) void MWList::onMouseWheel(MyGUI::Widget* _sender, int _rel)

View file

@ -26,7 +26,7 @@ namespace MWGui
EventHandle_String eventItemSelected; 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(); void adjustSize();

View file

@ -19,9 +19,15 @@ void Creature::load(ESMReader &esm, const std::string& id)
inventory.load(esm); 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) // AI_W - wander (14 bytes, i don't understand it)
// short distance // short distance
// byte duration // byte duration
@ -33,8 +39,8 @@ void Creature::load(ESMReader &esm, const std::string& id)
// AI_F - follow? // AI_F - follow?
// AI_E - escort? // AI_E - escort?
// AI_A - activate? // AI_A - activate?
esm.skipRecord(); esm.skipRecord();
} }
} }

View file

@ -51,6 +51,15 @@ struct Creature
int gold; int gold;
}; // 96 bytes }; // 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; NPDTstruct data;
int flags; int flags;
@ -61,6 +70,9 @@ struct Creature
// Defined in loadcont.hpp // Defined in loadcont.hpp
InventoryList inventory; InventoryList inventory;
bool hasAI;
AIDTstruct AI;
std::string mId; std::string mId;
void load(ESMReader &esm, const std::string& id); void load(ESMReader &esm, const std::string& id);