Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
itemmarketentryplayeritem.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 <QPointer>
18
19
#include "
./itemmarketentry.h
"
20
// Full types (not fwd decls) so QPointer<> can verify they are QObjects. toBox/toItem
21
// are NOT owned by this entry (they live in the save's item box) and can be freed out
22
// from under a stale entry that lingers in the static instances registry -- QPointer
23
// auto-nulls on their destruction so a stale read returns a safe default, not a UAF.
24
#include <
pse-savefile/expanded/fragments/item.h
>
25
#include <
pse-savefile/expanded/fragments/itemstoragebox.h
>
26
27
class
PlayerBasics
;
28
29
// Selling player inventory for money or coins
30
38
class
ItemMarketEntryPlayerItem
:
public
ItemMarketEntry
39
{
40
Q_OBJECT
41
42
public
:
43
ItemMarketEntryPlayerItem
(
ItemStorageBox
*
toBox
,
Item
*
toItem
);
44
virtual
~ItemMarketEntryPlayerItem
();
45
46
virtual
QString
_name
()
override
;
47
virtual
int
_inStockCount
()
override
;
48
virtual
bool
_canSell
()
override
;
49
virtual
int
_itemWorth
()
override
;
50
virtual
QString
_whichType
()
override
;
51
virtual
int
onCartLeft
()
override
;
52
virtual
int
stackCount
()
override
;
53
virtual
QString
infoText
()
override
;
54
55
public
slots:
56
virtual
void
checkout
()
override
;
57
58
public
:
59
QPointer<ItemStorageBox>
toBox
;
60
QPointer<Item>
toItem
;
61
static
constexpr
const
char
*
type
=
"playerItem"
;
62
};
ItemMarketEntryPlayerItem::type
static constexpr const char * type
This row's type key.
Definition
itemmarketentryplayeritem.h:61
ItemMarketEntryPlayerItem::checkout
virtual void checkout() override
Sell the item (remove qty, credit balance).
Definition
itemmarketentryplayeritem.cpp:135
ItemMarketEntryPlayerItem::toBox
QPointer< ItemStorageBox > toBox
The box the item is sold from (auto-nulls if freed).
Definition
itemmarketentryplayeritem.h:59
ItemMarketEntryPlayerItem::_canSell
virtual bool _canSell() override
Subtype: compute sellability.
Definition
itemmarketentryplayeritem.cpp:70
ItemMarketEntryPlayerItem::onCartLeft
virtual int onCartLeft() override
Subtype: how many more may be added.
Definition
itemmarketentryplayeritem.cpp:106
ItemMarketEntryPlayerItem::infoText
virtual QString infoText() override
Detailed-tooltip body (default none).
Definition
itemmarketentryplayeritem.cpp:42
ItemMarketEntryPlayerItem::stackCount
virtual int stackCount() override
Subtype: new stack slots needed (see note above).
Definition
itemmarketentryplayeritem.cpp:129
ItemMarketEntryPlayerItem::_itemWorth
virtual int _itemWorth() override
Subtype: compute the unit value.
Definition
itemmarketentryplayeritem.cpp:82
ItemMarketEntryPlayerItem::_whichType
virtual QString _whichType() override
Subtype: report the type label.
Definition
itemmarketentryplayeritem.cpp:101
ItemMarketEntryPlayerItem::toItem
QPointer< Item > toItem
The item being sold (auto-nulls if freed).
Definition
itemmarketentryplayeritem.h:60
ItemMarketEntryPlayerItem::_inStockCount
virtual int _inStockCount() override
Subtype: compute the owned/sellable count.
Definition
itemmarketentryplayeritem.cpp:62
ItemMarketEntryPlayerItem::ItemMarketEntryPlayerItem
ItemMarketEntryPlayerItem(ItemStorageBox *toBox, Item *toItem)
Definition
itemmarketentryplayeritem.cpp:29
ItemMarketEntryPlayerItem::_name
virtual QString _name() override
Subtype: compute the display name.
Definition
itemmarketentryplayeritem.cpp:50
ItemMarketEntryPlayerItem::~ItemMarketEntryPlayerItem
virtual ~ItemMarketEntryPlayerItem()
Definition
itemmarketentryplayeritem.cpp:40
ItemMarketEntry::ItemMarketEntry
ItemMarketEntry(int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither)
Definition
itemmarketentry.cpp:28
ItemStorageBox
A container of Items – either the trainer's bag or a PC item box.
Definition
itemstoragebox.h:36
Item
One inventory slot: an item index and an amount, with live pricing.
Definition
item.h:36
PlayerBasics
The trainer's headline values: name, ID, money, coins, badges, starter.
Definition
playerbasics.h:67
item.h
itemmarketentry.h
itemstoragebox.h
projects
app
src
mvc
itemmarket
itemmarketentryplayeritem.h
Generated by
1.17.0