Niceify-ing it (Yes, that's a word)

This commit is contained in:
Alexander "Ace" Olofsson 2012-04-06 21:14:52 +02:00
parent ba602929ef
commit 7c1e417f9a
16 changed files with 43 additions and 88 deletions

View file

@ -12,9 +12,6 @@ void Activator::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
if (!script.empty()) esm.writeHNOString("SCRI", script);
{
esm.writeHNString("SCRI", script);
}
} }
} }

View file

@ -14,12 +14,9 @@ void Potion::load(ESMReader &esm)
void Potion::save(ESMWriter &esm) void Potion::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!icon.empty()) esm.writeHNOString("TEXT", icon);
esm.writeHNString("TEXT", icon); esm.writeHNOString("SCRI", script);
if (!script.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("SCRI", script);
if (!name.empty())
esm.writeHNString("FNAM", name);
esm.writeHNT("ALDT", data, 12); esm.writeHNT("ALDT", data, 12);
effects.save(esm); effects.save(esm);
} }

View file

@ -15,8 +15,7 @@ void Apparatus::save(ESMWriter &esm)
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
esm.writeHNT("AADT", data, 16); esm.writeHNT("AADT", data, 16);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script);
esm.writeHNString("ITEX", icon); esm.writeHNString("ITEX", icon);
} }
} }

View file

@ -20,10 +20,8 @@ void PartReferenceList::save(ESMWriter &esm)
for (std::vector<PartReference>::iterator it = parts.begin(); it != parts.end(); ++it) for (std::vector<PartReference>::iterator it = parts.begin(); it != parts.end(); ++it)
{ {
esm.writeHT(it->part); esm.writeHT(it->part);
if (!it->male.empty()) esm.writeHNOString("BNAM", it->male);
esm.writeHNString("BNAM", it->male); esm.writeHNOString("CNAM", it->female);
if (!it->female.empty())
esm.writeHNString("CNAM", it->female);
} }
} }
@ -42,14 +40,11 @@ void Armor::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script);
esm.writeHNT("AODT", data, 24); esm.writeHNT("AODT", data, 24);
if (!icon.empty()) esm.writeHNOString("ITEX", icon);
esm.writeHNString("ITEX", icon);
parts.save(esm); parts.save(esm);
if (!enchant.empty()) esm.writeHNOString("ENAM", enchant);
esm.writeHNString("ENAM", enchant);
} }
} }

View file

@ -16,17 +16,12 @@ void Book::load(ESMReader &esm)
void Book::save(ESMWriter &esm) void Book::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!name.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("FNAM", name);
esm.writeHNT("BKDT", data, 20); esm.writeHNT("BKDT", data, 20);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script); esm.writeHNOString("ITEX", icon);
if (!icon.empty()) esm.writeHNOString("TEXT", text);
esm.writeHNString("ITEX", icon); esm.writeHNOString("ENAM", enchant);
if (!text.empty())
esm.writeHNString("TEXT", text);
if (!enchant.empty())
esm.writeHNString("ENAM", enchant);
} }
} }

View file

@ -14,10 +14,8 @@ void BirthSign::load(ESMReader &esm)
void BirthSign::save(ESMWriter &esm) void BirthSign::save(ESMWriter &esm)
{ {
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
if (!texture.empty()) esm.writeHNOString("TNAM", texture);
esm.writeHNString("TNAM", texture); esm.writeHNOString("DESC", description);
if (!description.empty())
esm.writeHNString("DESC", description);
powers.save(esm); powers.save(esm);
} }

View file

@ -100,18 +100,15 @@ void Cell::save(ESMWriter &esm)
{ {
if (water != 0) if (water != 0)
esm.writeHNT("WHGT", water); esm.writeHNT("WHGT", water);
if (data.flags & QuasiEx) if (data.flags & QuasiEx)
{ esm.writeHNOString("RGNN", region);
if (!region.empty())
esm.writeHNString("RGNN", region);
}
else else
esm.writeHNT("AMBI", ambi, 16); esm.writeHNT("AMBI", ambi, 16);
} }
else else
{ {
if (!region.empty()) esm.writeHNOString("RGNN", region);
esm.writeHNString("RGNN", region);
if (mapColor != 0) if (mapColor != 0)
esm.writeHNT("NAM5", mapColor); esm.writeHNT("NAM5", mapColor);
} }

View file

