Skip to content

Commit c4c865d

Browse files
committed
- Added Select Destination Base window.
- Fixed up layouts of Transfer windows.
1 parent 94554c1 commit c4c865d

8 files changed

Lines changed: 205 additions & 14 deletions

‎src/Basescape/BasescapeState.cpp‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "ManufactureState.h"
4545
#include "PurchaseState.h"
4646
#include "SellState.h"
47+
#include "TransferBaseState.h"
4748

4849
namespace OpenXcom
4950
{
@@ -153,7 +154,8 @@ BasescapeState::BasescapeState(Game *game, Base *base, Globe *globe) : State(gam
153154
_btnManufacture->onMouseClick((ActionHandler)&BasescapeState::btnManufactureClick);
154155

155156
_btnTransfer->setColor(Palette::blockOffset(13)+8);
156-
_btnTransfer->setText(_game->getLanguage()->getString("STR_TRANSFER"));
157+
_btnTransfer->setText(_game->getLanguage()->getString("STR_TRANSFER_UC"));
158+
_btnTransfer->onMouseClick((ActionHandler)&BasescapeState::btnTransferClick);
157159

158160
_btnPurchase->setColor(Palette::blockOffset(13)+8);
159161
_btnPurchase->setText(_game->getLanguage()->getString("STR_PURCHASE_RECRUIT"));
@@ -341,6 +343,15 @@ void BasescapeState::btnSellClick(Action *action)
341343
_game->pushState(new SellState(_game, _base));
342344
}
343345

346+
/**
347+
* Goes to the Select Destination Base window.
348+
* @param action Pointer to an action.
349+
*/
350+
void BasescapeState::btnTransferClick(Action *action)
351+
{
352+
_game->pushState(new TransferBaseState(_game, _base));
353+
}
354+
344355
/**
345356
* Returns to the previous screen.
346357
* @param action Pointer to an action.

‎src/Basescape/BasescapeState.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class BasescapeState : public State
7171
void btnPurchaseClick(Action *action);
7272
/// Handler for clicking the Sell/Sack button.
7373
void btnSellClick(Action *action);
74+
/// Handler for clicking the Transfer button.
75+
void btnTransferClick(Action *action);
7476
/// Handler for clicking the Geoscape button.
7577
void btnGeoscapeClick(Action *action);
7678
/// Handler for clicking the base view.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright 2010 OpenXcom Developers.
3+
*
4+
* This file is part of OpenXcom.
5+
*
6+
* OpenXcom is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* OpenXcom is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
#include "TransferBaseState.h"
20+
#include <sstream>
21+
#include "../Engine/Game.h"
22+
#include "../Resource/ResourcePack.h"
23+
#include "../Engine/Language.h"
24+
#include "../Engine/Font.h"
25+
#include "../Engine/Palette.h"
26+
#include "../Interface/TextButton.h"
27+
#include "../Interface/Window.h"
28+
#include "../Interface/Text.h"
29+
#include "../Interface/TextList.h"
30+
#include "../Savegame/SavedGame.h"
31+
#include "../Savegame/Base.h"
32+
33+
namespace OpenXcom
34+
{
35+
36+
/**
37+
* Initializes all the elements in the Select Destination Base window.
38+
* @param game Pointer to the core game.
39+
* @param base Pointer to the base to get info from.
40+
*/
41+
TransferBaseState::TransferBaseState(Game *game, Base *base) : State(game), _base(base)
42+
{
43+
// Create objects
44+
_window = new Window(this, 280, 140, 20, 30);
45+
_btnCancel = new TextButton(264, 16, 28, 146);
46+
_txtTitle = new Text(270, 16, 25, 38);
47+
_txtFunds = new Text(250, 9, 30, 54);
48+
_txtName = new Text(130, 16, 28, 64);
49+
_txtArea = new Text(130, 16, 160, 64);
50+
_lstBases = new TextList(248, 64, 28, 80);
51+
52+
// Set palette
53+
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(0)), Palette::backPos, 16);
54+
55+
add(_window);
56+
add(_btnCancel);
57+
add(_txtTitle);
58+
add(_txtFunds);
59+
add(_txtName);
60+
add(_txtArea);
61+
add(_lstBases);
62+
63+
// Set up objects
64+
_window->setColor(Palette::blockOffset(13)+8);
65+
_window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR"));
66+
67+
_btnCancel->setColor(Palette::blockOffset(13)+8);
68+
_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL"));
69+
_btnCancel->onMouseClick((ActionHandler)&TransferBaseState::btnCancelClick);
70+
71+
_txtTitle->setColor(Palette::blockOffset(13)+5);
72+
_txtTitle->setBig();
73+
_txtTitle->setAlign(ALIGN_CENTER);
74+
_txtTitle->setText(_game->getLanguage()->getString("STR_SELECT_DESTINATION_BASE"));
75+
76+
_txtFunds->setColor(Palette::blockOffset(13)+5);
77+
_txtFunds->setText(_game->getLanguage()->getString("STR_CURRENT_FUNDS"));
78+
79+
_txtName->setColor(Palette::blockOffset(13)+5);
80+
_txtName->setText(_game->getLanguage()->getString("STR_NAME"));
81+
_txtName->setBig();
82+
83+
_txtArea->setColor(Palette::blockOffset(13)+5);
84+
_txtArea->setText(_game->getLanguage()->getString("STR_AREA"));
85+
_txtArea->setBig();
86+
87+
_lstBases->setColor(Palette::blockOffset(15)+1);
88+
_lstBases->setArrowColor(Palette::blockOffset(13)+8);
89+
_lstBases->setColumns(2, 130, 116);
90+
_lstBases->setSelectable(true);
91+
_lstBases->setBackground(_window);
92+
_lstBases->setMargin(2);
93+
}
94+
95+
/**
96+
*
97+
*/
98+
TransferBaseState::~TransferBaseState()
99+
{
100+
}
101+
102+
/**
103+
* Returns to the previous screen.
104+
* @param action Pointer to an action.
105+
*/
106+
void TransferBaseState::btnCancelClick(Action *action)
107+
{
108+
_game->popState();
109+
}
110+
111+
}

