|
@@ -14,62 +14,65 @@
|
|
//服务器重启加载数据
|
|
//服务器重启加载数据
|
|
void area_business_count_checker::on_load_his(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
|
|
void area_business_count_checker::on_load_his(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
|
|
{
|
|
{
|
|
- if (nullptr == a->m_area )
|
|
|
|
- return ;
|
|
|
|
- if (c->is_person() && !a->m_area->m_event_person_count)
|
|
|
|
- {
|
|
|
|
- EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
|
|
- auto ev_ptr_temp = event_list::instance()->get_event_area(a->m_area->id(),ev);
|
|
|
|
- if (ev_ptr_temp && !ev_ptr_temp->is_end())
|
|
|
|
- a->m_area->m_event_person_count = true;
|
|
|
|
|
|
+ if (nullptr == a->m_area )
|
|
|
|
+ return ;
|
|
|
|
+ if (c->is_person() && !a->m_area->m_event_person_count)
|
|
|
|
+ {
|
|
|
|
+ EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
|
|
+ auto ev_ptr_temp = event_list::instance()->get_event_area(a->m_area->id(),ev);
|
|
|
|
+ if (ev_ptr_temp && !ev_ptr_temp->is_end())
|
|
|
|
+ a->m_area->m_event_person_count = true;
|
|
|
|
|
|
- }
|
|
|
|
- else if (c->is_vehicle() && !a->m_area->m_event_vehicle_count)
|
|
|
|
- {
|
|
|
|
- EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
|
|
- auto ev_ptr_temp = event_list::instance()->get_event_area(a->m_area->id(),ev);
|
|
|
|
- if (ev_ptr_temp && !ev_ptr_temp->is_end())
|
|
|
|
- {
|
|
|
|
- a->m_area->m_event_vehicle_count = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- on_enter(a,c,ptr);
|
|
|
|
|
|
+ }
|
|
|
|
+ else if (c->is_vehicle() && !a->m_area->m_event_vehicle_count)
|
|
|
|
+ {
|
|
|
|
+ EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
|
|
+ auto ev_ptr_temp = event_list::instance()->get_event_area(a->m_area->id(),ev);
|
|
|
|
+ if (ev_ptr_temp && !ev_ptr_temp->is_end())
|
|
|
|
+ {
|
|
|
|
+ a->m_area->m_event_vehicle_count = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ on_enter(a,c,ptr);
|
|
}
|
|
}
|
|
|
|
|
|
//增加计数,并进行判断
|
|
//增加计数,并进行判断
|
|
void area_business_count_checker::on_enter(const std::shared_ptr<area_hover>&a,
|
|
void area_business_count_checker::on_enter(const std::shared_ptr<area_hover>&a,
|
|
const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
|
|
const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
|
|
{
|
|
{
|
|
- if (nullptr == a->m_area )//|| !a->m_area->is_mine())
|
|
|
|
- {
|
|
|
|
- return ;
|
|
|
|
- }
|
|
|
|
|
|
+ if (nullptr == a->m_area )//|| !a->m_area->is_mine())
|
|
|
|
+ {
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
if (c->is_person())
|
|
if (c->is_person())
|
|
{
|
|
{
|
|
a->m_area->m_person_count ++ ;
|
|
a->m_area->m_person_count ++ ;
|
|
|
|
+ //printf("Person=%d On Enter Aread=%d! CurPersonCount=%d,LimitCount=%d, IsEvent=%d \n"
|
|
|
|
+ // ,c->m_id,a->m_area->m_id, (int)a->m_area->m_person_count , a->m_area->m_limit_person_count,a->m_area->m_event_person_count);
|
|
|
|
+
|
|
if (!a->m_area->m_event_person_count && a->m_area->m_person_count > a->m_area->m_limit_person_count)
|
|
if (!a->m_area->m_event_person_count && a->m_area->m_person_count > a->m_area->m_limit_person_count)
|
|
- {
|
|
|
|
- a->m_area->m_event_person_count = true;
|
|
|
|
- EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
|
|
- event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_person_count,a->m_area->m_person_count,true);
|
|
|
|
- log_info("area_business_count_checker::on_enter : Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
- ,ev,a->m_area->id(),a->m_area->m_limit_person_count,(int)a->m_area->m_person_count);
|
|
|
|
- }
|
|
|
|
|
|
+ {
|
|
|
|
+ a->m_area->m_event_person_count = true;
|
|
|
|
+ EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_person_count,a->m_area->m_person_count,true);
|
|
|
|
+ log_info("area_business_count_checker::on_enter : Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
+ ,ev,a->m_area->id(),a->m_area->m_limit_person_count,(int)a->m_area->m_person_count);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (c->is_vehicle())
|
|
else if (c->is_vehicle())
|
|
{
|
|
{
|
|
- a->m_area->m_vehicle_count ++ ;
|
|
|
|
-
|
|
|
|
- log_info("area_id:%d,v_count:%d",a->m_area->m_id,a->m_area->m_vehicle_count.load());
|
|
|
|
|
|
+ a->m_area->m_vehicle_count ++ ;
|
|
|
|
+ printf("Vehicle=%d On Enter Aread=%d! CurVehicleCount=%d,LimitCount=%d, IsEvent=%d \n"
|
|
|
|
+ ,c->m_id,a->m_area->m_id, (int)a->m_area->m_vehicle_count , a->m_area->m_limit_vehicle_count,a->m_area->m_event_vehicle_count);
|
|
|
|
|
|
- if (a->m_area->m_vehicle_count > a->m_area->m_limit_vehicle_count && !a->m_area->m_event_vehicle_count)
|
|
|
|
- {
|
|
|
|
- a->m_area->m_event_vehicle_count = true;
|
|
|
|
- EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
|
|
- event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,a->m_area->m_vehicle_count,true);
|
|
|
|
- log_info("area_business_count_checker::on_enter : Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
- ,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,(int)a->m_area->m_vehicle_count);
|
|
|
|
- }
|
|
|
|
|
|
+ if (a->m_area->m_vehicle_count > a->m_area->m_limit_vehicle_count && !a->m_area->m_event_vehicle_count)
|
|
|
|
+ {
|
|
|
|
+ a->m_area->m_event_vehicle_count = true;
|
|
|
|
+ EVENT_TYPE ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,a->m_area->m_vehicle_count,true);
|
|
|
|
+ log_info("area_business_count_checker::on_enter : Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
+ ,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,(int)a->m_area->m_vehicle_count);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -82,10 +85,10 @@ void area_business_count_checker::on_hover(const std::shared_ptr<area_hover>&a,
|
|
void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
{
|
|
{
|
|
- if (nullptr == a->m_area )
|
|
|
|
- {
|
|
|
|
- return ;
|
|
|
|
- }
|
|
|
|
|
|
+ if (nullptr == a->m_area )
|
|
|
|
+ {
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
int limitVal = 0;
|
|
int limitVal = 0;
|
|
int curVal = 0;
|
|
int curVal = 0;
|
|
bool tmp_event = false;
|
|
bool tmp_event = false;
|
|
@@ -97,13 +100,13 @@ void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
curVal = a->m_area->m_person_count;
|
|
curVal = a->m_area->m_person_count;
|
|
tmp_event = a->m_area->m_event_person_count;
|
|
tmp_event = a->m_area->m_event_person_count;
|
|
ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
|
|
- if(tmp_event && curVal < limitVal)
|
|
|
|
- {
|
|
|
|
- a->m_area->m_event_person_count = false;
|
|
|
|
- log_info("area_business_count_checker::on_leave :Cancel Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
- ,ev,a->m_area->id(),limitVal,curVal);
|
|
|
|
- event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),limitVal,curVal,false);
|
|
|
|
- }
|
|
|
|
|
|
+ if(tmp_event && curVal < limitVal)
|
|
|
|
+ {
|
|
|
|
+ a->m_area->m_event_person_count = false;
|
|
|
|
+ log_info("area_business_count_checker::on_leave :Cancel Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
+ ,ev,a->m_area->id(),limitVal,curVal);
|
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),limitVal,curVal,false);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (c->is_vehicle())
|
|
else if (c->is_vehicle())
|
|
{
|
|
{
|
|
@@ -112,13 +115,13 @@ void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
curVal = a->m_area->m_vehicle_count;
|
|
curVal = a->m_area->m_vehicle_count;
|
|
tmp_event = a->m_area->m_event_vehicle_count;
|
|
tmp_event = a->m_area->m_event_vehicle_count;
|
|
ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
|
|
- if(tmp_event && curVal < limitVal)
|
|
|
|
- {
|
|
|
|
- a->m_area->m_event_vehicle_count = false;
|
|
|
|
- log_info("area_business_count_checker::on_leave :Cancel Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
- ,ev,a->m_area->id(),limitVal,curVal);
|
|
|
|
- event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),limitVal,curVal,false);
|
|
|
|
- }
|
|
|
|
|
|
+ if(tmp_event && curVal <= limitVal)
|
|
|
|
+ {
|
|
|
|
+ a->m_area->m_event_vehicle_count = false;
|
|
|
|
+ log_info("area_business_count_checker::on_leave :Cancel Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
|
|
|
|
+ ,ev,a->m_area->id(),limitVal,curVal);
|
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),limitVal,curVal,false);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|