@ -29,8 +29,7 @@ void Class::save(ESMWriter &esm)
{ {
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
esm.writeHNT("CLDT", data, 60); esm.writeHNT("CLDT", data, 60);
if (!description.empty()) esm.writeHNOString("DESC", description);
esm.writeHNString("DESC", description);
} }
} }

View file

@ -19,19 +19,15 @@ void Clothing::load(ESMReader &esm)
void Clothing::save(ESMWriter &esm) void Clothing::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!name.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("FNAM", name);
esm.writeHNT("CTDT", data, 12); esm.writeHNT("CTDT", data, 12);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script); esm.writeHNOString("ITEX", icon);
if (!icon.empty())
esm.writeHNString("ITEX", icon);
parts.save(esm); parts.save(esm);
if (!enchant.empty()) esm.writeHNOString("ENAM", enchant);
esm.writeHNString("ENAM", enchant);
} }
} }

View file

@ -41,13 +41,11 @@ void Container::load(ESMReader &esm)
void Container::save(ESMWriter &esm) void Container::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!name.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("FNAM", name);
esm.writeHNT("CNDT", weight, 4); esm.writeHNT("CNDT", weight, 4);
esm.writeHNT("FLAG", flags, 4); esm.writeHNT("FLAG", flags, 4);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script);
inventory.save(esm); inventory.save(esm);
} }

View file

@ -40,12 +40,9 @@ void Creature::load(ESMReader &esm, const std::string& id)
void Creature::save(ESMWriter &esm) void Creature::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!original.empty()) esm.writeHNOString("CNAM", original);
esm.writeHNString("CNAM", original); esm.writeHNOString("FNAM", name);
if (!name.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("FNAM", name);
if (!script.empty())
esm.writeHNString("SCRI", script);
esm.writeHNT("NPDT", data, 96); esm.writeHNT("NPDT", data, 96);
esm.writeHNT("FLAG", flags); esm.writeHNT("FLAG", flags);
if (scale != 1.0) if (scale != 1.0)

View file

@ -14,14 +14,10 @@ void Door::load(ESMReader &esm)
void Door::save(ESMWriter &esm) void Door::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!name.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("FNAM", name); esm.writeHNOString("SCRI", script);
if (!script.empty()) esm.writeHNOString("SNAM", openSound);
esm.writeHNString("SCRI", script); esm.writeHNOString("ANAM", closeSound);
if (!openSound.empty())
esm.writeHNString("SNAM", openSound);
if (!closeSound.empty())
esm.writeHNString("ANAM", closeSound);
} }
} }

View file

@ -156,8 +156,7 @@ void DialInfo::save(ESMWriter &esm)
} }
} }
if (!resultScript.empty()) esm.writeHNOString("BNAM", resultScript);
esm.writeHNString("BNAM", resultScript);
switch(questStatus) switch(questStatus)
{ {

View file

@ -16,10 +16,8 @@ void Ingredient::save(ESMWriter &esm)
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
esm.writeHNString("FNAM", name); esm.writeHNString("FNAM", name);
esm.writeHNT("IRDT", data, 56); esm.writeHNT("IRDT", data, 56);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script); esm.writeHNOString("ITEX", script);
if (!icon.empty())
esm.writeHNString("ITEX", script);
} }
} }

View file

@ -16,15 +16,11 @@ void Light::load(ESMReader &esm)
void Light::save(ESMWriter &esm) void Light::save(ESMWriter &esm)
{ {
esm.writeHNString("MODL", model); esm.writeHNString("MODL", model);
if (!name.empty()) esm.writeHNOString("FNAM", name);
esm.writeHNString("FNAM", name); esm.writeHNOString("ITEX", icon);
if (!icon.empty())
esm.writeHNString("ITEX", icon);
esm.writeHNT("LHDT", data, 24); esm.writeHNT("LHDT", data, 24);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script); esm.writeHNOString("SNAM", sound);
if (!sound.empty())
esm.writeHNString("SNAM", sound);
} }
} }

View file

@ -44,10 +44,8 @@ void Tool::save(ESMWriter &esm)
} }
esm.writeT(data, 16); esm.writeT(data, 16);
if (!script.empty()) esm.writeHNOString("SCRI", script);
esm.writeHNString("SCRI", script); esm.writeHNOString("ITEX", icon);
if (!icon.empty())
esm.writeHNString("ITEX", icon);
} }