Skip to content

Commit 380afda

Browse files
committed
Merge pull request OpenXcom#899 from myk002/move_clear_inv_to_hotkey_only
remove clear inventory button; make hotkey only
2 parents da26709 + 5d7cd62 commit 380afda

4 files changed

Lines changed: 8 additions & 25 deletions

File tree

bin/data/Resources/UI/invclear.png

-1.1 KB
Binary file not shown.

bin/data/Ruleset/Xcom1Ruleset.rul

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9447,12 +9447,6 @@ extraSprites:
94479447
singleImage: true
94489448
files:
94499449
0: Resources/UI/invpaste_empty.png
9450-
- type: InvClear
9451-
width: 16
9452-
height: 16
9453-
singleImage: true
9454-
files:
9455-
0: Resources/UI/invclear.png
94569450
- type: BIGOBS.PCK
94579451
width: 64
94589452
height: 96

src/Battlescape/InventoryState.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ namespace OpenXcom
5353
{
5454

5555
static const int _templateBtnX = 288;
56-
static const int _createTemplateBtnY = 67;
57-
static const int _applyTemplateBtnY = 90;
58-
static const int _clearInventoryBtnY = 113;
56+
static const int _createTemplateBtnY = 90;
57+
static const int _applyTemplateBtnY = 113;
5958

6059
/**
6160
* Initializes all the elements in the Inventory screen.
@@ -99,7 +98,6 @@ InventoryState::InventoryState(bool tu, BattlescapeState *parent) : _tu(tu), _pa
9998
_btnRank = new InteractiveSurface(26, 23, 0, 0);
10099
_btnCreateTemplate = new InteractiveSurface(32, 22, _templateBtnX, _createTemplateBtnY);
101100
_btnApplyTemplate = new InteractiveSurface(32, 22, _templateBtnX, _applyTemplateBtnY);
102-
_btnClearInventory = new InteractiveSurface(32, 22, _templateBtnX, _clearInventoryBtnY);
103101
_selAmmo = new Surface(RuleInventory::HAND_W * RuleInventory::SLOT_W, RuleInventory::HAND_H * RuleInventory::SLOT_H, 272, 88);
104102
_inv = new Inventory(_game, 320, 200, 0, 0, _parent == 0);
105103

@@ -125,7 +123,6 @@ InventoryState::InventoryState(bool tu, BattlescapeState *parent) : _tu(tu), _pa
125123
add(_btnRank);
126124
add(_btnCreateTemplate);
127125
add(_btnApplyTemplate);
128-
add(_btnClearInventory);
129126
add(_selAmmo);
130127
add(_inv);
131128

@@ -212,23 +209,17 @@ InventoryState::InventoryState(bool tu, BattlescapeState *parent) : _tu(tu), _pa
212209

213210
_btnApplyTemplate->onMouseClick((ActionHandler)&InventoryState::btnApplyTemplateClick);
214211
_btnApplyTemplate->onKeyboardPress((ActionHandler)&InventoryState::btnApplyTemplateClick, Options::keyInvApplyTemplate);
212+
_btnApplyTemplate->onKeyboardPress((ActionHandler)&InventoryState::onClearInventory, Options::keyInvClear);
215213
_btnApplyTemplate->setTooltip("STR_APPLY_INVENTORY_TEMPLATE");
216214
_btnApplyTemplate->onMouseIn((ActionHandler)&InventoryState::txtTooltipIn);
217215
_btnApplyTemplate->onMouseOut((ActionHandler)&InventoryState::txtTooltipOut);
218216

219-
_btnClearInventory->onMouseClick((ActionHandler)&InventoryState::btnClearInventoryClick);
220-
_btnClearInventory->onKeyboardPress((ActionHandler)&InventoryState::btnClearInventoryClick, Options::keyInvClear);
221-
_btnClearInventory->setTooltip("STR_CLEAR_INVENTORY");
222-
_btnClearInventory->onMouseIn((ActionHandler)&InventoryState::txtTooltipIn);
223-
_btnClearInventory->onMouseOut((ActionHandler)&InventoryState::txtTooltipOut);
224-
225217

226218
// only use copy/paste buttons in setup (i.e. non-tu) mode
227219
if (_tu)
228220
{
229221
_btnCreateTemplate->setVisible(false);
230222
_btnApplyTemplate->setVisible(false);
231-
_btnClearInventory->setVisible(false);
232223
}
233224
else
234225
{
@@ -600,6 +591,7 @@ void InventoryState::btnCreateTemplateClick(Action *action)
600591

601592
// give audio feedback
602593
_game->getResourcePack()->getSound("BATTLE.CAT", 38)->play();
594+
_refreshMouse();
603595
}
604596

605597
static void _clearInventory(Game *game, std::vector<BattleItem*> *unitInv, Tile *groundTile)
@@ -744,7 +736,7 @@ void InventoryState::_refreshMouse()
744736
SDL_WarpMouse(x, y);
745737
}
746738

747-
void InventoryState::btnClearInventoryClick(Action *action)
739+
void InventoryState::onClearInventory(Action *action)
748740
{
749741
// don't accept clicks when moving items
750742
if (_inv->getSelectedItem() != 0)
@@ -919,8 +911,6 @@ void InventoryState::_updateTemplateButtons(bool isVisible)
919911
{
920912
if (isVisible)
921913
{
922-
_game->getResourcePack()->getSurface("InvClear")->blit(_btnClearInventory);
923-
924914
if (_curInventoryTemplate.empty())
925915
{
926916
// use "empty template" icons
@@ -938,7 +928,6 @@ void InventoryState::_updateTemplateButtons(bool isVisible)
938928
{
939929
_btnCreateTemplate->clear();
940930
_btnApplyTemplate->clear();
941-
_btnClearInventory->clear();
942931
}
943932
}
944933
}

src/Battlescape/InventoryState.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class InventoryState : public State
4545
Surface *_bg, *_soldier;
4646
Text *_txtName, *_txtItem, *_txtAmmo, *_txtWeight, *_txtTus, *_txtFAcc, *_txtReact, *_txtPSkill, *_txtPStr;
4747
InteractiveSurface *_btnOk, *_btnPrev, *_btnNext, *_btnUnload, *_btnGround, *_btnRank;
48-
InteractiveSurface *_btnCreateTemplate, *_btnApplyTemplate, *_btnClearInventory;
48+
InteractiveSurface *_btnCreateTemplate, *_btnApplyTemplate;
4949
Surface *_selAmmo;
5050
Inventory *_inv;
5151
std::vector<EquipmentLayoutItem*> _curInventoryTemplate;
@@ -80,8 +80,8 @@ class InventoryState : public State
8080
void btnCreateTemplateClick(Action *action);
8181
/// Handler for clicking the Apply Template button.
8282
void btnApplyTemplateClick(Action *action);
83-
/// Handler for clicking the Clear Inventory button.
84-
void btnClearInventoryClick(Action *action);
83+
/// Handler for hitting the Clear Inventory hotkey.
84+
void onClearInventory(Action *action);
8585
/// Handler for clicking on the inventory.
8686
void invClick(Action *action);
8787
/// Handler for showing item info.

0 commit comments

Comments
 (0)