Commit d63e2089 authored by nanahira's avatar nanahira

Merge branch 'server' of github.com:moecube/ygopro into server-develop

parents fad58a3a e257ab2e
......@@ -71,7 +71,7 @@ bool DataManager::ReadDB(sqlite3* pDB) {
cs.desc[i] = strBuffer;
}
}
#endif
#endif //YGOPRO_SERVER_MODE
}
sqlite3_finalize(pStmt);
for (const auto& entry : extra_setcode) {
......
......@@ -97,7 +97,7 @@ public:
string_pointer strings_end() const noexcept {
return _strings.cend();
}
#endif
#endif //YGOPRO_SERVER_MODE
bool GetData(uint32_t code, CardData* pData) const;
#ifndef YGOPRO_SERVER_MODE
bool GetString(uint32_t code, CardString* pStr) const;
......
......@@ -1250,7 +1250,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
RefreshHand(0);
RefreshHand(1);
#ifdef YGOPRO_SERVER_MODE
turn_player = BufferIO::Read<int8_t>(pbuf) & 0x1;
turn_player = BufferIO::Read<uint8_t>(pbuf) & 0x1;
#else
pbuf++;
#endif
......@@ -1273,7 +1273,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case MSG_NEW_PHASE: {
#ifdef YGOPRO_SERVER_MODE
phase = BufferIO::Read<int16_t>(pbuf);
phase = BufferIO::Read<uint16_t>(pbuf);
#else
pbuf += 2;
#endif
......@@ -1956,28 +1956,28 @@ void SingleDuel::RequestField(DuelPlayer* dp) {
};
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_START);
BufferIO::Write<int8_t>(pbuf, player);
BufferIO::Write<int8_t>(pbuf, host_info.duel_rule);
BufferIO::Write<uint8_t>(pbuf, MSG_START);
BufferIO::Write<uint8_t>(pbuf, player);
BufferIO::Write<uint8_t>(pbuf, host_info.duel_rule);
BufferIO::Write<int32_t>(pbuf, host_info.start_lp);
BufferIO::Write<int32_t>(pbuf, host_info.start_lp);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
});
uint8_t newturn_count = (turn_player == 1) ? 2 : 1;
for (uint8_t i = 0; i < newturn_count; ++i) {
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_NEW_TURN);
BufferIO::Write<int8_t>(pbuf, i);
BufferIO::Write<uint8_t>(pbuf, MSG_NEW_TURN);
BufferIO::Write<uint8_t>(pbuf, i);
});
}
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_NEW_PHASE);
BufferIO::Write<int16_t>(pbuf, phase);
BufferIO::Write<uint8_t>(pbuf, MSG_NEW_PHASE);
BufferIO::Write<uint16_t>(pbuf, phase);
});
WriteMsg([&](uint8_t*& pbuf) {
......@@ -2001,7 +2001,7 @@ void SingleDuel::RequestField(DuelPlayer* dp) {
// send MSG_REVERSE_DECK if deck is reversed
if(deck_reversed)
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_REVERSE_DECK);
BufferIO::Write<uint8_t>(pbuf, MSG_REVERSE_DECK);
});
uint8_t query_buffer[SIZE_QUERY_BUFFER];
......@@ -2026,9 +2026,9 @@ void SingleDuel::RequestField(DuelPlayer* dp) {
code |= 0x80000000; // mark as reversed
if(deck_reversed || position & POS_FACEUP)
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_DECK_TOP);
BufferIO::Write<int8_t>(pbuf, i);
BufferIO::Write<int8_t>(pbuf, 0);
BufferIO::Write<uint8_t>(pbuf, MSG_DECK_TOP);
BufferIO::Write<uint8_t>(pbuf, i);
BufferIO::Write<uint8_t>(pbuf, 0);
BufferIO::Write<int32_t>(pbuf, code);
});
}
......
......@@ -1247,7 +1247,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
}
case MSG_NEW_PHASE: {
#ifdef YGOPRO_SERVER_MODE
phase = BufferIO::Read<int16_t>(pbuf);
phase = BufferIO::Read<uint16_t>(pbuf);
#else
pbuf += 2;
#endif
......@@ -2049,15 +2049,15 @@ void TagDuel::RequestField(DuelPlayer* dp) {
};
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_START);
BufferIO::Write<int8_t>(pbuf, player);
BufferIO::Write<int8_t>(pbuf, host_info.duel_rule);
BufferIO::Write<uint8_t>(pbuf, MSG_START);
BufferIO::Write<uint8_t>(pbuf, player);
BufferIO::Write<uint8_t>(pbuf, host_info.duel_rule);
BufferIO::Write<int32_t>(pbuf, host_info.start_lp);
BufferIO::Write<int32_t>(pbuf, host_info.start_lp);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<int16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
BufferIO::Write<uint16_t>(pbuf, 0);
});
uint8_t newturn_count = turn_count % 4;
......@@ -2065,14 +2065,14 @@ void TagDuel::RequestField(DuelPlayer* dp) {
newturn_count = 4;
for (uint8_t i = 0; i < newturn_count; ++i) {
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_NEW_TURN);
BufferIO::Write<int8_t>(pbuf, i % 2);
BufferIO::Write<uint8_t>(pbuf, MSG_NEW_TURN);
BufferIO::Write<uint8_t>(pbuf, i % 2);
});
}
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_NEW_PHASE);
BufferIO::Write<int16_t>(pbuf, phase);
BufferIO::Write<uint8_t>(pbuf, MSG_NEW_PHASE);
BufferIO::Write<uint16_t>(pbuf, phase);
});
WriteMsg([&](uint8_t*& pbuf) {
......@@ -2115,9 +2115,9 @@ void TagDuel::RequestField(DuelPlayer* dp) {
code |= 0x80000000; // mark as reversed
if(deck_reversed || position & POS_FACEUP)
WriteMsg([&](uint8_t*& pbuf) {
BufferIO::Write<int8_t>(pbuf, MSG_DECK_TOP);
BufferIO::Write<int8_t>(pbuf, i);
BufferIO::Write<int8_t>(pbuf, 0);
BufferIO::Write<uint8_t>(pbuf, MSG_DECK_TOP);
BufferIO::Write<uint8_t>(pbuf, i);
BufferIO::Write<uint8_t>(pbuf, 0);
BufferIO::Write<int32_t>(pbuf, code);
});
}
......
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