#include <string.h>
//#include <stdio.h> // for printf()
#include "boards.h"
+#include "editorwidget.h" // for Level
GameBoard::GameBoard(int boardNumber)
}
+GameBoard::GameBoard(Level * level)
+{
+ Point size, corner;
+
+ EditorWidget::GetSizeAndCorner(level, size, corner);
+
+ width = size.x;
+ height = size.y;
+ boardLength = width * height;
+ board = new char[boardLength];
+ initialBoard = new char[boardLength];
+ name = level->name;
+
+ int current = 0;
+
+ for(int y=0; y<size.y; y++)
+ {
+ for(int x=0; x<size.x; x++)
+ {
+ uint8_t tile = level->board[corner.x + x][corner.y + y];
+
+ if (tile & GTMan)
+ {
+ initialX = x;
+ initialY = y;
+ tile &= ~GTMan;
+ }
+
+ initialBoard[current++] = tile;
+ }
+ }
+
+ ResetGame();
+}
+
+
GameBoard::~GameBoard()
{
if (board)