Stability fixes: avoid somfusions with same named variables in one function; Properly sort out players from player list that use too long filenames; Removed call for gr_set_fontcolor in kconfig where no canvas is set, causing crashes when trying to reassign a button, key or axis
This commit is contained in:
parent
8bc5fd54a1
commit
cf23e6bb24
|
@ -1,5 +1,9 @@
|
||||||
D1X-Rebirth Changelog
|
D1X-Rebirth Changelog
|
||||||
|
|
||||||
|
20110713
|
||||||
|
--------
|
||||||
|
arch/sdl/event.c, arch/sdl/key.c, main/kconfig.c, main/menu.c: Stability fixes: avoid somfusions with same named variables in one function; Properly sort out players from player list that use too long filenames; Removed call for gr_set_fontcolor in kconfig where no canvas is set, causing crashes when trying to reassign a button, key or axis
|
||||||
|
|
||||||
20110712
|
20110712
|
||||||
--------
|
--------
|
||||||
main/wall.c: Add fallback routine from D2 source in wall_frame_process() to automatically set open-flag if wall state is set to opened
|
main/wall.c: Add fallback routine from D2 source in wall_frame_process() to automatically set open-flag if wall state is set to opened
|
||||||
|
|
|
@ -72,8 +72,8 @@ void event_poll()
|
||||||
case SDL_JOYBALLMOTION:
|
case SDL_JOYBALLMOTION:
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT: {
|
case SDL_QUIT: {
|
||||||
d_event event = { EVENT_QUIT };
|
d_event qevent = { EVENT_QUIT };
|
||||||
call_default_handler(&event);
|
call_default_handler(&qevent);
|
||||||
idle = 0;
|
idle = 0;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,10 @@ void event_poll()
|
||||||
// Send the idle event if there were no other events
|
// Send the idle event if there were no other events
|
||||||
if (idle)
|
if (idle)
|
||||||
{
|
{
|
||||||
d_event event;
|
d_event ievent;
|
||||||
|
|
||||||
event.type = EVENT_IDLE;
|
ievent.type = EVENT_IDLE;
|
||||||
event_send(&event);
|
event_send(&ievent);
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_cursor_autohide();
|
mouse_cursor_autohide();
|
||||||
|
|
|
@ -363,22 +363,22 @@ unsigned char key_ascii()
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void key_handler(SDL_KeyboardEvent *event)
|
void key_handler(SDL_KeyboardEvent *kevent)
|
||||||
{
|
{
|
||||||
int keycode, event_keysym=-1, key_state;
|
int keycode, event_keysym=-1, key_state;
|
||||||
|
|
||||||
// Read SDLK symbol and state
|
// Read SDLK symbol and state
|
||||||
event_keysym = event->keysym.sym;
|
event_keysym = kevent->keysym.sym;
|
||||||
key_state = (event->state == SDL_PRESSED)?1:0;
|
key_state = (kevent->state == SDL_PRESSED)?1:0;
|
||||||
|
|
||||||
// fill the unicode frame-related unicode buffer
|
// fill the unicode frame-related unicode buffer
|
||||||
if (key_state && event->keysym.unicode > 31 && event->keysym.unicode < 255)
|
if (key_state && kevent->keysym.unicode > 31 && kevent->keysym.unicode < 255)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < KEY_BUFFER_SIZE; i++)
|
for (i = 0; i < KEY_BUFFER_SIZE; i++)
|
||||||
if (unicode_frame_buffer[i] == '\0')
|
if (unicode_frame_buffer[i] == '\0')
|
||||||
{
|
{
|
||||||
unicode_frame_buffer[i] = event->keysym.unicode;
|
unicode_frame_buffer[i] = kevent->keysym.unicode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,7 +566,6 @@ void kconfig_start_changing(kc_menu *menu)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
|
||||||
menu->q_fade_i = 0; // start question mark flasher
|
menu->q_fade_i = 0; // start question mark flasher
|
||||||
menu->changing = 1;
|
menu->changing = 1;
|
||||||
}
|
}
|
||||||
|
|
14
main/menu.c
14
main/menu.c
|
@ -369,12 +369,22 @@ int RegisterPlayer()
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
if (strlen(*f) > FILENAME_LEN-1 || strlen(*f) < 5) // sorry guys, can only have up to eight chars for the player name
|
||||||
|
{
|
||||||
|
NumItems--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
m[i++] = *f;
|
m[i++] = *f;
|
||||||
p = strchr(*f, '.');
|
p = strchr(*f, '.');
|
||||||
if (p)
|
if (p)
|
||||||
*p = '\0'; // chop the .plr
|
*p = '\0'; // chop the .plr
|
||||||
if ((p - *f) > 8)
|
}
|
||||||
*f[8] = 0; // sorry guys, can only have up to eight chars for the player name
|
|
||||||
|
if (NumItems <= 1) // so it seems all plr files we found were too long. funny. let's make a real player
|
||||||
|
{
|
||||||
|
MakeNewPlayerFile(0); // make a new player without showing listbox
|
||||||
|
PHYSFS_freeList(list);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort by name, except the <Create New Player> string
|
// Sort by name, except the <Create New Player> string
|
||||||
|
|
Loading…
Reference in a new issue