2011-04-08 13:58:21 +00:00
|
|
|
#include "loadlocks.hpp"
|
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void Tool::load(ESMReader &esm)
|
|
|
|
{
|
|
|
|
model = esm.getHNString("MODL");
|
|
|
|
name = esm.getHNString("FNAM");
|
|
|
|
|
|
|
|
esm.getSubName();
|
|
|
|
NAME n = esm.retSubName();
|
|
|
|
// The data name varies, RIDT for repair items, LKDT for lock
|
|
|
|
// picks, PBDT for probes
|
|
|
|
|
|
|
|
esm.getHT(data, 16);
|
|
|
|
|
|
|
|
if (n == "RIDT")
|
|
|
|
{
|
2012-04-06 19:04:30 +00:00
|
|
|
type = Type_Repair;
|
2011-04-08 13:58:21 +00:00
|
|
|
// 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;
|
|
|
|
}
|
2012-04-06 19:04:30 +00:00
|
|
|
else if (n == "LKDT")
|
|
|
|
type = Type_Pick;
|
|
|
|
else if (n == "PBDT")
|
|
|
|
type = Type_Probe;
|
2011-04-08 13:58:21 +00:00
|
|
|
|
|
|
|
script = esm.getHNOString("SCRI");
|
|
|
|
icon = esm.getHNOString("ITEX");
|
|
|
|
}
|
2012-04-06 19:04:30 +00:00
|
|
|
void Tool::save(ESMWriter &esm)
|
|
|
|
{
|
|
|
|
esm.writeHNString("MODL", model);
|
|
|
|
esm.writeHNString("FNAM", name);
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
2012-04-06 19:28:58 +00:00
|
|
|
case Type_Repair: esm.writeName("RIDT"); break;
|
|
|
|
case Type_Pick: esm.writeName("LKDT"); break;
|
|
|
|
case Type_Probe: esm.writeName("PBDT"); break;
|
2012-04-06 19:04:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
esm.writeT(data, 16);
|
2012-04-06 19:14:52 +00:00
|
|
|
esm.writeHNOString("SCRI", script);
|
|
|
|
esm.writeHNOString("ITEX", icon);
|
2012-04-06 19:04:30 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
|
|
|
|
}
|