Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: Z:/projects/WindowsProjects/trunk/JSMenu.cpp
- ===================================================================
- --- Z:/projects/WindowsProjects/trunk/JSMenu.cpp (revision 984)
- +++ Z:/projects/WindowsProjects/trunk/JSMenu.cpp (working copy)
- -254,8 +254,9 @@
- JSAPI_FUNC(my_addProfile)
- {
- // validate the args...
- - char *profile, *mode, *gateway, *username, *password, *charname;
- - if(argc != 6)
- + char *profile, *mode, *gateway, *username, *password, *charname, *spdifficulty;
- + profile = mode = gateway = username = password = charname = NULL; spdifficulty = "3";
- + if(argc < 6 || argc > 7)
- THROW_ERROR(cx, "Invalid arguments passed to addProfile");
- for(uintN i = 0; i < argc; i++)
- -268,7 +269,11 @@
- username = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
- password = JS_GetStringBytes(JSVAL_TO_STRING(argv[4]));
- charname = JS_GetStringBytes(JSVAL_TO_STRING(argv[5]));
- - if(!profile || !mode || !gateway || !username || !password || !charname)
- + if(argc == 7)
- + spdifficulty = JS_GetStringBytes(JSVAL_TO_STRING(argv[6]));
- +
- + if(!profile || !mode || !gateway || !username || !password || !charname ||
- + (argc == 7 && !spdifficulty))
- THROW_ERROR(cx, "Failed to convert string");
- char file[_MAX_FNAME+_MAX_PATH];
- -277,9 +282,10 @@
- if(!ProfileExists(profile))
- {
- char settings[600];
- - sprintf_s(settings, sizeof(settings),
- - "mode=%s\0gateway=%s\0username=%s\0password=%s\0character=%s\0\0",
- - mode, gateway, username, password, charname);
- + sprintf_s(settings, sizeof(settings),
- + "mode=%s\0gateway=%s\0username=%s\0password=%s\0character=%s\0spdifficulty=%s\0\0",
- + mode, gateway, username, password, charname, spdifficulty);
- +
- WritePrivateProfileSection(profile, settings, file);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement