
Originally Posted by
bigredron
OK, I have a grid based game and what I want to do is save the co-ordinates of some cells in a list/array/ini/whatever, (think of it as a queue file). Then I want to start a loop which runs through the list, reads the grid coordinates and does an action.
Lets say for example i have a 10x10 grid, and I have a square brush 3x3 grid cells in size, covering the grid from cell 5,5 to 7,7. I want to save these cells into the queue list.
It should look something like this:
x pos,y pos
5,5
5,6
5,7
6,5
6,6
6,7
7,5
7,6
7,7
Once all grid coordinates have been added, a loop will start which reads the number of lines in the file and starts the loop that many times. In this case, the loop will start 9 times. On each loop, it will do some actions to the cells read from that line number.
Loop 1 - Do actions to cell 5,5
Loop 2 - Do actions to cell 5,6
etc
At the moment I am using the ini++ file with two groups named 'x' and 'y', and saving the position under each group, howver I know there is an easier way.
I am looking for the easiest and fastest method of doing this, as my grid is much larger than 10x10 cells and the values will be added/read/deleted many times per second.