1
This commit is contained in:
parent
c469a91cbf
commit
72c8797fb5
@ -40,6 +40,7 @@ void Room::Init(const cs::CMJoin& msg)
|
||||
room_unionid = msg.team_uuid();
|
||||
{
|
||||
RoomMember p;
|
||||
p.entity_uniid = AllocUniid();
|
||||
p.accountid = msg.account_id();
|
||||
p.name = msg.name();
|
||||
p.avatar_url = msg.avatar_url();
|
||||
@ -50,6 +51,7 @@ void Room::Init(const cs::CMJoin& msg)
|
||||
for (auto& member : msg.room_member()) {
|
||||
if (members_hash_.size() < kROOM_MAX_PLAYER_NUM) {
|
||||
RoomMember p;
|
||||
p.entity_uniid = AllocUniid();
|
||||
p.accountid = member.account_id();
|
||||
p.name = member.name();
|
||||
p.avatar_url = member.avatar_url();
|
||||
@ -69,6 +71,7 @@ void Room::Init(const cs::CMJoin& msg)
|
||||
std::string robot_id = a8::Format("$robot_%d", {tmp_robot_meta.i->id()});
|
||||
if (members_hash_.find(robot_id) == members_hash_.end()) {
|
||||
RoomMember p;
|
||||
p.entity_uniid = AllocUniid();
|
||||
p.accountid = robot_id;
|
||||
p.name = tmp_robot_meta.i->name();
|
||||
p.avatar_url = "";
|
||||
@ -205,9 +208,11 @@ int Room::AliveCount()
|
||||
void Room::AddPlayer(Player* hum)
|
||||
{
|
||||
assert(gas_data.gas_mode == kGasInactive);
|
||||
int entity_uniid = 0;
|
||||
{
|
||||
auto itr = members_hash_.find(hum->account_id);
|
||||
if (itr != members_hash_.end()) {
|
||||
entity_uniid = itr->second.entity_uniid;
|
||||
itr->second.online = true;
|
||||
} else {
|
||||
abort();
|
||||
@ -218,7 +223,11 @@ void Room::AddPlayer(Player* hum)
|
||||
RandRemoveAndroid();
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
hum->entity_uniid = entity_uniid;
|
||||
#else
|
||||
hum->entity_uniid = AllocUniid();
|
||||
#endif
|
||||
hum->born_point = AllocBornPoint();
|
||||
{
|
||||
const MetaData::MapTplThing& thing_tpl = (*born_points_)[hum->born_point];
|
||||
@ -544,6 +553,22 @@ bool Room::IsGameOver()
|
||||
|
||||
void Room::FillSMUiUpdate(cs::SMUiUpdate& msg)
|
||||
{
|
||||
#if 1
|
||||
for (auto& pair : members_hash_) {
|
||||
cs::MFPlayerBattlingStats* p = msg.add_player_stats();
|
||||
p->set_player_id(pair.second.entity_uniid);
|
||||
p->set_name(pair.second.name);
|
||||
p->set_kills(0);
|
||||
p->set_last_kill_timeseq(0);
|
||||
for (auto& pair2 : human_hash_) {
|
||||
if (pair2.second->account_id == pair.second.accountid) {
|
||||
p->set_kills(pair2.second->stats.kills);
|
||||
p->set_last_kill_timeseq(pair2.second->stats.last_kill_timeseq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (auto& pair : human_hash_) {
|
||||
cs::MFPlayerBattlingStats* p = msg.add_player_stats();
|
||||
p->set_player_id(pair.second->entity_uniid);
|
||||
@ -551,6 +576,7 @@ void Room::FillSMUiUpdate(cs::SMUiUpdate& msg)
|
||||
p->set_kills(pair.second->stats.kills);
|
||||
p->set_last_kill_timeseq(pair.second->stats.last_kill_timeseq);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Hero* Room::CreateHero(Human* hum)
|
||||
@ -1328,7 +1354,11 @@ void Room::SpllyAndroid()
|
||||
#if 0
|
||||
hum->robot_meta = robot_meta;
|
||||
#endif
|
||||
#if 1
|
||||
hum->entity_uniid = pair.second.entity_uniid;
|
||||
#else
|
||||
hum->entity_uniid = AllocUniid();
|
||||
#endif
|
||||
hum->born_point = AllocBornPoint();
|
||||
{
|
||||
const MetaData::MapTplThing& thing_tpl = (*born_points_)[hum->born_point];
|
||||
|
@ -25,6 +25,7 @@ namespace MetaData
|
||||
|
||||
struct RoomMember
|
||||
{
|
||||
int entity_uniid = 0;
|
||||
std::string accountid;
|
||||
std::string name;
|
||||
std::string avatar_url;
|
||||
|
Loading…
x
Reference in New Issue
Block a user