- bugfix on new cellmap pos, need to check first if unit has a cellmap

This commit is contained in:
Mark Vejvoda 2011-05-01 05:40:45 +00:00
parent f71f83d2b8
commit 9def99c8f5
1 changed files with 9 additions and 8 deletions

View File

@ -617,17 +617,18 @@ Vec2i UnitType::getFirstOccupiedCellInCellMap(Vec2i currentPos) const {
//printf("\n\n\n\n^^^^^^^^^^ currentPos [%s] size [%d]\n",currentPos.getString().c_str(),size);
//checkItemInVault(&(this->size),this->size);
for(int i = 0; i < size; ++i) {
for(int j = 0; j < size; ++j){
if(cellMap[i*size+j] == true) {
cell.x += i;
cell.y += j;
//printf("\n^^^^^^^^^^ cell [%s] i [%d] j [%d]\n",cell.getString().c_str(),i,j);
return cell;
if(hasCellMap() == true) {
for(int i = 0; i < size; ++i) {
for(int j = 0; j < size; ++j){
if(cellMap[i*size+j] == true) {
cell.x += i;
cell.y += j;
//printf("\n^^^^^^^^^^ cell [%s] i [%d] j [%d]\n",cell.getString().c_str(),i,j);
return cell;
}
}
}
}
return cell;
}