fix new map heal location generation
This commit is contained in:
parent
bb855f8c3f
commit
1222954175
5 changed files with 12 additions and 8 deletions
|
@ -33,7 +33,7 @@ public:
|
|||
QString layout_id;
|
||||
QString location;
|
||||
QString requiresFlash;
|
||||
QString isFlyable; // TODO: implement this
|
||||
QString isFlyable;
|
||||
QString weather;
|
||||
QString type;
|
||||
QString unknown;
|
||||
|
|
|
@ -1103,6 +1103,9 @@ DraggablePixmapItem* Editor::addNewEvent(QString event_type) {
|
|||
if (project && map) {
|
||||
Event *event = Event::createNewEvent(event_type, map->name);
|
||||
event->put("map_name", map->name);
|
||||
if (event_type == "event_heal_location") {
|
||||
event->put("index", project->flyableMaps.length());
|
||||
}
|
||||
map->addEvent(event);
|
||||
project->loadEventPixmaps(map->getAllEvents());
|
||||
DraggablePixmapItem *object = addMapEvent(event);
|
||||
|
|
|
@ -673,6 +673,7 @@ void MainWindow::onNewMapCreated() {
|
|||
QString newMapName = this->newmapprompt->map->name;
|
||||
int newMapGroup = this->newmapprompt->group;
|
||||
Map *newMap_ = this->newmapprompt->map;
|
||||
|
||||
Map *newMap = editor->project->addNewMapToGroup(newMapName, newMapGroup, newMap_);
|
||||
|
||||
qDebug() << "Created a new map named" << newMapName;
|
||||
|
@ -689,6 +690,11 @@ void MainWindow::onNewMapCreated() {
|
|||
|
||||
setMap(newMapName, true);
|
||||
|
||||
if (newMap->isFlyable == "TRUE") {
|
||||
addNewEvent("event_heal_location");
|
||||
editor->project->saveHealLocationStruct(newMap);
|
||||
}
|
||||
|
||||
disconnect(this->newmapprompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1209,7 +1209,7 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap) {
|
|||
loadMapTilesets(map);
|
||||
setNewMapBlockdata(map);
|
||||
setNewMapBorder(map);
|
||||
//setNewMapEvents(map);
|
||||
setNewMapEvents(map);
|
||||
setNewMapConnections(map);
|
||||
map->commit();
|
||||
map->metatileHistory.save();
|
||||
|
|
|
@ -82,13 +82,8 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
|||
layout->blockdata_label = QString("%1_MapBlockdata").arg(newMap->name);
|
||||
layout->blockdata_path = QString("data/layouts/%1/map.bin").arg(newMap->name);
|
||||
|
||||
// EMERGENCY (MUST FIX):causes a segfault...
|
||||
// how do I add new event to newMap without behavior being undefined???
|
||||
if (this->ui->checkBox_NewMap_Flyable->isChecked()) {
|
||||
Event *healSpot = new Event;
|
||||
healSpot = Event::createNewEvent("event_heal_location", newMapName);
|
||||
healSpot->put("map_name", newMapName);
|
||||
newMap->addEvent(healSpot);
|
||||
newMap->isFlyable = "TRUE";
|
||||
}
|
||||
|
||||
newMap->layout = layout;
|
||||
|
|
Loading…
Reference in a new issue