Minor style changes

This commit is contained in:
Andrea Orru 2020-05-11 00:09:02 +09:00
parent 2cf8dffb44
commit 02f02312f1

View file

@ -33,7 +33,7 @@ bool useJoystick[] = { false, false };
/* Ensure config directory exists */
const char* get_config_path(char * buf, int buflen)
const char* get_config_path(char* buf, int buflen)
{
/* Bail on the complex stuff if we don't need it */
if (!USE_CONFIG_DIR)
@ -89,7 +89,7 @@ void load_settings()
/* Control settings */
for (int p = 0; p <= 1; p++)
{
const char* section = (p == 0) ?"controls p1":"controls p2";
const char* section = (p == 0) ? "controls p1" : "controls p2";
useJoystick[p] = (ini.GetValue(section, "usejoy", "no"))[0] == 'y';
if (useJoystick[p])
@ -125,27 +125,27 @@ void save_settings()
ini.SetValue("screen", "size", buf);
/* Control settings */
for (int p = 0; p <= 1; p++)
for (int p = 0; p < 2; p++)
{
const char* section = (p == 0) ? "controls p1" : "controls p2";
sprintf(buf, "%d", useJoystick[p] ? BTN_UP[p]:KEY_UP[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_UP[p] : KEY_UP[p]);
ini.SetValue(section, "UP", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_DOWN[p]:KEY_DOWN[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_DOWN[p] : KEY_DOWN[p]);
ini.SetValue(section, "DOWN", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_LEFT[p]:KEY_LEFT[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_LEFT[p] : KEY_LEFT[p]);
ini.SetValue(section, "LEFT", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_RIGHT[p]:KEY_RIGHT[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_RIGHT[p] : KEY_RIGHT[p]);
ini.SetValue(section, "RIGHT", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_A[p]:KEY_A[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_A[p] : KEY_A[p]);
ini.SetValue(section, "A", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_B[p]:KEY_B[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_B[p] : KEY_B[p]);
ini.SetValue(section, "B", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_SELECT[p]:KEY_SELECT[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_SELECT[p] : KEY_SELECT[p]);
ini.SetValue(section, "SELECT", buf);
sprintf(buf, "%d", useJoystick[p] ? BTN_START[p]:KEY_START[p]);
sprintf(buf, "%d", useJoystick[p] ? BTN_START[p] : KEY_START[p]);
ini.SetValue(section, "START", buf);
ini.SetValue(section, "usejoy", useJoystick[p]? "yes":"no");
ini.SetValue(section, "usejoy", useJoystick[p] ? "yes" : "no");
}
char path[CONFIG_PATH_MAX];