移除代码里的warning

This commit is contained in:
aozhiwei 2020-06-02 10:05:13 +08:00
parent e71d2a4f47
commit c88e463f97
6 changed files with 13 additions and 17 deletions

View File

@ -691,7 +691,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
a8::UdpLog::Instance()->Debug("hum2 %d %s", {(long long)this, objs_str}); a8::UdpLog::Instance()->Debug("hum2 %d %s", {(long long)this, objs_str});
} }
room->CheckPartObjects(hum, this); room->CheckPartObjects(hum, this);
bool ok = hum->InPartObjects(this); hum->InPartObjects(this);
#endif #endif
assert(hum->part_objects.find(this) != hum->part_objects.end()); assert(hum->part_objects.find(this) != hum->part_objects.end());
if (hum->part_objects.find(this) == hum->part_objects.end()) { if (hum->part_objects.find(this) == hum->part_objects.end()) {
@ -1816,11 +1816,11 @@ void Human::ClearFrameData()
if (!a8::HasBitFlag(status, HS_Disable)) { if (!a8::HasBitFlag(status, HS_Disable)) {
for (auto& itr : out_objects) { for (auto& itr : out_objects) {
Entity* entity = room->GetEntityByUniId(itr); Entity* entity = room->GetEntityByUniId(itr);
Human* hum = (Human*)entity;
if (entity) { if (entity) {
RemovePartObjects(entity); RemovePartObjects(entity);
if (entity->IsEntityType(ET_Player)) { if (entity->IsEntityType(ET_Player)) {
((Human*)entity)->RemovePartObjects(this); Human* hum = (Human*)entity;
hum->RemovePartObjects(this);
} }
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -138,12 +138,12 @@ void Player::UpdateMove()
if (tank_weapon.meta && tank_oil_value < 0.00001f) { if (tank_weapon.meta && tank_oil_value < 0.00001f) {
return; return;
} }
a8::Vec2 old_pos = GetPos();
_UpdateMove(std::max(1, (int)GetSpeed())); _UpdateMove(std::max(1, (int)GetSpeed()));
if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) { if (GetLastCollisionDoor() && !TestCollision(room, GetLastCollisionDoor())) {
SetLastCollisionDoor(nullptr); SetLastCollisionDoor(nullptr);
} }
#if 0 #if 0
a8::Vec2 old_pos = GetPos();
if (tank_weapon.meta) { if (tank_weapon.meta) {
CheckSkinTank(); CheckSkinTank();
tank_oil_value -= old_pos.Distance(GetPos()) * (MetaMgr::Instance()->average_oil / 100.0f); tank_oil_value -= old_pos.Distance(GetPos()) * (MetaMgr::Instance()->average_oil / 100.0f);

View File

@ -984,7 +984,7 @@ void Room::CombineTeam()
return; return;
} }
int first_team_num = 4; size_t first_team_num = 4;
switch (total_count) { switch (total_count) {
case 3: case 3:
{ {
@ -1780,7 +1780,6 @@ void Room::ShuaAndroidTimerFunc()
&xtimer_attacher_.timer_list_, &xtimer_attacher_.timer_list_,
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
Room* room = (Room*)param.sender.GetUserData();
} }
); );
if (shua_time > 0 && shua_num > 0) { if (shua_time > 0 && shua_num > 0) {
@ -1822,7 +1821,6 @@ void Room::DieAndroidTimerFunc()
&xtimer_attacher_.timer_list_, &xtimer_attacher_.timer_list_,
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
Room* room = (Room*)param.sender.GetUserData();
} }
); );
if (die_time > 0 && die_num > 0) { if (die_time > 0 && die_num > 0) {
@ -2096,7 +2094,6 @@ void Room::CheckPartObjects(Human* testa, Human* testb)
if (testa && testb) { if (testa && testb) {
if ((a == testa && b == testb) || if ((a == testa && b == testb) ||
(a == testb && b == testa)) { (a == testb && b == testa)) {
int i = 0;
} }
} }
if (a->InPartObjects(b)) { if (a->InPartObjects(b)) {
@ -2116,7 +2113,6 @@ void Room::CheckPartObjects(Human* testa, Human* testb)
if (testa && testb) { if (testa && testb) {
if ((huma == testa && humb == testb) || if ((huma == testa && humb == testb) ||
(huma == testb && humb == testa)) { (huma == testb && humb == testa)) {
int i = 0;
} }
} }
if (a8::HasBitFlag(huma->status, HS_Disable) || if (a8::HasBitFlag(huma->status, HS_Disable) ||
@ -2132,7 +2128,7 @@ void Room::CheckPartObjects(Human* testa, Human* testb)
} }
} }
void Room::GetAliveHumans(std::vector<Human*>& alive_humans, int num, Human* exclude_hum) void Room::GetAliveHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum)
{ {
alive_humans.reserve(num); alive_humans.reserve(num);
{ {
@ -2422,7 +2418,7 @@ Human* Room::GetOneCanEnableAndroid()
return !humans.empty() ? humans[0] : nullptr; return !humans.empty() ? humans[0] : nullptr;
} }
void Room::GetCanEnableAndroids(std::vector<Human*>& humans, int num) void Room::GetCanEnableAndroids(std::vector<Human*>& humans, size_t num)
{ {
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
if (pair.second->IsAndroid() && if (pair.second->IsAndroid() &&
@ -2477,7 +2473,7 @@ Player* Room::GetOneAlivePlayer()
return !humans.empty() ? humans[0] : nullptr; return !humans.empty() ? humans[0] : nullptr;
} }
void Room::GetAlivePlayers(std::vector<Player*>& humans, int num) void Room::GetAlivePlayers(std::vector<Player*>& humans, size_t num)
{ {
for (auto& pair : accountid_hash_) { for (auto& pair : accountid_hash_) {
if (!pair.second->real_dead) { if (!pair.second->real_dead) {

View File

@ -115,10 +115,10 @@ public:
void CheckPartObjects(Human* testa = nullptr, Human* testb = nullptr); void CheckPartObjects(Human* testa = nullptr, Human* testb = nullptr);
bool RuningInTimer(); bool RuningInTimer();
Human* GetOneCanEnableAndroid(); Human* GetOneCanEnableAndroid();
void GetCanEnableAndroids(std::vector<Human*>& humans, int num); void GetCanEnableAndroids(std::vector<Human*>& humans, size_t num);
void InstallCheckAutoDieTimer(Human* hum); void InstallCheckAutoDieTimer(Human* hum);
Player* GetOneAlivePlayer(); Player* GetOneAlivePlayer();
void GetAlivePlayers(std::vector<Player*>& humans, int num); void GetAlivePlayers(std::vector<Player*>& humans, size_t num);
int GetCanShuaNum(int shua_num); int GetCanShuaNum(int shua_num);
private: private:
@ -166,7 +166,7 @@ private:
void ProcDisableHuman(); void ProcDisableHuman();
void OnHumanGridChg(Human* target); void OnHumanGridChg(Human* target);
void ShuaGridRound(Human* target); void ShuaGridRound(Human* target);
void GetAliveHumans(std::vector<Human*>& alive_humans, int num, Human* exclude_hum); void GetAliveHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum);
void CheckAliveHuman(Human* hum, std::vector<Human*>& alive_humans); void CheckAliveHuman(Human* hum, std::vector<Human*>& alive_humans);
a8::Vec2 GetDefaultBornPoint(); a8::Vec2 GetDefaultBornPoint();

@ -1 +1 @@
Subproject commit 8ab07d896fab50c552a60220fa2508967f76a69b Subproject commit d73ff7eb0c53e6d93db95b14d0fb5945fae24649

@ -1 +1 @@
Subproject commit 15ab670d4a295138900981a1cc5c2cc48b80c2e5 Subproject commit 6a5392433ccd85ffbfea9a904fde0f5bae22c155