Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
mapdbentryspritepokemon.cpp
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
21
22#include <QDebug>
23#include <QJsonValue>
24#include <QQmlEngine>
26#include "../pokemon.h"
27
29 MapDBEntry* const parent) :
31{
32 pokemon = data["pokemon"].toString();
33 level = data["level"].toDouble();
34}
35
37{
40
41#ifdef QT_DEBUG
42 if(toPokemon == nullptr)
43 qCritical() << "MapDBEntrySpritePokemon: Unable to deep link " + pokemon + " to pokemon";
44#endif
45
46 if(toPokemon != nullptr)
47 toPokemon->toMapSpritePokemon = this;
48}
49
51{
52 static bool once = false;
53 if(once)
54 return;
55
56 qmlRegisterUncreatableType<MapDBEntrySpritePokemon>(
57 "PSE.DB.MapDBEntrySpritePokemon", 1, 0, "MapDBEntrySpritePokemon", "Can't instantiate in QML");
58 once = true;
59}
60
65
67{
68 return level;
69}
70
72{
73 return pokemon;
74}
75
static PokemonDB * inst()
< Number of species.
Definition pokemon.cpp:183
PokemonDBEntry * getIndAt(const QString &key) const
Species by name key (for QML).
Definition pokemon.cpp:199
MapDBEntrySpritePokemon(const QJsonValue &data, MapDBEntry *const parent)
Build from JSON under parent.
PokemonDBEntry * toPokemon
Resolved species (deepLink).
QString pokemon
Species name (read via getPokemon()).
virtual SpriteType type() const
< Species name.
virtual void qmlRegister() const
Register with QML.
virtual void deepLink()
Resolve the species link.
PokemonDBEntry * getToPokemon() const
MapDBEntrySprite()
Empty entry.
virtual void deepLink()
Resolve sprite/missable links.
MapDBEntry * parent
Owning map.
SpriteType
< X adjusted for Gen 1 placement.
One species' complete static data – the richest entry in the db layer.
Definition pokemon.h:98