Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
worldtrades.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 <pse-common/types.h>
20
21class SaveFile;
22
23constexpr var8 tradeCount = 10;
24constexpr var8 tradeByteCount = 2;
25
35class SAVEFILE_AUTOPORT WorldTrades : public QObject
36{
37 Q_OBJECT
38
39public:
40 WorldTrades(SaveFile* saveFile = nullptr);
41 virtual ~WorldTrades();
42
43 void load(SaveFile* saveFile = nullptr);
44 void save(SaveFile* saveFile);
45
46 Q_INVOKABLE int tradesCount();
47 Q_INVOKABLE bool tradesAt(int ind);
48 Q_INVOKABLE void tradesSet(int ind, bool val);
49
50signals:
52
53public slots:
54 void reset();
55 void randomize();
56
57public:
59};
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
void save(SaveFile *saveFile)
Flatten the trade flags to the save.
protected::void completedTradesChanged()
WorldTrades(SaveFile *saveFile=nullptr)
void randomize()
Randomize the trade flags.
void tradesSet(int ind, bool val)
Set/clear completed for trade ind.
void load(SaveFile *saveFile=nullptr)
Expand the trade flags from the save.
bool completedTrades[tradeCount]
Per-trade completed flags.
Definition worldtrades.h:58
int tradesCount()
Number of trade flags (tradeCount).
bool tradesAt(int ind)
Is trade ind completed?
void reset()
Clear all trade flags.
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.
constexpr var8 tradeCount
In-game NPC trades tracked.
Definition worldtrades.h:23
constexpr var8 tradeByteCount
6 of 16 bits unused
Definition worldtrades.h:24