Skip to content

Commit cc88138

Browse files
MULTIPLEXKEY
1 parent 26d04ba commit cc88138

File tree

6 files changed

+37
-9
lines changed

6 files changed

+37
-9
lines changed

dist/shared/data/init/dfplex.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Zero means unbounded.
1818
Enable autosave while nobody is playing. You probably shouldn't use this yet.
1919
[AUTOSAVE_WHILE_IDLE:NO]
2020

21-
This key enters uniplex mode.
22-
[UNIPLEXKEY:92]
21+
This key toggles multiplex mode.
22+
[MULTIPLEXKEY:92]
2323

2424
This key toggles client's debug output
2525
[DEBUGKEY:124]

server/config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ uint32_t MAX_CLIENTS = 0;
1010
uint16_t PORT = 1234;
1111
uint16_t STATICPORT = 8000;
1212
std::string STATICDIR = "hack/www";
13-
uint32_t UNIPLEXKEY = 0;
13+
uint32_t MULTIPLEXKEY = 0;
1414
uint32_t NEXT_CLIENT_POS_KEY = 0;
1515
uint32_t PREV_CLIENT_POS_KEY = 0;
1616
bool CURSOR_IS_TEXT = false;
@@ -97,8 +97,8 @@ bool load_text_file()
9797
{
9898
SERVERDEBUGKEY = std::stol(val);
9999
}
100-
if (key == "UNIPLEXKEY") {
101-
UNIPLEXKEY = std::stol(val);
100+
if (key == "MULTIPLEXKEY") {
101+
MULTIPLEXKEY = std::stol(val);
102102
}
103103
}
104104
return true;

server/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern uint32_t MAX_CLIENTS;
1515
extern uint16_t PORT;
1616
extern uint16_t STATICPORT;
1717
extern std::string STATICDIR;
18-
extern uint32_t UNIPLEXKEY;
18+
extern uint32_t MULTIPLEXKEY;
1919
extern uint32_t DEBUGKEY;
2020
extern uint32_t SERVERDEBUGKEY;
2121
extern uint32_t NEXT_CLIENT_POS_KEY;

server/dfplex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool is_paused()
121121
void apply_key(const KeyEvent& match, Client* cl, bool raw)
122122
{
123123
// special keys
124-
if (UNIPLEXKEY != 0 && (match.type == type_unicode || match.type == type_key) && match.unicode == UNIPLEXKEY)
124+
if (MULTIPLEXKEY != 0 && (match.type == type_unicode || match.type == type_key) && match.unicode == MULTIPLEXKEY)
125125
{
126126
// enter uniplex mode.
127127
if (uniplexing_requested)

server/screenbuf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ void modify_screenbuf(Client* cl)
279279
{
280280
case 0:
281281
// uniplex
282-
if (UNIPLEXKEY)
282+
if (MULTIPLEXKEY)
283283
{
284-
std::string keystr = key_display_name(UNIPLEXKEY);
284+
std::string keystr = key_display_name(MULTIPLEXKEY);
285285
write_to_screen(x, y, keystr, 4, 0, 1);
286286

287287
write_to_screen(x + keystr.length(), y,

server/state.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "df/viewscreen_optionst.h"
6262
#include "df/viewscreen_reportlistst.h"
6363
#include "df/viewscreen_textviewerst.h"
64+
#include "df/viewscreen_tradelistst.h"
6465
#include "df/viewscreen_titlest.h"
6566
#include "df/viewscreen_unitst.h"
6667
#include "df/viewscreen.h"
@@ -491,6 +492,24 @@ static bool stabilize_list_menu(Client* client)
491492
return true;
492493
}
493494

495+
bool tradelist_advance(Client* client)
496+
{
497+
df::viewscreen* vs;
498+
virtual_identity* id;
499+
UPDATE_VS(vs, id);
500+
if (id == &df::viewscreen_tradelistst::_identity)
501+
{
502+
// apply this 32 times for paranoia.
503+
for (size_t i = 0; i < 32; ++i)
504+
{
505+
vs->logic();
506+
UPDATE_VS(vs, id);
507+
}
508+
return true;
509+
}
510+
return false;
511+
}
512+
494513
// restores state for client
495514
// -- preconditions --
496515
// must be in the dfmode root menu.
@@ -650,6 +669,15 @@ RestoreResult restore_state(Client* client)
650669
}
651670
}
652671

672+
// tradelist immediately advances to a new screen
673+
// ometimes, so we must simulate that.
674+
if (tradelist_advance(client))
675+
{
676+
UPDATE_VS(vs, id);
677+
//vs->feed_key(df::enums::interface_key::STANDARDSCROLL_DOWN);
678+
//*_out << "advanced to " << get_current_menu_id() << std::endl;
679+
}
680+
653681
ui.m_restore_progress++;
654682
}
655683

0 commit comments

Comments
 (0)