Commit 8763c49e authored by Chen Bill's avatar Chen Bill

use memcpy in GetPosition

parent 57741bb6
......@@ -125,6 +125,12 @@ inline bool check_msg_size(int size) {
return true;
}
inline unsigned int GetPosition(unsigned char* qbuf, int offset) {
unsigned int info = 0;
std::memcpy(&info, qbuf + offset, sizeof info);
return info >> 24;
}
class DuelMode {
public:
virtual ~DuelMode() {}
......
......@@ -1480,10 +1480,6 @@ inline int SingleDuel::WriteUpdateData(int& player, int location, int& flag, uns
int len = query_field_card(pduel, player, location, flag, qbuf, use_cache);
return len;
}
inline unsigned int GetPosition(unsigned char*& qbuf, int offset) {
unsigned int info = *(unsigned int*)(qbuf + offset);
return info >> 24;
}
void SingleDuel::RefreshMzone(int player, int flag, int use_cache) {
std::vector<unsigned char> query_buffer;
query_buffer.resize(SIZE_QUERY_BUFFER);
......
......@@ -1602,10 +1602,6 @@ inline int TagDuel::WriteUpdateData(int& player, int location, int& flag, unsign
int len = query_field_card(pduel, player, location, flag, qbuf, use_cache);
return len;
}
inline unsigned int GetPosition(unsigned char*& qbuf, int offset) {
unsigned int info = *(unsigned int*)(qbuf + offset);
return info >> 24;
}
void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
std::vector<unsigned char> query_buffer;
query_buffer.resize(SIZE_QUERY_BUFFER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment