Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
mapdbentrywarpin.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 <QJsonValue>
23
#include <QQmlEngine>
24
#include <
pse-common/utility.h
>
25
#include "
mapdbentrywarpin.h
"
26
27
MapDBEntryWarpIn::MapDBEntryWarpIn
() {
28
qmlRegister
();
29
}
30
MapDBEntryWarpIn::MapDBEntryWarpIn
(
const
QJsonValue& data,
MapDBEntry
*
const
parent
) :
31
parent
(
parent
)
32
{
33
qmlRegister
();
34
35
x
= data[
"x"
].toDouble();
36
y
= data[
"y"
].toDouble();
37
}
38
39
void
MapDBEntryWarpIn::qmlRegister
()
const
40
{
41
static
bool
once =
false
;
42
if
(once)
43
return
;
44
45
qmlRegisterUncreatableType<MapDBEntryWarpIn>(
46
"PSE.DB.MapDBEntryWarpIn"
, 1, 0,
"MapDBEntryWarpIn"
,
"Can't instantiate in QML"
);
47
once =
true
;
48
}
49
50
MapDBEntry
*
MapDBEntryWarpIn::getParent
()
const
51
{
52
return
parent
;
53
}
54
55
void
MapDBEntryWarpIn::qmlProtect
(
const
QQmlEngine*
const
engine)
const
56
{
57
Utility::qmlProtectUtil
(
this
, engine);
58
}
59
60
const
QVector<MapDBEntryWarpOut*>
MapDBEntryWarpIn::getToConnectingWarps
()
const
61
{
62
return
toConnectingWarps
;
63
}
64
65
int
MapDBEntryWarpIn::getToConnectingWarpsSize
()
const
66
{
67
return
toConnectingWarps
.size();
68
}
69
70
MapDBEntryWarpOut
*
MapDBEntryWarpIn::getToConnectingWarpsAt
(
const
int
ind)
const
71
{
72
if
(ind >=
toConnectingWarps
.size())
73
return
nullptr
;
74
75
return
toConnectingWarps
.at(ind);
76
}
77
78
int
MapDBEntryWarpIn::getY
()
const
79
{
80
return
y
;
81
}
82
83
int
MapDBEntryWarpIn::getX
()
const
84
{
85
return
x
;
86
}
Utility::qmlProtectUtil
static void qmlProtectUtil(const QObject *const obj, const QQmlEngine *const engine)
Pin obj to C++ ownership so the QML engine never garbage-collects it.
Definition
utility.cpp:63
mapdbentrywarpin.h
MapDBEntryWarpIn::getX
int getX() const
< Warp-in tile X.
Definition
mapdbentrywarpin.cpp:83
MapDBEntryWarpIn::getToConnectingWarpsSize
int getToConnectingWarpsSize() const
Definition
mapdbentrywarpin.cpp:65
MapDBEntryWarpIn::qmlRegister
void qmlRegister() const
Register with QML.
Definition
mapdbentrywarpin.cpp:39
MapDBEntryWarpIn::y
int y
Warp-in tile Y.
Definition
mapdbentrywarpin.h:62
MapDBEntryWarpIn::MapDBEntry
friend class MapDBEntry
Definition
mapdbentrywarpin.h:67
MapDBEntryWarpIn::getY
int getY() const
Definition
mapdbentrywarpin.cpp:78
MapDBEntryWarpIn::toConnectingWarps
QVector< MapDBEntryWarpOut * > toConnectingWarps
Warp-outs arriving here (filled by warp-out deepLink).
Definition
mapdbentrywarpin.h:64
MapDBEntryWarpIn::MapDBEntryWarpIn
MapDBEntryWarpIn()
Empty entry.
Definition
mapdbentrywarpin.cpp:27
MapDBEntryWarpIn::parent
MapDBEntry * parent
Owning map.
Definition
mapdbentrywarpin.h:65
MapDBEntryWarpIn::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
mapdbentrywarpin.cpp:55
MapDBEntryWarpIn::MapDBEntryWarpOut
friend class MapDBEntryWarpOut
Definition
mapdbentrywarpin.h:69
MapDBEntryWarpIn::getToConnectingWarpsAt
MapDBEntryWarpOut * getToConnectingWarpsAt(const int ind) const
Connecting warp ind (for QML).
Definition
mapdbentrywarpin.cpp:70
MapDBEntryWarpIn::getParent
MapDBEntry * getParent() const
Definition
mapdbentrywarpin.cpp:50
MapDBEntryWarpIn::getToConnectingWarps
const QVector< MapDBEntryWarpOut * > getToConnectingWarps() const
Warp-outs that land here.
Definition
mapdbentrywarpin.cpp:60
MapDBEntryWarpIn::x
int x
Warp-in tile X.
Definition
mapdbentrywarpin.h:61
utility.h
projects
db
src
pse-db
entries
mapdbentrywarpin.cpp
Generated by
1.17.0