That stuff about memory pools made me realize I could probably just use one big array after all. I wanted the pointers for a linked queue of search nodes, but making the queue a big array probably won't slow things down noticeably. My project is due in a few days, so I don't want to mess with the firmware or anything. I'd like to learn more about data abstraction etc. sometime though. Thanks for the helpful links.
Now I just have one simple problem. I can't figure out how to initialize arrays of structs.
Code: Select all
struct Location
{
short value;
unsigned short num;
unsigned short paths[4][2];
short x;
short y;
};
Location map[23] =
{{0, 3, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 12, 12},//Location 0
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 1
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 2
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 3
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 4
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 5
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 6
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 7
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 8
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 9
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 10
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 11
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 12
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 13
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 14
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 15
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 16
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 17
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 18
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 19
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 20
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}, //Location 21
{0, 0, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, 0, 0}}; //Location 22
task main()
{
NumOut(0, 0, map[0].x);
Wait(10000);
}
It compiles and looks good but it outputs 0 instead of 12.