This commit is contained in:
aozhiwei 2022-12-30 15:01:42 +08:00
parent 0a2920cb12
commit 7a90166a53
3 changed files with 13 additions and 11 deletions

View File

@ -13,14 +13,16 @@ namespace mt
{
std::vector<std::string> strings;
a8::Split(start_point(), strings, ':');
_start_point_x = a8::XValue(strings[0]).GetDouble();
_start_point_y = a8::XValue(strings[1]).GetDouble();
start_point_.x = a8::XValue(strings[0]).GetDouble();
start_point_.y = 0.0f;
start_point_.z = a8::XValue(strings[1]).GetDouble();
}
{
std::vector<std::string> strings;
a8::Split(end_point(), strings, ':');
_end_point_x = a8::XValue(strings[0]).GetDouble();
_end_point_y = a8::XValue(strings[1]).GetDouble();
end_point_.x = a8::XValue(strings[0]).GetDouble();
end_point_.y = 0.0f;
end_point_.z = a8::XValue(strings[1]).GetDouble();
}
{
auto itr = mapid_hash_.find(map_id());

View File

@ -10,18 +10,18 @@ namespace mt
"airline@airline.csv",
"id")
public:
float _start_point_x = 0.0f;
float _start_point_y = 0.0f;
float _end_point_x = 0.0f;
float _end_point_y = 0.0f;
void Init1();
const glm::vec3& GetStartPoint() const { return start_point_; };
const glm::vec3& GetEndPoint() const { return end_point_; };
static const AirLine* RandAirLine(int map_id);
private:
static std::map<int, std::vector<const mt::AirLine*>> mapid_hash_;
glm::vec3 start_point_;
glm::vec3 end_point_;
};
}

View File

@ -1845,8 +1845,8 @@ void Room::ShuaPlane()
if (!airline_) {
A8_ABORT();
}
plane.start_point = glm::vec3(airline_->_start_point_x, 0.0f, airline_->_start_point_y);
plane.end_point = glm::vec3(airline_->_end_point_x, 0.0f, airline_->_end_point_y);
plane.start_point = airline_->GetStartPoint();
plane.end_point = airline_->GetEndPoint();
plane.dir = plane.end_point - plane.start_point;
GlmHelper::Normalize(plane.dir);
plane.curr_pos = plane.start_point;