Commit 03cce946 authored by nanahira's avatar nanahira

Merge branch 'server' of git.mycard.moe:mycard/ygopro into server-develop

parents 496d3f6e f1ce2613
......@@ -19,9 +19,9 @@ install:
- tar xf lua-5.4.4.tar.gz
- move lua-5.4.4 lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2022/sqlite-amalgamation-3390300.zip ; exit 0"
- 7z x -y sqlite-amalgamation-3390300.zip
- move sqlite-amalgamation-3390300 sqlite3
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2024/sqlite-amalgamation-3470000.zip ; exit 0"
- 7z x sqlite-amalgamation-3470000.zip
- move sqlite-amalgamation-3470000 sqlite3
before_build:
- xcopy /E premake\* .
......
......@@ -130,6 +130,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
#endif //YGOPRO_SERVER_MODE
return ret;
}
#ifndef YGOPRO_SERVER_MODE
bool DataManager::LoadStrings(const char* file) {
FILE* fp = fopen(file, "r");
if(!fp)
......@@ -141,7 +142,6 @@ bool DataManager::LoadStrings(const char* file) {
fclose(fp);
return true;
}
#ifndef YGOPRO_SERVER_MODE
bool DataManager::LoadStrings(irr::io::IReadFile* reader) {
char ch{};
std::string linebuf;
......@@ -157,7 +157,6 @@ bool DataManager::LoadStrings(irr::io::IReadFile* reader) {
reader->drop();
return true;
}
#endif //YGOPRO_SERVER_MODE
void DataManager::ReadStringConfLine(const char* linebuf) {
if(linebuf[0] != '!')
return;
......@@ -189,6 +188,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
_setnameStrings[value] = strBuffer;
}
}
#endif //YGOPRO_SERVER_MODE
bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
errmsg[0] = '\0';
std::strncat(errmsg, sqlite3_errmsg(pDB), sizeof errmsg - 1);
......@@ -199,6 +199,7 @@ bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
code_pointer DataManager::GetCodePointer(unsigned int code) const {
return _datas.find(code);
}
#ifndef YGOPRO_SERVER_MODE
string_pointer DataManager::GetStringPointer(unsigned int code) const {
return _strings.find(code);
}
......@@ -214,6 +215,7 @@ string_pointer DataManager::strings_begin() const {
string_pointer DataManager::strings_end() const {
return _strings.cend();
}
#endif //YGOPRO_SERVER_MODE
bool DataManager::GetData(unsigned int code, CardData* pData) const {
auto cdit = _datas.find(code);
if(cdit == _datas.end())
......@@ -223,6 +225,7 @@ bool DataManager::GetData(unsigned int code, CardData* pData) const {
}
return true;
}
#ifndef YGOPRO_SERVER_MODE
bool DataManager::GetString(unsigned int code, CardString* pStr) const {
auto csit = _strings.find(code);
if(csit == _strings.end()) {
......@@ -413,6 +416,7 @@ std::wstring DataManager::FormatLinkMarker(unsigned int link_marker) const {
buffer.append(L"[\u2198]");
return buffer;
}
#endif //YGOPRO_SERVER_MODE
uint32_t DataManager::CardReader(uint32_t code, card_data* pData) {
if (!dataManager.GetData(code, pData))
pData->clear();
......@@ -484,7 +488,6 @@ unsigned char* DataManager::ReadScriptFromFile(const char* script_name, int* sle
*slen = (int)len;
return scriptBuffer;
}
#ifndef YGOPRO_SERVER_MODE
bool DataManager::deck_sort_lv(code_pointer p1, code_pointer p2) {
if ((p1->second.type & 0x7) != (p2->second.type & 0x7))
......
......@@ -45,20 +45,23 @@ public:
DataManager();
bool ReadDB(sqlite3* pDB);
bool LoadDB(const wchar_t* wfile);
bool LoadStrings(const char* file);
#ifndef YGOPRO_SERVER_MODE
bool LoadStrings(const char* file);
bool LoadStrings(irr::io::IReadFile* reader);
#endif
void ReadStringConfLine(const char* linebuf);
#endif
bool Error(sqlite3* pDB, sqlite3_stmt* pStmt = nullptr);
code_pointer GetCodePointer(unsigned int code) const;
#ifndef YGOPRO_SERVER_MODE
string_pointer GetStringPointer(unsigned int code) const;
code_pointer datas_begin() const;
code_pointer datas_end() const;
string_pointer strings_begin() const;
string_pointer strings_end() const;
#endif
bool GetData(unsigned int code, CardData* pData) const;
#ifndef YGOPRO_SERVER_MODE
bool GetString(unsigned int code, CardString* pStr) const;
const wchar_t* GetName(unsigned int code) const;
const wchar_t* GetText(unsigned int code) const;
......@@ -80,6 +83,7 @@ public:
std::unordered_map<unsigned int, std::wstring> _victoryStrings;
std::unordered_map<unsigned int, std::wstring> _setnameStrings;
std::unordered_map<unsigned int, std::wstring> _sysStrings;
#endif
char errmsg[512]{};
static unsigned char scriptBuffer[0x100000];
......
......@@ -99,14 +99,14 @@ HostInfo game_info;
void Game::MainServerLoop() {
#ifdef SERVER_ZIP_SUPPORT
dataManager.FileSystem = new irr::io::CFileSystem();
DataManager::FileSystem = new irr::io::CFileSystem();
#endif
initUtils();
deckManager.LoadLFList();
dataManager.LoadDB(L"cards.cdb");
LoadExpansions();
#ifdef SERVER_PRO2_SUPPORT
dataManager.FileSystem->addFileArchive("data/script.zip", true, false, EFAT_ZIP);
DataManager::FileSystem->addFileArchive("data/script.zip", true, false, EFAT_ZIP);
#endif
server_port = NetServer::StartServer(server_port);
......@@ -1310,7 +1310,7 @@ void Game::LoadExpansions() {
FileSystem::TraversalDir(L"./cdb", [](const wchar_t* name, bool isdir) {
wchar_t fpath[1024];
myswprintf(fpath, L"./cdb/%ls", name);
if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".cdb", 4)) {
if(!isdir && IsExtension(name, L".cdb")) {
dataManager.LoadDB(fpath);
}
});
......
......@@ -30,14 +30,16 @@
#ifndef YGOPRO_DEFAULT_DUEL_RULE
#define YGOPRO_DEFAULT_DUEL_RULE 5
#endif
#define DEFAULT_DUEL_RULE YGOPRO_DEFAULT_DUEL_RULE
constexpr int CONFIG_LINE_SIZE = 1024;
constexpr int TEXT_LINE_SIZE = 256;
namespace ygo {
bool IsExtension(const wchar_t* filename, const wchar_t* extension);
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
struct Config {
bool use_d3d{ false };
bool use_image_scale{ true };
......
......@@ -65,12 +65,12 @@ void SingleDuel::JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater)
BufferIO::NullTerminate(pkt->pass);
BufferIO::CopyCharArray(pkt->pass, jpass);
#ifdef YGOPRO_SERVER_MODE
if(!wcscmp(jpass, L"the Big Brother") && !cache_recorder) {
if(!std::wcscmp(jpass, L"the Big Brother") && !cache_recorder) {
is_recorder = true;
cache_recorder = dp;
}
#ifndef YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
if(!wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
if(!std::wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
is_recorder = true;
replay_recorder = dp;
}
......
......@@ -93,3 +93,4 @@ protected:
}
#endif //SINGLE_DUEL_H
......@@ -69,12 +69,12 @@ void TagDuel::JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) {
BufferIO::NullTerminate(pkt->pass);
BufferIO::CopyCharArray(pkt->pass, jpass);
#ifdef YGOPRO_SERVER_MODE
if(!wcscmp(jpass, L"the Big Brother") && !cache_recorder) {
if(!std::wcscmp(jpass, L"the Big Brother") && !cache_recorder) {
is_recorder = true;
cache_recorder = dp;
}
#ifndef YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
if(!wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
if(!std::wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
is_recorder = true;
replay_recorder = dp;
}
......
......@@ -91,3 +91,4 @@ protected:
}
#endif //TAG_DUEL_H
......@@ -37,7 +37,7 @@ index 43557cd..ffa06bc 100644
} // end namespace core
} // end namespace irr
diff --git a/include/irrTypes.h b/include/irrTypes.h
index 403f890..940e859 100644
index 403f890..bfa13f4 100644
--- a/include/irrTypes.h
+++ b/include/irrTypes.h
@@ -48,6 +48,9 @@ typedef __int16 s16;
......@@ -50,6 +50,24 @@ index 403f890..940e859 100644
//! 32 bit unsigned variable.
@@ -113,17 +116,6 @@ typedef double f64;
#include <wchar.h>
#ifdef _IRR_WINDOWS_API_
-//! Defines for s{w,n}printf because these methods do not match the ISO C
-//! standard on Windows platforms, but it does on all others.
-//! These should be int snprintf(char *str, size_t size, const char *format, ...);
-//! and int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
-#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
-#define swprintf swprintf_s
-#define snprintf sprintf_s
-#elif !defined(__CYGWIN__)
-#define swprintf _snwprintf
-#define snprintf _snprintf
-#endif
// define the wchar_t type if not already built in.
#ifdef _MSC_VER
diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp
index 395fb69..cc6b75f 100644
--- a/source/Irrlicht/CGUIEditBox.cpp
......
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