1
This commit is contained in:
parent
0c3a1baa4c
commit
e2661014fe
@ -574,6 +574,14 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
SendGameOver();
|
||||
}
|
||||
}
|
||||
if (room->GetAliveTeamNum() == 1) {
|
||||
std::set<Human*>* members = room->GetAliveTeam();
|
||||
if (members) {
|
||||
for (Human* member : *members) {
|
||||
member->SendGameOver();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -699,13 +699,11 @@ void Player::LootInteraction(Loot* entity)
|
||||
if (item_meta->i->_inventory_slot() == 5 ||
|
||||
item_meta->i->_inventory_slot() == 6) {
|
||||
Weapon* weapon = &weapons[3 + (item_meta->i->_inventory_slot() - 5)];
|
||||
if (weapon->weapon_id == 0) {
|
||||
weapon->weapon_id = entity->item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += entity->count;
|
||||
weapon->meta = item_meta;
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
weapon->weapon_id = entity->item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += entity->count;
|
||||
weapon->meta = item_meta;
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
if (item_meta->i->_inventory_slot() > 12) {
|
||||
if (item_meta->i->_inventory_slot() - 12 > curr_scope_idx) {
|
||||
|
@ -624,6 +624,32 @@ bool Room::BattleStarted()
|
||||
return battle_start_frameno_ != 0;
|
||||
}
|
||||
|
||||
int Room::GetAliveTeamNum()
|
||||
{
|
||||
int num = 0;
|
||||
for (auto& pair : team_hash_) {
|
||||
for (Human* hum : pair.second) {
|
||||
if (!hum->dead) {
|
||||
++num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
std::set<Human*>* Room::GetAliveTeam()
|
||||
{
|
||||
for (auto& pair : team_hash_) {
|
||||
for (Human* hum : pair.second) {
|
||||
if (!hum->dead) {
|
||||
return &pair.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Room::NewTeam()
|
||||
{
|
||||
++current_teamid;
|
||||
|
@ -85,6 +85,8 @@ public:
|
||||
bool OverBorder(const Vector2D pos, float radius);
|
||||
Human* GetWatchWarTarget(Human* hum);
|
||||
bool BattleStarted();
|
||||
int GetAliveTeamNum();
|
||||
std::set<Human*>* GetAliveTeam();
|
||||
|
||||
private:
|
||||
unsigned short AllocUniid();
|
||||
|
Loading…
x
Reference in New Issue
Block a user