Permalink
Browse files

Revert engine-side league localization

The engine cannot know about all future league strings. Instead, localize server-side using language id from http request.
  • Loading branch information...
SvenTwo committed Apr 27, 2014
1 parent d117037 commit 45f69abb6e7ddf56fda60646f9880ace58248fed
@@ -39,16 +39,13 @@
die();
}
$server->cleanUp(true); //Cleanup old stuff
// register new release
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'release-file') {
try {
registerRelease();
} catch(Exception $e) {
C4Network::sendAnswer(C4Network::createError($e->getMessage()));
}
// prepare data for the engine
} else if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
} else if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { //data sent from engine?
$input = $GLOBALS['HTTP_RAW_POST_DATA'];
$action = ParseINI::parseValue('Action', $input);
$csid = ParseINI::parseValue('CSID', $input);
@@ -59,44 +56,44 @@
switch ($action) {
case 'Start': //start a new round
if (ParseINI::parseValue('LeagueAddress', $reference)) {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_LEAGUENOTSUPPORTED'));
C4Network::sendAnswer(C4Network::createError('League not supported!'));
} else {
$csid = $server->addReference($reference);
if ($csid) {
$answer = array('Status' => 'Success', 'CSID' => $csid);
if(!testHostConn($input))
$answer['Message'] = 'IDS_MSG_MASTERSERVNATERROR';
$answer['Message'] = 'Your network failed to pass certain tests. It is unlikely that are you able to host for the public.|To fix that, you need port forwarding in your router.';
C4Network::sendAnswer(C4Network::createAnswer($answer));
unset($answer);
} else {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MATERSERVSIGNUPFAIL'));
C4Network::sendAnswer(C4Network::createError('Round signup failed. (To many tries?)'));
}
}
break;
case 'Update': //update an existing round
if ($server->updateReference($csid, $reference)) {
C4Network::sendAnswer(C4Network::createAnswer(array('Status' => 'Success')));
} else {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MASTERSERVUPDATEFAIL'));
C4Network::sendAnswer(C4Network::createError('Round update failed.'));
}
break;
case 'End': //remove a round
if ($server->removeReference($csid)) {
C4Network::sendAnswer(C4Network::createAnswer(array('Status' => 'Success')));
} else {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MASTERSERVENDFAIL'));
C4Network::sendAnswer(C4Network::createError('Round end failed.'));
}
break;
default:
if (!empty($action)) {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MASTERSERVNOOP'));
C4Network::sendAnswer(C4Network::createError('Unknown action.'));
} else {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MASTERSERVNOOP'));
C4Network::sendAnswer(C4Network::createError('No action defined.'));
}
break;
}
} else {
C4Network::sendAnswer(C4Network::createError('IDS_MSG_MASTERSERVWRONGENGINE'));
C4Network::sendAnswer(C4Network::createError('Wrong engine, "' . ParseINI::parseValue('Game', $input) . '" expected.'));
}
} else { //list availabe games
$list = array();
@@ -411,30 +411,6 @@ IDS_LEAGUE_LEAGUEREPORTINGUNEXPECTED=Liga: unerwarteter Verbindungsabbruch wird
IDS_LEAGUE_WAITINGFORLASTLEAGUESERVE=Warten auf letzte Meldung des Ligaservers...
IDS_LGA_INVALIDRESPONSE3=Ungültige Antwort des Ligaservers (kein CSID).
IDS_LGA_SERVERFAILURE=Ligaserver-Fehler: %s
IDS_LGA_TOOMANYGAMESTARTS=Zu viele Versuche, ein Spiel zu starten
IDS_LGA_INVALIDPRODUCTID=Ungültiges Produkt oder Version
IDS_LGA_WRONGCHECKSUM=Falsche Prüfsumme
IDS_LGA_WRONGRESCHECKSUM=Falsche Ressourcen-Prüfsumme
IDS_LGA_SETTLEOFFICIALSERVER=Siedlungs-Ligaspiele können nur auf einem offiziellen Server gespielt werden
IDS_LGA_SETTLEOLDENGINE=Siedlungs-Ligaspiele können nur mit der aktuellsten Spielversion gespielt werden
IDS_LGA_CANTADDSCEN=Szenario konnte nicht zur Liga hinzugefügt werden
IDS_LGA_CANTFINDLEAGUESCEN=Kein Liga-Szenario und die offene Liga ist nicht aktiv
IDS_LGA_LEAGUESCENNOMELEE=Szenario ist in dieser Version in keiner Liga eingetragen. Nur Melees können in der offenen Liga gespielt werden
IDS_LGA_GAMEALREADYENDED=Spiel ist schon beendet
IDS_LGA_CANTFINDSCEN=Szenario nicht gefunden
IDS_LGA_NOCSID=CSID fehlt
IDS_LGA_CANTFINDGAME=Spiel nicht gefunden
IDS_LGA_WRONGHOSTIP=Falsche/geänderte Host-IP
IDS_LGA_CUIDALREADYEXISTS=Für diese CUID existiert bereits ein Account
IDS_LGA_WEBCODEAUTHFAILED=Authentifizierung fehlgeschlagen
IDS_LGA_WEBCODEAUTHNA=Authentifizierung derzeit nicht verfügbar
IDS_LGA_LOGINFAILED=Login fehlgeschlagen
IDS_LGA_AUIDNOTFOUND=Spieler wurde nicht authentifiziert
IDS_LGA_USERALREADYJOINED=Spieler ist diesem Spiel bereits beigetreten
IDS_LGA_USERBANNED=Benutzer gebannt
IDS_LGA_GAMENOLEAGUE=Kein Ligaspiel
IDS_LGA_GAMERECORDCOMPLETE=Aufnahme bereits komplett
IDS_LGA_GAMERECORDTOOLARGE=Aufnahme zu groß
IDS_LOG_COMMANDNOTALLOWEDINLEAGUE=Kommando in Ligaspielen nicht erlaubt!
IDS_MENU_ABORT=Runde abbrechen
IDS_MENU_ABORT_DESC=Die Runde ohne Auswertung abbrechen.
@@ -566,13 +542,6 @@ IDS_MSG_KICKFROMCLIENTLIST=Rausgeworfen über die Clientliste
IDS_MSG_KICKFROMLOBBY=Rausgeworfen aus der Lobby
IDS_MSG_KICKFROMMSGBOARD=Rausgeworfen über die Konsole
IDS_MSG_KICKFROMSTARTUPDLG=Rausgeworfen aus dem Startwartedialog
IDS_MSG_LEAGUENOTSUPPORTED=Der Masterserver unterstützt keine Liga.
IDS_MSG_MASTERSERVNATERROR=Es wurde festgestellt, dass aus deinem Netzwerk höchstwahrscheinlich keine Internetspiele gehostet werden können.|Um dies zu beheben, müssen bestimmte Ports an deinem Router freigeschaltet werden. Siehe dazu unsere FAQ für weitere Informationen.
IDS_MSG_MASTERSERVSIGNUPFAIL=Anmelden der Runde am Mastererver fehlgeschlagen.
IDS_MSG_MASTERSERVUPDATEFAIL=Aktualisierung der Runde am Masterserver fehlgeschlagen.
IDS_MSG_MASTERSERVENDFAIL=Dem Masterserver konnte nicht mitgeteilt werden, dass die Runde zuende beendet wurde.
IDS_MSG_MASTERSERVNOOP=Der Masterserver unterstützt diese Operation nicht.
IDS_MSG_MASTERSERVWRONGENGINE=Falsche Engine.
IDS_MSG_LEAGUEEVALUATIONSUCCESSFU=Ligaspiel erfolgreich ausgewertet.
IDS_MSG_LEAGUEGAMESIGNUP=Spiel bei Ligaserver %s angemeldet:|%s
IDS_MSG_LEAGUEINVALIDUSERNAME=Der Benutzername enthält ungültige Zeichen.
@@ -411,30 +411,6 @@ IDS_LEAGUE_LEAGUEREPORTINGUNEXPECTED=League: Reporting unexpected disconnect (re
IDS_LEAGUE_WAITINGFORLASTLEAGUESERVE=Waiting for last league server reply...
IDS_LGA_INVALIDRESPONSE3=Invalid reply from internet server (no CSID).
IDS_LGA_SERVERFAILURE=internet server error: %s
IDS_LGA_TOOMANYGAMESTARTS=Too many attempts to start a game
IDS_LGA_INVALIDPRODUCTID=Invalid product or version
IDS_LGA_WRONGCHECKSUM=Wrong checksum
IDS_LGA_WRONGRESCHECKSUM=Wrong resource checksum
IDS_LGA_SETTLEOFFICIALSERVER=Settle league games can only be played on official a server
IDS_LGA_SETTLEOLDENGINE=Settle league games can only be played using the latest game version
IDS_LGA_CANTADDSCEN=Scenario could not be added
IDS_LGA_CANTFINDLEAGUESCEN=Scenario not found and no open league active
IDS_LGA_LEAGUESCENNOMELEE=This scenario version is not registered in any league. Only melees can be played in the open league
IDS_LGA_GAMEALREADYENDED=Game already ended
IDS_LGA_CANTFINDSCEN=Scenario not found
IDS_LGA_NOCSID=CSID is missing
IDS_LGA_CANTFINDGAME=Game not found
IDS_LGA_WRONGHOSTIP=Wrong/changed host ip
IDS_LGA_CUIDALREADYEXISTS=There is already an account with this cuid
IDS_LGA_WEBCODEAUTHFAILED=Authentification failed
IDS_LGA_WEBCODEAUTHNA=Authentification not available at the moment
IDS_LGA_LOGINFAILED=Login failed
IDS_LGA_AUIDNOTFOUND=Player is not authentificated
IDS_LGA_USERALREADYJOINED=Player already joined this game
IDS_LGA_USERBANNED=User banned
IDS_LGA_GAMENOLEAGUE=Not a league game
IDS_LGA_GAMERECORDCOMPLETE=Record is already complete
IDS_LGA_GAMERECORDTOOLARGE=Record is too large
IDS_LOG_COMMANDNOTALLOWEDINLEAGUE=Command not allowed in league games!
IDS_MENU_ABORT=Abort round
IDS_MENU_ABORT_DESC=Abort the round without evaluation.
@@ -566,13 +542,6 @@ IDS_MSG_KICKFROMCLIENTLIST=kicked from client list
IDS_MSG_KICKFROMLOBBY=kicked from lobby
IDS_MSG_KICKFROMMSGBOARD=kicked from messageboard
IDS_MSG_KICKFROMSTARTUPDLG=kicked from startup waiting dialog
IDS_MSG_LEAGUENOTSUPPORTED=League not supported by masterserver.
IDS_MSG_MASTERSERVNATERROR=Your network failed to pass certain tests. It is unlikely that you are able to host games in the internet.|To fix that, you need to forward the certain ports on your router. Refer to the FAQ on our website for more information.
IDS_MSG_MASTERSERVSIGNUPFAIL=Round signup at the masterserver failed.
IDS_MSG_MASTERSERVUPDATEFAIL=Round update at the masterserver failed.
IDS_MSG_MASTERSERVENDFAIL=Round end notification at the masterserver failed.
IDS_MSG_MASTERSERVNOOP=Operation not supported by the masterserver.
IDS_MSG_MASTERSERVWRONGENGINE=Wrong engine.
IDS_MSG_LEAGUEEVALUATIONSUCCESSFU=League: evaluation successful.
IDS_MSG_LEAGUEGAMESIGNUP=Game signed up at league server %s:|%s
IDS_MSG_LEAGUEINVALIDUSERNAME=The user name contains invalid characters.
@@ -2017,7 +2017,7 @@ bool C4Network2::LeagueStart(bool *pCancel)
!pLeagueClient->GetStartReply(&LeagueServerMessage, &League, &StreamingAddr, &Seed, &MaxPlayersLeague))
{
const char *pError = pLeagueClient->GetError() ? pLeagueClient->GetError() :
LeagueServerMessage.getLength() ? LoadResStr(LeagueServerMessage.getData()) :
LeagueServerMessage.getLength() ? LeagueServerMessage.getData() :
LoadResStr("IDS_NET_ERR_LEAGUE_EMPTYREPLY");
StdStrBuf Message = FormatString(LoadResStr("IDS_NET_ERR_LEAGUE_REGGAME"), pError);
// Log message
@@ -2041,7 +2041,7 @@ bool C4Network2::LeagueStart(bool *pCancel)
// Show message
if (LeagueServerMessage.getLength())
{
StdStrBuf Message = FormatString(LoadResStr("IDS_MSG_LEAGUEGAMESIGNUP"), pLeagueClient->getServerName(), LoadResStr(LeagueServerMessage.getData()));
StdStrBuf Message = FormatString(LoadResStr("IDS_MSG_LEAGUEGAMESIGNUP"), pLeagueClient->getServerName(), LeagueServerMessage.getData());
// Log message
Log(Message.getData());
// Show message
@@ -2127,7 +2127,7 @@ bool C4Network2::LeagueUpdateProcessReply()
if (!fSucc)
{
const char *pError = pLeagueClient->GetError() ? pLeagueClient->GetError() :
LeagueServerMessage.getLength() ? LoadResStr(LeagueServerMessage.getData()) :
LeagueServerMessage.getLength() ? LeagueServerMessage.getData() :
LoadResStr("IDS_NET_ERR_LEAGUE_EMPTYREPLY");
StdStrBuf Message = FormatString(LoadResStr("IDS_NET_ERR_LEAGUE_UPDATEGAME"), pError);
// Show message - no dialog, because it's not really fatal and might happen in the running game
@@ -2205,7 +2205,7 @@ bool C4Network2::LeagueEnd(const char *szRecordName, const BYTE *pRecordSHA)
if (!pLeagueClient->isSuccess() || !pLeagueClient->GetEndReply(&LeagueServerMessage, &RoundResults))
{
const char *pError = pLeagueClient->GetError() ? pLeagueClient->GetError() :
LeagueServerMessage.getLength() ? LoadResStr(LeagueServerMessage.getData()) :
LeagueServerMessage.getLength() ? LeagueServerMessage.getData() :
LoadResStr("IDS_NET_ERR_LEAGUE_EMPTYREPLY");
sResultMessage.Take(FormatString(LoadResStr("IDS_NET_ERR_LEAGUE_SENDRESULT"), pError));
if (Application.isEditor) continue;
@@ -2355,7 +2355,7 @@ bool C4Network2::LeaguePlrAuth(C4PlayerInfo *pInfo)
bool fSuccess;
if (Message.getLength())
fSuccess = ::pGUI->ShowMessageModal(
LoadResStr(Message.getData()), LoadResStr("IDS_DLG_LEAGUESIGNUPCONFIRM"),
Message.getData(), LoadResStr("IDS_DLG_LEAGUESIGNUPCONFIRM"),
C4GUI::MessageDialog::btnOKAbort, C4GUI::Ico_Ex_League);
else if (AccountMaster.getLength())
fSuccess = ::pGUI->ShowMessageModal(
@@ -2441,7 +2441,7 @@ bool C4Network2::LeaguePlrAuthCheck(C4PlayerInfo *pInfo)
// Check if league server approves. pInfo will have league info if this call is successful.
if (!pLeagueClient->GetAuthCheckReply(&Message, Game.Parameters.League.getData(), pInfo))
{
LeagueShowError(FormatString(LoadResStr("IDS_MSG_LEAGUEJOINREFUSED"), pInfo->GetName(), LoadResStr(Message.getData())).getData());
LeagueShowError(FormatString(LoadResStr("IDS_MSG_LEAGUEJOINREFUSED"), pInfo->GetName(), Message.getData()).getData());
return false;
}
@@ -2476,7 +2476,7 @@ void C4Network2::LeagueNotifyDisconnect(int32_t iClientID, C4LeagueDisconnectRea
szMsg = LoadResStr("IDS_MSG_LEAGUEUNEXPECTEDDISCONNEC");
else
szMsg = LoadResStr("IDS_ERR_LEAGUEERRORREPORTINGUNEXP");
LogF(szMsg, LoadResStr(sMessage.getData()));
LogF(szMsg, sMessage.getData());
}
void C4Network2::LeagueWaitNotBusy()

0 comments on commit 45f69ab

Please sign in to comment.