This commit is contained in:
aozhiwei 2023-03-24 10:03:16 +08:00
parent 6438c98d43
commit c61c8966e6
3 changed files with 8 additions and 2 deletions

View File

@ -50,6 +50,7 @@ namespace mtb
float hp_ratio() const { return hp_ratio_; };
float damage_ratio() const { return damage_ratio_; };
float defence_ratio() const { return defence_ratio_; };
const std::string bt() const { return bt_; };
bool has_id() const { return __flags__.test(0);};
bool has_radius() const { return __flags__.test(1);};
@ -91,6 +92,7 @@ namespace mtb
bool has_hp_ratio() const { return __flags__.test(37);};
bool has_damage_ratio() const { return __flags__.test(38);};
bool has_defence_ratio() const { return __flags__.test(39);};
bool has_bt() const { return __flags__.test(40);};
protected:
@ -134,9 +136,10 @@ namespace mtb
float hp_ratio_ = 0.0f;
float damage_ratio_ = 0.0f;
float defence_ratio_ = 0.0f;
std::string bt_;
public:
std::bitset<40> __flags__;
std::bitset<41> __flags__;
};
};

View File

@ -297,7 +297,7 @@ namespace mtb
{
a8::reflect::Class* meta_class = nullptr;
if (!meta_class) {
meta_class = new a8::reflect::Class("Hero", 40, 0);
meta_class = new a8::reflect::Class("Hero", 41, 0);
meta_class->SetSimpleField(0, "id", a8::reflect::ET_INT32, my_offsetof2(Hero, id_));
meta_class->SetSimpleField(1, "radius", a8::reflect::ET_FLOAT, my_offsetof2(Hero, radius_));
meta_class->SetSimpleField(2, "move_speed", a8::reflect::ET_INT32, my_offsetof2(Hero, move_speed_));
@ -338,6 +338,7 @@ namespace mtb
meta_class->SetSimpleField(37, "hp_ratio", a8::reflect::ET_FLOAT, my_offsetof2(Hero, hp_ratio_));
meta_class->SetSimpleField(38, "damage_ratio", a8::reflect::ET_FLOAT, my_offsetof2(Hero, damage_ratio_));
meta_class->SetSimpleField(39, "defence_ratio", a8::reflect::ET_FLOAT, my_offsetof2(Hero, defence_ratio_));
meta_class->SetSimpleField(40, "bt", a8::reflect::ET_STRING, my_offsetof2(Hero, bt_));
}
return meta_class;
}

View File

@ -259,6 +259,8 @@ message Hero
optional float hp_ratio = 63;
optional float damage_ratio = 64;
optional float defence_ratio = 65;
optional string bt = 70;
}
message Robot