Adding basic save functions to all record types.

This commit is contained in:
Alexander "Ace" Olofsson 2012-04-06 21:04:30 +02:00
parent 8bf9b371c7
commit ba602929ef
86 changed files with 894 additions and 96 deletions

View file

@ -17,14 +17,38 @@ void Tool::load(ESMReader &esm)
if (n == "RIDT")
{
type = Type_Repair;
// Swap t.data.quality and t.data.uses for repair items (sigh)
float tmp = *((float*) &data.uses);
data.uses = *((int*) &data.quality);
data.quality = tmp;
}
else if (n == "LKDT")
type = Type_Pick;
else if (n == "PBDT")
type = Type_Probe;
script = esm.getHNOString("SCRI");
icon = esm.getHNOString("ITEX");
}
void Tool::save(ESMWriter &esm)
{
esm.writeHNString("MODL", model);
esm.writeHNString("FNAM", name);
switch(type)
{
case Type_Repair: esm.writeHString("RIDT"); break;
case Type_Pick: esm.writeHString("LKDT"); break;
case Type_Probe: esm.writeHString("PBDT"); break;
}
esm.writeT(data, 16);
if (!script.empty())
esm.writeHNString("SCRI", script);
if (!icon.empty())
esm.writeHNString("ITEX", icon);
}
}