Fix more warnings

This commit is contained in:
Marcus Huderle 2018-09-14 18:37:44 -05:00
parent 0b07ea63cb
commit a2d95bfc72
11 changed files with 35 additions and 47 deletions

View file

@ -10,13 +10,13 @@ class Blockdata : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Blockdata(QObject *parent = 0); explicit Blockdata(QObject *parent = nullptr);
~Blockdata() { ~Blockdata() {
if (blocks) delete blocks; if (blocks) delete blocks;
} }
public: public:
QList<Block> *blocks = NULL; QList<Block> *blocks = nullptr;
void addBlock(uint16_t); void addBlock(uint16_t);
void addBlock(Block); void addBlock(Block);
QByteArray serialize(); QByteArray serialize();

View file

@ -1017,7 +1017,7 @@ void MovementPermissionsPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent* ev
if (x >= width) x = width - 1; if (x >= width) x = width - 1;
if (y < 0) y = 0; if (y < 0) y = 0;
if (y >= height) y = height - 1; if (y >= height) y = height - 1;
pick(x, y); pick(static_cast<uint16_t>(x), static_cast<uint16_t>(y));
} }
void MovementPermissionsPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { void MovementPermissionsPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) {
updateCurHoveredMetatile(event->pos()); updateCurHoveredMetatile(event->pos());

View file

@ -415,7 +415,7 @@ public:
MovementPermissionsPixmapItem(Map *map_): MetatilesPixmapItem(map_) { MovementPermissionsPixmapItem(Map *map_): MetatilesPixmapItem(map_) {
connect(map, SIGNAL(paintCollisionChanged(Map*)), this, SLOT(paintCollisionChanged(Map *))); connect(map, SIGNAL(paintCollisionChanged(Map*)), this, SLOT(paintCollisionChanged(Map *)));
} }
virtual void pick(int collision, int elevation) { virtual void pick(uint16_t collision, uint16_t elevation) {
map->paint_collision = collision; map->paint_collision = collision;
map->paint_elevation = elevation; map->paint_elevation = elevation;
draw(); draw();

View file

@ -18,7 +18,7 @@ Event::Event()
Event* Event::createNewEvent(QString event_type, QString map_name) Event* Event::createNewEvent(QString event_type, QString map_name)
{ {
Event *event; Event *event = new Event;
if (event_type == EventType::Object) { if (event_type == EventType::Object) {
event = createNewObjectEvent(); event = createNewObjectEvent();
} else if (event_type == EventType::Warp) { } else if (event_type == EventType::Warp) {

View file

@ -6,18 +6,6 @@
class Editor; class Editor;
/*
class GraphicsView_Object : public QObject
{
Q_OBJECT
signals:
void onMousePress(QMouseEvent *event);
void onMouseMove(QMouseEvent *event);
void onMouseRelease(QMouseEvent *event);
};
*/
class GraphicsView : public QGraphicsView class GraphicsView : public QGraphicsView
{ {
public: public:

View file

@ -22,7 +22,7 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
public slots: public slots:
@ -125,7 +125,7 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QStandardItemModel *mapListModel; QStandardItemModel *mapListModel;
QList<QStandardItem*> *mapGroupsModel; QList<QStandardItem*> *mapGroupsModel;
Editor *editor = NULL; Editor *editor = nullptr;
QIcon* mapIcon; QIcon* mapIcon;
void setMap(QString); void setMap(QString);
void redrawMapScene(); void redrawMapScene();

16
map.h
View file

@ -99,15 +99,15 @@ public:
QString blockdata_path; QString blockdata_path;
QString tileset_primary_label; QString tileset_primary_label;
QString tileset_secondary_label; QString tileset_secondary_label;
Tileset *tileset_primary = NULL; Tileset *tileset_primary = nullptr;
Tileset *tileset_secondary = NULL; Tileset *tileset_secondary = nullptr;
Blockdata* blockdata = NULL; Blockdata* blockdata = nullptr;
QImage border_image; QImage border_image;
QPixmap border_pixmap; QPixmap border_pixmap;
Blockdata *border = NULL; Blockdata *border = nullptr;
Blockdata *cached_blockdata = NULL; Blockdata *cached_blockdata = nullptr;
Blockdata *cached_collision = NULL; Blockdata *cached_collision = nullptr;
Blockdata *cached_border = NULL; Blockdata *cached_border = nullptr;
bool has_unsaved_changes = false; bool has_unsaved_changes = false;
public: public:
static QString getNameFromLabel(QString label) { static QString getNameFromLabel(QString label) {
@ -120,7 +120,7 @@ class Map : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Map(QObject *parent = 0); explicit Map(QObject *parent = nullptr);
public: public:
QString name; QString name;

View file

@ -8,7 +8,7 @@ class NewEventToolButton : public QToolButton
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit NewEventToolButton(QWidget *parent = 0); explicit NewEventToolButton(QWidget *parent = nullptr);
void initButton(); void initButton();
QString getSelectedEventType(); QString getSelectedEventType();
public slots: public slots:

View file

@ -12,7 +12,7 @@ class ObjectPropertiesFrame : public QFrame
Q_OBJECT Q_OBJECT
public: public:
explicit ObjectPropertiesFrame(QWidget *parent = 0); explicit ObjectPropertiesFrame(QWidget *parent = nullptr);
~ObjectPropertiesFrame(); ~ObjectPropertiesFrame();
public: public:

View file

@ -14,10 +14,10 @@ class Project
public: public:
Project(); Project();
QString root; QString root;
QStringList *groupNames = NULL; QStringList *groupNames = nullptr;
QMap<QString, int> *map_groups; QMap<QString, int> *map_groups;
QList<QStringList> groupedMapNames; QList<QStringList> groupedMapNames;
QStringList *mapNames = NULL; QStringList *mapNames = nullptr;
QList<HealLocation> flyableMaps; QList<HealLocation> flyableMaps;
QMap<QString, QString>* mapConstantsToMapNames; QMap<QString, QString>* mapConstantsToMapNames;
QMap<QString, QString>* mapNamesToMapConstants; QMap<QString, QString>* mapNamesToMapConstants;
@ -25,24 +25,24 @@ public:
QList<QString> mapLayoutsTableMaster; QList<QString> mapLayoutsTableMaster;
QMap<QString, MapLayout*> mapLayouts; QMap<QString, MapLayout*> mapLayouts;
QMap<QString, MapLayout*> mapLayoutsMaster; QMap<QString, MapLayout*> mapLayoutsMaster;
QStringList *regionMapSections = NULL; QStringList *regionMapSections = nullptr;
QStringList *itemNames = NULL; QStringList *itemNames = nullptr;
QStringList *flagNames = NULL; QStringList *flagNames = nullptr;
QStringList *varNames = NULL; QStringList *varNames = nullptr;
QStringList *movementTypes = NULL; QStringList *movementTypes = nullptr;
QStringList *mapTypes = NULL; QStringList *mapTypes = nullptr;
QStringList *mapBattleScenes = NULL; QStringList *mapBattleScenes = nullptr;
QStringList *weatherNames = NULL; QStringList *weatherNames = nullptr;
QStringList *coordEventWeatherNames = NULL; QStringList *coordEventWeatherNames = nullptr;
QStringList *secretBaseIds = NULL; QStringList *secretBaseIds = nullptr;
QStringList *bgEventFacingDirections = NULL; QStringList *bgEventFacingDirections = nullptr;
QStringList mapsWithConnections; QStringList mapsWithConnections;
QMap<QString, Map*> *map_cache; QMap<QString, Map*> *map_cache;
Map* loadMap(QString); Map* loadMap(QString);
Map* getMap(QString); Map* getMap(QString);
QMap<QString, Tileset*> *tileset_cache = NULL; QMap<QString, Tileset*> *tileset_cache = nullptr;
Tileset* loadTileset(QString); Tileset* loadTileset(QString);
Tileset* getTileset(QString); Tileset* getTileset(QString);

View file

@ -21,9 +21,9 @@ public:
QString callback_label; QString callback_label;
QString metatile_attrs_label; QString metatile_attrs_label;
QList<QImage> *tiles = NULL; QList<QImage> *tiles = nullptr;
QList<Metatile*> *metatiles = NULL; QList<Metatile*> *metatiles = nullptr;
QList<QList<QRgb>> *palettes = NULL; QList<QList<QRgb>> *palettes = nullptr;
}; };
class Metatile class Metatile
@ -31,7 +31,7 @@ class Metatile
public: public:
Metatile(); Metatile();
public: public:
QList<Tile> *tiles = NULL; QList<Tile> *tiles = nullptr;
int attr; int attr;
static QImage getMetatileImage(int, Tileset*, Tileset*); static QImage getMetatileImage(int, Tileset*, Tileset*);