This commit is contained in:
aozhiwei 2022-04-07 14:30:08 +08:00
parent 37135c3173
commit 0f4712b43f
3 changed files with 23 additions and 0 deletions

View File

@ -818,6 +818,8 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
p->add_values(pair.second); p->add_values(pair.second);
} }
} }
stats.CalcReward(this, stats.rank, stats.kills);
TypeConvert::ToPb(stats.over_reward, msg.mutable_reward());
} }
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id) void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)

View File

@ -1,6 +1,8 @@
#include "precompile.h" #include "precompile.h"
#include "typeconvert.h"
#include "cs_proto.pb.h" #include "cs_proto.pb.h"
#include "human.h"
namespace TypeConvert namespace TypeConvert
{ {
@ -16,4 +18,18 @@ namespace TypeConvert
v.y = pb_obj->y(); v.y = pb_obj->y();
} }
void ToPb(const OverReward& v, cs::MFOverReward* pb_obj)
{
pb_obj->set_total(v.total);
pb_obj->mutable_hero()->set_obtain_gold(v.hero.obtain_gold);
pb_obj->mutable_hero()->set_gold_limit(v.hero.gold_limit);
pb_obj->mutable_weapon1()->set_obtain_gold(v.weapon1.obtain_gold);
pb_obj->mutable_weapon1()->set_gold_limit(v.weapon1.gold_limit);
pb_obj->mutable_weapon2()->set_obtain_gold(v.weapon2.obtain_gold);
pb_obj->mutable_weapon2()->set_gold_limit(v.weapon2.gold_limit);
}
} }

View File

@ -3,10 +3,15 @@
namespace cs namespace cs
{ {
class MFVec2; class MFVec2;
class MFOverReward;
} }
struct OverReward;
namespace TypeConvert namespace TypeConvert
{ {
void ToPb(const a8::Vec2& v, cs::MFVec2* pb_obj); void ToPb(const a8::Vec2& v, cs::MFVec2* pb_obj);
void FromPb(a8::Vec2& v, const cs::MFVec2* pb_obj); void FromPb(a8::Vec2& v, const cs::MFVec2* pb_obj);
void ToPb(const OverReward& v, cs::MFOverReward* pb_obj);
} }