| 549 | } |
| 550 | |
| 551 | bool Player::TryPickupBackpack( const Backpack& backpack ) |
| 552 | { |
| 553 | for( unsigned int i= 0u; i < GameConstants::weapon_count; i++ ) |
| 554 | { |
| 555 | have_weapon_[i]= have_weapon_[i] || backpack.weapon[i]; |
| 556 | ammo_[i]= std::min( int( ammo_[i] + backpack.ammo[i] ), game_resources_->weapons_description[i].limit ); |
| 557 | } |
| 558 | |
| 559 | have_red_key_ = have_red_key_ || backpack.red_key ; |
| 560 | have_green_key_= have_green_key_ || backpack.green_key; |
| 561 | have_blue_key_ = have_blue_key_ || backpack.blue_key ; |
| 562 | |
| 563 | armor_+= backpack.armor; |
| 564 | if( armor_ > GameConstants::player_max_armor ) armor_= GameConstants::player_max_armor; |
| 565 | |
| 566 | // TODO - return if really something new picked. |
| 567 | AddItemPickupFlash(); |
| 568 | return true; |
| 569 | } |
| 570 | |
| 571 | void Player::BuildPositionMessage( Messages::PlayerPosition& out_position_message ) const |
| 572 | { |
no outgoing calls
no test coverage detected