1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

add date; cleanup

This commit is contained in:
Laserlicht
2023-09-30 17:56:51 +02:00
committed by GitHub
parent 79e66c38df
commit c6adcc40f5
5 changed files with 20 additions and 10 deletions

View File

@@ -51,6 +51,8 @@
"vcmi.lobby.filename" : "Filename",
"vcmi.lobby.creationDate" : "Creation date",
"vcmi.lobby.scenarioName" : "Scenario name",
"vcmi.lobby.mapPreview" : "Map preview",
"vcmi.server.errors.existingProcess" : "Another VCMI server process is running. Please terminate it before starting a new game.",
"vcmi.server.errors.modsToEnable" : "{Following mods are required}",

View File

@@ -50,6 +50,8 @@
"vcmi.lobby.filename" : "Dateiname",
"vcmi.lobby.creationDate" : "Erstellungsdatum",
"vcmi.lobby.scenarioName" : "Szenario-Name",
"vcmi.lobby.mapPreview" : "Kartenvorschau",
"vcmi.server.errors.existingProcess" : "Es läuft ein weiterer vcmiserver-Prozess, bitte beendet diesen zuerst",
"vcmi.server.errors.modsToEnable" : "{Erforderliche Mods um das Spiel zu laden}",
@@ -361,4 +363,4 @@
"core.bonus.WATER_IMMUNITY.description": "Immun gegen alle Zauber der Wasserschule",
"core.bonus.WIDE_BREATH.name": "Breiter Atem",
"core.bonus.WIDE_BREATH.description": "Breiter Atem-Angriff (mehrere Felder)"
}
}

View File

@@ -13,6 +13,8 @@
#include "../lobby/SelectionTab.h"
#include <vstd/DateUtils.h>
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../widgets/CComponent.h"
@@ -35,6 +37,7 @@
#include "../../lib/mapping/CMapHeader.h"
#include "../../lib/mapping/MapFormat.h"
#include "../../lib/TerrainHandler.h"
#include "../../lib/filesystem/Filesystem.h"
CMapOverview::CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType)
: CWindowObject(BORDERED | RCLICK_POPUP), resource(resource), mapName(mapName), fileName(fileName), date(date), tabType(tabType)
@@ -175,12 +178,15 @@ std::shared_ptr<CLabel> CMapOverview::CMapOverviewWidget::buildDrawString(const
if("mapname" == config["text"].String())
text = parent.mapName;
if("date" == config["text"].String())
{
if(parent.date.empty())
{
//std::time_t time =
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(ResourcePath(parent.resource.getName(), EResType::MAP)));
text = vstd::getFormattedDateTime(time);
}
else
text = parent.date;
}
auto position = readPosition(config["position"]);
return std::make_shared<CLabel>(position.x, position.y, font, alignment, color, text);
}

View File

@@ -48,11 +48,11 @@ class CMapOverview : public CWindowObject
std::shared_ptr<CMapOverviewWidget> widget;
public:
ResourcePath resource;
std::string mapName;
std::string fileName;
std::string date;
ESelectionScreen tabType;
const ResourcePath resource;
const std::string mapName;
const std::string fileName;
const std::string date;
const ESelectionScreen tabType;
CMapOverview(std::string mapName, std::string fileName, std::string date, ResourcePath resource, ESelectionScreen tabType);
};

View File

@@ -5,7 +5,7 @@
"name": "background",
"type": "texture",
"image": "DIBOXBCK",
"rect": {"w": 428, "h": 500}
"rect": {"w": 428, "h": 384}
},
{
"type": "drawTransparentRect",
@@ -18,7 +18,7 @@
"font": "medium",
"alignment": "center",
"color": "yellow",
"text": "vcmi.lobby.filename",
"text": "vcmi.lobby.scenarioName",
"position": {"x": 214, "y": 15}
},
{
@@ -46,7 +46,7 @@
"font": "medium",
"alignment": "center",
"color": "yellow",
"text": "vcmi.lobby.filename",
"text": "vcmi.lobby.mapPreview",
"position": {"x": 214, "y": 65}
},
{