|
@@ -40,35 +40,33 @@ void area_business_count_checker::on_load_his(const std::shared_ptr<area_hover>&
|
|
|
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)
|
|
|
{
|
|
|
- if (nullptr == a->m_area )//|| !a->m_area->is_mine())
|
|
|
- {
|
|
|
+ if (nullptr == a->m_area )
|
|
|
return ;
|
|
|
- }
|
|
|
if (c->is_person())
|
|
|
{
|
|
|
a->m_area->m_person_count ++ ;
|
|
|
- if (!a->m_area->m_event_person_count && a->m_area->m_person_count > a->m_area->m_limit_person_count)
|
|
|
+ int pc=a->m_area->m_person_count.load();
|
|
|
+ if (!a->m_area->m_event_person_count && pc > 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);
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_person_count,pc,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);
|
|
|
+ ,ev,a->m_area->id(),a->m_area->m_limit_person_count,pc);
|
|
|
}
|
|
|
}
|
|
|
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());
|
|
|
-
|
|
|
- if (a->m_area->m_vehicle_count > a->m_area->m_limit_vehicle_count && !a->m_area->m_event_vehicle_count)
|
|
|
+ int vc=a->m_area->m_vehicle_count.load();
|
|
|
+ log_info("area_id:%d,v_count:%d",a->m_area->m_id,vc);
|
|
|
+ if (vc > 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);
|
|
|
+ event_tool::instance()->handle_event(OT_AREA,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,vc,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);
|
|
|
+ ,ev,a->m_area->id(),a->m_area->m_limit_vehicle_count,vc);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -94,7 +92,7 @@ void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
|
{
|
|
|
a->m_area->m_person_count -- ;
|
|
|
limitVal = a->m_area->m_limit_person_count;
|
|
|
- curVal = a->m_area->m_person_count;
|
|
|
+ curVal = a->m_area->m_person_count.load();
|
|
|
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 ;
|
|
|
if(tmp_event && curVal < limitVal)
|
|
@@ -109,7 +107,7 @@ void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
|
|
|
{
|
|
|
a->m_area->m_vehicle_count -- ;
|
|
|
limitVal = a->m_area->m_limit_vehicle_count;
|
|
|
- curVal = a->m_area->m_vehicle_count;
|
|
|
+ curVal = a->m_area->m_vehicle_count.load();
|
|
|
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 ;
|
|
|
if(tmp_event && curVal < limitVal)
|