Commit b3b7400d authored by wind2009's avatar wind2009

Merge remote-tracking branch 'upstream/master' into server-develop

parents 134ab17b 3d8c3621
#ifndef BUFFERIO_H #ifndef BUFFERIO_H
#define BUFFERIO_H #define BUFFERIO_H
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#endif
class BufferIO { class BufferIO {
public: public:
...@@ -43,7 +40,7 @@ public: ...@@ -43,7 +40,7 @@ public:
inline static int CopyWStr(T1* src, T2* pstr, int bufsize) { inline static int CopyWStr(T1* src, T2* pstr, int bufsize) {
int l = 0; int l = 0;
while(src[l] && l < bufsize - 1) { while(src[l] && l < bufsize - 1) {
pstr[l] = src[l]; pstr[l] = (T2)src[l];
l++; l++;
} }
pstr[l] = 0; pstr[l] = 0;
...@@ -53,7 +50,7 @@ public: ...@@ -53,7 +50,7 @@ public:
inline static int CopyWStrRef(T1* src, T2*& pstr, int bufsize) { inline static int CopyWStrRef(T1* src, T2*& pstr, int bufsize) {
int l = 0; int l = 0;
while(src[l] && l < bufsize - 1) { while(src[l] && l < bufsize - 1) {
pstr[l] = src[l]; pstr[l] = (T2)src[l];
l++; l++;
} }
pstr += l; pstr += l;
...@@ -65,7 +62,7 @@ public: ...@@ -65,7 +62,7 @@ public:
char* pstr = str; char* pstr = str;
while(*wsrc != 0) { while(*wsrc != 0) {
if(*wsrc < 0x80) { if(*wsrc < 0x80) {
*str = *wsrc; *str = (char)*wsrc;
++str; ++str;
} else if(*wsrc < 0x800) { } else if(*wsrc < 0x800) {
str[0] = ((*wsrc >> 6) & 0x1f) | 0xc0; str[0] = ((*wsrc >> 6) & 0x1f) | 0xc0;
...@@ -131,12 +128,14 @@ public: ...@@ -131,12 +128,14 @@ public:
return wp - wstr; return wp - wstr;
} }
static int GetVal(const wchar_t* pstr) { static int GetVal(const wchar_t* pstr) {
int ret = 0; unsigned int ret = 0;
while(*pstr >= L'0' && *pstr <= L'9') { while(*pstr >= L'0' && *pstr <= L'9') {
ret = ret * 10 + (*pstr - L'0'); ret = ret * 10 + (*pstr - L'0');
pstr++; pstr++;
} }
return ret; if (*pstr == 0)
return (int)ret;
return 0;
} }
}; };
......
...@@ -113,10 +113,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -113,10 +113,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
if(flag & QUERY_REASON_CARD) if(flag & QUERY_REASON_CARD)
buf += 4; buf += 4;
if(flag & QUERY_EQUIP_CARD) { if(flag & QUERY_EQUIP_CARD) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadUInt8(buf);
int l = BufferIO::ReadInt8(buf); unsigned int l = BufferIO::ReadUInt8(buf);
int s = BufferIO::ReadInt8(buf); int s = BufferIO::ReadUInt8(buf);
BufferIO::ReadInt8(buf); BufferIO::ReadUInt8(buf);
ClientCard* ecard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s); ClientCard* ecard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s);
if (ecard) { if (ecard) {
equipTarget = ecard; equipTarget = ecard;
...@@ -126,10 +126,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -126,10 +126,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
if(flag & QUERY_TARGET_CARD) { if(flag & QUERY_TARGET_CARD) {
int count = BufferIO::ReadInt32(buf); int count = BufferIO::ReadInt32(buf);
for(int i = 0; i < count; ++i) { for(int i = 0; i < count; ++i) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadUInt8(buf);
int l = BufferIO::ReadInt8(buf); unsigned int l = BufferIO::ReadUInt8(buf);
int s = BufferIO::ReadInt8(buf); int s = BufferIO::ReadUInt8(buf);
BufferIO::ReadInt8(buf); BufferIO::ReadUInt8(buf);
ClientCard* tcard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s); ClientCard* tcard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s);
if (tcard) { if (tcard) {
cardTarget.insert(tcard); cardTarget.insert(tcard);
......
...@@ -192,7 +192,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -192,7 +192,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
case LOCATION_DECK: { case LOCATION_DECK: {
if (sequence != 0 || deck[controler].size() == 0) { if (sequence != 0 || deck[controler].size() == 0) {
deck[controler].push_back(pcard); deck[controler].push_back(pcard);
pcard->sequence = deck[controler].size() - 1; pcard->sequence = (unsigned char)(deck[controler].size() - 1);
} else { } else {
deck[controler].push_back(0); deck[controler].push_back(0);
for(int i = deck[controler].size() - 1; i > 0; --i) { for(int i = deck[controler].size() - 1; i > 0; --i) {
...@@ -207,7 +207,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -207,7 +207,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
} }
case LOCATION_HAND: { case LOCATION_HAND: {
hand[controler].push_back(pcard); hand[controler].push_back(pcard);
pcard->sequence = hand[controler].size() - 1; pcard->sequence = (unsigned char)(hand[controler].size() - 1);
break; break;
} }
case LOCATION_MZONE: { case LOCATION_MZONE: {
...@@ -220,18 +220,18 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -220,18 +220,18 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
} }
case LOCATION_GRAVE: { case LOCATION_GRAVE: {
grave[controler].push_back(pcard); grave[controler].push_back(pcard);
pcard->sequence = grave[controler].size() - 1; pcard->sequence = (unsigned char)(grave[controler].size() - 1);
break; break;
} }
case LOCATION_REMOVED: { case LOCATION_REMOVED: {
remove[controler].push_back(pcard); remove[controler].push_back(pcard);
pcard->sequence = remove[controler].size() - 1; pcard->sequence = (unsigned char)(remove[controler].size() - 1);
break; break;
} }
case LOCATION_EXTRA: { case LOCATION_EXTRA: {
if(extra_p_count[controler] == 0 || (pcard->position & POS_FACEUP)) { if(extra_p_count[controler] == 0 || (pcard->position & POS_FACEUP)) {
extra[controler].push_back(pcard); extra[controler].push_back(pcard);
pcard->sequence = extra[controler].size() - 1; pcard->sequence = (unsigned char)(extra[controler].size() - 1);
} else { } else {
extra[controler].push_back(0); extra[controler].push_back(0);
int p = extra[controler].size() - extra_p_count[controler] - 1; int p = extra[controler].size() - extra_p_count[controler] - 1;
......
...@@ -238,7 +238,7 @@ code_pointer DataManager::GetCodePointer(unsigned int code) const { ...@@ -238,7 +238,7 @@ code_pointer DataManager::GetCodePointer(unsigned int code) const {
string_pointer DataManager::GetStringPointer(unsigned int code) const { string_pointer DataManager::GetStringPointer(unsigned int code) const {
return _strings.find(code); return _strings.find(code);
} }
bool DataManager::GetString(int code, CardString* pStr) { bool DataManager::GetString(unsigned int code, CardString* pStr) {
auto csit = _strings.find(code); auto csit = _strings.find(code);
if(csit == _strings.end()) { if(csit == _strings.end()) {
pStr->name = unknown_string; pStr->name = unknown_string;
...@@ -248,7 +248,7 @@ bool DataManager::GetString(int code, CardString* pStr) { ...@@ -248,7 +248,7 @@ bool DataManager::GetString(int code, CardString* pStr) {
*pStr = csit->second; *pStr = csit->second;
return true; return true;
} }
const wchar_t* DataManager::GetName(int code) { const wchar_t* DataManager::GetName(unsigned int code) {
auto csit = _strings.find(code); auto csit = _strings.find(code);
if(csit == _strings.end()) if(csit == _strings.end())
return unknown_string; return unknown_string;
...@@ -256,7 +256,7 @@ const wchar_t* DataManager::GetName(int code) { ...@@ -256,7 +256,7 @@ const wchar_t* DataManager::GetName(int code) {
return csit->second.name.c_str(); return csit->second.name.c_str();
return unknown_string; return unknown_string;
} }
const wchar_t* DataManager::GetText(int code) { const wchar_t* DataManager::GetText(unsigned int code) {
auto csit = _strings.find(code); auto csit = _strings.find(code);
if(csit == _strings.end()) if(csit == _strings.end())
return unknown_string; return unknown_string;
...@@ -265,7 +265,7 @@ const wchar_t* DataManager::GetText(int code) { ...@@ -265,7 +265,7 @@ const wchar_t* DataManager::GetText(int code) {
return unknown_string; return unknown_string;
} }
const wchar_t* DataManager::GetDesc(unsigned int strCode) { const wchar_t* DataManager::GetDesc(unsigned int strCode) {
if(strCode < 10000u) if (strCode < (MIN_CARD_ID << 4))
return GetSysString(strCode); return GetSysString(strCode);
unsigned int code = (strCode >> 4) & 0x0fffffff; unsigned int code = (strCode >> 4) & 0x0fffffff;
unsigned int offset = strCode & 0xf; unsigned int offset = strCode & 0xf;
...@@ -277,7 +277,7 @@ const wchar_t* DataManager::GetDesc(unsigned int strCode) { ...@@ -277,7 +277,7 @@ const wchar_t* DataManager::GetDesc(unsigned int strCode) {
return unknown_string; return unknown_string;
} }
const wchar_t* DataManager::GetSysString(int code) { const wchar_t* DataManager::GetSysString(int code) {
if(code < 0 || code >= 2048) if (code < 0 || code > MAX_STRING_ID)
return unknown_string; return unknown_string;
auto csit = _sysStrings.find(code); auto csit = _sysStrings.find(code);
if(csit == _sysStrings.end()) if(csit == _sysStrings.end())
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <unordered_map> #include <unordered_map>
namespace ygo { namespace ygo {
constexpr int MAX_STRING_ID = 0x7ff;
constexpr unsigned int MIN_CARD_ID = (unsigned int)(MAX_STRING_ID + 1) >> 4;
class DataManager { class DataManager {
public: public:
...@@ -28,9 +30,9 @@ public: ...@@ -28,9 +30,9 @@ public:
bool GetData(unsigned int code, CardData* pData); bool GetData(unsigned int code, CardData* pData);
code_pointer GetCodePointer(unsigned int code) const; code_pointer GetCodePointer(unsigned int code) const;
string_pointer GetStringPointer(unsigned int code) const; string_pointer GetStringPointer(unsigned int code) const;
bool GetString(int code, CardString* pStr); bool GetString(unsigned int code, CardString* pStr);
const wchar_t* GetName(int code); const wchar_t* GetName(unsigned int code);
const wchar_t* GetText(int code); const wchar_t* GetText(unsigned int code);
const wchar_t* GetDesc(unsigned int strCode); const wchar_t* GetDesc(unsigned int strCode);
const wchar_t* GetSysString(int code); const wchar_t* GetSysString(int code);
const wchar_t* GetVictoryString(int code); const wchar_t* GetVictoryString(int code);
......
...@@ -41,49 +41,49 @@ public: ...@@ -41,49 +41,49 @@ public:
void pop_side(int seq); void pop_side(int seq);
bool check_limit(code_pointer pointer); bool check_limit(code_pointer pointer);
long long filter_effect; long long filter_effect{};
unsigned int filter_type; unsigned int filter_type{};
unsigned int filter_type2; unsigned int filter_type2{};
unsigned int filter_attrib; unsigned int filter_attrib{};
unsigned int filter_race; unsigned int filter_race{};
unsigned int filter_atktype; unsigned int filter_atktype{};
int filter_atk; int filter_atk{};
unsigned int filter_deftype; unsigned int filter_deftype{};
int filter_def; int filter_def{};
unsigned int filter_lvtype; unsigned int filter_lvtype{};
unsigned int filter_lv; unsigned int filter_lv{};
unsigned int filter_scltype; unsigned int filter_scltype{};
unsigned int filter_scl; unsigned int filter_scl{};
unsigned int filter_marks; unsigned int filter_marks{};
int filter_lm; int filter_lm{};
position2di mouse_pos; position2di mouse_pos;
int hovered_code; int hovered_code{};
int hovered_pos; int hovered_pos{};
int hovered_seq; int hovered_seq{ -1 };
int is_lastcard; int is_lastcard{};
int click_pos; int click_pos{};
bool is_draging; bool is_draging{};
bool is_starting_dragging; bool is_starting_dragging{};
int dragx; int dragx{};
int dragy; int dragy{};
int bigcard_code; int bigcard_code{};
float bigcard_zoom; float bigcard_zoom{};
size_t pre_mainc; size_t pre_mainc{};
size_t pre_extrac; size_t pre_extrac{};
size_t pre_sidec; size_t pre_sidec{};
code_pointer draging_pointer; code_pointer draging_pointer;
int prev_category; int prev_category{};
int prev_deck; int prev_deck{};
s32 prev_operation; s32 prev_operation{};
int prev_sel; int prev_sel{ -1 };
bool is_modified; bool is_modified{};
bool readonly; bool readonly{};
bool showing_pack; bool showing_pack{};
mt19937 rnd; mt19937 rnd;
const std::unordered_map<int, int>* filterList; const std::unordered_map<int, int>* filterList;
std::vector<code_pointer> results; std::vector<code_pointer> results;
wchar_t result_string[8]; wchar_t result_string[8]{};
std::vector<std::wstring> expansionPacks; std::vector<std::wstring> expansionPacks;
}; };
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace ygo { namespace ygo {
#ifndef YGOPRO_SERVER_MODE #ifndef YGOPRO_SERVER_MODE
char DeckManager::deckBuffer[0x10000]; char DeckManager::deckBuffer[0x10000]{};
#endif #endif
DeckManager deckManager; DeckManager deckManager;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace ygo { namespace ygo {
struct LFList { struct LFList {
unsigned int hash; unsigned int hash{};
std::wstring listName; std::wstring listName;
std::unordered_map<int, int> content; std::unordered_map<int, int> content;
}; };
......
This diff is collapsed.
...@@ -771,7 +771,7 @@ bool Game::Initialize() { ...@@ -771,7 +771,7 @@ bool Game::Initialize() {
cbCardType->addItem(dataManager.GetSysString(1312)); cbCardType->addItem(dataManager.GetSysString(1312));
cbCardType->addItem(dataManager.GetSysString(1313)); cbCardType->addItem(dataManager.GetSysString(1313));
cbCardType->addItem(dataManager.GetSysString(1314)); cbCardType->addItem(dataManager.GetSysString(1314));
cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 200, 20 + 25 / 6), wFilter, COMBOBOX_SECONDTYPE); cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 195, 20 + 25 / 6), wFilter, COMBOBOX_SECONDTYPE);
cbCardType2->setMaxSelectionRows(10); cbCardType2->setMaxSelectionRows(10);
cbCardType2->addItem(dataManager.GetSysString(1310), 0); cbCardType2->addItem(dataManager.GetSysString(1310), 0);
stLimit = env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter); stLimit = env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter);
...@@ -787,13 +787,13 @@ bool Game::Initialize() { ...@@ -787,13 +787,13 @@ bool Game::Initialize() {
cbLimit->addItem(dataManager.GetSysString(1484)); cbLimit->addItem(dataManager.GetSysString(1484));
cbLimit->addItem(dataManager.GetSysString(1485)); cbLimit->addItem(dataManager.GetSysString(1485));
stAttribute = env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter); stAttribute = env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter);
cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, COMBOBOX_ATTRIBUTE); cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 195, 40 + 50 / 6), wFilter, COMBOBOX_ATTRIBUTE);
cbAttribute->setMaxSelectionRows(10); cbAttribute->setMaxSelectionRows(10);
cbAttribute->addItem(dataManager.GetSysString(1310), 0); cbAttribute->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1) for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(dataManager.FormatAttribute(filter), filter); cbAttribute->addItem(dataManager.FormatAttribute(filter), filter);
stRace = env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter); stRace = env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, COMBOBOX_RACE); cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 195, 60 + 75 / 6), wFilter, COMBOBOX_RACE);
cbRace->setMaxSelectionRows(10); cbRace->setMaxSelectionRows(10);
cbRace->addItem(dataManager.GetSysString(1310), 0); cbRace->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter < (1 << RACES_COUNT); filter <<= 1) for(int filter = 0x1; filter < (1 << RACES_COUNT); filter <<= 1)
...@@ -808,7 +808,7 @@ bool Game::Initialize() { ...@@ -808,7 +808,7 @@ bool Game::Initialize() {
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS); ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stScale = env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter); stScale = env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS); ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 195, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stSearch = env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter); stSearch = env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD); ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD);
...@@ -836,7 +836,7 @@ bool Game::Initialize() { ...@@ -836,7 +836,7 @@ bool Game::Initialize() {
int wcatewidth = catewidth * 4 + 16; int wcatewidth = catewidth * 4 + 16;
wCategories->setRelativePosition(rect<s32>(1000 - wcatewidth, 60, 1000, 305)); wCategories->setRelativePosition(rect<s32>(1000 - wcatewidth, 60, 1000, 305));
btnCategoryOK->setRelativePosition(recti(wcatewidth / 2 - 50, 210, wcatewidth / 2 + 50, 235)); btnCategoryOK->setRelativePosition(recti(wcatewidth / 2 - 50, 210, wcatewidth / 2 + 50, 235));
btnMarksFilter = env->addButton(rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374)); btnMarksFilter = env->addButton(rect<s32>(60, 80 + 125 / 6, 195, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374));
wLinkMarks = env->addWindow(rect<s32>(700, 30, 820, 150), false, L""); wLinkMarks = env->addWindow(rect<s32>(700, 30, 820, 150), false, L"");
wLinkMarks->getCloseButton()->setVisible(false); wLinkMarks->getCloseButton()->setVisible(false);
wLinkMarks->setDrawTitlebar(false); wLinkMarks->setDrawTitlebar(false);
...@@ -1111,7 +1111,7 @@ void Game::MainLoop() { ...@@ -1111,7 +1111,7 @@ void Game::MainLoop() {
SingleMode::StopPlay(true); SingleMode::StopPlay(true);
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(500));
SaveConfig(); SaveConfig();
// device->drop(); device->drop();
} }
void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) { void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) {
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)
...@@ -1844,8 +1844,9 @@ void Game::CloseDuelWindow() { ...@@ -1844,8 +1844,9 @@ void Game::CloseDuelWindow() {
ClearTextures(); ClearTextures();
closeDoneSignal.Set(); closeDoneSignal.Set();
} }
int Game::LocalPlayer(int player) { int Game::LocalPlayer(int player) const {
return dInfo.isFirst ? player : 1 - player; int pid = player ? 1 : 0;
return dInfo.isFirst ? pid : 1 - pid;
} }
const wchar_t* Game::LocalName(int local_player) { const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname; return local_player == 0 ? dInfo.hostname : dInfo.clientname;
...@@ -1897,12 +1898,12 @@ void Game::OnResize() { ...@@ -1897,12 +1898,12 @@ void Game::OnResize() {
wFilter->setRelativePosition(Resize(610, 5, 1020, 130)); wFilter->setRelativePosition(Resize(610, 5, 1020, 130));
scrFilter->setRelativePosition(Resize(999, 161, 1019, 629)); scrFilter->setRelativePosition(Resize(999, 161, 1019, 629));
cbCardType->setRelativePosition(Resize(60, 25 / 6, 120, 20 + 25 / 6)); cbCardType->setRelativePosition(Resize(60, 25 / 6, 120, 20 + 25 / 6));
cbCardType2->setRelativePosition(Resize(130, 25 / 6, 190, 20 + 25 / 6)); cbCardType2->setRelativePosition(Resize(125, 25 / 6, 195, 20 + 25 / 6));
cbRace->setRelativePosition(Resize(60, 40 + 75 / 6, 190, 60 + 75 / 6)); cbRace->setRelativePosition(Resize(60, 40 + 75 / 6, 195, 60 + 75 / 6));
cbAttribute->setRelativePosition(Resize(60, 20 + 50 / 6, 190, 40 + 50 / 6)); cbAttribute->setRelativePosition(Resize(60, 20 + 50 / 6, 195, 40 + 50 / 6));
cbLimit->setRelativePosition(Resize(260, 25 / 6, 390, 20 + 25 / 6)); cbLimit->setRelativePosition(Resize(260, 25 / 6, 390, 20 + 25 / 6));
ebStar->setRelativePosition(Resize(60, 60 + 100 / 6, 95, 80 + 100 / 6)); ebStar->setRelativePosition(Resize(60, 60 + 100 / 6, 95, 80 + 100 / 6));
ebScale->setRelativePosition(Resize(155, 60 + 100 / 6, 190, 80 + 100 / 6)); ebScale->setRelativePosition(Resize(155, 60 + 100 / 6, 195, 80 + 100 / 6));
ebAttack->setRelativePosition(Resize(260, 20 + 50 / 6, 340, 40 + 50 / 6)); ebAttack->setRelativePosition(Resize(260, 20 + 50 / 6, 340, 40 + 50 / 6));
ebDefense->setRelativePosition(Resize(260, 40 + 75 / 6, 340, 60 + 75 / 6)); ebDefense->setRelativePosition(Resize(260, 40 + 75 / 6, 340, 60 + 75 / 6));
ebCardName->setRelativePosition(Resize(260, 60 + 100 / 6, 390, 80 + 100 / 6)); ebCardName->setRelativePosition(Resize(260, 60 + 100 / 6, 390, 80 + 100 / 6));
...@@ -1910,7 +1911,7 @@ void Game::OnResize() { ...@@ -1910,7 +1911,7 @@ void Game::OnResize() {
btnStartFilter->setRelativePosition(Resize(260, 80 + 125 / 6, 390, 100 + 125 / 6)); btnStartFilter->setRelativePosition(Resize(260, 80 + 125 / 6, 390, 100 + 125 / 6));
if(btnClearFilter) if(btnClearFilter)
btnClearFilter->setRelativePosition(Resize(205, 80 + 125 / 6, 255, 100 + 125 / 6)); btnClearFilter->setRelativePosition(Resize(205, 80 + 125 / 6, 255, 100 + 125 / 6));
btnMarksFilter->setRelativePosition(Resize(60, 80 + 125 / 6, 190, 100 + 125 / 6)); btnMarksFilter->setRelativePosition(Resize(60, 80 + 125 / 6, 195, 100 + 125 / 6));
recti btncatepos = btnEffectFilter->getAbsolutePosition(); recti btncatepos = btnEffectFilter->getAbsolutePosition();
wCategories->setRelativePosition(recti( wCategories->setRelativePosition(recti(
......
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
void CloseGameWindow(); void CloseGameWindow();
void CloseDuelWindow(); void CloseDuelWindow();
int LocalPlayer(int player); int LocalPlayer(int player) const;
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
bool HasFocus(EGUI_ELEMENT_TYPE type) const { bool HasFocus(EGUI_ELEMENT_TYPE type) const {
......
...@@ -352,141 +352,141 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -352,141 +352,141 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * 11 + 3;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 12; pbuf += 12;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 3; pbuf += 3;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * 13;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 9; pbuf += count * 9;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
pbuf++; pbuf++;
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 6; pbuf += 6;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshDeck(player); ReplayRefreshDeck(player);
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
/*int oplayer = */BufferIO::ReadInt8(pbuf); /*int oplayer = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
/*int oplayer = */BufferIO::ReadInt8(pbuf); /*int oplayer = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -497,7 +497,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -497,7 +497,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshGrave(player); ReplayRefreshGrave(player);
break; break;
...@@ -515,7 +515,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -515,7 +515,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
pbuf++; pbuf++;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -529,7 +529,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -529,7 +529,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} }
} }
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -653,22 +653,22 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -653,22 +653,22 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_CARD_SELECTED: case MSG_CARD_SELECTED:
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
pauseable = false; pauseable = false;
break; break;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_DRAW: { case MSG_DRAW: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -761,21 +761,21 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -761,21 +761,21 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_HAND_RES: { case MSG_HAND_RES: {
...@@ -784,18 +784,18 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -784,18 +784,18 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_ANNOUNCE_CARD: case MSG_ANNOUNCE_CARD:
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadUInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 4 * count; pbuf += 4 * count;
return ReadReplayResponse(); return ReadReplayResponse();
...@@ -827,12 +827,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -827,12 +827,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
pbuf += 4; pbuf += 4;
for(int seq = 0; seq < 7; ++seq) { for(int seq = 0; seq < 7; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf += 2; pbuf += 2;
} }
for(int seq = 0; seq < 8; ++seq) { for(int seq = 0; seq < 8; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf++; pbuf++;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -223,7 +223,7 @@ end ...@@ -223,7 +223,7 @@ end
filter { "configurations:Release", "action:vs*" } filter { "configurations:Release", "action:vs*" }
flags { "LinkTimeOptimization" } flags { "LinkTimeOptimization" }
staticruntime "On" staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4828", "4800", "6011", "6031", "6054", "6262" } disablewarnings { "4244", "4267", "4838", "4577", "4018", "4996", "4477", "4091", "4800", "6011", "6031", "6054", "6262" }
filter { "configurations:Release", "not action:vs*" } filter { "configurations:Release", "not action:vs*" }
symbols "On" symbols "On"
...@@ -233,7 +233,7 @@ end ...@@ -233,7 +233,7 @@ end
end end
filter { "configurations:Debug", "action:vs*" } filter { "configurations:Debug", "action:vs*" }
disablewarnings { "4819", "4828", "6011", "6031", "6054", "6262" } disablewarnings { "6011", "6031", "6054", "6262" }
filter "action:vs*" filter "action:vs*"
vectorextensions "SSE2" vectorextensions "SSE2"
......
...@@ -657,6 +657,8 @@ ...@@ -657,6 +657,8 @@
!counter 0x68 指示物(图腾柱) !counter 0x68 指示物(图腾柱)
!counter 0x69 指示物(吠陀-优婆尼沙昙) !counter 0x69 指示物(吠陀-优婆尼沙昙)
!counter 0x6a 响鸣指示物 !counter 0x6a 响鸣指示物
!counter 0x6b 狂乱指示物
!counter 0x6c 访问指示物
#setnames, using tab for comment #setnames, using tab for comment
!setname 0x1 正义盟军 AOJ !setname 0x1 正义盟军 AOJ
!setname 0x2 次世代 ジェネクス !setname 0x2 次世代 ジェネクス
...@@ -1212,3 +1214,9 @@ ...@@ -1212,3 +1214,9 @@
!setname 0x1ab 蕾祸 蕾禍 !setname 0x1ab 蕾祸 蕾禍
!setname 0x1ac 飞龙炎 Salamandra !setname 0x1ac 飞龙炎 Salamandra
!setname 0x1ad 灰尽 Ashened !setname 0x1ad 灰尽 Ashened
!setname 0x1ae 千年 千年/ミレニアム
!setname 0x1af 艾格佐德 エグゾード
!setname 0x1b0 刻魔 デモンスミス
!setname 0x1b1 白森林 白き森
!setname 0x1b2 欢聚友伴 マルチャミー
!setname 0x1b3 徽记 エンブレーマ
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