mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-30 13:57:59 +03:00
Adding basic save functions to all record types.
This commit is contained in:
parent
8bf9b371c7
commit
ba602929ef
86 changed files with 894 additions and 96 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue