Example #1
0
 private function _put(Item $item, $posx, $posy)
 {
     if ($posx >= $this->getWidth() || $posx < 0) {
         throw new Exception('Invalid slot position. (x > width || x < 0)');
     } elseif ($posy >= $this->getHeight() || $posy < 0) {
         throw new Exception('Invalid slot position. (y > height || y < 0)');
     }
     for ($y = $posy; $y < $posy + $item->getHeight(); $y++) {
         for ($x = $posx; $x < $posx + $item->getWidth(); $x++) {
             $this->_map[$x][$y] = true;
         }
     }
     $this->_items[$posx][$posy] = $item;
     return true;
 }