Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Robosturm committed Aug 11, 2024
1 parent 131e6ee commit 8259eae
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 33 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ endif()
add_definitions(
-DVERSION_MAJOR=0
-DVERSION_MINOR=37
-DVERSION_REVISION=0
-DVERSION_REVISION=1
-DVERSION_SUFFIX="main"
-DCOW_BUILD_TAG="${COW_BUILD_TAG}"
)

set(COW_ANDROID_VERSION_NAME "0.37.0-main")
set(COW_ANDROID_VERSION_CODE "58")
set(COW_ANDROID_VERSION_NAME "0.37.1-main")
set(COW_ANDROID_VERSION_CODE "59")

###################################################################################
# Set up some compiler and linking options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void ScriptConditionTerrainDestroyed::writeCondition(QTextStream& rStream)
}
rStream << " " << m_executed << ".writeDataBool(true);\n";
}
rStream << " } // " + QString(ConditionBuildingDestroyed) + " End\n";
rStream << " } // " + QString(ConditionTerrainDestroyed) + " End\n";
}

void ScriptConditionTerrainDestroyed::writePostCondition(QTextStream& rStream)
Expand Down
98 changes: 69 additions & 29 deletions objects/mapselection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void MapSelection::changeFolder(QString folder)
{
CONSOLE_PRINT("MapSelection::changeFolder " + folder, GameConsole::eDEBUG);
m_itemClicked = false;
QString newFolder = folder;
QString newFolder = folder;
if (newFolder == "")
{
newFolder = Settings::getInstance()->getUserPath() + "maps";
Expand All @@ -110,31 +110,64 @@ void MapSelection::changeFolder(QString folder)
{
newFolder = newFolder.replace("//", "/");
}
QDir dir(newFolder);
QDir virtDir(oxygine::Resource::RCC_PREFIX_PATH + newFolder);
if (dir.exists() || virtDir.exists())
QFileInfo newFolderInfo(newFolder);
newFolder = GlobalUtils::makePathRelative(newFolderInfo.canonicalFilePath());
QStringList searchPaths;
searchPaths.append(newFolder);
searchPaths.append(QString(oxygine::Resource::RCC_PREFIX_PATH) + newFolder);
CONSOLE_PRINT("MapSelection::changeFolder. Relative Path: " + newFolder, GameConsole::eDEBUG);
m_Files.clear();
QStringList filterList;
filterList.reserve(m_filter.size());
for (const auto & ending : std::as_const(m_filter))
{
QFileInfo newFolderInfo(newFolder);
newFolder = GlobalUtils::makePathRelative(newFolderInfo.canonicalFilePath());
CONSOLE_PRINT("MapSelection::changeFolder. Relative Path: " + newFolder, GameConsole::eDEBUG);
m_Files.clear();
if (newFolder != "maps")
filterList.append("*" + ending);
}
for(qint32 i = 0; i < 2 ; ++i)
{
QDir::Filter filter;
if (i == 1)
{
m_Files.append("..");

filter = QDir::Files;
addFiles(newFolder, searchPaths, filterList, filter);
}
QFileInfo upFolder(newFolder + "..");
QStringList list;
list.reserve(m_filter.size());
for (const auto & ending : std::as_const(m_filter))
else
{
list.append("*" + ending);
filter = QDir::Dirs;
addFiles(newFolder, searchPaths, filterList, filter);
}
QFileInfoList infoList = GlobalUtils::getInfoList(newFolder, list);
}
m_currentFolder = newFolder;
updateSelection();
if (m_currentIdx < m_Files.size() && m_currentIdx >= 0)
{
m_currentItem = m_Files[m_currentIdx];
emit sigStartItemChangeTimer();
}
}

void MapSelection::addFiles(const QString & newFolder, const QStringList & searchPaths, QStringList filterList, QDir::Filter filter)
{
for (auto & path : searchPaths)
{
QFileInfo upFolder(path + "..");
Userdata* pUserdata = Userdata::getInstance();
auto hideList = pUserdata->getShopItemsList(GameEnums::ShopItemType_Map, false);
for (qint32 i = 1; i < infoList.size(); i++)
QStringList dirIterFilterList;
if (filter == QDir::Dirs)
{
auto & infoItem = infoList[i];
dirIterFilterList = QStringList();
}
else
{
dirIterFilterList = filterList;
}
QDirIterator dirIter(path, dirIterFilterList, filter, QDirIterator::NoIteratorFlags);
while (dirIter.hasNext())
{
dirIter.next();
auto infoItem = dirIter.fileInfo();
QString myPath = infoItem.canonicalFilePath();
QString item = GlobalUtils::makePathRelative(myPath);
bool isDir = infoItem.isDir();
Expand All @@ -148,27 +181,34 @@ void MapSelection::changeFolder(QString folder)
}
if (isDir)
{
QString path = infoItem.canonicalFilePath();
QDirIterator iter(path, list, QDir::Files, QDirIterator::Subdirectories);
QDirIterator iter2(oxygine::Resources::RCC_PREFIX_PATH + item, list, QDir::Files, QDirIterator::Subdirectories);
QString currentPath = infoItem.canonicalFilePath();
QDirIterator iter(path, filterList, QDir::Files, QDirIterator::Subdirectories);
QDirIterator iter2(oxygine::Resources::RCC_PREFIX_PATH + item, filterList, QDir::Files, QDirIterator::Subdirectories);
if (!iter.hasNext() && !iter2.hasNext())
{
continue;
}
m_Files.append(path);
QString baseName = infoItem.completeBaseName();
bool add = true;
for (const auto & item : m_Files)
{
auto items = item.split("/");
if (items[items.size() - 1].endsWith(baseName))
{
add = false;
break;
}
}
if (add)
{
m_Files.append(currentPath);
}
}
else if (infoItem.isFile())
{
m_Files.append(infoItem.canonicalFilePath());
}
}
m_currentFolder = newFolder;
updateSelection();
if (m_currentIdx < m_Files.size() && m_currentIdx >= 0)
{
m_currentItem = m_Files[m_currentIdx];
emit sigStartItemChangeTimer();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions objects/mapselection.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public slots:
void refresh();
private:
void addNewSelectionItem(qint32 i, qint32 & y);
void addFiles(const QString & newFolder, const QStringList & searchPaths, QStringList filterList, QDir::Filter filter);
private:
QStringList m_filter;
QString m_currentFolder;
Expand Down
16 changes: 16 additions & 0 deletions resources/ui/coGenerator/cogeneratormenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
<x>10</x>
<y>10</y>
<width>300</width>
<text>QT_TRANSLATE_NOOP("GAME","CO ID:")</text>
<font>"main"</font>
<fontSize>24</fontSize>
</Label>
<Textbox>
<x>lastX + lastWidth + 10</x>
<y>lastY</y>
<width>settings.getStageWidth() - 90 - lastWidth - lastX - 170</width>
<tooltip>QT_TRANSLATE_NOOP("GAME","The ID of the CO.")</tooltip>
<startValue>currentMenu.getCoId()</startValue>
<onEvent>currentMenu.setCoId(input)</onEvent>
</Textbox>
<Label>
<x>10</x>
<y>lastY + lastHeight + 10</y>
<width>300</width>
<text>QT_TRANSLATE_NOOP("GAME","CO name:")</text>
<font>"main"</font>
<fontSize>24</fontSize>
Expand Down

0 comments on commit 8259eae

Please sign in to comment.