Commit de5cdc5f authored by nanahira's avatar nanahira

Merge branch 'server' into full-view

parents b3c856d6 584831b9
#!/bin/bash
set -x
set -o errexit
TARGET_YGOPRO_BINARY_PATH=./ygopro-platforms/ygopro-platform-$TARGET_PATFORM
export YGOPRO_LIBEVENT_STATIC_PATH=$PWD/libevent-stable
git submodule update --init
./premake5 gmake --cc=clang
cd build
make config=release -j4
cd ..
mkdir ygopro-platforms
mv bin/release/ygopro.app $TARGET_YGOPRO_BINARY_PATH
install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib $TARGET_YGOPRO_BINARY_PATH
strip $TARGET_YGOPRO_BINARY_PATH
stages:
- prepare
- build
- sign
- combine
- pack
- deploy
variables:
GIT_DEPTH: "1"
#USE_IRRKLANG: "1"
mat_common:
stage: prepare
......@@ -73,6 +72,7 @@ exec_windows:
#variables:
# irrklang_pro: '1'
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- bin/
- obj/
......@@ -93,11 +93,13 @@ exec_linux:
- linux
variables:
YGOPRO_BUILD_ALL: '1'
USE_IRRKLANG: "1"
dependencies:
- mat_common
#- mat_irrklang
- mat_linux
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- bin/
- obj/
......
No preview for this file type
......@@ -224,10 +224,10 @@ const wchar_t* DataManager::GetText(int code) {
return unknown_string;
}
const wchar_t* DataManager::GetDesc(int strCode) {
if(strCode < 10000)
if((unsigned int)strCode < 10000u)
return GetSysString(strCode);
int code = strCode >> 4;
int offset = strCode & 0xf;
unsigned int code = strCode >> 4;
unsigned int offset = strCode & 0xf;
auto csit = _strings.find(code);
if(csit == _strings.end())
return unknown_string;
......
......@@ -1489,14 +1489,16 @@ void DeckBuilder::FilterCards() {
if(filter_lm) {
if(filter_lm <= 3 && (!filterList->count(ptr->first) || (*filterList).at(ptr->first) != filter_lm - 1))
continue;
if(filter_lm == 4 && data.ot != 1)
if(filter_lm == 4 && (data.ot & 0x3) != 1)
continue;
if(filter_lm == 5 && data.ot != 2)
if(filter_lm == 5 && (data.ot & 0x3) != 2)
continue;
if(filter_lm == 6 && data.ot != 3)
if(filter_lm == 6 && (data.ot & 0x3) != 3)
continue;
if(filter_lm == 7 && data.ot != 4)
continue;
if(filter_lm == 8 && !(data.ot & 0x8))
continue;
}
bool is_target = true;
for (auto elements_iterator = query_elements.begin(); elements_iterator != query_elements.end(); ++elements_iterator) {
......
......@@ -72,7 +72,24 @@ const std::unordered_map<int, int>* DeckManager::GetLFListContent(int lfhash) {
return &lit->content;
return nullptr;
}
int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg) {
int DeckManager::IsGameRuleDisallowed(unsigned char hostInfoRule, unsigned int cardOt) {
bool allow_ocg = hostInfoRule == 0 || hostInfoRule == 2; // OCG can be used in OCG and OT duels
bool allow_tcg = hostInfoRule == 1 || hostInfoRule == 2; // TCG can be used in TCG and OT duels
bool allow_ccg = hostInfoRule == 0 || hostInfoRule == 4 || hostInfoRule == 2; // CCG can be used in OCG, CCG and OT duels
if(!allow_ocg && (cardOt & 0x3 == 0x1))
return DECKERROR_OCGONLY;
if(!allow_tcg && (cardOt & 0x3 == 0x2))
return DECKERROR_TCGONLY;
if(hostInfoRule == 4 && !(cardOt & 0x8) && (cardOt & 0x3)) { // in CCG duels, cards labeled with ither OCG or TCG, but not CCG, would not be allowed.
if(cardOt & 0x3 == 0x2) {
return DECKERROR_TCGONLY;
} else {
return DECKERROR_OCGONLY;
}
}
return 0;
}
int DeckManager::CheckDeck(Deck& deck, int lfhash, unsigned char hostInfoRule) {
std::unordered_map<int, int> ccount;
auto list = GetLFListContent(lfhash);
if(!list)
......@@ -96,10 +113,9 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
for(size_t i = 0; i < deck.main.size(); ++i) {
code_pointer cit = deck.main[i];
if(!allow_ocg && (cit->second.ot == 0x1))
return (DECKERROR_OCGONLY << 28) + cit->first;
if(!allow_tcg && (cit->second.ot == 0x2))
return (DECKERROR_TCGONLY << 28) + cit->first;
const int gameruleDeckError = IsGameRuleDisallowed(hostInfoRule, cit->second.ot);
if(gameruleDeckError)
return (gameruleDeckError << 28) + cit->first;
if(cit->second.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_TOKEN | TYPE_LINK))
return (DECKERROR_EXTRACOUNT << 28);
int code = cit->second.alias ? cit->second.alias : cit->first;
......@@ -113,10 +129,9 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
}
for(size_t i = 0; i < deck.extra.size(); ++i) {
code_pointer cit = deck.extra[i];
if(!allow_ocg && (cit->second.ot == 0x1))
return (DECKERROR_OCGONLY << 28) + cit->first;
if(!allow_tcg && (cit->second.ot == 0x2))
return (DECKERROR_TCGONLY << 28) + cit->first;
const int gameruleDeckError = IsGameRuleDisallowed(hostInfoRule, cit->second.ot);
if(gameruleDeckError)
return (gameruleDeckError << 28) + cit->first;
int code = cit->second.alias ? cit->second.alias : cit->first;
ccount[code]++;
dc = ccount[code];
......@@ -128,10 +143,9 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tc
}
for(size_t i = 0; i < deck.side.size(); ++i) {
code_pointer cit = deck.side[i];
if(!allow_ocg && (cit->second.ot == 0x1))
return (DECKERROR_OCGONLY << 28) + cit->first;
if(!allow_tcg && (cit->second.ot == 0x2))
return (DECKERROR_TCGONLY << 28) + cit->first;
const int gameruleDeckError = IsGameRuleDisallowed(hostInfoRule, cit->second.ot);
if(gameruleDeckError)
return (gameruleDeckError << 28) + cit->first;
int code = cit->second.alias ? cit->second.alias : cit->first;
ccount[code]++;
dc = ccount[code];
......
......@@ -39,7 +39,8 @@ public:
void LoadLFList();
const wchar_t* GetLFListName(int lfhash);
const std::unordered_map<int, int>* GetLFListContent(int lfhash);
int CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg);
int IsGameRuleDisallowed(unsigned char hostInfoRule, unsigned int cardOt);
int CheckDeck(Deck &deck, int lfhash, unsigned char hostInfoRule);
int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec);
bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec);
#ifndef YGOPRO_SERVER_MODE
......
......@@ -1185,24 +1185,17 @@ void Game::DrawThumb(code_pointer cp, position2di pos, const std::unordered_map<
break;
}
}
if(cbLimit->getSelected() >= 4 && (cp->second.ot & gameConf.defaultOT)) {
switch(cp->second.ot) {
case 1:
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 128, 128, 192), 0, 0, true);
break;
case 2:
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 192, 128, 256), 0, 0, true);
break;
if(cbLimit->getSelected() >= 4 && ((cp->second.ot & 0x8) || cp->second.ot & 0x3 && (cp->second.ot & 0x3) != 0x3)) {
int xOffset = 0, yOffset = 0;
if(cp->second.ot & 0x8)
xOffset += 128;
else if((cp->second.ot & 0x3)== 0x2) {
yOffset += 64;
}
} else if(cbLimit->getSelected() >= 4 || !(cp->second.ot & gameConf.defaultOT)) {
switch(cp->second.ot) {
case 1:
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 0, 128, 64), 0, 0, true);
break;
case 2:
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 64, 128, 128), 0, 0, true);
break;
if(!deckManager.IsGameRuleDisallowed(gameConf.defaultOT, cp->second.ot)) {
yOffset += 128;
}
driver->draw2DImage(imageManager.tOT, otloc, recti(xOffset, yOffset, 128 + xOffset, 64 + yOffset), 0, 0, true);
}
}
void Game::DrawDeckBd() {
......
......@@ -520,7 +520,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
wchar_t msgbuf[256];
myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1226), deckManager.GetLFListName(pkt->info.lflist));
str.append(msgbuf);
myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1225), dataManager.GetSysString(1240 + pkt->info.rule));
myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1225), dataManager.GetSysString(pkt->info.rule == 4 ? 1249 : 1240 + pkt->info.rule));
str.append(msgbuf);
myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1227), dataManager.GetSysString(1244 + pkt->info.mode));
str.append(msgbuf);
......
......@@ -255,6 +255,7 @@ bool Game::Initialize() {
cbRule->addItem(dataManager.GetSysString(1241));
cbRule->addItem(dataManager.GetSysString(1242));
cbRule->addItem(dataManager.GetSysString(1243));
cbRule->addItem(dataManager.GetSysString(1249));
cbRule->setSelected(gameConf.defaultOT - 1);
env->addStaticText(dataManager.GetSysString(1227), rect<s32>(20, 90, 220, 110), false, false, wCreateHost);
cbMatchMode = env->addComboBox(rect<s32>(140, 85, 300, 110), wCreateHost);
......@@ -759,6 +760,7 @@ bool Game::Initialize() {
cbLimit->addItem(dataManager.GetSysString(1241));
cbLimit->addItem(dataManager.GetSysString(1242));
cbLimit->addItem(dataManager.GetSysString(1243));
cbLimit->addItem(dataManager.GetSysString(1249));
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->setMaxSelectionRows(10);
......
......@@ -299,7 +299,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, char* data, unsigned int len) {
duel_mode = new TagDuel();
duel_mode->etimer = event_new(net_evbase, 0, EV_TIMEOUT | EV_PERSIST, TagDuel::TagTimer, duel_mode);
}
if(pkt->info.rule > 3)
if(pkt->info.rule > 4)
pkt->info.rule = 0;
if(pkt->info.mode > 2)
pkt->info.mode = 0;
......
......@@ -54,4 +54,5 @@ project "ygopro"
configuration "macosx"
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos11" }
linkoptions { "-arch arm64" }
end
......@@ -71,10 +71,12 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
is_recorder = true;
cache_recorder = dp;
}
#ifndef YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
if(!wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
is_recorder = true;
replay_recorder = dp;
}
#endif //YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
#else
if(wcscmp(jpass, pass)) {
STOC_ErrorMsg scem;
......@@ -357,9 +359,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
if(deck_error[dp->type]) {
deckerror = (DECKERROR_UNKNOWNCARD << 28) + deck_error[dp->type];
} else {
bool allow_ocg = host_info.rule == 0 || host_info.rule == 2;
bool allow_tcg = host_info.rule == 1 || host_info.rule == 2;
deckerror = deckManager.CheckDeck(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg);
deckerror = deckManager.CheckDeck(pdeck[dp->type], host_info.lflist, host_info.rule);
}
}
if(deckerror) {
......
......@@ -67,10 +67,12 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
is_recorder = true;
cache_recorder = dp;
}
#ifndef YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
if(!wcscmp(jpass, L"Marshtomp") && !replay_recorder) {
is_recorder = true;
replay_recorder = dp;
}
#endif //YGOPRO_SERVER_MODE_DISABLE_CLOUD_REPLAY
#else
if(wcscmp(jpass, pass)) {
STOC_ErrorMsg scem;
......@@ -335,9 +337,7 @@ void TagDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
if(deck_error[dp->type]) {
deckerror = (DECKERROR_UNKNOWNCARD << 28) + deck_error[dp->type];
} else {
bool allow_ocg = host_info.rule == 0 || host_info.rule == 2;
bool allow_tcg = host_info.rule == 1 || host_info.rule == 2;
deckerror = deckManager.CheckDeck(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg);
deckerror = deckManager.CheckDeck(pdeck[dp->type], host_info.lflist, host_info.rule);
}
}
if(deckerror) {
......
......@@ -69,8 +69,8 @@ end
defines { "LUA_USE_MACOSX", "DBL_MAX_10_EXP=+308", "DBL_MANT_DIG=53", "GL_SILENCE_DEPRECATION" }
if not LIBEVENT_ROOT then
includedirs { "/usr/local/include/event2" }
libdirs { "/usr/local/lib" }
end
libdirs { "/usr/local/lib" }
buildoptions { "-stdlib=libc++" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos11" }
......
Subproject commit eae593f91a9e1c71649ab8d7463ffc0da97b8abe
Subproject commit 7fb19c31965cef7c4b0513ad69f08a3d07d10f6d
......@@ -307,6 +307,7 @@
!system 1246 TAG
!system 1247 标准对战
!system 1248 自定义
!system 1249 简体中文
!system 1250 决斗准备
!system 1251 →决斗者
!system 1252 →观战
......
textures/ot.png

8.26 KB | W: | H:

textures/ot.png

9.92 KB | W: | H:

textures/ot.png
textures/ot.png
textures/ot.png
textures/ot.png
  • 2-up
  • Swipe
  • Onion skin
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