Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
areasign.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include <QObject>
18#include <QVector>
19#include <pse-common/types.h>
21
22class SaveFile;
23class SignData;
24class MapDBEntry;
25
26constexpr var8 maxSigns = 16;
27
37class SAVEFILE_AUTOPORT AreaSign : public QObject
38{
39 Q_OBJECT
40
41public:
42 AreaSign(SaveFile* saveFile = nullptr);
43 virtual ~AreaSign();
44
45 void load(SaveFile* saveFile = nullptr);
46 void save(SaveFile* saveFile);
47
48 Q_INVOKABLE int signCount();
49 Q_INVOKABLE int signMax();
50 Q_INVOKABLE SignData* signAt(int ind);
51 Q_INVOKABLE void signSwap(int from, int to);
52 Q_INVOKABLE void signRemove(int ind);
53 Q_INVOKABLE void signNew();
54
55signals:
57
58public slots:
59 void reset();
60 void randomize(MapDBEntry* mapData);
61 void setTo(MapDBEntry* mapData);
62
63public:
64 QVector<SignData*> signs;
65};
constexpr var8 maxSigns
Maximum signs on a map.
Definition areasign.h:26
void signSwap(int from, int to)
Reorder signs.
Definition areasign.cpp:58
void save(SaveFile *saveFile)
Flatten the sign list to the save.
Definition areasign.cpp:104
AreaSign(SaveFile *saveFile=nullptr)
Definition areasign.cpp:32
void signNew()
Add a fresh sign.
Definition areasign.cpp:79
void signRemove(int ind)
Remove sign ind.
Definition areasign.cpp:69
void load(SaveFile *saveFile=nullptr)
Expand the sign list from the save.
Definition areasign.cpp:88
void randomize(MapDBEntry *mapData)
Randomize signs for mapData.
Definition areasign.cpp:124
int signMax()
Capacity (maxSigns).
Definition areasign.cpp:48
QVector< SignData * > signs
The map's signs.
Definition areasign.h:64
SignData * signAt(int ind)
Sign ind (GC-protected return).
Definition areasign.cpp:53
void setTo(MapDBEntry *mapData)
Rebuild the list from mapData's signs.
Definition areasign.cpp:137
int signCount()
Number of signs.
Definition areasign.cpp:43
protected::void signsChanged()
void reset()
Empty the sign list.
Definition areasign.cpp:114
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
One sign on the current map: its tile position and text id.
Definition signdata.h:37
Project-wide fixed-width integer aliases (var8, var16, ...).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition types.h:124
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56