wraithx2/Buildaria — pull request #1 by dantedom (2011-11-18 07:16:03+00:00)
Title: a temporary fix for the inventory lost?

private static bool canreplace = false;
private static List type = new List();
private static List stack = new List();
private static List name = new List();

public static void Save()
{

if (!canreplace)
{
for (int num = 0; num < 40; num++)
{
type.Add(Main.player[Main.myPlayer].inventory[num].type);
name.Add(Main.player[Main.myPlayer].inventory[num].name);
stack.Add(Main.player[Main.myPlayer].inventory[num].stack);
}
canreplace = true;

}

}

public static void Restore()
{
if (canreplace)
{
for (int num = 0; num < 40; num++)
{
Main.player[Main.myPlayer].inventory[num].SetDefaults(type[num],false);
Main.player[Main.myPlayer].inventory[num].SetDefaults(name[num]);
Main.player[Main.myPlayer].inventory[num].stack = stack[num];
}
type.Clear();
name.Clear();
stack.Clear();
canreplace = false;
}
}