game2006/server/gameserver/typeconvert.cc
aozhiwei 912073235b 1
2022-09-15 21:23:15 +08:00

34 lines
873 B
C++

#include "precompile.h"
#include "typeconvert.h"
#include "cs_proto.pb.h"
#include "human.h"
namespace TypeConvert
{
void ToPb(const a8::Vec2& v, cs::MFVec2* pb_obj)
{
pb_obj->set_x(v.x);
pb_obj->set_y(v.y);
}
void FromPb(a8::Vec2& v, const cs::MFVec2* pb_obj)
{
v.x = pb_obj->x();
v.y = pb_obj->y();
}
void ToPb(const OverReward& v, cs::MFOverReward* pb_obj)
{
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);
}
}