1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-26 06:11:34 +00:00

Remove tabs as requested. Sorry about that, thought I already

had. :-) I updated the help to better document the --type option,
although I did not finish reasoning through it's interaction with the
new loading framework. I also expanded the print() methods of a few
more of the record types to make a more consistent commit.
This commit is contained in:
cfcohen 2012-10-09 19:41:45 -04:00
parent 57f3b50dc8
commit 50e259c060
3 changed files with 317 additions and 211 deletions

View file

@ -13,7 +13,7 @@
#include "record.hpp" #include "record.hpp"
#define ESMTOOL_VERSION 1.1 #define ESMTOOL_VERSION 1.2
// Create a local alias for brevity // Create a local alias for brevity
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
@ -72,9 +72,12 @@ bool parseOptions (int argc, char** argv, Arguments &info)
desc.add_options() desc.add_options()
("help,h", "print help message.") ("help,h", "print help message.")
("version,v", "print version information and quit.") ("version,v", "print version information and quit.")
("raw,r", "Show an unformattet list of all records and subrecords.") ("raw,r", "Show an unformatted list of all records and subrecords.")
// The intention is that this option would interact better
// with other modes including clone, dump, and raw.
("type,t", bpo::value< std::vector<std::string> >(), ("type,t", bpo::value< std::vector<std::string> >(),
"Show only records of this type.") "Show only records of this type (four character record code). May "
"be specified multiple times. Only affects dump mode.")
("quiet,q", "Supress all record information. Useful for speed tests.") ("quiet,q", "Supress all record information. Useful for speed tests.")
("loadcells,C", "Browse through contents of all cells.") ("loadcells,C", "Browse through contents of all cells.")

View file

