1
0
Selaa lähdekoodia

Merge branch 'master' of zengminguo/server-l-zmg into master

zhuyf 2 vuotta sitten
vanhempi
commit
4970d1047d
2 muutettua tiedostoa jossa 24 lisäystä ja 9 poistoa
  1. 23 8
      card_base.cpp
  2. 1 1
      card_car.cpp

+ 23 - 8
card_base.cpp

@@ -145,17 +145,32 @@ void card_location_base::on_location(const std::vector<point>&vp, const std::vec
         sid = site_ptr->m_id;
 	if(pt.m_useless)
 	{
-		if (!is_v_map)
+		if (is_person())
 		{
-			x = tool_other::round(pt.x, 3);
-			y = tool_other::round(pt.y, 3);
+			if (!is_v_map)
+			{
+				x = tool_other::round(pt.x, 3);
+				y = tool_other::round(pt.y, 3);
+			}
+			else
+			{
+				m_v_point.x = tool_other::round(pt.x, 3);
+				m_v_point.y = tool_other::round(pt.y, 3);
+				log_info("useful loc m_v_point: type=%d, card=%d, site=%d, ct=%d, timestamp=%llu, x=%f, y=%f, speed=%.2f, acc=%.2f", m_type, m_id, sid, m_ct, m_time, m_v_point.x, m_v_point.y, m_speed, lm[0].m_acc);
+				return;
+			}
 		}
-		else
+		else if (is_vehicle())
 		{
-			m_v_point.x = tool_other::round(pt.x, 3);
-			m_v_point.y = tool_other::round(pt.y, 3);
-			log_info("useful loc m_v_point: type=%d, card=%d, site=%d, ct=%d, timestamp=%llu, x=%f, y=%f, speed=%.2f, acc=%.2f", m_type, m_id, sid, m_ct, m_time, m_v_point.x, m_v_point.y, m_speed, lm[0].m_acc);
-			return;
+			if (is_v_map)
+			{
+				x = tool_other::round(pt.x, 3);
+				y = tool_other::round(pt.y, 3);
+			}
+			else
+			{
+				return;
+			}
 		}
 
 		double acc = lm[0].m_acc;

+ 1 - 1
card_car.cpp

@@ -89,7 +89,7 @@ void car::handle_anti_coll(const point& pt, const int& sid)
             int d = (c.second->m_timeval >= m_timeval ? (c.second->m_timeval - m_timeval) : (m_timeval - c.second->m_timeval)) / 1000.0;
             s = ((c.second->m_timeval >= m_timeval ? (c.second->m_timeval - m_timeval) : (m_timeval - c.second->m_timeval)) /1000.0 <= 30);
             //float dist = pt.dist(*c.second);
-			float dist = pt.dist(*c.second.m_v_point);
+			float dist = pt.dist(c.second->m_v_point);
             if(dist < k.second && s){
                 int call_level = 5 - k.first;
                 log_info("[anti_coll] distance=%.3f, level=%d, thre_value=%.3f, time_diff=%d", dist, call_level, k.second, d);