rename skin -> tank
This commit is contained in:
parent
bfff27e082
commit
38937b0d42
@ -25,7 +25,7 @@ Android::~Android()
|
||||
void Android::Initialize()
|
||||
{
|
||||
Human::Initialize();
|
||||
SetSkinInfo(MetaMgr::Instance()->RandTank());
|
||||
SetTankInfo(MetaMgr::Instance()->RandTank());
|
||||
tank_meta = MetaMgr::Instance()->GetTank(TankId());
|
||||
if (tank_meta) {
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(tank_meta->i->skill_id());
|
||||
|
@ -15,7 +15,7 @@ class Hero : public Entity
|
||||
|
||||
Human* master = nullptr;
|
||||
|
||||
Skin skin;
|
||||
Tank skin;
|
||||
int backpack = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
|
@ -121,7 +121,7 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
|
||||
p->set_downed(downed);
|
||||
#endif
|
||||
p->set_disconnected(disconnected);
|
||||
tank.ToPB(p->mutable_skin());
|
||||
tank_.ToPB(p->mutable_skin());
|
||||
p->set_backpack(backpack);
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
@ -705,7 +705,7 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||
player_data->set_action_target_id(action_target_id);
|
||||
}
|
||||
}
|
||||
tank.ToPB(player_data->mutable_skin());
|
||||
tank_.ToPB(player_data->mutable_skin());
|
||||
player_data->set_backpack(backpack);
|
||||
player_data->set_helmet(helmet);
|
||||
player_data->set_chest(chest);
|
||||
@ -1123,33 +1123,33 @@ int Human::GetWeaponConfigLv(int weapon_id)
|
||||
return itr != weapon_configs.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
int Human::GetSkinConfigLv(int skin_id)
|
||||
int Human::GetTankConfigLv(int tank_id)
|
||||
{
|
||||
auto itr = skin_configs.find(skin_id);
|
||||
return itr != skin_configs.end() ? itr->second : 0;
|
||||
auto itr = tank_configs.find(tank_id);
|
||||
return itr != tank_configs.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
void Human::SetSkinInfo(int skin_id)
|
||||
void Human::SetTankInfo(int tank_id)
|
||||
{
|
||||
tank.skin_id = skin_id;
|
||||
if (tank.skin_id != 0){
|
||||
tank.skin_lv = std::max(1, GetSkinConfigLv(tank.skin_id));
|
||||
tank_.tank_id = tank_id;
|
||||
if (tank_.tank_id != 0){
|
||||
tank_.tank_lv = std::max(1, GetTankConfigLv(tank_.tank_id));
|
||||
}
|
||||
}
|
||||
|
||||
const Skin& Human::GetTank()
|
||||
const Tank& Human::GetTank()
|
||||
{
|
||||
return tank;
|
||||
return tank_;
|
||||
}
|
||||
|
||||
int Human::TankId()
|
||||
{
|
||||
return tank.skin_id;
|
||||
return tank_.tank_id;
|
||||
}
|
||||
|
||||
int Human::TankLv()
|
||||
{
|
||||
return tank.skin_lv;
|
||||
return tank_.tank_lv;
|
||||
}
|
||||
|
||||
int Human::GetSkillLeftTime()
|
||||
|
@ -62,7 +62,7 @@ class Human : public Entity
|
||||
int action_duration = 0;
|
||||
int action_item_id = 0;
|
||||
int action_target_id = 0;
|
||||
Skin tankskin;
|
||||
TankSkin tankskin;
|
||||
Driver driver;
|
||||
int backpack = 0;
|
||||
int helmet = 0;
|
||||
@ -102,7 +102,7 @@ class Human : public Entity
|
||||
long long send_msg_times = 0;
|
||||
|
||||
std::map<int, int> weapon_configs;
|
||||
std::map<int, int> skin_configs;
|
||||
std::map<int, int> tank_configs;
|
||||
|
||||
bool use_skill = false;
|
||||
size_t curr_skill_phase = 0;
|
||||
@ -181,9 +181,9 @@ class Human : public Entity
|
||||
void SendUIUpdate();
|
||||
void SendWxVoip();
|
||||
int GetWeaponConfigLv(int weapon_id);
|
||||
int GetSkinConfigLv(int skin_id);
|
||||
void SetSkinInfo(int skin_id);
|
||||
const Skin& GetTank();
|
||||
int GetTankConfigLv(int tank_id);
|
||||
void SetTankInfo(int tank_id);
|
||||
const Tank& GetTank();
|
||||
int TankId();
|
||||
int TankLv();
|
||||
int GetSkillLeftTime();
|
||||
@ -266,7 +266,7 @@ private:
|
||||
bool already_report_battle_ = false;
|
||||
bool sent_game_end_ = false;
|
||||
|
||||
Skin tank;
|
||||
Tank tank_;
|
||||
|
||||
xtimer_list* grass_hide_timer_list_ = nullptr;
|
||||
xtimer_list* leave_grass_timer_list_ = nullptr;
|
||||
|
@ -59,7 +59,7 @@ Player* PlayerMgr::CreatePlayerByCMJoin(long ip_saddr, int socket, const cs::CMJ
|
||||
}
|
||||
for (auto& skin : msg.skins()) {
|
||||
if (skin.skin_id() != 0 && skin.skin_lv() > 0) {
|
||||
hum->skin_configs[skin.skin_id()] = skin.skin_lv();
|
||||
hum->tank_configs[skin.skin_id()] = skin.skin_lv();
|
||||
}
|
||||
}
|
||||
if (msg.weapon().weapon_id() != 0) {
|
||||
@ -78,7 +78,7 @@ Player* PlayerMgr::CreatePlayerByCMJoin(long ip_saddr, int socket, const cs::CMJ
|
||||
hum->curr_weapon = &hum->weapons[GUN_SLOT0];
|
||||
}
|
||||
}
|
||||
hum->SetSkinInfo(msg.baseskin());
|
||||
hum->SetTankInfo(msg.baseskin());
|
||||
hum->driver.FromPB(&msg.driver());
|
||||
hum->tankskin.FromPB(&msg.tankskin());
|
||||
socket_hash_[socket] = hum;
|
||||
|
@ -20,13 +20,25 @@ int Weapon::GetClipVolume()
|
||||
return meta->i->clip_volume();
|
||||
}
|
||||
|
||||
void Skin::FromPB(const cs::MFSkin* pb_obj)
|
||||
void Tank::FromPB(const cs::MFSkin* pb_obj)
|
||||
{
|
||||
tank_id = pb_obj->skin_id();
|
||||
tank_lv = pb_obj->skin_lv();
|
||||
}
|
||||
|
||||
void Tank::ToPB(cs::MFSkin* pb_obj)
|
||||
{
|
||||
pb_obj->set_skin_id(tank_id);
|
||||
pb_obj->set_skin_lv(tank_lv);
|
||||
}
|
||||
|
||||
void TankSkin::FromPB(const cs::MFSkin* pb_obj)
|
||||
{
|
||||
skin_id = pb_obj->skin_id();
|
||||
skin_lv = pb_obj->skin_lv();
|
||||
}
|
||||
|
||||
void Skin::ToPB(cs::MFSkin* pb_obj)
|
||||
void TankSkin::ToPB(cs::MFSkin* pb_obj)
|
||||
{
|
||||
pb_obj->set_skin_id(skin_id);
|
||||
pb_obj->set_skin_lv(skin_lv);
|
||||
|
@ -56,7 +56,16 @@ struct Weapon
|
||||
int GetClipVolume();
|
||||
};
|
||||
|
||||
struct Skin
|
||||
struct Tank
|
||||
{
|
||||
int tank_id = 0;
|
||||
int tank_lv = 0;
|
||||
|
||||
void FromPB(const cs::MFSkin* pb_obj);
|
||||
void ToPB(cs::MFSkin* pb_obj);
|
||||
};
|
||||
|
||||
struct TankSkin
|
||||
{
|
||||
int skin_id = 0;
|
||||
int skin_lv = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user