Skip to content

Commit b2aef6c

Browse files
committed
just do a basic device unset message for now
1 parent 905210c commit b2aef6c

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Source/Managers/UInputMan.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ void UInputMan::DisableMouseMoving(bool disable) {
314314
}
315315
}
316316
bool UInputMan::CheckMultiMouseKeyboardEnabled(std::optional<std::reference_wrapper<const std::vector<int>>> players) {
317+
if (m_ForceDisableMultiMouseKeyboard) {
318+
m_EnableMultiMouseKeyboard = false;
319+
return false;
320+
}
317321
int playerMouseControlled{0};
318322
if (players) {
319323
for (int player: players->get()) {
@@ -707,7 +711,7 @@ bool UInputMan::GetKeyboardButtonState(SDL_Scancode scancodeToTest, InputState w
707711

708712
std::unordered_map<SDL_KeyboardID, Keyboard>::const_iterator keyboardIterator;
709713

710-
if (keyboardID == 0 && (playerDevice == InputDevice::DEVICE_KEYB_ONLY || playerDevice == InputDevice::DEVICE_MOUSE_KEYB)) {
714+
if (m_EnableMultiMouseKeyboard && keyboardID == 0 && (playerDevice == InputDevice::DEVICE_KEYB_ONLY || playerDevice == InputDevice::DEVICE_MOUSE_KEYB)) {
711715
if(playerDevice == InputDevice::DEVICE_KEYB_ONLY) {
712716
keyboardID = m_ControlScheme.at(whichPlayer).GetDeviceID().keyboard;
713717
} else {
@@ -752,7 +756,7 @@ bool UInputMan::GetMouseButtonState(int whichPlayer, int whichButton, InputState
752756

753757
std::unordered_map<SDL_MouseID, Mouse>::const_iterator mouseIterator;
754758

755-
if (mouseID == 0 && (playerDevice == InputDevice::DEVICE_MOUSE_KEYB)) {
759+
if (m_EnableMultiMouseKeyboard && mouseID == 0 && (playerDevice == InputDevice::DEVICE_MOUSE_KEYB)) {
756760
mouseID = m_ControlScheme.at(whichPlayer).GetDeviceID().mouseKeyboard.mouse;
757761
}
758762

Source/Menus/ScenarioActivityConfigGUI.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,18 @@ bool ScenarioActivityConfigGUI::Update(int mouseX, int mouseY) {
284284
int maxHumanPlayers = m_SelectedActivity->GetMaxPlayerSupport();
285285
int minTeamsRequired = m_SelectedActivity->GetMinTeamsRequired();
286286

287+
std::vector humanPlayers = GetHumanPlayers();
287288
std::string errorMessage = "";
288289
if (humansInTeams > maxHumanPlayers) {
289290
errorMessage = "Too many players assigned! Max for this activity is " + std::to_string(maxHumanPlayers);
290291
} else if (minTeamsRequired > teamsWithPlayers) {
291292
errorMessage = "Assign players to at least " + std::to_string(minTeamsRequired) + " of the teams!";
292293
} else if (teamWithHumans == 0) {
293294
errorMessage = "Assign human players to at least one team!";
295+
} else if (g_UInputMan.CheckMultiMouseKeyboardEnabled(humanPlayers) && !g_UInputMan.AllPlayerInputDevicesKnown(humanPlayers)) {
296+
errorMessage = "Some players have not set keyboard or mouse devices. Please go to input settings to configure!";
294297
}
298+
295299
m_StartErrorLabel->SetText(errorMessage);
296300
m_StartErrorLabel->SetVisible(!errorMessage.empty());
297301
m_StartGameButton->SetVisible(errorMessage.empty());
@@ -427,17 +431,10 @@ bool ScenarioActivityConfigGUI::HandleInputEvents() {
427431
SetEnabled(false);
428432
} else if (guiEvent.GetControl() == m_StartGameButton) {
429433
// Make sure all players have known input devices if multimouse is enabled.
430-
std::vector humanPlayers = GetHumanPlayers();
431-
if (g_UInputMan.CheckMultiMouseKeyboardEnabled(humanPlayers) && g_UInputMan.AllPlayerInputDevicesKnown(humanPlayers)) {
432-
g_GUISound.ButtonPressSound()->Play();
433-
StartGame();
434-
SetEnabled(false);
435-
return true;
436-
} else {
437-
// TODO: Show message and device selection.
438-
g_GUISound.UserErrorSound()->Play();
439-
return false;
440-
}
434+
g_GUISound.ButtonPressSound()->Play();
435+
StartGame();
436+
SetEnabled(false);
437+
return true;
441438
}
442439
} else if (guiEvent.GetType() == GUIEvent::Notification) {
443440
if (guiEvent.GetControl() == m_ActivityDifficultySlider) {

0 commit comments

Comments
 (0)