Change many pointer members in Project to values
This commit is contained in:
parent
c1303d98c3
commit
820b514f26
11 changed files with 79 additions and 90 deletions
|
@ -77,7 +77,7 @@ public:
|
|||
static Event* createNewSecretBaseEvent(Project*);
|
||||
|
||||
OrderedJson::object buildObjectEventJSON();
|
||||
OrderedJson::object buildWarpEventJSON(QMap<QString, QString>*);
|
||||
OrderedJson::object buildWarpEventJSON(const QMap<QString, QString> &);
|
||||
OrderedJson::object buildTriggerEventJSON();
|
||||
OrderedJson::object buildWeatherTriggerEventJSON();
|
||||
OrderedJson::object buildSignEventJSON();
|
||||
|
|
|
@ -33,20 +33,20 @@ public:
|
|||
|
||||
public:
|
||||
QString root;
|
||||
QStringList *groupNames = nullptr;
|
||||
QMap<QString, int> *mapGroups;
|
||||
QStringList groupNames;
|
||||
QMap<QString, int> mapGroups;
|
||||
QList<QStringList> groupedMapNames;
|
||||
QStringList *mapNames = nullptr;
|
||||
QStringList mapNames;
|
||||
QMap<QString, QVariant> miscConstants;
|
||||
QList<HealLocation> healLocations;
|
||||
QMap<QString, QString>* mapConstantsToMapNames;
|
||||
QMap<QString, QString>* mapNamesToMapConstants;
|
||||
QList<QString> mapLayoutsTable;
|
||||
QList<QString> mapLayoutsTableMaster;
|
||||
QMap<QString, QString> mapConstantsToMapNames;
|
||||
QMap<QString, QString> mapNamesToMapConstants;
|
||||
QStringList mapLayoutsTable;
|
||||
QStringList mapLayoutsTableMaster;
|
||||
QString layoutsLabel;
|
||||
QMap<QString, MapLayout*> mapLayouts;
|
||||
QMap<QString, MapLayout*> mapLayoutsMaster;
|
||||
QMap<QString, QString> *mapSecToMapHoverName;
|
||||
QMap<QString, QString> mapSecToMapHoverName;
|
||||
QMap<QString, int> mapSectionNameToValue;
|
||||
QMap<int, QString> mapSectionValueToName;
|
||||
QStringList *itemNames = nullptr;
|
||||
|
|
|
@ -321,13 +321,13 @@ OrderedJson::object Event::buildObjectEventJSON()
|
|||
return eventObj;
|
||||
}
|
||||
|
||||
OrderedJson::object Event::buildWarpEventJSON(QMap<QString, QString> *mapNamesToMapConstants)
|
||||
OrderedJson::object Event::buildWarpEventJSON(const QMap<QString, QString> &mapNamesToMapConstants)
|
||||
{
|
||||
OrderedJson::object warpObj;
|
||||
warpObj["x"] = this->getU16("x");
|
||||
warpObj["y"] = this->getU16("y");
|
||||
warpObj["elevation"] = this->getInt("elevation");
|
||||
warpObj["dest_map"] = mapNamesToMapConstants->value(this->get("destination_map_name"));
|
||||
warpObj["dest_map"] = mapNamesToMapConstants.value(this->get("destination_map_name"));
|
||||
warpObj["dest_warp_id"] = this->getInt("destination_warp");
|
||||
this->addCustomValuesTo(&warpObj);
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ bool RegionMap::readLayout() {
|
|||
return false;
|
||||
}
|
||||
|
||||
QMap<QString, QString> *qmap = new QMap<QString, QString>;
|
||||
QMap<QString, QString> qmap;
|
||||
|
||||
bool mapNamesQualified = false, mapEntriesQualified = false;
|
||||
|
||||
|
@ -155,7 +155,7 @@ bool RegionMap::readLayout() {
|
|||
QStringList entry = reAfter.match(line).captured(1).remove(" ").split(",");
|
||||
QString mapsec = reBefore.match(line).captured(1);
|
||||
QString insertion = entry[4].remove("sMapName_");
|
||||
qmap->insert(mapsec, sMapNamesMap.value(insertion));
|
||||
qmap.insert(mapsec, sMapNamesMap.value(insertion));
|
||||
mapSecToMapEntry[mapsec] = {
|
||||
// x y width height name
|
||||
entry[0].toInt(), entry[1].toInt(), entry[2].toInt(), entry[3].toInt(), insertion
|
||||
|
@ -265,7 +265,7 @@ void RegionMap::saveOptions(int id, QString sec, QString name, int x, int y) {
|
|||
this->map_squares[index].mapsec = sec;
|
||||
if (!name.isEmpty()) {
|
||||
this->map_squares[index].map_name = name;
|
||||
this->project->mapSecToMapHoverName->insert(sec, name);
|
||||
this->project->mapSecToMapHoverName.insert(sec, name);
|
||||
QString sName = fixCase(sec);
|
||||
sMapNamesMap.insert(sName, name);
|
||||
if (!mapSecToMapEntry.keys().contains(sec)) {
|
||||
|
|
|
@ -726,11 +726,11 @@ void Editor::populateConnectionMapPickers() {
|
|||
ui->comboBox_EmergeMap->blockSignals(true);
|
||||
|
||||
ui->comboBox_ConnectedMap->clear();
|
||||
ui->comboBox_ConnectedMap->addItems(*project->mapNames);
|
||||
ui->comboBox_ConnectedMap->addItems(project->mapNames);
|
||||
ui->comboBox_DiveMap->clear();
|
||||
ui->comboBox_DiveMap->addItems(*project->mapNames);
|
||||
ui->comboBox_DiveMap->addItems(project->mapNames);
|
||||
ui->comboBox_EmergeMap->clear();
|
||||
ui->comboBox_EmergeMap->addItems(*project->mapNames);
|
||||
ui->comboBox_EmergeMap->addItems(project->mapNames);
|
||||
|
||||
ui->comboBox_ConnectedMap->blockSignals(false);
|
||||
ui->comboBox_DiveMap->blockSignals(true);
|
||||
|
@ -1678,7 +1678,7 @@ void Editor::updateConnectionOffset(int offset) {
|
|||
}
|
||||
|
||||
void Editor::setConnectionMap(QString mapName) {
|
||||
if (!mapName.isEmpty() && !project->mapNames->contains(mapName)) {
|
||||
if (!mapName.isEmpty() && !project->mapNames.contains(mapName)) {
|
||||
logError(QString("Invalid map name '%1' specified for connection.").arg(mapName));
|
||||
return;
|
||||
}
|
||||
|
@ -1714,9 +1714,9 @@ void Editor::addNewConnection() {
|
|||
}
|
||||
|
||||
// Don't connect the map to itself.
|
||||
QString defaultMapName = project->mapNames->first();
|
||||
QString defaultMapName = project->mapNames.first();
|
||||
if (defaultMapName == map->name) {
|
||||
defaultMapName = project->mapNames->value(1);
|
||||
defaultMapName = project->mapNames.value(1);
|
||||
}
|
||||
|
||||
MapConnection* newConnection = new MapConnection;
|
||||
|
@ -1824,7 +1824,7 @@ void Editor::updateEmergeMap(QString mapName) {
|
|||
}
|
||||
|
||||
void Editor::updateDiveEmergeMap(QString mapName, QString direction) {
|
||||
if (!mapName.isEmpty() && !project->mapNamesToMapConstants->contains(mapName)) {
|
||||
if (!mapName.isEmpty() && !project->mapNamesToMapConstants.contains(mapName)) {
|
||||
logError(QString("Invalid %1 connection map name: '%2'").arg(direction).arg(mapName));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -672,7 +672,7 @@ void MainWindow::refreshMapScene()
|
|||
|
||||
void MainWindow::openWarpMap(QString map_name, QString warp_num) {
|
||||
// Ensure valid destination map name.
|
||||
if (!editor->project->mapNames->contains(map_name)) {
|
||||
if (!editor->project->mapNames.contains(map_name)) {
|
||||
logError(QString("Invalid warp destination map name '%1'").arg(map_name));
|
||||
return;
|
||||
}
|
||||
|
@ -946,8 +946,8 @@ void MainWindow::sortMapList() {
|
|||
switch (mapSortOrder)
|
||||
{
|
||||
case MapSortOrder::Group:
|
||||
for (int i = 0; i < project->groupNames->length(); i++) {
|
||||
QString group_name = project->groupNames->value(i);
|
||||
for (int i = 0; i < project->groupNames.length(); i++) {
|
||||
QString group_name = project->groupNames.value(i);
|
||||
QStandardItem *group = new QStandardItem;
|
||||
group->setText(group_name);
|
||||
group->setIcon(mapFolderIcon);
|
||||
|
@ -982,7 +982,7 @@ void MainWindow::sortMapList() {
|
|||
mapGroupItemsList->append(mapsec);
|
||||
mapsecToGroupNum.insert(mapsec_name, i);
|
||||
}
|
||||
for (int i = 0; i < project->groupNames->length(); i++) {
|
||||
for (int i = 0; i < project->groupNames.length(); i++) {
|
||||
QStringList names = project->groupedMapNames.value(i);
|
||||
for (int j = 0; j < names.length(); j++) {
|
||||
QString map_name = names.value(j);
|
||||
|
@ -1014,7 +1014,7 @@ void MainWindow::sortMapList() {
|
|||
mapGroupItemsList->append(layoutItem);
|
||||
layoutIndices[layoutId] = i;
|
||||
}
|
||||
for (int i = 0; i < project->groupNames->length(); i++) {
|
||||
for (int i = 0; i < project->groupNames.length(); i++) {
|
||||
QStringList names = project->groupedMapNames.value(i);
|
||||
for (int j = 0; j < names.length(); j++) {
|
||||
QString map_name = names.value(j);
|
||||
|
@ -1828,10 +1828,10 @@ void MainWindow::updateSelectedObjects() {
|
|||
}
|
||||
|
||||
if (key == "destination_map_name") {
|
||||
if (!editor->project->mapNames->contains(value)) {
|
||||
if (!editor->project->mapNames.contains(value)) {
|
||||
combo->addItem(value);
|
||||
}
|
||||
combo->addItems(*editor->project->mapNames);
|
||||
combo->addItems(editor->project->mapNames);
|
||||
combo->setCurrentIndex(combo->findText(value));
|
||||
combo->setToolTip("The destination map name of the warp.");
|
||||
} else if (key == "destination_warp") {
|
||||
|
@ -1931,10 +1931,10 @@ void MainWindow::updateSelectedObjects() {
|
|||
} else if (key == "in_connection") {
|
||||
check->setToolTip("Check if object is positioned in the connection to another map.");
|
||||
} else if (key == "respawn_map") {
|
||||
if (!editor->project->mapNames->contains(value)) {
|
||||
if (!editor->project->mapNames.contains(value)) {
|
||||
combo->addItem(value);
|
||||
}
|
||||
combo->addItems(*editor->project->mapNames);
|
||||
combo->addItems(editor->project->mapNames);
|
||||
combo->setToolTip("The map where the player will respawn after whiteout.");
|
||||
} else if (key == "respawn_npc") {
|
||||
spin->setToolTip("event_object ID of the NPC the player interacts with\n"
|
||||
|
@ -2482,7 +2482,7 @@ void MainWindow::on_spinBox_ConnectionOffset_valueChanged(int offset)
|
|||
|
||||
void MainWindow::on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName)
|
||||
{
|
||||
if (editor->project->mapNames->contains(mapName))
|
||||
if (editor->project->mapNames.contains(mapName))
|
||||
editor->setConnectionMap(mapName);
|
||||
}
|
||||
|
||||
|
@ -2510,13 +2510,13 @@ void MainWindow::on_pushButton_ConfigureEncountersJSON_clicked() {
|
|||
|
||||
void MainWindow::on_comboBox_DiveMap_currentTextChanged(const QString &mapName)
|
||||
{
|
||||
if (editor->project->mapNames->contains(mapName))
|
||||
if (editor->project->mapNames.contains(mapName))
|
||||
editor->updateDiveMap(mapName);
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_EmergeMap_currentTextChanged(const QString &mapName)
|
||||
{
|
||||
if (editor->project->mapNames->contains(mapName))
|
||||
if (editor->project->mapNames.contains(mapName))
|
||||
editor->updateEmergeMap(mapName);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,6 @@ int Project::max_object_events = 64;
|
|||
|
||||
Project::Project(QWidget *parent) : parent(parent)
|
||||
{
|
||||
groupNames = new QStringList;
|
||||
mapGroups = new QMap<QString, int>;
|
||||
mapNames = new QStringList;
|
||||
itemNames = new QStringList;
|
||||
flagNames = new QStringList;
|
||||
varNames = new QStringList;
|
||||
|
@ -53,8 +50,6 @@ Project::Project(QWidget *parent) : parent(parent)
|
|||
bgEventFacingDirections = new QStringList;
|
||||
trainerTypes = new QStringList;
|
||||
mapCache = new QMap<QString, Map*>;
|
||||
mapConstantsToMapNames = new QMap<QString, QString>;
|
||||
mapNamesToMapConstants = new QMap<QString, QString>;
|
||||
tilesetCache = new QMap<QString, Tileset*>;
|
||||
|
||||
initSignals();
|
||||
|
@ -62,9 +57,6 @@ Project::Project(QWidget *parent) : parent(parent)
|
|||
|
||||
Project::~Project()
|
||||
{
|
||||
delete this->groupNames;
|
||||
delete this->mapGroups;
|
||||
delete this->mapNames;
|
||||
delete this->itemNames;
|
||||
delete this->flagNames;
|
||||
delete this->varNames;
|
||||
|
@ -78,9 +70,6 @@ Project::~Project()
|
|||
delete this->trainerTypes;
|
||||
delete this->mapTypes;
|
||||
|
||||
delete this->mapConstantsToMapNames;
|
||||
delete this->mapNamesToMapConstants;
|
||||
|
||||
clearMapCache();
|
||||
delete this->mapCache;
|
||||
clearTilesetCache();
|
||||
|
@ -283,8 +272,8 @@ bool Project::loadMapData(Map* map) {
|
|||
|
||||
// Ensure the warp destination map constant is valid before adding it to the warps.
|
||||
QString mapConstant = event["dest_map"].toString();
|
||||
if (mapConstantsToMapNames->contains(mapConstant)) {
|
||||
warp->put("destination_map_name", mapConstantsToMapNames->value(mapConstant));
|
||||
if (mapConstantsToMapNames.contains(mapConstant)) {
|
||||
warp->put("destination_map_name", mapConstantsToMapNames.value(mapConstant));
|
||||
warp->put("event_group_type", "warp_event_group");
|
||||
map->events["warp_event_group"].append(warp);
|
||||
} else if (mapConstant == NONE_MAP_CONSTANT) {
|
||||
|
@ -302,7 +291,7 @@ bool Project::loadMapData(Map* map) {
|
|||
HealLocation loc = *it;
|
||||
|
||||
//if TRUE map is flyable / has healing location
|
||||
if (loc.mapName == QString(mapNamesToMapConstants->value(map->name)).remove(0,4)) {
|
||||
if (loc.mapName == QString(mapNamesToMapConstants.value(map->name)).remove(0,4)) {
|
||||
Event *heal = new Event;
|
||||
heal->put("map_name", map->name);
|
||||
heal->put("x", loc.x);
|
||||
|
@ -311,11 +300,11 @@ bool Project::loadMapData(Map* map) {
|
|||
heal->put("id_name", loc.idName);
|
||||
heal->put("index", loc.index);
|
||||
heal->put("elevation", 3); // TODO: change this?
|
||||
heal->put("destination_map_name", mapConstantsToMapNames->value(map->name));
|
||||
heal->put("destination_map_name", mapConstantsToMapNames.value(map->name));
|
||||
heal->put("event_group_type", "heal_event_group");
|
||||
heal->put("event_type", EventType::HealLocation);
|
||||
if (projectConfig.getHealLocationRespawnDataEnabled()) {
|
||||
heal->put("respawn_map", mapConstantsToMapNames->value(QString("MAP_" + loc.respawnMap)));
|
||||
heal->put("respawn_map", mapConstantsToMapNames.value(QString("MAP_" + loc.respawnMap)));
|
||||
heal->put("respawn_npc", loc.respawnNPC);
|
||||
}
|
||||
map->events["heal_event_group"].append(heal);
|
||||
|
@ -408,8 +397,8 @@ bool Project::loadMapData(Map* map) {
|
|||
connection->direction = connectionObj["direction"].toString();
|
||||
connection->offset = QString::number(connectionObj["offset"].toInt());
|
||||
QString mapConstant = connectionObj["map"].toString();
|
||||
if (mapConstantsToMapNames->contains(mapConstant)) {
|
||||
connection->map_name = mapConstantsToMapNames->value(mapConstant);
|
||||
if (mapConstantsToMapNames.contains(mapConstant)) {
|
||||
connection->map_name = mapConstantsToMapNames.value(mapConstant);
|
||||
map->connections.append(connection);
|
||||
} else {
|
||||
logError(QString("Failed to find connected map for map constant '%1'").arg(mapConstant));
|
||||
|
@ -703,7 +692,7 @@ void Project::saveMapGroups() {
|
|||
mapGroupsObj["layouts_table_label"] = layoutsLabel;
|
||||
|
||||
OrderedJson::array groupNamesArr;
|
||||
for (QString groupName : *this->groupNames) {
|
||||
for (QString groupName : this->groupNames) {
|
||||
groupNamesArr.push_back(groupName);
|
||||
}
|
||||
mapGroupsObj["group_order"] = groupNamesArr;
|
||||
|
@ -714,7 +703,7 @@ void Project::saveMapGroups() {
|
|||
for (QString mapName : mapNames) {
|
||||
groupArr.push_back(mapName);
|
||||
}
|
||||
mapGroupsObj[this->groupNames->at(groupNum)] = groupArr;
|
||||
mapGroupsObj[this->groupNames.at(groupNum)] = groupArr;
|
||||
groupNum++;
|
||||
}
|
||||
|
||||
|
@ -826,13 +815,13 @@ void Project::saveMapConstantsHeader() {
|
|||
text += QString("// Map Group %1\n").arg(groupNum);
|
||||
int maxLength = 0;
|
||||
for (QString mapName : mapNames) {
|
||||
QString mapConstantName = mapNamesToMapConstants->value(mapName);
|
||||
QString mapConstantName = mapNamesToMapConstants.value(mapName);
|
||||
if (mapConstantName.length() > maxLength)
|
||||
maxLength = mapConstantName.length();
|
||||
}
|
||||
int groupIndex = 0;
|
||||
for (QString mapName : mapNames) {
|
||||
QString mapConstantName = mapNamesToMapConstants->value(mapName);
|
||||
QString mapConstantName = mapNamesToMapConstants.value(mapName);
|
||||
text += QString("#define %1%2(%3 | (%4 << 8))\n")
|
||||
.arg(mapConstantName)
|
||||
.arg(QString(" ").repeated(maxLength - mapConstantName.length() + 1))
|
||||
|
@ -1369,11 +1358,11 @@ void Project::saveMap(Map *map) {
|
|||
if (map->connections.length() > 0) {
|
||||
OrderedJson::array connectionsArr;
|
||||
for (MapConnection* connection : map->connections) {
|
||||
if (mapNamesToMapConstants->contains(connection->map_name)) {
|
||||
if (mapNamesToMapConstants.contains(connection->map_name)) {
|
||||
OrderedJson::object connectionObj;
|
||||
connectionObj["direction"] = connection->direction;
|
||||
connectionObj["offset"] = connection->offset.toInt();
|
||||
connectionObj["map"] = this->mapNamesToMapConstants->value(connection->map_name);
|
||||
connectionObj["map"] = this->mapNamesToMapConstants.value(connection->map_name);
|
||||
connectionsArr.append(connectionObj);
|
||||
} else {
|
||||
logError(QString("Failed to write map connection. '%1' is not a valid map name").arg(connection->map_name));
|
||||
|
@ -1833,9 +1822,9 @@ bool Project::readWildMonData() {
|
|||
}
|
||||
|
||||
bool Project::readMapGroups() {
|
||||
mapConstantsToMapNames->clear();
|
||||
mapNamesToMapConstants->clear();
|
||||
mapGroups->clear();
|
||||
mapConstantsToMapNames.clear();
|
||||
mapNamesToMapConstants.clear();
|
||||
mapGroups.clear();
|
||||
|
||||
QString mapGroupsFilepath = QString("%1/data/maps/map_groups.json").arg(root);
|
||||
fileWatcher.addPath(mapGroupsFilepath);
|
||||
|
@ -1849,29 +1838,29 @@ bool Project::readMapGroups() {
|
|||
QJsonArray mapGroupOrder = mapGroupsObj["group_order"].toArray();
|
||||
|
||||
QList<QStringList> groupedMaps;
|
||||
QStringList *maps = new QStringList;
|
||||
QStringList *groups = new QStringList;
|
||||
QStringList maps;
|
||||
QStringList groups;
|
||||
for (int groupIndex = 0; groupIndex < mapGroupOrder.size(); groupIndex++) {
|
||||
QString groupName = mapGroupOrder.at(groupIndex).toString();
|
||||
QJsonArray mapNames = mapGroupsObj.value(groupName).toArray();
|
||||
groupedMaps.append(QStringList());
|
||||
groups->append(groupName);
|
||||
groups.append(groupName);
|
||||
for (int j = 0; j < mapNames.size(); j++) {
|
||||
QString mapName = mapNames.at(j).toString();
|
||||
mapGroups->insert(mapName, groupIndex);
|
||||
mapGroups.insert(mapName, groupIndex);
|
||||
groupedMaps[groupIndex].append(mapName);
|
||||
maps->append(mapName);
|
||||
maps.append(mapName);
|
||||
|
||||
// Build the mapping and reverse mapping between map constants and map names.
|
||||
QString mapConstant = Map::mapConstantFromName(mapName);
|
||||
mapConstantsToMapNames->insert(mapConstant, mapName);
|
||||
mapNamesToMapConstants->insert(mapName, mapConstant);
|
||||
mapConstantsToMapNames.insert(mapConstant, mapName);
|
||||
mapNamesToMapConstants.insert(mapName, mapConstant);
|
||||
}
|
||||
}
|
||||
|
||||
mapConstantsToMapNames->insert(NONE_MAP_CONSTANT, NONE_MAP_NAME);
|
||||
mapNamesToMapConstants->insert(NONE_MAP_NAME, NONE_MAP_CONSTANT);
|
||||
maps->append(NONE_MAP_NAME);
|
||||
mapConstantsToMapNames.insert(NONE_MAP_CONSTANT, NONE_MAP_NAME);
|
||||
mapNamesToMapConstants.insert(NONE_MAP_NAME, NONE_MAP_CONSTANT);
|
||||
maps.append(NONE_MAP_NAME);
|
||||
|
||||
groupNames = groups;
|
||||
groupedMapNames = groupedMaps;
|
||||
|
@ -1881,15 +1870,15 @@ bool Project::readMapGroups() {
|
|||
|
||||
Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
||||
// Setup new map in memory, but don't write to file until map is actually saved later.
|
||||
mapNames->append(mapName);
|
||||
mapGroups->insert(mapName, groupNum);
|
||||
mapNames.append(mapName);
|
||||
mapGroups.insert(mapName, groupNum);
|
||||
groupedMapNames[groupNum].append(mapName);
|
||||
|
||||
Map *map = new Map;
|
||||
map->isPersistedToFile = false;
|
||||
map->setName(mapName);
|
||||
mapConstantsToMapNames->insert(map->constantName, map->name);
|
||||
mapNamesToMapConstants->insert(map->name, map->constantName);
|
||||
mapConstantsToMapNames.insert(map->constantName, map->name);
|
||||
mapNamesToMapConstants.insert(map->name, map->constantName);
|
||||
setNewMapHeader(map, mapLayoutsTable.size() + 1);
|
||||
setNewMapLayout(map);
|
||||
loadMapTilesets(map);
|
||||
|
@ -1903,8 +1892,8 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
|||
}
|
||||
|
||||
Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap, bool existingLayout) {
|
||||
mapNames->append(mapName);
|
||||
mapGroups->insert(mapName, groupNum);
|
||||
mapNames.append(mapName);
|
||||
mapGroups.insert(mapName, groupNum);
|
||||
groupedMapNames[groupNum].append(mapName);
|
||||
|
||||
Map *map = new Map;
|
||||
|
@ -1913,8 +1902,8 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap, bool
|
|||
map->isPersistedToFile = false;
|
||||
map->setName(mapName);
|
||||
|
||||
mapConstantsToMapNames->insert(map->constantName, map->name);
|
||||
mapNamesToMapConstants->insert(map->name, map->constantName);
|
||||
mapConstantsToMapNames.insert(map->constantName, map->name);
|
||||
mapNamesToMapConstants.insert(map->name, map->constantName);
|
||||
if (!existingLayout) {
|
||||
mapLayouts.insert(map->layoutId, map->layout);
|
||||
mapLayoutsTable.append(map->layoutId);
|
||||
|
@ -1935,7 +1924,7 @@ QString Project::getNewMapName() {
|
|||
QString newMapName;
|
||||
do {
|
||||
newMapName = QString("NewMap%1").arg(++i);
|
||||
} while (mapNames->contains(newMapName));
|
||||
} while (mapNames.contains(newMapName));
|
||||
|
||||
return newMapName;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) {
|
|||
}
|
||||
else if (this->event->get("event_type") == EventType::SecretBase) {
|
||||
QString baseId = this->event->get("secret_base_id");
|
||||
QString destMap = editor->project->mapConstantsToMapNames->value("MAP_" + baseId.left(baseId.lastIndexOf("_")));
|
||||
QString destMap = editor->project->mapConstantsToMapNames.value("MAP_" + baseId.left(baseId.lastIndexOf("_")));
|
||||
if (destMap != NONE_MAP_NAME) {
|
||||
emit editor->warpEventDoubleClicked(destMap, "0");
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ MapImageExporter::MapImageExporter(QWidget *parent_, Editor *editor_, ImageExpor
|
|||
this->ui->groupBox_Connections->setVisible(this->mode == ImageExporterMode::Normal);
|
||||
this->ui->groupBox_Timelapse->setVisible(this->mode == ImageExporterMode::Timelapse);
|
||||
|
||||
this->ui->comboBox_MapSelection->addItems(*editor->project->mapNames);
|
||||
this->ui->comboBox_MapSelection->addItems(editor->project->mapNames);
|
||||
this->ui->comboBox_MapSelection->setCurrentText(map->name);
|
||||
this->ui->comboBox_MapSelection->setEnabled(false);// TODO: allow selecting map from drop-down
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
|
|||
ui->comboBox_NewMap_Primary_Tileset->addItems(tilesets.value("primary"));
|
||||
ui->comboBox_NewMap_Secondary_Tileset->addItems(tilesets.value("secondary"));
|
||||
|
||||
ui->comboBox_NewMap_Group->addItems(*project->groupNames);
|
||||
ui->comboBox_NewMap_Group->setCurrentText(project->groupNames->at(groupNum));
|
||||
ui->comboBox_NewMap_Group->addItems(project->groupNames);
|
||||
ui->comboBox_NewMap_Group->setCurrentText(project->groupNames.at(groupNum));
|
||||
|
||||
if (existingLayout) {
|
||||
ui->spinBox_NewMap_Width->setValue(project->mapLayouts.value(layoutId)->width.toInt(nullptr, 0));
|
||||
|
@ -165,7 +165,7 @@ void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
|
|||
}
|
||||
|
||||
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
||||
if (project->mapNames->contains(text)) {
|
||||
if (project->mapNames.contains(text)) {
|
||||
QPalette palette = this->ui->lineEdit_NewMap_Name->palette();
|
||||
QColor color = Qt::red;
|
||||
color.setAlpha(25);
|
||||
|
@ -188,7 +188,7 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
|||
// After stripping invalid characters, strip any leading digits.
|
||||
QString newMapName = this->ui->lineEdit_NewMap_Name->text().remove(QRegularExpression("[^a-zA-Z0-9_]+"));
|
||||
newMapName.remove(QRegularExpression("^[0-9]*"));
|
||||
if (project->mapNames->contains(newMapName) || newMapName.isEmpty()) {
|
||||
if (project->mapNames.contains(newMapName) || newMapName.isEmpty()) {
|
||||
newMapName = project->getNewMapName();
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
|||
newMap->floorNumber = this->ui->spinBox_NewMap_Floor_Number->value();
|
||||
}
|
||||
|
||||
group = project->groupNames->indexOf(this->ui->comboBox_NewMap_Group->currentText());
|
||||
group = project->groupNames.indexOf(this->ui->comboBox_NewMap_Group->currentText());
|
||||
newMap->layout = layout;
|
||||
newMap->layoutId = layout->id;
|
||||
if (this->existingLayout) {
|
||||
|
|
|
@ -215,7 +215,7 @@ void RegionMapEditor::displayRegionMapLayoutOptions() {
|
|||
|
||||
void RegionMapEditor::updateRegionMapLayoutOptions(int index) {
|
||||
this->ui->comboBox_RM_ConnectedMap->blockSignals(true);
|
||||
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(this->region_map->map_squares[index].mapsec));
|
||||
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName.value(this->region_map->map_squares[index].mapsec));
|
||||
this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->map_squares[index].mapsec);
|
||||
this->ui->comboBox_RM_ConnectedMap->blockSignals(false);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ void RegionMapEditor::onRegionMapLayoutSelectedTileChanged(int index) {
|
|||
this->currIndex = index;
|
||||
this->region_map_layout_item->highlightedTile = index;
|
||||
if (this->region_map->map_squares[index].has_map) {
|
||||
message = QString("\t %1").arg(this->project->mapSecToMapHoverName->value(
|
||||
message = QString("\t %1").arg(this->project->mapSecToMapHoverName.value(
|
||||
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
|
||||
}
|
||||
this->ui->statusbar->showMessage(message);
|
||||
|
@ -454,7 +454,7 @@ void RegionMapEditor::onRegionMapLayoutHoveredTileChanged(int index) {
|
|||
if (x >= 0 && y >= 0) {
|
||||
message = QString("(%1, %2)").arg(x).arg(y);
|
||||
if (this->region_map->map_squares[index].has_map) {
|
||||
message += QString("\t %1").arg(this->project->mapSecToMapHoverName->value(
|
||||
message += QString("\t %1").arg(this->project->mapSecToMapHoverName.value(
|
||||
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ void RegionMapEditor::on_tabWidget_Region_Map_currentChanged(int index) {
|
|||
}
|
||||
|
||||
void RegionMapEditor::on_comboBox_RM_ConnectedMap_activated(const QString &mapsec) {
|
||||
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(mapsec));
|
||||
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName.value(mapsec));
|
||||
onRegionMapLayoutSelectedTileChanged(this->currIndex);// re-draw layout image
|
||||
this->hasUnsavedChanges = true;// sometimes this is called for unknown reasons
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue