| 309 | } |
| 310 | |
| 311 | void Player::dropHand(Tile *t, unsigned int index) |
| 312 | { |
| 313 | // Add the creature to the map |
| 314 | if(index >= mObjectsInHand.size()) |
| 315 | { |
| 316 | OD_LOG_ERR("seatId=" + Helper::toString(getSeat()->getId()) + ", index=" + Helper::toString(index) + ", size=" + Helper::toString(mObjectsInHand.size())); |
| 317 | return; |
| 318 | } |
| 319 | |
| 320 | GameEntity *entity = mObjectsInHand[index]; |
| 321 | mObjectsInHand.erase(mObjectsInHand.begin() + index); |
| 322 | |
| 323 | Ogre::Vector3 pos(static_cast<Ogre::Real>(t->getX()), |
| 324 | static_cast<Ogre::Real>(t->getY()), entity->getPosition().z); |
| 325 | if(mGameMap->isServerGameMap()) |
| 326 | { |
| 327 | entity->drop(pos); |
| 328 | entity->fireDropEntity(this, t); |
| 329 | return; |
| 330 | } |
| 331 | |
| 332 | entity->correctDropPosition(pos); |
| 333 | OD_LOG_INF("player seatId=" + Helper::toString(getSeat()->getId()) + " drop " + entity->getName() + " on tile=" + Tile::displayAsString(t)); |
| 334 | entity->drop(pos); |
| 335 | |
| 336 | // If this is the result of another player dropping the creature it is currently not visible so we need to create a mesh for it |
| 337 | //cout << "\nthis: " << this << "\nme: " << gameMap->getLocalPlayer() << endl; |
| 338 | //cout.flush(); |
| 339 | if (this != mGameMap->getLocalPlayer()) |
| 340 | { |
| 341 | OD_LOG_ERR("cannot pickup entity player seat=" + Helper::toString(getSeat()->getId()) + ", localPlayer seat id=" + Helper::toString(mGameMap->getLocalPlayer()->getSeat()->getId()) + ", entity=" + entity->getName()); |
| 342 | return; |
| 343 | } |
| 344 | // Send a render request to rearrange the creatures in the hand to move them all forward 1 place |
| 345 | RenderManager::getSingleton().rrDropHand(entity, this); |
| 346 | } |
| 347 | |
| 348 | void Player::rotateHand(Direction d) |
| 349 | { |
no test coverage detected