remove warngin

This commit is contained in:
aozhiwei 2019-07-13 16:37:06 +08:00
parent e9a3169c95
commit 18f69865ec
16 changed files with 56 additions and 27 deletions

View File

@ -2,6 +2,11 @@
#include "aicomponent.h"
AIComponent::~AIComponent()
{
}
void AIComponent::Update(int delta_time)
{

View File

@ -6,5 +6,6 @@ class AIComponent
public:
Entity* owner = nullptr;
virtual ~AIComponent();
virtual void Update(int delta_time);
};

View File

@ -7,6 +7,10 @@
#include "room.h"
#include "metamgr.h"
AndroidAI::~AndroidAI()
{
}
void AndroidAI::Update(int delta_time)
{
Human* hum = (Human*)owner;

View File

@ -17,6 +17,7 @@ class AndroidAI : public AIComponent
int state_elapsed_time = 0;
Human* last_hiter = nullptr;
virtual ~AndroidAI() override;
virtual void Update(int delta_time) override;
private:

View File

@ -191,6 +191,8 @@ bool ColliderComponent::CalcSafePoint(ColliderComponent* b, a8::Vec2& new_pos)
new_pos);
}
break;
default:
break;
}
}
break;
@ -220,6 +222,8 @@ bool ColliderComponent::CalcSafePoint(ColliderComponent* b, a8::Vec2& new_pos)
new_pos);
}
break;
default:
break;
}
}
break;
@ -258,6 +262,8 @@ bool ColliderComponent::CalcSafePointEx(const a8::Vec2& a_pos, ColliderComponent
new_pos);
}
break;
default:
break;
}
}
break;
@ -287,6 +293,8 @@ bool ColliderComponent::CalcSafePointEx(const a8::Vec2& a_pos, ColliderComponent
new_pos);
}
break;
default:
break;
}
}
break;

View File

