1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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.rooms" : "Game Rooms",
"vcmi.lobby.header.channels" : "Chat Channels", "vcmi.lobby.header.channels" : "Chat Channels",
"vcmi.lobby.header.chat" : "Game Chat", "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.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.create" : "Create New Room",
"vcmi.lobby.room.players.limit" : "Players Limit", "vcmi.lobby.room.players.limit" : "Players Limit",
"vcmi.lobby.room.description.public" : "Any player can join public room.", "vcmi.lobby.room.description.public" : "Any player can join public room.",

View File

@@ -83,6 +83,9 @@
"vcmi.lobby.header.chat" : "Чат гри", "vcmi.lobby.header.chat" : "Чат гри",
"vcmi.lobby.header.history" : "Ваші попередні ігри", "vcmi.lobby.header.history" : "Ваші попередні ігри",
"vcmi.lobby.header.players" : "Гравці в мережі", "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.create" : "Створити нову кімнату",
"vcmi.lobby.room.players.limit" : "Максимум гравців", "vcmi.lobby.room.players.limit" : "Максимум гравців",
"vcmi.lobby.room.description.public" : "Будь-хто з гравців може приєднатися до публічної кімнати.", "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)); 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; return chatHistory;
} }

View File

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

View File

@@ -24,6 +24,7 @@
#include "../widgets/ObjectLists.h" #include "../widgets/ObjectLists.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/Languages.h" #include "../../lib/Languages.h"
#include "../../lib/MetaString.h" #include "../../lib/MetaString.h"
@@ -222,14 +223,23 @@ GlobalLobbyMatchCard::GlobalLobbyMatchCard(GlobalLobbyWindow * window, const Glo
MetaString opponentDescription; MetaString opponentDescription;
if (matchDescription.participants.size() == 1) 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) 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) if (matchDescription.participants.size() > 2)
{ {
opponentDescription.appendRawString("%d players"); opponentDescription.appendTextID("vcmi.lobby.match.multi");
opponentDescription.replaceNumber(matchDescription.participants.size()); opponentDescription.replaceNumber(matchDescription.participants.size());
} }