‎src/Basescape/TransferBaseState.h‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2010 OpenXcom Developers.
3+
*
4+
* This file is part of OpenXcom.
5+
*
6+
* OpenXcom is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* OpenXcom is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
#ifndef OPENXCOM_TRANSFERBASESTATE_H
20+
#define OPENXCOM_TRANSFERBASESTATE_H
21+
22+
#include "../Engine/State.h"
23+
#include <vector>
24+
#include <string>
25+
26+
namespace OpenXcom
27+
{
28+
29+
class TextButton;
30+
class Window;
31+
class Text;
32+
class TextList;
33+
class Base;
34+
35+
/**
36+
* Window that lets the player pick the base
37+
* to transfer items to.
38+
*/
39+
class TransferBaseState : public State
40+
{
41+
private:
42+
Base *_base;
43+
TextButton *_btnCancel;
44+
Window *_window;
45+
Text *_txtTitle, *_txtFunds, *_txtName, *_txtArea;
46+
TextList *_lstBases;
47+
public:
48+
/// Creates the Transfer Base state.
49+
TransferBaseState(Game *game, Base *base);
50+
/// Cleans up the Transfer Base state.
51+
~TransferBaseState();
52+
/// Handler for clicking the Cancel button.
53+
void btnCancelClick(Action *action);
54+
};
55+
56+
}
57+
58+
#endif

‎src/Basescape/TransferItemsState.cpp‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ namespace OpenXcom
4545
/**
4646
* Initializes all the elements in the Transfer screen.
4747
* @param game Pointer to the core game.
48-
* @param base Pointer to the base to get info from.
48+
* @param baseFrom Pointer to the source base.
49+
* @param baseTo Pointer to the destination base.
4950
*/
5051
TransferItemsState::TransferItemsState(Game *game, Base *baseFrom, Base *baseTo) : State(game), _baseFrom(baseFrom), _baseTo(baseTo), _qtys(), _soldiers(), _crafts(), _items(), _sel(0), _total(0), _sOffset(0), _eOffset(0)
5152
{
@@ -54,11 +55,11 @@ TransferItemsState::TransferItemsState(Game *game, Base *baseFrom, Base *baseTo)
5455
_btnOk = new TextButton(148, 16, 8, 176);
5556
_btnCancel = new TextButton(148, 16, 164, 176);
5657
_txtTitle = new Text(310, 16, 5, 8);
57-
_txtItem = new Text(130, 9, 10, 32);
58-
_txtQuantity = new Text(44, 9, 140, 32);
59-
_txtAmountTransfer = new Text(96, 9, 184, 32);
60-
_txtAmountDestination = new Text(34, 9, 280, 32);
61-
_lstItems = new TextList(288, 120, 8, 44);
58+
_txtItem = new Text(130, 9, 10, 22);
59+
_txtQuantity = new Text(50, 9, 150, 22);
60+
_txtAmountTransfer = new Text(60, 16, 200, 22);
61+
_txtAmountDestination = new Text(60, 16, 260, 22);
62+
_lstItems = new TextList(288, 128, 8, 40);
6263

6364
// Set palette
6465
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(0)), Palette::backPos, 16);
@@ -77,11 +78,11 @@ TransferItemsState::TransferItemsState(Game *game, Base *baseFrom, Base *baseTo)
7778
_window->setColor(Palette::blockOffset(13)+13);
7879
_window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR"));
7980

