X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgameboard.cpp;fp=src%2Fgameboard.cpp;h=0d1216f1c0bfbd1b16bfbadc2dc1ad0fb9197554;hb=003638a66da61e2269e4ef398aa294c6ee02b171;hp=e39d2e56b22e2f202326c6e73915d9bc7eb2d5e7;hpb=195a185d42504cbface8c29911467ce8cff27229;p=warehouse-man-deluxe diff --git a/src/gameboard.cpp b/src/gameboard.cpp index e39d2e5..0d1216f 100644 --- a/src/gameboard.cpp +++ b/src/gameboard.cpp @@ -15,6 +15,7 @@ #include //#include // for printf() #include "boards.h" +#include "editorwidget.h" // for Level GameBoard::GameBoard(int boardNumber) @@ -60,6 +61,42 @@ 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; yboard[corner.x + x][corner.y + y]; + + if (tile & GTMan) + { + initialX = x; + initialY = y; + tile &= ~GTMan; + } + + initialBoard[current++] = tile; + } + } + + ResetGame(); +} + + GameBoard::~GameBoard() { if (board)