add AdjustPosInnnerMap function
This commit is contained in:
parent
88980bd9da
commit
f4098cb2db
@ -569,6 +569,38 @@ bool Room::OverBorder(const a8::Vec2 pos, float radius)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Room::AdjustPosInnerMap(a8::Vec2& pos, float radius)
|
||||||
|
{
|
||||||
|
//检查x轴
|
||||||
|
{
|
||||||
|
int left_x = pos.x - radius;
|
||||||
|
if (left_x < 0.001f) {
|
||||||
|
pos.x = radius + 10;
|
||||||
|
}
|
||||||
|
int right_x = pos.x + radius;
|
||||||
|
if (right_x > map_meta_->i->map_width()) {
|
||||||
|
pos.x = map_meta_->i->map_width() - radius - 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//检查y轴
|
||||||
|
{
|
||||||
|
int up_y = pos.y + radius;
|
||||||
|
if (up_y > map_meta_->i->map_height()) {
|
||||||
|
pos.y = map_meta_->i->map_height() - radius - 10;
|
||||||
|
}
|
||||||
|
int down_y = pos.y - radius;
|
||||||
|
if (down_y < 0.001f) {
|
||||||
|
pos.y = radius + 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (OverBorder(pos, radius)) {
|
||||||
|
pos = a8::Vec2(1800, 1800);
|
||||||
|
#ifdef DEBUG
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Human* Room::GetWatchWarTarget(Human* hum)
|
Human* Room::GetWatchWarTarget(Human* hum)
|
||||||
{
|
{
|
||||||
if (hum->team_members) {
|
if (hum->team_members) {
|
||||||
|
@ -120,6 +120,7 @@ public:
|
|||||||
Player* GetOneAlivePlayer();
|
Player* GetOneAlivePlayer();
|
||||||
void GetAlivePlayers(std::vector<Player*>& humans, size_t num);
|
void GetAlivePlayers(std::vector<Player*>& humans, size_t num);
|
||||||
int GetCanShuaNum(int shua_num);
|
int GetCanShuaNum(int shua_num);
|
||||||
|
void AdjustPosInnerMap(a8::Vec2& pos, float radius);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AllocUniid();
|
int AllocUniid();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user