1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Show opponent name in 1-vs-1 games, minor tweaks

This commit is contained in:
Ivan Savenko 2024-03-20 19:49:28 +02:00
parent 829b754091
commit b50d9de912
5 changed files with 22 additions and 6 deletions

View File

@ -81,8 +81,11 @@
"vcmi.lobby.header.rooms" : "Game Rooms",
"vcmi.lobby.header.channels" : "Chat Channels",
"vcmi.lobby.header.chat" : "Game Chat",
"vcmi.lobby.header.history" : "Your Games",
"vcmi.lobby.header.history" : "Your Previous Games",
"vcmi.lobby.header.players" : "Players Online",
"vcmi.lobby.match.solo" : "Solo Game",
"vcmi.lobby.match.duel" : "Game with %s",
"vcmi.lobby.match.multi" : "%d players",
"vcmi.lobby.room.create" : "Create New Room",
"vcmi.lobby.room.players.limit" : "Players Limit",
"vcmi.lobby.room.description.public" : "Any player can join public room.",

View File

@ -83,6 +83,9 @@
"vcmi.lobby.header.chat" : "Чат гри",
"vcmi.lobby.header.history" : "Ваші попередні ігри",
"vcmi.lobby.header.players" : "Гравці в мережі",
"vcmi.lobby.match.solo" : "Одиночна гра",
"vcmi.lobby.match.duel" : "Гра з %s",
"vcmi.lobby.match.multi" : "%d гравців",
"vcmi.lobby.room.create" : "Створити нову кімнату",
"vcmi.lobby.room.players.limit" : "Максимум гравців",
"vcmi.lobby.room.description.public" : "Будь-хто з гравців може приєднатися до публічної кімнати.",

View File

@ -35,7 +35,7 @@ static std::string getCurrentTimeFormatted(int timeOffsetSeconds = 0)
return TextOperations::getFormattedTimeLocal(std::chrono::system_clock::to_time_t(timeNowChrono));
}
const std::vector<GameChatMessage> & GameChatHandler::getChatHistory()
const std::vector<GameChatMessage> & GameChatHandler::getChatHistory() const
{
return chatHistory;
}

View File

@ -25,7 +25,7 @@ class GameChatHandler : boost::noncopyable
std::vector<GameChatMessage> chatHistory;
public:
/// Returns all message history for current match
const std::vector<GameChatMessage> & getChatHistory();
const std::vector<GameChatMessage> & getChatHistory() const;
/// Erases any local state, must be called when client disconnects from match server
void resetMatchState();

View File

@ -24,6 +24,7 @@
#include "../widgets/ObjectLists.h"
#include "../widgets/TextControls.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/Languages.h"
#include "../../lib/MetaString.h"
@ -222,14 +223,23 @@ GlobalLobbyMatchCard::GlobalLobbyMatchCard(GlobalLobbyWindow * window, const Glo
MetaString opponentDescription;
if (matchDescription.participants.size() == 1)
opponentDescription.appendRawString("Solo game"); // or "Singleplayer game" is better?
opponentDescription.appendTextID("vcmi.lobby.match.solo");
if (matchDescription.participants.size() == 2)
opponentDescription.appendRawString(matchDescription.participants[0].displayName);//FIXME: find opponent - not our player
{
std::string ourAccountID = settings["lobby"]["accountID"].String();
opponentDescription.appendTextID("vcmi.lobby.match.duel");
// Find display name of our one and only opponent in this game
if (matchDescription.participants[0].accountID == ourAccountID)
opponentDescription.replaceRawString(matchDescription.participants[1].displayName);
else
opponentDescription.replaceRawString(matchDescription.participants[0].displayName);
}
if (matchDescription.participants.size() > 2)
{
opponentDescription.appendRawString("%d players");
opponentDescription.appendTextID("vcmi.lobby.match.multi");
opponentDescription.replaceNumber(matchDescription.participants.size());
}