244 lines
6.5 KiB
Diff
244 lines
6.5 KiB
Diff
--- a/src/OGAMEMP.cpp 2022-04-29 03:09:22.000000000 +0200
|
|
+++ b/src/OGAMEMP.cpp 2022-04-29 15:17:16.264545936 +0200
|
|
@@ -585,22 +585,6 @@
|
|
return;
|
|
}
|
|
|
|
- if (service_mode == 3 || service_mode == 4)
|
|
- {
|
|
- mp_obj.set_service_provider("www.7kfans.com");
|
|
- }
|
|
-
|
|
- if (service_mode == 4)
|
|
- {
|
|
- if (!mp_get_leader_board())
|
|
- box.msg(_("Unable to retrieve leaderboard"));
|
|
-#ifdef HAVE_LIBCURL
|
|
- ws.deinit();
|
|
-#endif
|
|
- mp_obj.deinit();
|
|
- return;
|
|
- }
|
|
-
|
|
// create game or join game
|
|
switch( mp_select_mode(NULL, service_mode) )
|
|
{
|
|
@@ -844,22 +828,6 @@
|
|
return;
|
|
}
|
|
|
|
- if (service_mode == 3 || service_mode == 4)
|
|
- {
|
|
- mp_obj.set_service_provider("www.7kfans.com");
|
|
- }
|
|
-
|
|
- if (service_mode == 4)
|
|
- {
|
|
- if (!mp_get_leader_board())
|
|
- box.msg(_("Unable to retrieve leaderboard"));
|
|
-#ifdef HAVE_LIBCURL
|
|
- ws.deinit();
|
|
-#endif
|
|
- mp_obj.deinit();
|
|
- return;
|
|
- }
|
|
-
|
|
// count required player
|
|
int gamePlayerCount = 0;
|
|
for(nationRecno = 1; nationRecno <= nation_array.size(); ++nationRecno)
|
|
@@ -1039,19 +1007,17 @@
|
|
// --------- End of static function load_mp_game ----------//
|
|
|
|
|
|
-enum { SERVICE_BUTTON_NUM = 3 };
|
|
+enum { SERVICE_BUTTON_NUM = 2 };
|
|
const char *service_short_desc[SERVICE_BUTTON_NUM] =
|
|
{
|
|
N_("Local Area Network"),
|
|
// TRANSLATORS: This is a button label for entering a web or IP Address for connecting to an online game
|
|
N_("Enter Address"),
|
|
- "7kfans.com",
|
|
};
|
|
const char *service_long_desc[SERVICE_BUTTON_NUM] =
|
|
{
|
|
N_("Host or join a game using the local area network"),
|
|
N_("Join a game by entering an address"),
|
|
- N_("Host or join a game over the internet"),
|
|
};
|
|
//-------- Begin of function Game::mp_select_service --------//
|
|
//
|
|
@@ -1062,8 +1028,8 @@
|
|
//
|
|
int Game::mp_select_service()
|
|
{
|
|
- static short buttonX[SERVICE_BUTTON_NUM] = { 171, 171, 171 };
|
|
- static short buttonY[SERVICE_BUTTON_NUM] = { 57, 125, 193 };
|
|
+ static short buttonX[SERVICE_BUTTON_NUM] = { 171, 171 };
|
|
+ static short buttonY[SERVICE_BUTTON_NUM] = { 57, 125 };
|
|
#define SERVICE_BUTTON_WIDTH 459
|
|
#define SERVICE_BUTTON_HEIGHT 67
|
|
enum { DESC_MARGIN = 10, DESC_TOP_MARGIN = 6 };
|
|
@@ -1195,19 +1161,12 @@
|
|
}
|
|
//--------- End of function Game::mp_select_service ---------//
|
|
|
|
-
|
|
-const char *login_dialog_txt[] =
|
|
-{
|
|
- N_("Enter your 7kfans.com/forums account credentials to continue.\nTIP: If you have just previously logged in using the same username, you can leave your password blank, and the previous session is used."),
|
|
- N_("Username:"),
|
|
- N_("Password:")
|
|
-};
|
|
//-------- Begin of function Game::mp_select_mode --------//
|
|
// return 0 = cancel, 1 = create, 2 = join
|
|
int Game::mp_select_mode(char *defSaveFileName, int service_mode)
|
|
{
|
|
- static short buttonX[SERVICE_BUTTON_NUM] = { 171, 171, 171 };
|
|
- static short buttonY[SERVICE_BUTTON_NUM] = { 57, 125, 193 };
|
|
+ static short buttonX[SERVICE_BUTTON_NUM] = { 171, 171 };
|
|
+ static short buttonY[SERVICE_BUTTON_NUM] = { 57, 125 };
|
|
#define SERVICE_BUTTON_WIDTH 459
|
|
#define SERVICE_BUTTON_HEIGHT 67
|
|
enum { DESC_MARGIN = 10, DESC_TOP_MARGIN = 6 };
|
|
@@ -1431,28 +1390,6 @@
|
|
strncpy(username, config.player_name, MP_FRIENDLY_NAME_LEN);
|
|
username[MP_FRIENDLY_NAME_LEN] = 0;
|
|
password[0] = 0;
|
|
-
|
|
- if( input_name_pass(login_dialog_txt, username, MP_FRIENDLY_NAME_LEN+1, password, MP_FRIENDLY_NAME_LEN+1) )
|
|
- {
|
|
- int rc2;
|
|
- if( strlen(password) )
|
|
- rc2 = ws.login(username, password);
|
|
- else
|
|
- rc2 = ws.refresh(username);
|
|
- if( rc2 )
|
|
- {
|
|
- mp_obj.create_my_player(username); // reset name
|
|
- }
|
|
- else
|
|
- {
|
|
- box.msg(_("Unable to connect to 7kfans.com"));
|
|
- rc = 0;
|
|
- }
|
|
- }
|
|
- else
|
|
- {
|
|
- rc = 0;
|
|
- }
|
|
#endif
|
|
}
|
|
|
|
@@ -1735,12 +1672,6 @@
|
|
}
|
|
|
|
|
|
-#ifdef HAVE_LIBCURL
|
|
-const char *login_failed_msg = N_("Unable to connect to the 7kfans.com service. Verify your account information and try again.");
|
|
-#else
|
|
-const char *login_failed_msg = N_("Unable to connect to the 7kfans service.\n(No libcurl)");
|
|
-#endif
|
|
-
|
|
|
|
//-------- Begin of function Game::mp_select_session --------//
|
|
int Game::mp_select_session()
|
|
@@ -1934,7 +1865,6 @@
|
|
statusMsg = _("Trying to connect to the service provider");
|
|
break;
|
|
case MP_POLL_LOGIN_FAILED:
|
|
- box.msg(_(login_failed_msg));
|
|
goto exit_poll;
|
|
}
|
|
if( statusMsg )
|
|
@@ -1942,15 +1872,6 @@
|
|
vga_front.d3_panel_up(60, 65, VGA_WIDTH-60, 100, 2);
|
|
font_san.put(70, 75, statusMsg, 0, VGA_WIDTH-70);
|
|
}
|
|
-#if 0
|
|
- if (mp_obj.is_update_available() > 0)
|
|
- {
|
|
- String update_message;
|
|
- update_message = _("There is a new version of Seven Kingdoms: Ancient Adversaries at www.7kfans.com");
|
|
- vga_front.d3_panel_up(60, 65, VGA_WIDTH-60, 100, 2);
|
|
- font_san.put(70, 75, update_message, 0, VGA_WIDTH-70);
|
|
- }
|
|
-#endif
|
|
}
|
|
|
|
if( refreshFlag & SSOPTION_SCROLL_BAR )
|
|
@@ -2131,7 +2052,6 @@
|
|
|
|
if (pollStatus == MP_POLL_LOGIN_FAILED)
|
|
{
|
|
- box.msg(_(login_failed_msg));
|
|
return 0;
|
|
}
|
|
else if (pollStatus == MP_POLL_NO_SESSION)
|
|
@@ -2997,7 +2917,6 @@
|
|
pollStatus = mp_obj.poll_players();
|
|
if (pollStatus == MP_POLL_LOGIN_FAILED)
|
|
{
|
|
- box.msg(_(login_failed_msg));
|
|
break;
|
|
}
|
|
recvPtr = mp_obj.receive(&from, &recvLen, &sysMsgCount);
|
|
@@ -4903,7 +4822,6 @@
|
|
pollStatus = mp_obj.poll_players();
|
|
if (pollStatus == MP_POLL_LOGIN_FAILED)
|
|
{
|
|
- box.msg(_(login_failed_msg));
|
|
break;
|
|
}
|
|
recvPtr = mp_obj.receive(&from, &recvLen, &sysMsgCount);
|
|
@@ -5638,11 +5556,6 @@
|
|
retFlag = 1;
|
|
}
|
|
|
|
- if( pollStatus == MP_POLL_LOGIN_FAILED )
|
|
- {
|
|
- box.msg(_(login_failed_msg));
|
|
- }
|
|
-
|
|
return retFlag;
|
|
}
|
|
#ifdef Y_SHIFT
|
|
--- a/src/curl/WebService.cpp 2022-04-29 03:09:22.000000000 +0200
|
|
+++ b/src/curl/WebService.cpp 2022-04-29 15:12:54.294790812 +0200
|
|
@@ -82,36 +82,11 @@
|
|
int WebService::refresh(char *user)
|
|
{
|
|
CURLcode res;
|
|
-
|
|
- curl_easy_setopt(curl, CURLOPT_POST, 0);
|
|
- curl_easy_setopt(curl, CURLOPT_URL, "https://7kfans.com/forums/index.php");
|
|
- buffer = "";
|
|
-
|
|
- res = curl_easy_perform(curl);
|
|
return res == CURLE_OK;
|
|
}
|
|
|
|
int WebService::login(char *user, char *pass)
|
|
{
|
|
CURLcode res;
|
|
-
|
|
- /* the fields given by the user must be url encoded */
|
|
- std::string login = "login=Login&username=";
|
|
- char *encoded;
|
|
-
|
|
- encoded = curl_easy_escape(curl, user, 0);
|
|
- login += encoded;
|
|
- curl_free(encoded);
|
|
- login += "&password=";
|
|
- encoded = curl_easy_escape(curl, pass, 0);
|
|
- login += encoded;
|
|
- curl_free(encoded);
|
|
-
|
|
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, login.c_str());
|
|
- curl_easy_setopt(curl, CURLOPT_POST, 1);
|
|
- curl_easy_setopt(curl, CURLOPT_URL, "https://7kfans.com/forums/ucp.php?mode=login");
|
|
- buffer = "";
|
|
-
|
|
- res = curl_easy_perform(curl);
|
|
return res == CURLE_OK;
|
|
}
|