修复同步自己问题

This commit is contained in:
aozhiwei 2019-03-22 14:35:19 +08:00
parent fd9f9e2b96
commit f1943cc35b
6 changed files with 22 additions and 0 deletions

View File

@ -137,6 +137,12 @@ MetaData::Map* MetaMgr::GetMap(int map_id)
return itr != loader_->gamemap_hash.end() ? itr->second : nullptr;
}
MetaData::MapThing* MetaMgr::GetMapThing(int mapthing_id)
{
auto itr = loader_->mapthing_hash.find(mapthing_id);
return itr != loader_->mapthing_hash.end() ? itr->second : nullptr;
}
MetaData::Player* MetaMgr::GetPlayer(int id)
{
auto itr = loader_->player_hash.find(id);

View File

@ -18,6 +18,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
std::string GetSysParam(const std::string& param_name);
MetaData::Map* GetMap(int map_id);
MetaData::MapThing* GetMapThing(int mapthing_id);
MetaData::Player* GetPlayer(int id);
MetaData::Equip* GetEquip(int id);

View File

@ -9,6 +9,7 @@
#include "movement.h"
#include "bullet.h"
#include "collider.h"
#include "obstacle.h"
const int ROOM_MAX_PLAYER_NUM = 50;
const int ANDROID_NUM = 0;
@ -79,6 +80,8 @@ void Room::AddPlayer(Player* hum)
accountid_hash_[hum->account_id] = hum;
human_hash_[hum->entity_uniid] = hum;
++alive_count_;
hum->new_players.insert(hum);
hum->part_players.insert(hum);
for (auto& pair : human_hash_) {
if (pair.second != hum) {
pair.second->new_players.insert(hum);
@ -133,6 +136,14 @@ void Room::ShuaAndroid()
}
}
void Room::ShuaObstacle(Human* hum)
{
MetaData::MapThing* thing = MetaMgr::Instance()->GetMapThing(61001);
if (!thing) {
return;
}
}
bool Room::RandomPos(Human* hum, float distance, Vector2D& out_pos)
{
float angle = ((float)rand() / RAND_MAX) * 2.0f;

View File

@ -45,6 +45,7 @@ public:
void AddBullet(Bullet* bullet);
unsigned short AllocUniid();
void ShuaAndroid();
void ShuaObstacle(Human* hum);
bool RandomPos(Human* hum, float distance, Vector2D& out_pos);
Human* FindEnemy(Human* hum);
void CollisionDetection(Entity* sender, int detection_flags, std::vector<Entity*> objects);

View File

@ -55,6 +55,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
{
cs::SMJoinedNotify notifymsg;
notifymsg.set_error_code(0);
room->FillSMJoinedNotify(hum, notifymsg);
GGListener::Instance()->SendToClient(hdr.socket_handle, hdr.seqid, notifymsg);
}

View File

@ -545,6 +545,8 @@ message SMJoinedNotify
optional int32 map_type = 5; //
optional bool elo_start = 6; //
optional int32 error_code = 7; //
}
//