Commit a1c19506 authored by salix5's avatar salix5

add CardDataC::get_duel_code

parent 4165a715
......@@ -51,6 +51,13 @@ struct CardDataC {
}
return false;
}
uint32_t get_duel_code() const {
if (rule_code)
return rule_code;
if (alias)
return alias;
return code;
}
};
constexpr int DESC_COUNT = 16;
struct CardString {
......
......@@ -1875,21 +1875,21 @@ void DeckBuilder::pop_side(int seq) {
GetHoveredCard();
}
bool DeckBuilder::check_limit(code_pointer pointer) {
auto limitcode = pointer->second.alias ? pointer->second.alias : pointer->first;
auto limitcode = pointer->second.get_duel_code();
int limit = 3;
auto flit = filterList->content.find(limitcode);
if(flit != filterList->content.end())
limit = flit->second;
for (auto& card : deckManager.current_deck.main) {
if (card->first == limitcode || card->second.alias == limitcode)
if (card->second.get_duel_code() == limitcode)
limit--;
}
for (auto& card : deckManager.current_deck.extra) {
if (card->first == limitcode || card->second.alias == limitcode)
if (card->second.get_duel_code() == limitcode)
limit--;
}
for (auto& card : deckManager.current_deck.side) {
if (card->first == limitcode || card->second.alias == limitcode)
if (card->second.get_duel_code() == limitcode)
limit--;
}
return limit > 0;
......
......@@ -105,7 +105,7 @@ unsigned int DeckManager::CheckDeck(const Deck& deck, unsigned int lfhash, int r
return (gameruleDeckError << 28) | cit->first;
if (cit->second.type & (TYPES_EXTRA_DECK | TYPE_TOKEN))
return (DECKERROR_MAINCOUNT << 28);
int code = cit->second.alias ? cit->second.alias : cit->first;
auto code = cit->second.get_duel_code();
ccount[code]++;
int dc = ccount[code];
if(dc > 3)
......@@ -120,7 +120,7 @@ unsigned int DeckManager::CheckDeck(const Deck& deck, unsigned int lfhash, int r
return (gameruleDeckError << 28) | cit->first;
if (!(cit->second.type & TYPES_EXTRA_DECK) || cit->second.type & TYPE_TOKEN)
return (DECKERROR_EXTRACOUNT << 28);
int code = cit->second.alias ? cit->second.alias : cit->first;
auto code = cit->second.get_duel_code();
ccount[code]++;
int dc = ccount[code];
if(dc > 3)
......@@ -135,7 +135,7 @@ unsigned int DeckManager::CheckDeck(const Deck& deck, unsigned int lfhash, int r
return (gameruleDeckError << 28) | cit->first;
if (cit->second.type & TYPE_TOKEN)
return (DECKERROR_SIDECOUNT << 28);
int code = cit->second.alias ? cit->second.alias : cit->first;
auto code = cit->second.get_duel_code();
ccount[code]++;
int dc = ccount[code];
if(dc > 3)
......
......@@ -1125,9 +1125,7 @@ void Game::WaitFrameSignal(int frame) {
}
void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const LFList* lflist, bool drag) {
auto code = cp->first;
auto lcode = cp->second.alias;
if(lcode == 0)
lcode = code;
auto lcode = cp->second.get_duel_code();
irr::video::ITexture* img = imageManager.GetTextureThumb(code);
if(img == nullptr)
return; //nullptr->getSize() will cause a crash
......
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