|
@@ -168,6 +168,7 @@ struct card_message_handle
|
|
|
log_warn("%s","当前代码没有处理历史消息记录。");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
if(loc.m_batty_status == 2)
|
|
|
{
|
|
|
m_card->do_status(STA_TYPE::STATUS_LOW_POWER);
|
|
@@ -176,6 +177,7 @@ struct card_message_handle
|
|
|
{
|
|
|
m_card->do_status(STA_TYPE::STATUS_HELP);
|
|
|
}
|
|
|
+
|
|
|
m_ct_list[loc.m_card_ct&(m_ct_list.size()-1)]->on_message(loop,loc);
|
|
|
}
|
|
|
};
|
|
@@ -199,6 +201,7 @@ struct person:card_location_base,card_area
|
|
|
m_message_handle->on_message(loop,loc,is_history);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
struct car:card_location_base,card_area
|
|
|
{
|
|
|
car(std::string type)
|
|
@@ -216,39 +219,21 @@ loc_tool_main one_ct_message_handle::m_loc_tool;
|
|
|
|
|
|
struct card_list_impl:card_list
|
|
|
{
|
|
|
- std::vector<card_location_base*> m_list;
|
|
|
-
|
|
|
card_list_impl()
|
|
|
{
|
|
|
- m_list.reserve(1<<16);
|
|
|
}
|
|
|
|
|
|
void init_card_from_db()
|
|
|
{
|
|
|
- for(int i=0;i<(1<<16);i++)
|
|
|
- {
|
|
|
- card_location_base * mp = new car("car1");
|
|
|
- m_list.push_back(mp);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- card_location_base *get(uint64_t card_id)const
|
|
|
- {
|
|
|
- uint32_t cid=0xFFFF&card_id;
|
|
|
-
|
|
|
- if(cid>=m_list.size())
|
|
|
- return nullptr;
|
|
|
-
|
|
|
- return m_list[cid];
|
|
|
}
|
|
|
|
|
|
void on_message(zloop<task*> *loop,const message_locinfo&loc,bool is_history)
|
|
|
{
|
|
|
- card_location_base *c=get(loc.m_card_id);
|
|
|
+ std::shared_ptr<card_location_base> c=get(loc.long_id());
|
|
|
|
|
|
if(c==nullptr)
|
|
|
{
|
|
|
- log_warn("数据库中未定义该卡的信息,card_id=%d", loc.m_card_id);
|
|
|
+ log_warn("数据库中未定义该卡的信息,type=%d,card_id=%d", loc.m_card_type, loc.m_card_id);
|
|
|
return;
|
|
|
}
|
|
|
|