Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
EDIT: Nvm, I used something else.
Processor's world deserializer is in fashion, yeah. But what about the complexity of the errors?
public static class World
{
public static DataArgs[,] DataBlocks;
public class Info
{
public static string Key;
public static int Woots;
public static string Owner;
public static string Title;
public static int Plays;
public static uint[, ,] Data;
public class Size
{
public static int X;
public static int Y;
}
}
public partial class DataArgs
{
public string Special { get; set; }
}
}
That's the base class I use for it... Now here comes the problem:
World.Info.Owner = m.GetString(0);
World.Info.Title = m.GetString(1);
World.Info.Plays = m.GetInt(2);
World.Info.Woots = m.GetInt(3);
World.Info.Key = derot(m.GetString(5));
LocalPlayer.UserID = m.GetInt(6);
LocalPlayer.UserName = m.GetString(9);
World.Info.Size.X = m.GetInt(12);
World.Info.Size.Y = m.GetInt(13);
World.Info.Data = new uint[2, m.GetInt(12), m.GetInt(13)];
var roomData = new uint[2, m.GetInt(12), m.GetInt(13)];
World.DataBlocks = new World.DataArgs[m.GetInt(12), m.GetInt(13)];
var chunks = InitParse.Parse(m);
foreach (var chunk in chunks)
{
foreach (var pos in chunk.Locations)
{
roomData[chunk.Layer, pos.X, pos.Y] = chunk.Type;
World.Info.Data[chunk.Layer, pos.X, pos.Y] = chunk.Type;
try
{
foreach (var Args in chunk.Args)
{
MessageBox.Show(Args.ToString()); //displays whats on sign
World.DataBlocks[pos.X, pos.Y].Special = Args.ToString(); //error
}
}
catch (Exception er)
{
MessageBox.Show(er.ToString());
}
}
}
World.DataBlocks[pos.X, pos.Y].Special = Args.ToString();
This is what errors. Throws a "NullReferenceException." Even though I assign it it seems to fail.
More details: "Object reference not set to an instance of an object"
shh i have returned
Offline
Args is an object array, that's why it gives null.
Replace Args.ToString() with
Args[position].ToString()
Hope this helps.
EDIT: For a guide about this, go here:
http://forums.everybodyedits.com/viewtopic.php?id=27068
and go to step 3, specials, way 1.
Offline
Args is an object array, that's why it gives null.
Replace Args.ToString() with
Args[position].ToString()Hope this helps.
EDIT: For a guide about this, go here:
http://forums.everybodyedits.com/viewtopic.php?id=27068
and go to step 3, specials, way 1.
Hopefully you have noticed Args is foreach'd. So therefore this answer is useless.
shh i have returned
Offline
Change
World.DataBlocks[pos.X, pos.Y].Special = Args.ToString();
Into
World.DataBlocks[pos.X, pos.Y] = new DataArgs();
World.DataBlocks[pos.X, pos.Y].Special = Args.ToString();
TADA!
I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.
Offline
[ Started around 1732811504.0675 - Generated in 0.036 seconds, 14 queries executed - Memory usage: 1.42 MiB (Peak: 1.53 MiB) ]