Fixed bug that was not correctly showing the full Commander decks list in the deck choosing menu page, added a new gesture for Android to emulate back button pressure: now sliding from down to up for almost all screen size will trigger the back button in game (e.g. pause match in gameplay, going back from shop, and so on).

This commit is contained in:
Vittorio Alfieri
2021-09-05 01:15:01 +02:00
parent c211b2eaa4
commit ccae9673e6
7 changed files with 19 additions and 14 deletions
+1 -1
View File
@@ -446,7 +446,7 @@ void DeckMenu::Add(int id, const string& text, const string& desc, bool forceFoc
else
deckDescription = deckMetaData ? deckMetaData->getDescription() : desc;
if(deckMetaData && deckMetaData->isCommanderDeck)
if(deckMetaData && deckMetaData->isCommanderDeck())
deckDescription = deckDescription + " (" + _("CMD") + ")"; // It will show a CMD suffix for Commander Decks.
menuItem->setDescription(deckDescription);
+6 -6
View File
@@ -21,7 +21,6 @@ DeckMetaData::DeckMetaData(const string& filename, bool isAI)
LoadDeck();
}
void DeckMetaData::LoadDeck()
{
if (!mDeckLoaded)
@@ -30,7 +29,7 @@ void DeckMetaData::LoadDeck()
mName = trim(deck.meta_name);
mDescription = trim(deck.meta_desc);
mDeckId = atoi((mFilename.substr(mFilename.find("deck") + 4, mFilename.find(".txt"))).c_str());
isCommanderDeck = deck.meta_commander; //Added to read the command tag in deck's metafile.
mCommanderDeck = deck.meta_commander; //Added to read the command tag in deck's metafile.
vector<string> requirements = split(deck.meta_unlockRequirements, ',');
for(size_t i = 0; i < requirements.size(); ++i)
@@ -49,10 +48,8 @@ void DeckMetaData::LoadDeck()
}
}
}
void DeckMetaData::LoadStats()
{
if (!mStatsLoaded)
@@ -65,7 +62,6 @@ void DeckMetaData::LoadStats()
mGamesPlayed = 0;
mColorIndex = "";
mDifficulty = 0;
isCommanderDeck = false;
stats->load(mPlayerDeck);
DeckStat * opponentDeckStats = stats->getDeckStat(mStatsFilename);
@@ -115,6 +111,11 @@ int DeckMetaData::getAvatarId()
//Accessors
bool DeckMetaData::isCommanderDeck()
{
return mCommanderDeck;
}
string DeckMetaData::getFilename()
{
return mFilename;
@@ -135,7 +136,6 @@ vector<int> DeckMetaData::getUnlockRequirements()
return mUnlockRequirements;
}
string DeckMetaData::getAvatarFilename()
{
return mAvatarFilename;
+1 -1
View File
@@ -42,7 +42,7 @@ vector<DeckMetaData *> GameState::BuildDeckList(const string& path, const string
if (meta)
{
found = 1;
if(!showall && ((meta->isCommanderDeck && type != GAME_TYPE_COMMANDER) || (!meta->isCommanderDeck && type == GAME_TYPE_COMMANDER))){
if(!showall && ((meta->isCommanderDeck() && type != GAME_TYPE_COMMANDER) || (!meta->isCommanderDeck() && type == GAME_TYPE_COMMANDER))){
meta = NULL; // It will show commander decks only in commander mode and it will hide them in other modes.
nbDecks++;
continue;
+1 -2
View File
@@ -896,10 +896,10 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
size_t dot = filename.find(".");
meta_name = filename.substr(slash + 1, dot - slash - 1);
meta_id = atoi(meta_name.substr(4).c_str());
meta_commander = false;
std::string contents;
if (JFileSystem::GetInstance()->readIntoString(config_file, contents))
{
meta_commander = (contents.find("#CMD:")!=string::npos)?true:false; //Added to read the command tag in metafile.
std::stringstream stream(contents);
std::string s;
while (std::getline(stream, s))
@@ -970,7 +970,6 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
found = s.find("CMD:"); // Now it's possible to add a card to Command Zone even using their Name instead of ID such as normal deck cards.
if (found != string::npos)
{
meta_commander = true; //Added to read the command tag in metafile.
if(!database) continue;
s = s.substr(found + 4);
s.erase(s.find_last_not_of("\t\n\v\f\r ") + 1);