修复空袭预警coredump问题
This commit is contained in:
parent
ea68294f62
commit
3129b7ff54
@ -69,6 +69,27 @@ void MapService::UnInit()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MapService::CanAdd(const a8::Vec2& pos, int rad)
|
||||||
|
{
|
||||||
|
//上
|
||||||
|
if (pos.y + rad + 10 > map_height_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//下
|
||||||
|
if (rad + 10 > pos.y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//左
|
||||||
|
if (rad + 10 > pos.x) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//右
|
||||||
|
if (pos.x + rad + 10 > map_width_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void MapService::AddCollider(ColliderComponent* collider)
|
void MapService::AddCollider(ColliderComponent* collider)
|
||||||
{
|
{
|
||||||
if (!(collider->owner->IsEntityType(ET_Obstacle) ||
|
if (!(collider->owner->IsEntityType(ET_Obstacle) ||
|
||||||
|
@ -38,6 +38,7 @@ class MapService
|
|||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
void AddCollider(ColliderComponent* collider);
|
void AddCollider(ColliderComponent* collider);
|
||||||
|
bool CanAdd(const a8::Vec2& pos, int rad);
|
||||||
void RemoveCollider(ColliderComponent* collider);
|
void RemoveCollider(ColliderComponent* collider);
|
||||||
void GetColliders(Room* room,
|
void GetColliders(Room* room,
|
||||||
float world_x,
|
float world_x,
|
||||||
|
@ -4010,3 +4010,13 @@ void Room::AddTeam(class MatchTeam* team)
|
|||||||
}
|
}
|
||||||
NotifyUiUpdate();
|
NotifyUiUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Room::CanAddObstacle(const a8::Vec2& pos, int obstacle_id)
|
||||||
|
{
|
||||||
|
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(obstacle_id);
|
||||||
|
if (!thing_meta) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int rad = std::max(thing_meta->i->width(), thing_meta->i->height());
|
||||||
|
return map_service->CanAdd(pos, rad);
|
||||||
|
}
|
||||||
|
@ -227,6 +227,7 @@ public:
|
|||||||
void SetInfiniteBulletMode();
|
void SetInfiniteBulletMode();
|
||||||
bool IsInfiniteBulletMode() { return infinite_bullet_mode_; };
|
bool IsInfiniteBulletMode() { return infinite_bullet_mode_; };
|
||||||
void AddToPostBattleAutoFreeList(xtimer_list* timer);
|
void AddToPostBattleAutoFreeList(xtimer_list* timer);
|
||||||
|
bool CanAddObstacle(const a8::Vec2& pos, int obstacle_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShuaAndroid();
|
void ShuaAndroid();
|
||||||
|
@ -720,15 +720,21 @@ void RoomObstacle::InstallPreExplostionSummonTimer()
|
|||||||
[] (const a8::XParams& param)
|
[] (const a8::XParams& param)
|
||||||
{
|
{
|
||||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||||
RoomObstacle* p = obstacle->room->CreateObstacle
|
a8::Vec2 pos = a8::Vec2(
|
||||||
(
|
|
||||||
param.param1,
|
|
||||||
obstacle->GetPos().x + param.param2.GetDouble(),
|
obstacle->GetPos().x + param.param2.GetDouble(),
|
||||||
obstacle->GetPos().y + param.param3.GetDouble()
|
obstacle->GetPos().y + param.param3.GetDouble()
|
||||||
);
|
);
|
||||||
|
if (obstacle->room->CanAddObstacle(pos, param.param1)) {
|
||||||
|
RoomObstacle* p = obstacle->room->CreateObstacle
|
||||||
|
(
|
||||||
|
param.param1,
|
||||||
|
pos.x,
|
||||||
|
pos.y
|
||||||
|
);
|
||||||
if (p) {
|
if (p) {
|
||||||
p->Active();
|
p->Active();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
&xtimer_attacher.timer_list_
|
&xtimer_attacher.timer_list_
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user