@ -113,6 +113,8 @@ void Entity::FindLocationWithTarget(Entity* target)
}
}
break;
default:
break;
}
if (building) {
break;

View File

@ -27,7 +27,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
for (auto& itr : hum->out_objects) {
msg->add_out_objids(itr);
}
for (int idx : hum->shots_) {
for (size_t idx : hum->shots_) {
if (idx < room->frame_event.shots_.size()) {
auto& tuple = room->frame_event.shots_[idx];
if (hum->CanSee(std::get<0>(tuple))) {
@ -35,7 +35,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
}
}
}
for (int idx : hum->bullets_) {
for (size_t idx : hum->bullets_) {
if (idx < room->frame_event.bullets_.size()) {
auto& tuple = room->frame_event.bullets_[idx];
if (hum->CanSee(std::get<0>(tuple))) {
@ -43,7 +43,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
}
}
}
for (int idx : hum->explosions_) {
for (size_t idx : hum->explosions_) {
if (idx < room->frame_event.explosions_.size()) {
auto& tuple = room->frame_event.explosions_[idx];
if (hum->CanSee(std::get<0>(tuple))) {
@ -51,7 +51,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
}
}
}
for (int idx : hum->smokes_) {
for (size_t idx : hum->smokes_) {
if (idx < room->frame_event.smokes_.size()) {
auto& tuple = room->frame_event.smokes_[idx];
if (hum->CanSee(std::get<0>(tuple))) {
@ -59,7 +59,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
}
}
}
for (int idx : hum->emotes_) {
for (size_t idx : hum->emotes_) {
if (idx < room->frame_event.emotes_.size()) {
auto& tuple = room->frame_event.emotes_[idx];
if (hum->CanSee(std::get<0>(tuple))) {

View File

@ -264,7 +264,6 @@ void GridService::ComputeDiff(int old_grid_id, int new_grid_id,
std::set<GridCell*>& inc_grid_list,
std::set<GridCell*>& dec_grid_list)
{
int diff_grid = new_grid_id - old_grid_id;
#if 1
{
std::set<GridCell*> new_grid_list;

View File

@ -363,6 +363,8 @@ bool Human::IsCollisionInMapService()
}
}
break;
default:
break;
}
}
return false;
@ -509,7 +511,7 @@ void Human::AutoLoadingBullet(bool manual)
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(curr_weapon->meta->i->use_bullet());
if (bullet_meta &&
bullet_meta->i->_inventory_slot() >= 0 &&
bullet_meta->i->_inventory_slot() < inventory_.size()
bullet_meta->i->_inventory_slot() < (int)inventory_.size()
) {
if (GetInventory(bullet_meta->i->_inventory_slot()) > 0) {
StartAction(AT_Reload,
@ -1092,6 +1094,8 @@ void Human::FindLocation()
}
}
break;
default:
break;
}
}
}
@ -1739,6 +1743,8 @@ void Human::UpdateAction()
hum->SyncAroundPlayers();
}
break;
default:
break;
}
ResetAction();
}

View File

@ -131,6 +131,8 @@ void MapService::AddCollider(ColliderComponent* collider)
}
}
break;
default:
break;
}
if (top_node) {
auto pair = node_hash_.find(collider);
@ -165,7 +167,7 @@ void MapService::GetColliders(float world_x, float world_y, std::set<ColliderCom
if (center_grid_id < 0 || center_grid_id >= max_grid_id_) {
return;
}
for (size_t i = 0; i < a8::ArraySize(grid_offset_arr_); ++i) {
for (int i = 0; i < a8::ArraySize(grid_offset_arr_); ++i) {
int grid_id = center_grid_id + grid_offset_arr_[i];
if (grid_id >= 0 && grid_id < max_grid_id_) {
list_head* head = &map_cells_[grid_id];

View File

@ -69,8 +69,8 @@ namespace MetaData
a8::Split(str, strings2, ':');
assert(strings2.size() == 2);
if (strings2.size() >= 2) {
int slot = a8::XValue(strings2[0]);
int num = a8::XValue(strings2[1]);
size_t slot = a8::XValue(strings2[0]);
size_t num = a8::XValue(strings2[1]);
if (slot >= 0 && slot < volume.size()){
volume[slot] = num;
}
@ -81,7 +81,7 @@ namespace MetaData
void EquipUpgrade::Init()
{
for (size_t j = 0; j < i->max_lv(); ++j) {
for (int j = 0; j < i->max_lv(); ++j) {
std::array<float, EA_End>& attrs = a8::FastAppend(level_attrs);
for (size_t k = 0; k < EA_End; ++k) {
attrs[k] = 0;
@ -101,7 +101,7 @@ namespace MetaData
float attr_value = a8::XValue(strings2[2]).GetDouble();
if (attr_type < EA_End) {
if (attr_level >= 0 && attr_level < i->max_lv()) {
for (size_t j = 1; j < i->max_lv(); ++j) {
for (int j = 1; j < i->max_lv(); ++j) {
if (j % attr_level == 0) {
level_attrs[j][attr_type] = attr_value * (j / attr_level);
}
@ -117,7 +117,7 @@ namespace MetaData
if (level < 1) {
return 0;
}
if (level > level_attrs.size()) {
if (level > (int)level_attrs.size()) {
return 0;
}
if (attr_type < EA_End) {
@ -136,8 +136,8 @@ namespace MetaData
a8::Split(str, strings2, ':');
assert(strings2.size() == 2);
if (strings2.size() >= 2) {
int slot = a8::XValue(strings2[0]);
int num = a8::XValue(strings2[1]);
size_t slot = a8::XValue(strings2[0]);
size_t num = a8::XValue(strings2[1]);
if (slot >= 0 && slot < volume.size()){
volume[slot] = num;
}
@ -189,7 +189,7 @@ namespace MetaData
assert(itemids.size() == nums.size());
#if 1
std::vector<int> item_lvs;
for (auto& itr : itemids) {
for (size_t ii = 0; ii < itemids.size(); ++ii) {
item_lvs.push_back(1);
}
#endif
@ -368,7 +368,7 @@ namespace MetaData
void Dress::Init()
{
for (size_t j = 0; j < i->max_lv(); ++j) {
for (int j = 0; j < i->max_lv(); ++j) {
std::array<float, EA_End>& attrs = a8::FastAppend(level_attrs);
for (size_t k = 0; k < EA_End; ++k) {
attrs[k] = 0;
@ -388,7 +388,7 @@ namespace MetaData
float attr_value = a8::XValue(strings2[2]).GetDouble();
if (attr_type < EA_End) {
if (attr_level >= 0 && attr_level < i->max_lv()) {
for (size_t j = 1; j < i->max_lv(); ++j) {
for (int j = 1; j < i->max_lv(); ++j) {
if (j % attr_type == 0) {
level_attrs[j][attr_type] = attr_value * (j / attr_level);
}
@ -404,7 +404,7 @@ namespace MetaData
if (level < 1) {
return 0;
}
if (level > level_attrs.size()) {
if (level > (int)level_attrs.size()) {
return 0;
}
if (attr_type < EA_End) {

View File

@ -339,7 +339,7 @@ void Player::Shot()
}
bullet_dir.Rotate(bullet_angle / 180.0f);
room->frame_event.AddBullet(this, bullet_born_pos, bullet_dir, fly_distance);
if (room->BattleStarted() || room->gas_data.gas_mode == GasJump && !a8::HasBitFlag(status, HS_Jump)) {
if (room->BattleStarted() || (room->gas_data.gas_mode == GasJump && !a8::HasBitFlag(status, HS_Jump))) {
room->CreateBullet(this, curr_weapon, bullet_born_pos, bullet_dir, fly_distance);
}
}
@ -813,7 +813,6 @@ void Player::ProcPrepareItems(const ::google::protobuf::RepeatedField< ::google:
void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
{
bool has_move_dir = msg.has_move_dir();
moving = false;
if (msg.has_move_dir()) {
if (std::abs(msg.move_dir().x()) > FLT_EPSILON ||

View File

@ -31,10 +31,10 @@ class Player : public Human
int moved_frames = 0;
bool select_weapon = false;
int selected_weapon_idx = 0;
size_t selected_weapon_idx = 0;
bool drop_weapon = false;
int drop_weapon_idx = 0;
size_t drop_weapon_idx = 0;
bool cancel_action = false;

View File

@ -92,7 +92,6 @@ void Room::Update(int delta_time)
return;
}
long long begin_tick = a8::XGetTickCount();
elapsed_time_ += delta_time;
while (elapsed_time_ >= 50) {
if (frame_no % 2 == 0) {
@ -119,7 +118,6 @@ void Room::Update(int delta_time)
++frame_no;
elapsed_time_ -= 50;
}
long long end_tick = a8::XGetTickCount();
}
int Room::GetPlayerNum()
@ -731,6 +729,8 @@ Entity* Room::FindFirstCollisonEntity(const a8::Vec2& aabb_pos, AabbCollider& aa
}
}
break;
default:
break;
}
}
}
@ -771,6 +771,8 @@ void Room::FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCo
}
}
break;
default:
break;
}
if (building) {
break;

@ -1 +1 @@
Subproject commit 88b75d811aecd688865fddf4d47413a50f953d34
Subproject commit 0f45b14f63aca986db9c6eb07bbdfd9822114991

@ -1 +1 @@
Subproject commit df9f299b3f5a7305946113ffea3fec7c7023a92d
Subproject commit dd38a6a7c75ae7c880b6f2103763c2709abad920