Skip to content

Commit

Permalink
improved code for default keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
White Dragon committed Jul 5, 2018
1 parent 31c63c8 commit 691299b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions engine/sdl/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ void control_update(s_playercontrols ** playercontrols, int numplayers)

k = 0;

for(i=0;i<JOY_MAX_INPUTS;i++)
for(i = 0; i < JOY_MAX_INPUTS; i++)
{
t = pcontrols->settings[i];
if(t >= SDLK_FIRST && t < SDLK_LAST){
Expand All @@ -864,8 +864,10 @@ void control_update(s_playercontrols ** playercontrols, int numplayers)
}

//White Dragon: Set input from default keys overriding previous keys
if (player <= 0) {
for(i=0;i<JOY_MAX_INPUTS;i++)
//Default keys are available just if no configured keys are pressed!
if (player <= 0 && !k)
{
for(i = 0; i < JOY_MAX_INPUTS; i++)
{
t = default_control.settings[i];
if(t >= SDLK_FIRST && t < SDLK_LAST){
Expand All @@ -876,7 +878,7 @@ void control_update(s_playercontrols ** playercontrols, int numplayers)

if(usejoy)
{
for(i=0; i<JOY_MAX_INPUTS; i++)
for(i = 0; i < JOY_MAX_INPUTS; i++)
{
t = pcontrols->settings[i];
if(t >= JOY_LIST_FIRST && t <= JOY_LIST_LAST)
Expand Down

2 comments on commit 691299b

@msmalik681
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job.

@whitedragon0000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

Please sign in to comment.