80-
_btnOk->setColor(Palette::blockOffset(13)+13);
81+
_btnOk->setColor(Palette::blockOffset(15)+9);
8182
_btnOk->setText(_game->getLanguage()->getString("STR_TRANSFER"));
8283
_btnOk->onMouseClick((ActionHandler)&TransferItemsState::btnOkClick);
8384

84-
_btnCancel->setColor(Palette::blockOffset(13)+13);
85+
_btnCancel->setColor(Palette::blockOffset(15)+9);
8586
_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL"));
8687
_btnCancel->onMouseClick((ActionHandler)&TransferItemsState::btnCancelClick);
8788

@@ -102,10 +103,10 @@ TransferItemsState::TransferItemsState(Game *game, Base *baseFrom, Base *baseTo)
102103
_txtAmountDestination->setColor(Palette::blockOffset(13)+10);
103104
_txtAmountDestination->setText(_game->getLanguage()->getString("STR_AMOUNT_AT_DESTINATION"));
104105

105-
_lstItems->setColor(Palette::blockOffset(13)+10);
106+
_lstItems->setColor(Palette::blockOffset(15)+1);
106107
_lstItems->setArrowColor(Palette::blockOffset(13)+13);
107-
_lstItems->setArrowColumn(189, ARROW_VERTICAL);
108-
_lstItems->setColumns(4, 156, 62, 28, 40);
108+
_lstItems->setArrowColumn(193, ARROW_VERTICAL);
109+
_lstItems->setColumns(4, 162, 58, 55, 11);
109110
_lstItems->setSelectable(true);
110111
_lstItems->setBackground(_window);
111112
_lstItems->setMargin(2);

‎src/Basescape/TransferItemsState.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Soldier;
3636
class Craft;
3737

3838
/**
39-
* Sell/Sack screen that lets the player sell
40-
* any items in a particular base.
39+
* Transfer screen that lets the player pick
40+
* what items to transfer between bases.
4141
*/
4242
class TransferItemsState : public State
4343
{

‎src/OpenXcom.2010.vcxproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<ClCompile Include="Basescape\SoldierInfoState.cpp" />
131131
<ClCompile Include="Basescape\SoldiersState.cpp" />
132132
<ClCompile Include="Basescape\StoresState.cpp" />
133+
<ClCompile Include="Basescape\TransferBaseState.cpp" />
133134
<ClCompile Include="Basescape\TransferItemsState.cpp" />
134135
<ClCompile Include="Basescape\TransfersState.cpp" />
135136
<ClCompile Include="Battlescape\BattlescapeGenerator.cpp" />
@@ -296,6 +297,7 @@
296297
<ClInclude Include="Basescape\SoldierInfoState.h" />
297298
<ClInclude Include="Basescape\SoldiersState.h" />
298299
<ClInclude Include="Basescape\StoresState.h" />
300+
<ClInclude Include="Basescape\TransferBaseState.h" />
299301
<ClInclude Include="Basescape\TransferItemsState.h" />
300302
<ClInclude Include="Basescape\TransfersState.h" />
301303
<ClInclude Include="Battlescape\BattlescapeGenerator.h" />

‎src/OpenXcom.2010.vcxproj.filters‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@
491491
<ClCompile Include="Basescape\TransferItemsState.cpp">
492492
<Filter>Basescape</Filter>
493493
</ClCompile>
494+
<ClCompile Include="Basescape\TransferBaseState.cpp">
495+
<Filter>Basescape</Filter>
496+
</ClCompile>
494497
</ItemGroup>
495498
<ItemGroup>
496499
<ClInclude Include="resource.h" />
@@ -984,6 +987,9 @@
984987
<ClInclude Include="Basescape\TransferItemsState.h">
985988
<Filter>Basescape</Filter>
986989
</ClInclude>
990+
<ClInclude Include="Basescape\TransferBaseState.h">
991+
<Filter>Basescape</Filter>
992+
</ClInclude>
987993
</ItemGroup>
988994
<ItemGroup>
989995
<ResourceCompile Include="OpenXcom.rc" />

0 commit comments

Comments
 (0)