Browse Source

add const

lixioayao 6 years ago
parent
commit
3e3cb4f97d
6 changed files with 8 additions and 10 deletions
  1. 1 1
      Makefile.am
  2. 2 2
      ant.cpp
  3. 0 1
      card_car.cpp
  4. 1 2
      card_person.cpp
  5. 1 1
      module_service/area_business_person_attendance.cpp
  6. 3 3
      znet.cpp

+ 1 - 1
Makefile.am

@@ -44,7 +44,7 @@ client_SOURCES=client.cpp message_file.cpp
 client_CPPFLAGS=${AM_CPPFLAGS}
 client_LDFLAGS=${AM_LDFLAGS}  -L. -lzlog
 
-test_SOURCES=test.cpp base64.cpp
+test_SOURCES=test.cpp base64.cpp point.cpp
 test_CPPFLAGS=${AM_CPPFLAGS}
 test_LDFLAGS=${AM_LDFLAGS}  -L. -lzlog -lrt
 

+ 2 - 2
ant.cpp

@@ -41,7 +41,7 @@ void ant::set_path(const std::vector<line_v>&v_line,std::vector<line_v>::const_i
 		m_path[1][i].swap_point();
 	}
 
-	for(auto&p:m_path)
+	for(const auto&p:m_path)
 	{
 		log_info("site-path: %s",p.to_str().c_str());
 	}
@@ -196,7 +196,7 @@ bool visit_site_status::visit(std::shared_ptr<site> s)
 {
 	time_t now=time(0);
 	int diff = now-s->m_time;
-	event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_ERROR,s->m_id,READER_TIMEOUT,diff,[diff](){return diff>READER_TIMEOUT;});
+	event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_ERROR,s->m_id,READER_TIMEOUT,diff,diff>READER_TIMEOUT);
 	return true;
 }
 

+ 0 - 1
card_car.cpp

@@ -35,7 +35,6 @@ void car::set_area_info(int mapid,double scale,int areaid,uint64_t t,int type)
 void car::do_business(const std::shared_ptr<site>&site,const point &pt,double acc)
 {
 	m_acc=acc;
-    m_area_tool->set_site(site);
 	m_area_tool->on_point(shared_from_this(),pt);
 	m_timeval=m_time;
 	m_mine_tool->on_point(m_id, m_type, m_vehicle_category_id);

+ 1 - 2
card_person.cpp

@@ -90,7 +90,6 @@ std::shared_ptr<mine_tool> person::get_mine_tool()
 
 void person::do_business(const std::shared_ptr<site>&site,const point &pt,double acc)
 {
-    m_area_tool->set_site(site);
 	m_area_tool->on_point(shared_from_this(),pt);
 	m_timeval=m_time;
 	handle_three_rates(pt);
@@ -144,7 +143,7 @@ void person::on_timer()
 
 	if(m_upmine_flag.load())
 	{
-		m_upmine_flag.store(0);
+		m_upmine_flag=0;
 		m_area_tool->on_leave(shared_from_this());
 	}
 }

+ 1 - 1
module_service/area_business_person_attendance.cpp

@@ -110,7 +110,7 @@ void area_business_person_attendance::handle_up_mine(sio::message::ptr const& da
         if(card_ptr && STATUS_LOST == card_ptr->m_biz_stat)
         {
             log_info("handle_up_card:%s 手工升井,处理",s_card_id.c_str());
-            module_meta_date_changed::clear_card(card_ptr);
+            card_ptr->inc_upmine_flag();
         }
         else
             log_warn("handle_up_card:%s,手动升井的卡找不到,或者该卡不在盲区",s_card_id.c_str());

+ 3 - 3
znet.cpp

@@ -55,7 +55,7 @@ public:
 
 	void boardcast(const std::vector<char>&msg)
 	{
-		for(auto&i:m_thread_clts)
+		for(const auto&i:m_thread_clts)
 		{
 			std::vector<char> tmp(msg);
 			i->send(std::move(tmp));
@@ -99,7 +99,7 @@ public:
 
 	void close_all()
 	{
-		for(auto&clt:m_thread_clts)
+		for(const auto&clt:m_thread_clts)
 		{
 			if(!clt)
 				continue;
@@ -110,7 +110,7 @@ public:
 
 	void on_async(const std::list<std::shared_ptr<client>>&notify_clts)
 	{
-		for(auto&clt:notify_clts)
+		for(const auto&clt:notify_clts)
 		{
 			((client_ex*)clt.get())->on_notify();
 		}