Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion FeLib/Source/feio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,13 @@ int iosystem::StringQuestion(festring& Input,
return NORMAL_EXIT;
}

/* by how many do a subsequent up/down Presses increase the value in NumberQuestion */
static int clickval(int a) {
int click_values[] = {0, 1, 2, 3, 4, 5, 7, 10, 15, 20, 30, 40, 50, 60, 80};
if(a < 14) return click_values[a];
return clickval(a-8) * 10;
}

/* Ask a question defined by Topic. This function only accepts numbers.
The question is drawn to coordinates given by Pos. All fonts are Color
colored. If Fade is true the question is asked on a black background
Expand All @@ -642,6 +649,7 @@ long iosystem::NumberQuestion(cfestring& Topic, v2 Pos, col16 Color,
truth Fade, truth ReturnZeroOnEsc)
{
bInUse=true;
int last_direction = 0, clicks = 0;

v2 V(RES.X, 10); ///???????????
bitmap BackUp(V, 0);
Expand Down Expand Up @@ -682,9 +690,12 @@ long iosystem::NumberQuestion(cfestring& Topic, v2 Pos, col16 Color,
&& LastKey != KEY_ENTER && LastKey != KEY_ESC
&& LastKey != KEY_HOME && LastKey != KEY_END
&& LastKey != KEY_LEFT && LastKey != KEY_RIGHT
&& LastKey != KEY_UP && LastKey != KEY_DOWN
&& LastKey != KEY_CONTROLLER_A && LastKey != KEY_CONTROLLER_B
&& (LastKey != '-' || !Input.IsEmpty()))
&& (LastKey != '-' || !Input.IsEmpty())) {
LastKey = GET_KEY(false);
if(LastKey != KEY_UP && LastKey != KEY_DOWN) clicks = 0;
}

if(LastKey == KEY_BACK_SPACE)
{
Expand Down Expand Up @@ -729,6 +740,20 @@ long iosystem::NumberQuestion(cfestring& Topic, v2 Pos, col16 Color,
continue;
}

if(LastKey == KEY_UP || LastKey == KEY_DOWN)
{
if(last_direction != LastKey)
{
last_direction = LastKey;
clicks = 0;
}
int current = atoi(Input.CStr());
current += (LastKey == KEY_UP ? 1 : -1) * (clickval(clicks+1) - clickval(clicks));
clicks++;
Input = ""; Input << current;
continue;
}

if(LastKey == KEY_RIGHT)
{
if(CursorPos < static_cast<int>(Input.GetSize()))
Expand Down
2 changes: 2 additions & 0 deletions Main/Source/char.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3746,6 +3746,8 @@ void character::PerformPlayerCommand(int Key, bool& HasActed, bool& ValidKeyPres
HasActed = true;
}
else if(v.IsAdjacent(ZERO_V2)) MoveByVector(v);
else if(game::IsInWilderness())
ADD_MESSAGE("Auto-routing cannot be used while in wilderness.");
else {
ValidKeyPressed = true;
HasActed = commandsystem::SpawnRoute(this, TPos);
Expand Down
2 changes: 2 additions & 0 deletions Main/Source/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,8 @@ truth commandsystem::SpawnRoute(character* Char, v2 Pos)
}
}

if(RouteGoOn.empty()) return false;

go* Go = go::Spawn(Char);
Go->SetRoute(RouteGoOn);
Go->SetDirectionFromRoute();
Expand Down
Loading