完成gridcell改造
This commit is contained in:
parent
f5208e0913
commit
4cf475dbd5
@ -177,7 +177,7 @@ void AndroidNewAI::DoMoveOldAI()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hum->room->grid_service->MoveHuman(hum);
|
hum->room->grid_service->MoveCreature(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ void AndroidNewAI::UpdateNewBieNpc()
|
|||||||
int speed = std::max(1, (int)hum->GetSpeed());
|
int speed = std::max(1, (int)hum->GetSpeed());
|
||||||
for (int i = 0; i < speed; ++i) {
|
for (int i = 0; i < speed; ++i) {
|
||||||
hum->SetPos(hum->GetPos() + hum->move_dir);
|
hum->SetPos(hum->GetPos() + hum->move_dir);
|
||||||
hum->room->grid_service->MoveHuman(hum);
|
hum->room->grid_service->MoveCreature(hum);
|
||||||
}
|
}
|
||||||
} else if (hum->room->GetFrameNo() - hum->enable_frameno < SERVER_FRAME_RATE * 3) {
|
} else if (hum->room->GetFrameNo() - hum->enable_frameno < SERVER_FRAME_RATE * 3) {
|
||||||
Human* enemy = hum->room->GetFirstNewBie();
|
Human* enemy = hum->room->GetFirstNewBie();
|
||||||
@ -265,7 +265,7 @@ void AndroidNewAI::UpdateLastNpc()
|
|||||||
a8::Vec2 old_pos = hum->GetPos();
|
a8::Vec2 old_pos = hum->GetPos();
|
||||||
hum->SetPos(hum->GetPos() + hum->move_dir);
|
hum->SetPos(hum->GetPos() + hum->move_dir);
|
||||||
if (!hum->room->OverBorder(hum->GetPos(), hum->meta->i->radius())) {
|
if (!hum->room->OverBorder(hum->GetPos(), hum->meta->i->radius())) {
|
||||||
hum->room->grid_service->MoveHuman(hum);
|
hum->room->grid_service->MoveCreature(hum);
|
||||||
} else {
|
} else {
|
||||||
hum->SetPos(old_pos);
|
hum->SetPos(old_pos);
|
||||||
break;
|
break;
|
||||||
@ -361,7 +361,7 @@ void AndroidNewAI::UpdateNewBieRoomLogic()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
hum->SetPos(pos);
|
hum->SetPos(pos);
|
||||||
hum->room->grid_service->MoveHuman(hum);
|
hum->room->grid_service->MoveCreature(hum);
|
||||||
hum->FindLocation();
|
hum->FindLocation();
|
||||||
hum->RefreshView();
|
hum->RefreshView();
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ void AndroidNewAI::UpdateNewBieRoomLogic()
|
|||||||
speed *= 0.7;
|
speed *= 0.7;
|
||||||
for (int i = 0; i < speed; ++i) {
|
for (int i = 0; i < speed; ++i) {
|
||||||
hum->SetPos(hum->GetPos() + hum->move_dir);
|
hum->SetPos(hum->GetPos() + hum->move_dir);
|
||||||
hum->room->grid_service->MoveHuman(hum);
|
hum->room->grid_service->MoveCreature(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,7 +62,7 @@ void Android::InternalUpdate(int delta_time)
|
|||||||
}
|
}
|
||||||
if (HasBuffEffect(kBET_Fly)) {
|
if (HasBuffEffect(kBET_Fly)) {
|
||||||
SetPos(room->plane.curr_pos);
|
SetPos(room->plane.curr_pos);
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ai->Update(delta_time);
|
ai->Update(delta_time);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "perfmonitor.h"
|
#include "perfmonitor.h"
|
||||||
#include "typeconvert.h"
|
#include "typeconvert.h"
|
||||||
|
|
||||||
Car::Car():MoveableEntity()
|
Car::Car():Creature()
|
||||||
{
|
{
|
||||||
++PerfMonitor::Instance()->entity_num[ET_Car];
|
++PerfMonitor::Instance()->entity_num[ET_Car];
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ Car::~Car()
|
|||||||
|
|
||||||
void Car::Initialize()
|
void Car::Initialize()
|
||||||
{
|
{
|
||||||
MoveableEntity::Initialize();
|
Creature::Initialize();
|
||||||
hero_meta_ = MetaMgr::Instance()->GetPlayer(meta->i->heroid());
|
hero_meta_ = MetaMgr::Instance()->GetPlayer(meta->i->heroid());
|
||||||
if (!hero_meta_) {
|
if (!hero_meta_) {
|
||||||
abort();
|
abort();
|
||||||
@ -172,9 +172,9 @@ void Car::SyncPos()
|
|||||||
if (hum != driver_) {
|
if (hum != driver_) {
|
||||||
hum->SetPos(GetPos());
|
hum->SetPos(GetPos());
|
||||||
hum->move_dir = move_dir;
|
hum->move_dir = move_dir;
|
||||||
room->grid_service->MoveHuman(hum);
|
room->grid_service->MoveCreature(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
room->grid_service->MoveCar(this);
|
room->grid_service->MoveCreature(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "moveableentity.h"
|
#include "creature.h"
|
||||||
|
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ namespace MetaData
|
|||||||
|
|
||||||
class Human;
|
class Human;
|
||||||
class Room;
|
class Room;
|
||||||
class Car : public MoveableEntity
|
class Car : public Creature
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int car_uniid = 0;
|
int car_uniid = 0;
|
||||||
|
@ -832,3 +832,18 @@ float Creature::GetAttrRate(int attr_id)
|
|||||||
float attr_rate_val = GetBuffAttrRate(attr_id);
|
float attr_rate_val = GetBuffAttrRate(attr_id);
|
||||||
return attr_rate_val;
|
return attr_rate_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Creature::IsPlayer() const
|
||||||
|
{
|
||||||
|
return IsHuman() && IsEntitySubType(EST_Player);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Creature::IsAndroid() const
|
||||||
|
{
|
||||||
|
return IsHuman() && IsEntitySubType(EST_Android);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Creature::IsHuman() const
|
||||||
|
{
|
||||||
|
return IsEntityType(ET_Player);
|
||||||
|
}
|
||||||
|
@ -71,8 +71,9 @@ class Creature : public MoveableEntity
|
|||||||
virtual std::string GetName() { return "";};
|
virtual std::string GetName() { return "";};
|
||||||
virtual void SendDebugMsg(const std::string& debug_msg);
|
virtual void SendDebugMsg(const std::string& debug_msg);
|
||||||
virtual void DropItems(Obstacle* obstacle) {};
|
virtual void DropItems(Obstacle* obstacle) {};
|
||||||
virtual bool IsPlayer() const { return false;};
|
bool IsPlayer() const;
|
||||||
virtual bool IsAndroid() const { return false;};
|
bool IsAndroid() const;
|
||||||
|
bool IsHuman() const;
|
||||||
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {};
|
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {};
|
||||||
|
|
||||||
RaceType_e GetRace() { return race_; }
|
RaceType_e GetRace() { return race_; }
|
||||||
|
@ -7,50 +7,37 @@
|
|||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "car.h"
|
#include "car.h"
|
||||||
#include "hero.h"
|
#include "hero.h"
|
||||||
|
#include "creature.h"
|
||||||
|
|
||||||
GridCell::GridCell()
|
GridCell::GridCell()
|
||||||
{
|
{
|
||||||
human_list_.reserve(MAX_ROOM_IDX);
|
entitys_.reserve(MAX_ROOM_IDX);
|
||||||
entity_list_.reserve(MAX_ROOM_IDX);
|
bullets_.reserve(MAX_ROOM_IDX);
|
||||||
bullet_list_.reserve(MAX_ROOM_IDX);
|
creatures_.reserve(MAX_ROOM_IDX);
|
||||||
for (int i = 0; i < MAX_ROOM_IDX; ++i) {
|
for (int i = 0; i < MAX_ROOM_IDX; ++i) {
|
||||||
human_list_.push_back(std::set<Human*>());
|
entitys_.push_back(std::set<Entity*>());
|
||||||
entity_list_.push_back(std::set<Entity*>());
|
bullets_.push_back(std::set<Bullet*>());
|
||||||
bullet_list_.push_back(std::set<Bullet*>());
|
creatures_.push_back(std::set<Creature*>());
|
||||||
car_list_.push_back(std::set<Car*>());
|
|
||||||
hero_list_.push_back(std::set<Hero*>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GridCell::ClearRoomData(Room* room)
|
void GridCell::ClearRoomData(Room* room)
|
||||||
{
|
{
|
||||||
human_list_[room->GetRoomIdx()].clear();
|
entitys_[room->GetRoomIdx()].clear();
|
||||||
entity_list_[room->GetRoomIdx()].clear();
|
bullets_[room->GetRoomIdx()].clear();
|
||||||
bullet_list_[room->GetRoomIdx()].clear();
|
creatures_[room->GetRoomIdx()].clear();
|
||||||
bullet_list_[room->GetRoomIdx()].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::AddHuman(Human* hum)
|
|
||||||
{
|
|
||||||
human_list_[hum->room->GetRoomIdx()].insert(hum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::RemoveHuman(Human* hum)
|
|
||||||
{
|
|
||||||
human_list_[hum->room->GetRoomIdx()].erase(hum);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GridCell::ExistsHuman(Human* hum)
|
|
||||||
{
|
|
||||||
return human_list_[hum->room->GetRoomIdx()].find(hum) != human_list_[hum->room->GetRoomIdx()].end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::TouchHumanList(std::function<void (Human*, bool&)>& func,
|
void GridCell::TouchHumanList(std::function<void (Human*, bool&)>& func,
|
||||||
int room_idx,
|
int room_idx,
|
||||||
bool& stop)
|
bool& stop)
|
||||||
{
|
{
|
||||||
for (Human* hum : human_list_[room_idx]) {
|
for (Creature* c : creatures_[room_idx]) {
|
||||||
|
if (!c->IsHuman()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Human* hum = (Human*)c;
|
||||||
func(hum, stop);
|
func(hum, stop);
|
||||||
if (stop) {
|
if (stop) {
|
||||||
return;
|
return;
|
||||||
@ -67,62 +54,42 @@ void GridCell::TouchHumanListEx(std::function<void (Human*, bool&)> func,
|
|||||||
|
|
||||||
void GridCell::AddBullet(Bullet* bullet)
|
void GridCell::AddBullet(Bullet* bullet)
|
||||||
{
|
{
|
||||||
bullet_list_[bullet->room->GetRoomIdx()].insert(bullet);
|
bullets_[bullet->room->GetRoomIdx()].insert(bullet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::RemoveBullet(Bullet* bullet)
|
void GridCell::RemoveBullet(Bullet* bullet)
|
||||||
{
|
{
|
||||||
bullet_list_[bullet->room->GetRoomIdx()].erase(bullet);
|
bullets_[bullet->room->GetRoomIdx()].erase(bullet);
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::AddCar(Car* car)
|
|
||||||
{
|
|
||||||
car_list_[car->room->GetRoomIdx()].insert(car);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::RemoveCar(Car* car)
|
|
||||||
{
|
|
||||||
car_list_[car->room->GetRoomIdx()].erase(car);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::AddHero(Hero* hero)
|
|
||||||
{
|
|
||||||
hero_list_[hero->room->GetRoomIdx()].insert(hero);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridCell::RemoveHero(Hero* hero)
|
|
||||||
{
|
|
||||||
hero_list_[hero->room->GetRoomIdx()].erase(hero);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::AddPermanentEntity(Entity* entity)
|
void GridCell::AddPermanentEntity(Entity* entity)
|
||||||
{
|
{
|
||||||
entity_list_[0].insert(entity);
|
entitys_[0].insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::AddRoomEntity(Room* room, Entity* entity)
|
void GridCell::AddRoomEntity(Room* room, Entity* entity)
|
||||||
{
|
{
|
||||||
entity_list_[room->GetRoomIdx()].insert(entity);
|
entitys_[room->GetRoomIdx()].insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::RemoveRoomEntity(Room* room, Entity* entity)
|
void GridCell::RemoveRoomEntity(Room* room, Entity* entity)
|
||||||
{
|
{
|
||||||
entity_list_[room->GetRoomIdx()].erase(entity);
|
entitys_[room->GetRoomIdx()].erase(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GridCell::ExistsEntity(Room* room, Entity* entity)
|
bool GridCell::EntityExists(Room* room, Entity* entity)
|
||||||
{
|
{
|
||||||
if (entity_list_[0].find(entity) != entity_list_[0].end()) {
|
if (entitys_[0].find(entity) != entitys_[0].end()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return entity_list_[room->GetRoomIdx()].find(entity) !=
|
return entitys_[room->GetRoomIdx()].find(entity) !=
|
||||||
entity_list_[room->GetRoomIdx()].end();
|
entitys_[room->GetRoomIdx()].end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridCell::TouchLayer0EntityList(std::function<void (Entity*, bool&)>& func,
|
void GridCell::TouchLayer0EntityList(std::function<void (Entity*, bool&)>& func,
|
||||||
bool& stop)
|
bool& stop)
|
||||||
{
|
{
|
||||||
for (Entity* entity : entity_list_[0]) {
|
for (Entity* entity : entitys_[0]) {
|
||||||
func(entity, stop);
|
func(entity, stop);
|
||||||
if (stop) {
|
if (stop) {
|
||||||
return;
|
return;
|
||||||
@ -134,7 +101,7 @@ void GridCell::TouchLayer1EntityList(std::function<void (Entity*, bool&)>& func,
|
|||||||
int room_idx,
|
int room_idx,
|
||||||
bool& stop)
|
bool& stop)
|
||||||
{
|
{
|
||||||
for (Entity* entity : entity_list_[room_idx]) {
|
for (Entity* entity : entitys_[room_idx]) {
|
||||||
func(entity, stop);
|
func(entity, stop);
|
||||||
if (stop) {
|
if (stop) {
|
||||||
return;
|
return;
|
||||||
@ -151,3 +118,18 @@ void GridCell::TouchAllLayerEntityList(std::function<void (Entity*, bool&)>& fun
|
|||||||
TouchLayer1EntityList(func, room_idx, stop);
|
TouchLayer1EntityList(func, room_idx, stop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridCell::AddCreature(Creature* c)
|
||||||
|
{
|
||||||
|
creatures_[c->room->GetRoomIdx()].insert(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCell::RemoveCreature(Creature* c)
|
||||||
|
{
|
||||||
|
creatures_[c->room->GetRoomIdx()].erase(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GridCell::CreatureExists(Creature* c)
|
||||||
|
{
|
||||||
|
return creatures_[c->room->GetRoomIdx()].find(c) != creatures_[c->room->GetRoomIdx()].end();
|
||||||
|
}
|
||||||
|
@ -4,8 +4,7 @@ class Entity;
|
|||||||
class Human;
|
class Human;
|
||||||
class Bullet;
|
class Bullet;
|
||||||
class Room;
|
class Room;
|
||||||
class Car;
|
class Creature;
|
||||||
class Hero;
|
|
||||||
|
|
||||||
class GridCell
|
class GridCell
|
||||||
{
|
{
|
||||||
@ -13,9 +12,7 @@ public:
|
|||||||
|
|
||||||
GridCell();
|
GridCell();
|
||||||
void ClearRoomData(Room* room);
|
void ClearRoomData(Room* room);
|
||||||
void AddHuman(Human* hum);
|
|
||||||
void RemoveHuman(Human* hum);
|
|
||||||
bool ExistsHuman(Human* hum);
|
|
||||||
void TouchHumanList(std::function<void (Human*, bool&)>& func,
|
void TouchHumanList(std::function<void (Human*, bool&)>& func,
|
||||||
int room_idx,
|
int room_idx,
|
||||||
bool& stop);
|
bool& stop);
|
||||||
@ -23,16 +20,15 @@ public:
|
|||||||
int room_idx,
|
int room_idx,
|
||||||
bool& stop);
|
bool& stop);
|
||||||
|
|
||||||
|
void AddCreature(Creature* c);
|
||||||
|
void RemoveCreature(Creature* c);
|
||||||
|
bool CreatureExists(Creature* c);
|
||||||
void AddBullet(Bullet* bullet);
|
void AddBullet(Bullet* bullet);
|
||||||
void RemoveBullet(Bullet* bullet);
|
void RemoveBullet(Bullet* bullet);
|
||||||
void AddCar(Car* car);
|
|
||||||
void RemoveCar(Car* car);
|
|
||||||
void AddHero(Hero* hero);
|
|
||||||
void RemoveHero(Hero* hero);
|
|
||||||
void AddPermanentEntity(Entity* entity);
|
void AddPermanentEntity(Entity* entity);
|
||||||
void AddRoomEntity(Room* room, Entity* entity);
|
void AddRoomEntity(Room* room, Entity* entity);
|
||||||
void RemoveRoomEntity(Room* room, Entity* entity);
|
void RemoveRoomEntity(Room* room, Entity* entity);
|
||||||
bool ExistsEntity(Room* room, Entity* Entity);
|
bool EntityExists(Room* room, Entity* Entity);
|
||||||
void TouchLayer0EntityList(std::function<void (Entity*, bool&)>& func,
|
void TouchLayer0EntityList(std::function<void (Entity*, bool&)>& func,
|
||||||
bool& stop);
|
bool& stop);
|
||||||
void TouchLayer1EntityList(std::function<void (Entity*, bool&)>& func,
|
void TouchLayer1EntityList(std::function<void (Entity*, bool&)>& func,
|
||||||
@ -43,9 +39,7 @@ public:
|
|||||||
bool& stop);
|
bool& stop);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::set<Human*>> human_list_;
|
std::vector<std::set<Entity*>> entitys_;
|
||||||
std::vector<std::set<Entity*>> entity_list_;
|
std::vector<std::set<Bullet*>> bullets_;
|
||||||
std::vector<std::set<Bullet*>> bullet_list_;
|
std::vector<std::set<Creature*>> creatures_;
|
||||||
std::vector<std::set<Car*>> car_list_;
|
|
||||||
std::vector<std::set<Hero*>> hero_list_;
|
|
||||||
};
|
};
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
#include "bullet.h"
|
#include "bullet.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "gridcell.h"
|
#include "gridcell.h"
|
||||||
#include "car.h"
|
|
||||||
#include "hero.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1 2 3
|
1 2 3
|
||||||
@ -102,25 +100,31 @@ void GridService::ClearRoomData(Room* room)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridService::AddHuman(Human* hum)
|
void GridService::AddCreature(Creature* c)
|
||||||
{
|
{
|
||||||
int x = (int)hum->GetX() + cell_width_;
|
int x = (int)c->GetX() + cell_width_;
|
||||||
int y = (int)hum->GetY() + cell_width_;
|
int y = (int)c->GetY() + cell_width_;
|
||||||
if (BroderOverFlow(x, y)) {
|
if (BroderOverFlow(x, y)) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
hum->SetGridId(x/cell_width_ + (y/cell_width_) * cell_count_per_row_);
|
c->SetGridId(x/cell_width_ + (y/cell_width_) * cell_count_per_row_);
|
||||||
if (hum->GetGridId() == 0 || hum->GetGridId() > max_grid_id_) {
|
if (c->GetGridId() == 0 || c->GetGridId() > max_grid_id_) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
cells_[hum->GetGridId()].AddHuman(hum);
|
cells_[c->GetGridId()].AddCreature(c);
|
||||||
GetAllCells(hum->room, hum->GetGridId(), hum->GetGridList());
|
GetAllCells(c->room, c->GetGridId(), c->GetGridList());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridService::MoveHuman(Human* hum)
|
void GridService::RemoveCreature(Creature* c)
|
||||||
{
|
{
|
||||||
int new_x = (int)hum->GetX() + cell_width_;
|
GridCell& cell = cells_[c->GetGridId()];
|
||||||
int new_y = (int)hum->GetY() + cell_width_;
|
cell.RemoveCreature(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridService::MoveCreature(Creature* c)
|
||||||
|
{
|
||||||
|
int new_x = (int)c->GetX() + cell_width_;
|
||||||
|
int new_y = (int)c->GetY() + cell_width_;
|
||||||
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
|
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
|
||||||
if (BroderOverFlow(new_x, new_y)) {
|
if (BroderOverFlow(new_x, new_y)) {
|
||||||
abort();
|
abort();
|
||||||
@ -128,20 +132,20 @@ void GridService::MoveHuman(Human* hum)
|
|||||||
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
|
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
if (new_grid_id != hum->GetGridId()) {
|
if (new_grid_id != c->GetGridId()) {
|
||||||
std::set<GridCell*> inc_grid_list;
|
std::set<GridCell*> inc_grid_list;
|
||||||
std::set<GridCell*> dec_grid_list;
|
std::set<GridCell*> dec_grid_list;
|
||||||
std::set<GridCell*> old_grid_list = hum->GetGridList();
|
std::set<GridCell*> old_grid_list = c->GetGridList();
|
||||||
ComputeDiff(hum->room,
|
ComputeDiff(c->room,
|
||||||
hum->GetGridId(),
|
c->GetGridId(),
|
||||||
new_grid_id,
|
new_grid_id,
|
||||||
hum->GetGridList(),
|
c->GetGridList(),
|
||||||
inc_grid_list,
|
inc_grid_list,
|
||||||
dec_grid_list);
|
dec_grid_list);
|
||||||
cells_[hum->GetGridId()].RemoveHuman(hum);
|
cells_[c->GetGridId()].RemoveCreature(c);
|
||||||
cells_[new_grid_id].AddHuman(hum);
|
cells_[new_grid_id].AddCreature(c);
|
||||||
hum->SetGridId(new_grid_id);
|
c->SetGridId(new_grid_id);
|
||||||
hum->OnGridListChange(old_grid_list, inc_grid_list, dec_grid_list);
|
c->OnGridListChange(old_grid_list, inc_grid_list, dec_grid_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,104 +197,6 @@ void GridService::DelBullet(Bullet* bullet)
|
|||||||
cell.RemoveBullet(bullet);
|
cell.RemoveBullet(bullet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridService::AddCar(Car* car)
|
|
||||||
{
|
|
||||||
int x = (int)car->GetX() + cell_width_;
|
|
||||||
int y = (int)car->GetY() + cell_width_;
|
|
||||||
if (BroderOverFlow(x, y)) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
car->SetGridId(x/cell_width_ + (y/cell_width_) * cell_count_per_row_);
|
|
||||||
if (car->GetGridId() == 0 || car->GetGridId() > max_grid_id_) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
cells_[car->GetGridId()].AddCar(car);
|
|
||||||
GetAllCells(car->room, car->GetGridId(), car->GetGridList());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::MoveCar(Car* car)
|
|
||||||
{
|
|
||||||
int new_x = (int)car->GetX() + cell_width_;
|
|
||||||
int new_y = (int)car->GetY() + cell_width_;
|
|
||||||
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
|
|
||||||
if (BroderOverFlow(new_x, new_y)) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
if (new_grid_id != car->GetGridId()) {
|
|
||||||
std::set<GridCell*> inc_grid_list;
|
|
||||||
std::set<GridCell*> dec_grid_list;
|
|
||||||
std::set<GridCell*> old_grid_list = car->GetGridList();
|
|
||||||
ComputeDiff(car->room,
|
|
||||||
car->GetGridId(),
|
|
||||||
new_grid_id,
|
|
||||||
car->GetGridList(),
|
|
||||||
inc_grid_list,
|
|
||||||
dec_grid_list);
|
|
||||||
cells_[car->GetGridId()].RemoveCar(car);
|
|
||||||
cells_[new_grid_id].AddCar(car);
|
|
||||||
car->SetGridId(new_grid_id);
|
|
||||||
car->OnGridListChange(old_grid_list, inc_grid_list, dec_grid_list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::DelCar(Car* car)
|
|
||||||
{
|
|
||||||
GridCell& cell = cells_[car->GetGridId()];
|
|
||||||
cell.RemoveCar(car);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::AddHero(Hero* hero)
|
|
||||||
{
|
|
||||||
int x = (int)hero->GetX() + cell_width_;
|
|
||||||
int y = (int)hero->GetY() + cell_width_;
|
|
||||||
if (BroderOverFlow(x, y)) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
hero->SetGridId(x/cell_width_ + (y/cell_width_) * cell_count_per_row_);
|
|
||||||
if (hero->GetGridId() == 0 || hero->GetGridId() > max_grid_id_) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
cells_[hero->GetGridId()].AddHero(hero);
|
|
||||||
GetAllCells(hero->room, hero->GetGridId(), hero->GetGridList());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::MoveHero(Hero* hero)
|
|
||||||
{
|
|
||||||
int new_x = (int)hero->GetX() + cell_width_;
|
|
||||||
int new_y = (int)hero->GetY() + cell_width_;
|
|
||||||
int new_grid_id = new_x/cell_width_ + (new_y/cell_width_) * cell_count_per_row_;
|
|
||||||
if (BroderOverFlow(new_x, new_y)) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
if (new_grid_id == 0 || new_grid_id > max_grid_id_) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
if (new_grid_id != hero->GetGridId()) {
|
|
||||||
std::set<GridCell*> inc_grid_list;
|
|
||||||
std::set<GridCell*> dec_grid_list;
|
|
||||||
std::set<GridCell*> old_grid_list = hero->GetGridList();
|
|
||||||
ComputeDiff(hero->room,
|
|
||||||
hero->GetGridId(),
|
|
||||||
new_grid_id,
|
|
||||||
hero->GetGridList(),
|
|
||||||
inc_grid_list,
|
|
||||||
dec_grid_list);
|
|
||||||
cells_[hero->GetGridId()].RemoveHero(hero);
|
|
||||||
cells_[new_grid_id].AddHero(hero);
|
|
||||||
hero->SetGridId(new_grid_id);
|
|
||||||
hero->OnGridListChange(old_grid_list, inc_grid_list, dec_grid_list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::DelHero(Hero* hero)
|
|
||||||
{
|
|
||||||
GridCell& cell = cells_[hero->GetGridId()];
|
|
||||||
cell.RemoveHero(hero);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridService::AddRoomEntity(Room* room, Entity* entity)
|
void GridService::AddRoomEntity(Room* room, Entity* entity)
|
||||||
{
|
{
|
||||||
assert(!entity->IsEntityType(ET_Player));
|
assert(!entity->IsEntityType(ET_Player));
|
||||||
@ -327,10 +233,10 @@ void GridService::AddPermanentEntity(Entity* entity)
|
|||||||
cells_[entity->GetGridId()].AddPermanentEntity(entity);
|
cells_[entity->GetGridId()].AddPermanentEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GridService::HumanInGridList(Human* hum, std::set<GridCell*>& grid_list)
|
bool GridService::CreatureInGridList(Creature* c, std::set<GridCell*>& grid_list)
|
||||||
{
|
{
|
||||||
for (auto& cell : grid_list) {
|
for (auto& cell : grid_list) {
|
||||||
if (cell->ExistsHuman(hum)) {
|
if (cell->CreatureExists(c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,7 +246,7 @@ bool GridService::HumanInGridList(Human* hum, std::set<GridCell*>& grid_list)
|
|||||||
bool GridService::EntityInGridList(Room* room, Entity* entity, std::set<GridCell*>& grid_list)
|
bool GridService::EntityInGridList(Room* room, Entity* entity, std::set<GridCell*>& grid_list)
|
||||||
{
|
{
|
||||||
for (auto& cell : grid_list) {
|
for (auto& cell : grid_list) {
|
||||||
if (cell->ExistsEntity(room, entity)) {
|
if (cell->EntityExists(room, entity)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,7 +390,7 @@ void GridService::DeatchHuman(Human* target)
|
|||||||
},
|
},
|
||||||
target->room->GetRoomIdx(),
|
target->room->GetRoomIdx(),
|
||||||
stop);
|
stop);
|
||||||
cell->RemoveHuman(target);
|
cell->RemoveCreature(target);
|
||||||
}
|
}
|
||||||
target->SetGridId(0);
|
target->SetGridId(0);
|
||||||
target->GetGridList().clear();
|
target->GetGridList().clear();
|
||||||
|
@ -4,8 +4,7 @@ class Human;
|
|||||||
class Entity;
|
class Entity;
|
||||||
class Room;
|
class Room;
|
||||||
class Bullet;
|
class Bullet;
|
||||||
class Car;
|
class Creature;
|
||||||
class Hero;
|
|
||||||
class GridCell;
|
class GridCell;
|
||||||
class GridService
|
class GridService
|
||||||
{
|
{
|
||||||
@ -21,27 +20,20 @@ class GridService
|
|||||||
bool CanAdd(float x, float y);
|
bool CanAdd(float x, float y);
|
||||||
void ClearRoomData(Room* room);
|
void ClearRoomData(Room* room);
|
||||||
|
|
||||||
void AddHuman(Human* hum);
|
void AddCreature(Creature* c);
|
||||||
void MoveHuman(Human* hum);
|
void RemoveCreature(Creature* c);
|
||||||
|
void MoveCreature(Creature* c);
|
||||||
|
|
||||||
void AddBullet(Bullet* bullet);
|
void AddBullet(Bullet* bullet);
|
||||||
void MoveBullet(Bullet* bullet);
|
void MoveBullet(Bullet* bullet);
|
||||||
void DelBullet(Bullet* bullet);
|
void DelBullet(Bullet* bullet);
|
||||||
|
|
||||||
void AddCar(Car* car);
|
|
||||||
void MoveCar(Car* car);
|
|
||||||
void DelCar(Car* car);
|
|
||||||
|
|
||||||
void AddHero(Hero* hero);
|
|
||||||
void MoveHero(Hero* hero);
|
|
||||||
void DelHero(Hero* hero);
|
|
||||||
|
|
||||||
void AddRoomEntity(Room* room, Entity* entity);
|
void AddRoomEntity(Room* room, Entity* entity);
|
||||||
void DelRoomEntity(Room* room, Entity* entity);
|
void DelRoomEntity(Room* room, Entity* entity);
|
||||||
|
|
||||||
void AddPermanentEntity(Entity* entity);
|
void AddPermanentEntity(Entity* entity);
|
||||||
|
|
||||||
bool HumanInGridList(Human* hum, std::set<GridCell*>& grid_list);
|
bool CreatureInGridList(Creature* c, std::set<GridCell*>& grid_list);
|
||||||
bool EntityInGridList(Room* room, Entity* entity, std::set<GridCell*>& grid_list);
|
bool EntityInGridList(Room* room, Entity* entity, std::set<GridCell*>& grid_list);
|
||||||
bool InView(int a_grid, int b_grid);
|
bool InView(int a_grid, int b_grid);
|
||||||
bool InView(int grid_id, float x, float y);
|
bool InView(int grid_id, float x, float y);
|
||||||
|
@ -91,7 +91,7 @@ void Hero::InternalUpdateMove(float speed)
|
|||||||
|
|
||||||
SetPos(new_pos);
|
SetPos(new_pos);
|
||||||
if (!IsCollisionInMapService()) {
|
if (!IsCollisionInMapService()) {
|
||||||
room->grid_service->MoveHero(this);
|
room->grid_service->MoveCreature(this);
|
||||||
} else {
|
} else {
|
||||||
if (on_move_collision && !on_move_collision()) {
|
if (on_move_collision && !on_move_collision()) {
|
||||||
SetPos(old_pos);
|
SetPos(old_pos);
|
||||||
|
@ -2133,7 +2133,7 @@ void Human::_InternalUpdateMove(float speed)
|
|||||||
#if 1
|
#if 1
|
||||||
SetPos(old_pos + a8::Vec2(nx, ny));
|
SetPos(old_pos + a8::Vec2(nx, ny));
|
||||||
if (!IsCollisionInMapService()) {
|
if (!IsCollisionInMapService()) {
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (Global::last_collider && Global::last_collider->type == CT_Circle) {
|
if (Global::last_collider && Global::last_collider->type == CT_Circle) {
|
||||||
@ -2148,7 +2148,7 @@ void Human::_InternalUpdateMove(float speed)
|
|||||||
SetPos(GetPos() + new_dir);
|
SetPos(GetPos() + new_dir);
|
||||||
}
|
}
|
||||||
if (!IsCollisionInMapService()) {
|
if (!IsCollisionInMapService()) {
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2174,7 +2174,7 @@ void Human::_InternalUpdateMove(float speed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetPos(old_pos + a8::Vec2(nx, ny));
|
SetPos(old_pos + a8::Vec2(nx, ny));
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ClearFrameData()
|
void Human::ClearFrameData()
|
||||||
@ -2730,7 +2730,7 @@ void Human::FindLocationWithTarget(Entity* target)
|
|||||||
float distance = (new_pos - old_pos).Norm();
|
float distance = (new_pos - old_pos).Norm();
|
||||||
for (int i = distance; i < 10000000; i += 5) {
|
for (int i = distance; i < 10000000; i += 5) {
|
||||||
SetPos(old_pos + new_pos_dir * i);
|
SetPos(old_pos + new_pos_dir * i);
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
|
|
||||||
Entity* building = nullptr;
|
Entity* building = nullptr;
|
||||||
std::set<GridCell*> tmp_grids;
|
std::set<GridCell*> tmp_grids;
|
||||||
@ -2915,16 +2915,6 @@ void Human::DecItem(int item_id, int item_num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Human::IsPlayer() const
|
|
||||||
{
|
|
||||||
return IsEntitySubType(EST_Player);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Human::IsAndroid() const
|
|
||||||
{
|
|
||||||
return IsEntitySubType(EST_Android);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Human::DropItems(Obstacle* obstacle)
|
void Human::DropItems(Obstacle* obstacle)
|
||||||
{
|
{
|
||||||
bool is_treasure_box = false;
|
bool is_treasure_box = false;
|
||||||
@ -3101,7 +3091,7 @@ void Human::OnEnable()
|
|||||||
{
|
{
|
||||||
a8::UnSetBitFlag(status, HS_Disable);
|
a8::UnSetBitFlag(status, HS_Disable);
|
||||||
enable_frameno = room->GetFrameNo();
|
enable_frameno = room->GetFrameNo();
|
||||||
room->grid_service->AddHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
FindLocation();
|
FindLocation();
|
||||||
RefreshView();
|
RefreshView();
|
||||||
}
|
}
|
||||||
@ -3191,7 +3181,7 @@ void Human::ProcIncGridList(std::set<GridCell*>& old_grids,
|
|||||||
inc_grids,
|
inc_grids,
|
||||||
[this, &old_grids] (Human* hum, bool& stop)
|
[this, &old_grids] (Human* hum, bool& stop)
|
||||||
{
|
{
|
||||||
if (!room->grid_service->HumanInGridList(hum, old_grids)) {
|
if (!room->grid_service->CreatureInGridList(hum, old_grids)) {
|
||||||
hum->AddToNewObjects(this);
|
hum->AddToNewObjects(this);
|
||||||
hum->AddToPartObjects(this);
|
hum->AddToPartObjects(this);
|
||||||
hum->RemoveOutObjects(this);
|
hum->RemoveOutObjects(this);
|
||||||
@ -3233,7 +3223,7 @@ void Human::ProcDecGridList(std::set<GridCell*>& old_grids,
|
|||||||
dec_grids,
|
dec_grids,
|
||||||
[this] (Human* hum, bool& stop)
|
[this] (Human* hum, bool& stop)
|
||||||
{
|
{
|
||||||
if (!room->grid_service->HumanInGridList(hum, GetGridList())) {
|
if (!room->grid_service->CreatureInGridList(hum, GetGridList())) {
|
||||||
AddOutObjects(hum);
|
AddOutObjects(hum);
|
||||||
hum->AddOutObjects(this);
|
hum->AddOutObjects(this);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -3476,7 +3466,7 @@ void Human::OnLand()
|
|||||||
for (const a8::Vec2& dir : dirs) {
|
for (const a8::Vec2& dir : dirs) {
|
||||||
SetPos(old_pos + dir * i);
|
SetPos(old_pos + dir * i);
|
||||||
if (!IsCollisionInMapService()) {
|
if (!IsCollisionInMapService()) {
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,8 +240,6 @@ class Human : public Creature
|
|||||||
int GetItemNum(int item_id);
|
int GetItemNum(int item_id);
|
||||||
void AddItem(int item_id, int item_num);
|
void AddItem(int item_id, int item_num);
|
||||||
void DecItem(int item_id, int item_num);
|
void DecItem(int item_id, int item_num);
|
||||||
virtual bool IsPlayer() const override;
|
|
||||||
virtual bool IsAndroid() const override;
|
|
||||||
virtual void DropItems(Obstacle* obstacle) override;
|
virtual void DropItems(Obstacle* obstacle) override;
|
||||||
void ProcNewBieLogic();
|
void ProcNewBieLogic();
|
||||||
void OnEnable();
|
void OnEnable();
|
||||||
|
@ -46,7 +46,7 @@ void MoveableEntity::OnGridListChange(std::set<GridCell*>& old_grids,
|
|||||||
inc_grids,
|
inc_grids,
|
||||||
[this, &old_grids] (Human* hum, bool& stop)
|
[this, &old_grids] (Human* hum, bool& stop)
|
||||||
{
|
{
|
||||||
if (!room->grid_service->HumanInGridList(hum, old_grids)) {
|
if (!room->grid_service->CreatureInGridList(hum, old_grids)) {
|
||||||
hum->AddToNewObjects(this);
|
hum->AddToNewObjects(this);
|
||||||
hum->AddToPartObjects(this);
|
hum->AddToPartObjects(this);
|
||||||
hum->RemoveOutObjects(this);
|
hum->RemoveOutObjects(this);
|
||||||
@ -60,7 +60,7 @@ void MoveableEntity::OnGridListChange(std::set<GridCell*>& old_grids,
|
|||||||
dec_grids,
|
dec_grids,
|
||||||
[this] (Human* hum, bool& stop)
|
[this] (Human* hum, bool& stop)
|
||||||
{
|
{
|
||||||
if (!room->grid_service->HumanInGridList(hum, GetGridList())) {
|
if (!room->grid_service->CreatureInGridList(hum, GetGridList())) {
|
||||||
hum->AddOutObjects(this);
|
hum->AddOutObjects(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -58,7 +58,7 @@ void Player::InternalUpdate(int delta_time)
|
|||||||
}
|
}
|
||||||
if (HasBuffEffect(kBET_Fly)) {
|
if (HasBuffEffect(kBET_Fly)) {
|
||||||
SetPos(room->plane.curr_pos);
|
SetPos(room->plane.curr_pos);
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveCreature(this);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||||
GetCar()->SyncPos();
|
GetCar()->SyncPos();
|
||||||
|
@ -237,7 +237,7 @@ void Room::AddPlayer(Player* hum)
|
|||||||
alive_count_chged_frameno_ = GetFrameNo();
|
alive_count_chged_frameno_ = GetFrameNo();
|
||||||
++PerfMonitor::Instance()->alive_count;
|
++PerfMonitor::Instance()->alive_count;
|
||||||
|
|
||||||
grid_service->AddHuman(hum);
|
grid_service->AddCreature(hum);
|
||||||
hum->FindLocation();
|
hum->FindLocation();
|
||||||
hum->RefreshView();
|
hum->RefreshView();
|
||||||
AddPlayerPostProc(hum);
|
AddPlayerPostProc(hum);
|
||||||
@ -352,7 +352,7 @@ void Room::CreateAndroid(int robot_num)
|
|||||||
} else {
|
} else {
|
||||||
AddToAliveHumanHash(hum);
|
AddToAliveHumanHash(hum);
|
||||||
AddToMoveableHash(hum);
|
AddToMoveableHash(hum);
|
||||||
grid_service->AddHuman(hum);
|
grid_service->AddCreature(hum);
|
||||||
hum->FindLocation();
|
hum->FindLocation();
|
||||||
hum->RefreshView();
|
hum->RefreshView();
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ Car* Room::CreateCar(Human* driver,
|
|||||||
}
|
}
|
||||||
car->Initialize();
|
car->Initialize();
|
||||||
AddToEntityHash(car);
|
AddToEntityHash(car);
|
||||||
grid_service->AddCar(car);
|
grid_service->AddCreature(car);
|
||||||
car->RefreshView();
|
car->RefreshView();
|
||||||
car->BroadcastFullState(this);
|
car->BroadcastFullState(this);
|
||||||
return car;
|
return car;
|
||||||
@ -584,7 +584,7 @@ Hero* Room::CreateHero(Creature* master,
|
|||||||
hero->Initialize();
|
hero->Initialize();
|
||||||
AddToEntityHash(hero);
|
AddToEntityHash(hero);
|
||||||
AddToMoveableHash(hero);
|
AddToMoveableHash(hero);
|
||||||
grid_service->AddHero(hero);
|
grid_service->AddCreature(hero);
|
||||||
hero->RefreshView();
|
hero->RefreshView();
|
||||||
return hero;
|
return hero;
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
|
|||||||
{
|
{
|
||||||
entity->RemoveFromAroundPlayers(entity->room);
|
entity->RemoveFromAroundPlayers(entity->room);
|
||||||
entity->BroadcastDeleteState(entity->room);
|
entity->BroadcastDeleteState(entity->room);
|
||||||
entity->room->grid_service->DelCar((Car*)entity);
|
entity->room->grid_service->RemoveCreature((Car*)entity);
|
||||||
entity->room->RemoveFromMoveableHash((Car*)entity);
|
entity->room->RemoveFromMoveableHash((Car*)entity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1685,7 +1685,7 @@ void Room::ShuaPlane()
|
|||||||
pair.second->SetPos(plane.curr_pos);
|
pair.second->SetPos(plane.curr_pos);
|
||||||
pair.second->attack_dir = plane.dir;
|
pair.second->attack_dir = plane.dir;
|
||||||
pair.second->move_dir = plane.dir;
|
pair.second->move_dir = plane.dir;
|
||||||
grid_service->MoveHuman(pair.second);
|
grid_service->MoveCreature(pair.second);
|
||||||
pair.second->AddToNewObjects(pair.second);
|
pair.second->AddToNewObjects(pair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3029,7 +3029,7 @@ void Room::CombineTeamBornPoint()
|
|||||||
if (!a8::HasBitFlag(hum->status, HS_Disable)) {
|
if (!a8::HasBitFlag(hum->status, HS_Disable)) {
|
||||||
hum->FindLocation();
|
hum->FindLocation();
|
||||||
hum->RefreshView();
|
hum->RefreshView();
|
||||||
grid_service->MoveHuman(hum);
|
grid_service->MoveCreature(hum);
|
||||||
} else if (room_type_ == RT_MidBrid && !hum->team_uuid.empty()){
|
} else if (room_type_ == RT_MidBrid && !hum->team_uuid.empty()){
|
||||||
EnableHuman(hum);
|
EnableHuman(hum);
|
||||||
}
|
}
|
||||||
@ -3050,7 +3050,7 @@ void Room::ForceSetBornPoint(Human* hum, BornPoint* born_point)
|
|||||||
}
|
}
|
||||||
hum->FindLocation();
|
hum->FindLocation();
|
||||||
hum->RefreshView();
|
hum->RefreshView();
|
||||||
grid_service->MoveHuman(hum);
|
grid_service->MoveCreature(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user