完善模式协议
This commit is contained in:
parent
ad43e3a120
commit
db9a820e6b
@ -278,6 +278,18 @@ enum ObjectSyncFlags_e
|
||||
kOsfIsDead = 0,
|
||||
};
|
||||
|
||||
enum RoomMode_e
|
||||
{
|
||||
kChiJiMode = 0,
|
||||
kZombieMode = 1
|
||||
};
|
||||
|
||||
enum RaceType_e
|
||||
{
|
||||
kHumanRace = 1,
|
||||
kZombieRace = 2
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -277,6 +277,7 @@ class Human : public MoveableEntity
|
||||
void SetLastCollisionDoor(Entity* door) { last_collision_door_ = door; }
|
||||
ObjectSyncFlags* GetObjectSyncFlags(int obj_uniid);
|
||||
void _UpdateMove(int speed);
|
||||
RaceType_e GetRace() { return race_; }
|
||||
|
||||
protected:
|
||||
void _InternalUpdateMove(float speed);
|
||||
@ -355,6 +356,7 @@ protected:
|
||||
MetaData::Skill* skill_meta_ = nullptr;
|
||||
|
||||
private:
|
||||
RaceType_e race_ = kHumanRace;
|
||||
CircleCollider* self_collider_ = nullptr;
|
||||
long long last_sync_gas_frameno = 0;
|
||||
std::list<Buff> buff_list_;
|
||||
|
@ -45,6 +45,7 @@ Room::~Room()
|
||||
void Room::InitData(RoomInitInfo& init_info)
|
||||
{
|
||||
room_idx_ = init_info.room_idx;
|
||||
room_mode_ = init_info.room_mode;
|
||||
room_uuid_ = init_info.room_uuid;
|
||||
room_type_ = init_info.room_type;
|
||||
creator_game_times_ = init_info.creator_game_times;
|
||||
|
@ -207,6 +207,7 @@ private:
|
||||
|
||||
private:
|
||||
int room_idx_ = 0;
|
||||
RoomMode_e room_mode_ = kChiJiMode;
|
||||
long long room_uuid_ = 0;
|
||||
const MetaData::Map* map_meta_ = nullptr;
|
||||
std::string map_tpl_name_;
|
||||
|
@ -130,8 +130,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
Room* room = GetJoinableRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
register_time,
|
||||
msg.force_entry_newbie_room()
|
||||
register_time
|
||||
);
|
||||
if (!room) {
|
||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
||||
@ -166,8 +165,7 @@ int RoomMgr::OverRoomNum()
|
||||
Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
const RoomType_e self_room_type,
|
||||
int game_times,
|
||||
int creator_register_time,
|
||||
bool force_entry_newbie_room
|
||||
int creator_register_time
|
||||
)
|
||||
{
|
||||
std::vector<std::vector<Room*>> group_rooms;
|
||||
@ -188,16 +186,16 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
return group_rooms[self_room_type][rand() % group_rooms[self_room_type].size()];
|
||||
}
|
||||
if (self_room_type == RT_NewBrid) {
|
||||
return CreateRoom(self_room_type,
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time,
|
||||
force_entry_newbie_room);
|
||||
creator_register_time);
|
||||
}
|
||||
if (self_room_type == RT_MidBrid) {
|
||||
return CreateRoom(self_room_type,
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time,
|
||||
force_entry_newbie_room);
|
||||
creator_register_time);
|
||||
}
|
||||
for (int i = 0; i < RT_Max; ++i) {
|
||||
for (Room* room : group_rooms[i]) {
|
||||
@ -206,10 +204,10 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
||||
}
|
||||
}
|
||||
}
|
||||
return CreateRoom(self_room_type,
|
||||
return CreateRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
creator_register_time,
|
||||
force_entry_newbie_room);
|
||||
creator_register_time);
|
||||
}
|
||||
|
||||
Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
||||
@ -382,10 +380,10 @@ int RoomMgr::AllocRoomIdx()
|
||||
return current_room_idx_;
|
||||
}
|
||||
|
||||
Room* RoomMgr::CreateRoom(RoomType_e room_type,
|
||||
Room* RoomMgr::CreateRoom(const cs::CMJoin& msg,
|
||||
RoomType_e room_type,
|
||||
int game_times,
|
||||
int creator_register_time,
|
||||
bool force_entry_newbie_room)
|
||||
int creator_register_time)
|
||||
{
|
||||
int room_idx = AllocRoomIdx();
|
||||
if (room_idx < 1) {
|
||||
@ -398,7 +396,7 @@ Room* RoomMgr::CreateRoom(RoomType_e room_type,
|
||||
init_info.room_type = room_type;
|
||||
init_info.creator_game_times = game_times;
|
||||
init_info.creator_register_time = creator_register_time;
|
||||
init_info.force_entry_newbie_room = force_entry_newbie_room;
|
||||
init_info.force_entry_newbie_room = msg.force_entry_newbie_room();
|
||||
if (GetRoomByUuid(init_info.room_uuid)) {
|
||||
abort();
|
||||
}
|
||||
|
@ -36,17 +36,16 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
Room* GetJoinableRoom(const cs::CMJoin& msg,
|
||||
const RoomType_e self_room_type,
|
||||
int game_times,
|
||||
int creator_register_time,
|
||||
bool force_entry_newbie_room);
|
||||
int creator_register_time);
|
||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||
void FreeOverRoom(long long room_uuid);
|
||||
bool IsLimitJoin();
|
||||
|
||||
int AllocRoomIdx();
|
||||
Room* CreateRoom(RoomType_e room_type,
|
||||
Room* CreateRoom(const cs::CMJoin& msg,
|
||||
RoomType_e room_type,
|
||||
int game_times,
|
||||
int creator_register_time,
|
||||
bool force_entry_newbie_room);
|
||||
int creator_register_time);
|
||||
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
|
||||
|
||||
private:
|
||||
|
@ -151,6 +151,7 @@ class Building;
|
||||
struct RoomInitInfo
|
||||
{
|
||||
int room_idx = 0;
|
||||
RoomMode_e room_mode = kChiJiMode;
|
||||
long long room_uuid = 0;
|
||||
RoomType_e room_type = RT_NewBrid;
|
||||
int creator_game_times = 0;
|
||||
|
@ -698,6 +698,7 @@ message MFPosition
|
||||
optional int32 obj_uniid = 1; //唯一id
|
||||
optional MFVec2 pos = 2; //位置
|
||||
optional MFVec2 dir = 3; //朝向
|
||||
optional int32 race = 4; //1:人 2:僵尸
|
||||
}
|
||||
|
||||
//end mfmsg
|
||||
@ -910,8 +911,7 @@ message SMUpdate
|
||||
//一下字段只有僵尸模式才有效
|
||||
repeated int32 revive_objids = 41; //复活的玩家
|
||||
repeated MFTuple dead_objs = 42; //死亡的玩家values[0]:objid values[1]:多少毫秒后复活
|
||||
repeated MFPosition zombie_positions = 43; //僵尸位置信息
|
||||
repeated MFPosition human_positions = 44; //人类位置信息
|
||||
repeated MFPosition object_positions = 43; //对象坐标信息,如果对象已经在part_objects则可能不发,这时客户端可以读取part_objects里的左边更新小地图
|
||||
optional int32 game_left_time = 45; //游戏剩余时间(毫秒, 战斗开始后字段才有意义)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user