diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 44ca2e6..25adf3c 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -1274,7 +1274,7 @@ void Room::InitAirDrop() void Room::AirDrop(int appear_time, int box_id) { MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(box_id); - if (thing_meta) { + if (thing_meta && thing_meta->i->type() == 2) { a8::Vec2 dir = a8::Vec2::UP; dir.Rotate(a8::RandAngle()); a8::Vec2 box_pos = gas_data.pos_new + dir * (500 + rand() % 300); @@ -1305,6 +1305,13 @@ void Room::AirDrop(int appear_time, int box_id) box_pos.x = new_x; box_pos.y = new_y; } + if (box_pos.x + thing_meta->i->width()/2 + 2 > map_meta->i->map_width() || + box_pos.x - thing_meta->i->width()/2 - 2 < 1 || + box_pos.y + thing_meta->i->height()/2 + 2 > map_meta->i->map_height() || + box_pos.y - thing_meta->i->height()/2 - 2 < 1 + ) { + return; + } frame_event.AddAirDrop(appear_time, box_id, box_pos); xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f, a8::XParams()