@ -51,6 +51,27 @@ void printAIPackage(ESM::AIPackage p)
std::cout << " Cell Name: " << p.mCellName << std::endl; std::cout << " Cell Name: " << p.mCellName << std::endl;
} }
void printEffectList(ESM::EffectList effects)
{
int i = 0;
std::vector<ESM::ENAMstruct>::iterator eit;
for (eit = effects.mList.begin(); eit != effects.mList.end(); eit++)
{
std::cout << " Effect[" << i << "]: " << eit->mEffectID << std::endl;
if (eit->mSkill != -1)
std::cout << " Skill: " << (int)eit->mSkill << std::endl;
if (eit->mAttribute != -1)
std::cout << " Attribute: " << (int)eit->mAttribute << std::endl;
std::cout << " Range: " << eit->mRange << std::endl;
// Area is always zero if range type is "Self"
if (eit->mRange != ESM::RT_Self)
std::cout << " Area: " << eit->mArea << std::endl;
std::cout << " Duration: " << eit->mDuration << std::endl;
std::cout << " Magnitude: " << eit->mMagnMin << "-" << eit->mMagnMax << std::endl;
i++;
}
}
namespace EsmTool { namespace EsmTool {
RecordBase * RecordBase *
@ -297,7 +318,7 @@ void Record<ESM::Potion>::print()
std::cout << " Weight: " << mData.mData.mWeight << std::endl; std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl; std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " AutoCalc: " << mData.mData.mAutoCalc << std::endl; std::cout << " AutoCalc: " << mData.mData.mAutoCalc << std::endl;
// mEffects missing printEffectList(mData.mEffects);
} }
template<> template<>
@ -316,7 +337,14 @@ void Record<ESM::Armor>::print()
std::cout << " Health: " << mData.mData.mHealth << std::endl; std::cout << " Health: " << mData.mData.mHealth << std::endl;
std::cout << " Armor: " << mData.mData.mArmor << std::endl; std::cout << " Armor: " << mData.mData.mArmor << std::endl;
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
// mParts missing std::vector<ESM::PartReference>::iterator pit;
for (pit = mData.mParts.mParts.begin(); pit != mData.mParts.mParts.end(); pit++)
{
std::cout << " Body Part: " << (int)(pit->mPart) << std::endl;
std::cout << " Male Name: " << pit->mMale << std::endl;
if (pit->mFemale != "")
std::cout << " Female Name: " << pit->mFemale << std::endl;
}
} }
template<> template<>
@ -358,7 +386,12 @@ void Record<ESM::Book>::print()
std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl; std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl;
std::cout << " SkillID: " << mData.mData.mSkillID << std::endl; std::cout << " SkillID: " << mData.mData.mSkillID << std::endl;
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
// mText missing std::cout << " Text: [skipped]" << std::endl;
// Skip until multi-line fields is controllable by a command line option.
// Mildly problematic because there are no parameter to print() currently.
// std::cout << "-------------------------------------------" << std::endl;
// std::cout << mData.mText << std::endl;
// std::cout << "-------------------------------------------" << std::endl;
} }
template<> template<>
@ -442,7 +475,10 @@ void Record<ESM::Container>::print()
std::cout << " Script: " << mData.mScript << std::endl; std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Flags: " << mData.mFlags << std::endl; std::cout << " Flags: " << mData.mFlags << std::endl;
std::cout << " Weight: " << mData.mWeight << std::endl; std::cout << " Weight: " << mData.mWeight << std::endl;
// mInventory missing std::vector<ESM::ContItem>::iterator cit;
for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); cit++)
std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount
<< " Item: " << cit->mItem.toString() << std::endl;
} }
template<> template<>
@ -512,7 +548,12 @@ template<>
void Record<ESM::Dialogue>::print() void Record<ESM::Dialogue>::print()
{ {
std::cout << " Type: " << (int)mData.mType << std::endl; std::cout << " Type: " << (int)mData.mType << std::endl;
// mInfo missing // Sadly, there are no DialInfos, because the loader dumps as it
// loads, rather than loading and then dumping. :-( Anyone mind if
// I change this?
std::vector<ESM::DialInfo>::iterator iit;
for (iit = mData.mInfo.begin(); iit != mData.mInfo.end(); iit++)
std::cout << "INFO!" << iit->mId << std::endl;
} }
template<> template<>
@ -532,7 +573,7 @@ void Record<ESM::Enchantment>::print()
std::cout << " Cost: " << mData.mData.mCost << std::endl; std::cout << " Cost: " << mData.mData.mCost << std::endl;
std::cout << " Charge: " << mData.mData.mCharge << std::endl; std::cout << " Charge: " << mData.mData.mCharge << std::endl;
std::cout << " AutoCalc: " << mData.mData.mAutocalc << std::endl; std::cout << " AutoCalc: " << mData.mData.mAutocalc << std::endl;
// mEffects missing printEffectList(mData.mEffects);
} }
template<> template<>
@ -602,8 +643,53 @@ template<>
void Record<ESM::DialInfo>::print() void Record<ESM::DialInfo>::print()
{ {
std::cout << " Id: " << mData.mId << std::endl; std::cout << " Id: " << mData.mId << std::endl;
if (mData.mPrev != "")
std::cout << " Previous ID: " << mData.mPrev << std::endl;
if (mData.mNext != "")
std::cout << " Next ID: " << mData.mNext << std::endl;
std::cout << " Text: " << mData.mResponse << std::endl; std::cout << " Text: " << mData.mResponse << std::endl;
// Lots missing, more coming if (mData.mActor != "")
std::cout << " Actor: " << mData.mActor << std::endl;
if (mData.mRace != "")
std::cout << " Race: " << mData.mRace << std::endl;
if (mData.mClass != "")
std::cout << " Class: " << mData.mClass << std::endl;
std::cout << " Factionless: " << mData.mFactionLess << std::endl;
if (mData.mNpcFaction != "")
std::cout << " NPC Faction: " << mData.mNpcFaction << std::endl;
if (mData.mData.mRank != -1)
std::cout << " NPC Rank: " << (int)mData.mData.mRank << std::endl;
if (mData.mPcFaction != "")
std::cout << " PC Faction: " << mData.mPcFaction << std::endl;
// CHANGE? non-standard capitalization mPCrank -> mPCRank (mPcRank?)
if (mData.mData.mPCrank != -1)
std::cout << " PC Rank: " << (int)mData.mData.mPCrank << std::endl;
if (mData.mCell != "")
std::cout << " Cell: " << mData.mCell << std::endl;
if (mData.mData.mDisposition > 0)
std::cout << " Disposition: " << mData.mData.mDisposition << std::endl;
if (mData.mData.mGender != ESM::DialInfo::NA)
std::cout << " Gender: " << mData.mData.mGender << std::endl;
if (mData.mSound != "")
std::cout << " Sound File: " << mData.mSound << std::endl;
if (mData.mResultScript != "")
{
std::cout << " Result Script: [skipped]" << std::endl;
// Skip until multi-line fields is controllable by a command line option.
// Mildly problematic because there are no parameter to print() currently.
// std::cout << "-------------------------------------------" << std::endl;
// std::cout << mData.mResultScript << std::endl;
// std::cout << "-------------------------------------------" << std::endl;
}
std::cout << " Quest Status: " << mData.mQuestStatus << std::endl;
std::cout << " Unknown1: " << mData.mData.mUnknown1 << std::endl;
std::cout << " Unknown2: " << (int)mData.mData.mUnknown2 << std::endl;
std::vector<ESM::DialInfo::SelectStruct>::iterator sit;
for (sit = mData.mSelects.begin(); sit != mData.mSelects.end(); sit++)
std::cout << " Select Rule: " << sit->mType << " " << sit->mSelectRule << std::endl;
} }
template<> template<>
@ -630,7 +716,23 @@ template<>
void Record<ESM::Land>::print() void Record<ESM::Land>::print()
{ {
std::cout << " Coordinates: (" << mData.mX << "," << mData.mY << ")" << std::endl; std::cout << " Coordinates: (" << mData.mX << "," << mData.mY << ")" << std::endl;
// Lots missing, more coming std::cout << " Flags: " << mData.mFlags << std::endl;
std::cout << " HasData: " << mData.mHasData << std::endl;
std::cout << " DataTypes: " << mData.mDataTypes << std::endl;
// Seems like this should done with reference counting in the
// loader to me. But I'm not really knowledgable about this
// record type yet. --Cory
bool wasLoaded = mData.mDataLoaded;
if (mData.mDataTypes) mData.loadData(mData.mDataTypes);
if (mData.mDataLoaded)
{
std::cout << " Height Offset: " << mData.mLandData->mHeightOffset << std::endl;
// Lots of missing members.
std::cout << " Unknown1: " << mData.mLandData->mUnk1 << std::endl;
std::cout << " Unknown2: " << mData.mLandData->mUnk2 << std::endl;
}
if (!wasLoaded) mData.unloadData();
} }
template<> template<>
@ -1009,10 +1111,11 @@ void Record<ESM::Script>::print()
std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl; std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl;
std::cout << " Script: [skipped]" << std::endl; std::cout << " Script: [skipped]" << std::endl;
// Skip until multi-line field is controllable by a command line option. // Skip until multi-line fields is controllable by a command line option.
//std::cout << "-------------------------------------------" << std::endl; // Mildly problematic because there are no parameter to print() currently.
//std::cout << s->scriptText << std::endl; // std::cout << "-------------------------------------------" << std::endl;
//std::cout << "-------------------------------------------" << std::endl; // std::cout << s->scriptText << std::endl;
// std::cout << "-------------------------------------------" << std::endl;
std::vector<std::string>::iterator vit; std::vector<std::string>::iterator vit;
for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++) for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++)
std::cout << " Variable: " << *vit << std::endl; std::cout << " Variable: " << *vit << std::endl;
@ -1066,7 +1169,7 @@ void Record<ESM::Spell>::print()
std::cout << " Type: " << mData.mData.mType << std::endl; std::cout << " Type: " << mData.mData.mType << std::endl;
std::cout << " Flags: " << mData.mData.mFlags << std::endl; std::cout << " Flags: " << mData.mData.mFlags << std::endl;
std::cout << " Cost: " << mData.mData.mCost << std::endl; std::cout << " Cost: " << mData.mData.mCost << std::endl;
// mEffect missing printEffectList(mData.mEffects);
} }
template<> template<>