mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-08 00:39:47 +02:00
commit
861ed7667d
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "is.xyz.vcmi"
|
applicationId "is.xyz.vcmi"
|
||||||
minSdk 19
|
minSdk 19
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 1520
|
versionCode 1521
|
||||||
versionName "1.5.2"
|
versionName "1.5.2"
|
||||||
setProperty("archivesBaseName", "vcmi")
|
setProperty("archivesBaseName", "vcmi")
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ void CPlayerInterface::performAutosave()
|
|||||||
int txtlen = TextOperations::getUnicodeCharactersCount(name);
|
int txtlen = TextOperations::getUnicodeCharactersCount(name);
|
||||||
|
|
||||||
TextOperations::trimRightUnicode(name, std::max(0, txtlen - 15));
|
TextOperations::trimRightUnicode(name, std::max(0, txtlen - 15));
|
||||||
std::string forbiddenChars("\\/:?\"<>| ");
|
std::string forbiddenChars("\\/:*?\"<>| ");
|
||||||
std::replace_if(name.begin(), name.end(), [&](char c) { return std::string::npos != forbiddenChars.find(c); }, '_' );
|
std::replace_if(name.begin(), name.end(), [&](char c) { return std::string::npos != forbiddenChars.find(c); }, '_' );
|
||||||
|
|
||||||
prefix = name + "_" + cb->getStartInfo()->startTimeIso8601 + "/";
|
prefix = name + "_" + cb->getStartInfo()->startTimeIso8601 + "/";
|
||||||
|
@ -643,11 +643,15 @@ void AdventureMapInterface::onTileHovered(const int3 &targetPosition)
|
|||||||
objRelations = LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner);
|
objRelations = LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner);
|
||||||
std::string text = LOCPLINT->localState->getCurrentHero() ? objAtTile->getHoverText(LOCPLINT->localState->getCurrentHero()) : objAtTile->getHoverText(LOCPLINT->playerID);
|
std::string text = LOCPLINT->localState->getCurrentHero() ? objAtTile->getHoverText(LOCPLINT->localState->getCurrentHero()) : objAtTile->getHoverText(LOCPLINT->playerID);
|
||||||
boost::replace_all(text,"\n"," ");
|
boost::replace_all(text,"\n"," ");
|
||||||
|
if (GH.isKeyboardShiftDown())
|
||||||
|
text.append(" (" + std::to_string(targetPosition.x) + ", " + std::to_string(targetPosition.y) + ")");
|
||||||
GH.statusbar()->write(text);
|
GH.statusbar()->write(text);
|
||||||
}
|
}
|
||||||
else if(isTargetPositionVisible)
|
else if(isTargetPositionVisible)
|
||||||
{
|
{
|
||||||
std::string tileTooltipText = CGI->mh->getTerrainDescr(targetPosition, false);
|
std::string tileTooltipText = CGI->mh->getTerrainDescr(targetPosition, false);
|
||||||
|
if (GH.isKeyboardShiftDown())
|
||||||
|
tileTooltipText.append(" (" + std::to_string(targetPosition.x) + ", " + std::to_string(targetPosition.y) + ")");
|
||||||
GH.statusbar()->write(tileTooltipText);
|
GH.statusbar()->write(tileTooltipText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,42 +542,34 @@ void CGarrisonInt::addSplitBtn(std::shared_ptr<CButton> button)
|
|||||||
|
|
||||||
void CGarrisonInt::createSlots()
|
void CGarrisonInt::createSlots()
|
||||||
{
|
{
|
||||||
|
availableSlots.clear();
|
||||||
|
|
||||||
int distance = interx + (smallIcons ? 32 : 58);
|
int distance = interx + (smallIcons ? 32 : 58);
|
||||||
for(auto i : { EGarrisonType::UPPER, EGarrisonType::LOWER })
|
for(auto i : { EGarrisonType::UPPER, EGarrisonType::LOWER })
|
||||||
{
|
{
|
||||||
Point offset = garOffset * static_cast<int>(i);
|
Point offset = garOffset * static_cast<int>(i);
|
||||||
|
|
||||||
std::vector<std::shared_ptr<CGarrisonSlot>> garrisonSlots;
|
|
||||||
garrisonSlots.resize(7);
|
|
||||||
if(army(i))
|
|
||||||
{
|
|
||||||
for(auto & elem : army(i)->Slots())
|
|
||||||
{
|
|
||||||
garrisonSlots[elem.first.getNum()] = std::make_shared<CGarrisonSlot>(this, offset.x + (elem.first.getNum()*distance), offset.y, elem.first, i, elem.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int j = 0; j < 7; j++)
|
for(int j = 0; j < 7; j++)
|
||||||
{
|
{
|
||||||
if(!garrisonSlots[j])
|
Point position(offset.x + (j*distance), offset.y);
|
||||||
garrisonSlots[j] = std::make_shared<CGarrisonSlot>(this, offset.x + (j*distance), offset.y, SlotID(j), i, nullptr);
|
|
||||||
|
|
||||||
if(layout == ESlotsLayout::TWO_ROWS && j >= 4)
|
if(layout == ESlotsLayout::TWO_ROWS && j >= 4)
|
||||||
{
|
{
|
||||||
garrisonSlots[j]->moveBy(Point(-126, 37));
|
position += Point(-126, 37);
|
||||||
}
|
}
|
||||||
else if(layout == ESlotsLayout::REVERSED_TWO_ROWS)
|
else if(layout == ESlotsLayout::REVERSED_TWO_ROWS)
|
||||||
{
|
{
|
||||||
if(j >= 3)
|
if(j >= 3)
|
||||||
{
|
{
|
||||||
garrisonSlots[j]->moveBy(Point(-90, 49));
|
position += Point(-90, 49);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
garrisonSlots[j]->moveBy(Point(36, 0));
|
position += Point(36, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SlotID slot(j);
|
||||||
|
availableSlots.push_back(std::make_shared<CGarrisonSlot>(this, position.x, position.y, slot, i, army(i) ? army(i)->getStackPtr(slot) : nullptr));
|
||||||
}
|
}
|
||||||
vstd::concatenate(availableSlots, garrisonSlots);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,14 +434,15 @@ CLevelWindow::CLevelWindow(const CGHeroInstance * hero, PrimarySkill pskill, std
|
|||||||
skillValue = std::make_shared<CLabel>(192, 253, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->primarySkillNames[static_cast<int>(pskill)] + " +1");
|
skillValue = std::make_shared<CLabel>(192, 253, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->primarySkillNames[static_cast<int>(pskill)] + " +1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLevelWindow::close()
|
||||||
CLevelWindow::~CLevelWindow()
|
|
||||||
{
|
{
|
||||||
//FIXME: call callback if there was nothing to select?
|
//FIXME: call callback if there was nothing to select?
|
||||||
if (box && box->selectedIndex() != -1)
|
if (box && box->selectedIndex() != -1)
|
||||||
cb(box->selectedIndex());
|
cb(box->selectedIndex());
|
||||||
|
|
||||||
LOCPLINT->showingDialog->setFree();
|
LOCPLINT->showingDialog->setFree();
|
||||||
|
|
||||||
|
CWindowObject::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj, const std::function<void()> & onWindowClosed)
|
CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj, const std::function<void()> & onWindowClosed)
|
||||||
|
@ -150,7 +150,8 @@ class CLevelWindow : public CWindowObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CLevelWindow(const CGHeroInstance *hero, PrimarySkill pskill, std::vector<SecondarySkill> &skills, std::function<void(ui32)> callback);
|
CLevelWindow(const CGHeroInstance *hero, PrimarySkill pskill, std::vector<SecondarySkill> &skills, std::function<void(ui32)> callback);
|
||||||
~CLevelWindow();
|
|
||||||
|
void close() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Town portal, castle gate window
|
/// Town portal, castle gate window
|
||||||
|
@ -1104,7 +1104,11 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, EMovementMode moveme
|
|||||||
objectToVisit = t.visitableObjects.back();
|
objectToVisit = t.visitableObjects.back();
|
||||||
|
|
||||||
if (isInTheMap(guardPos))
|
if (isInTheMap(guardPos))
|
||||||
guardian = getTile(guardPos)->visitableObjects.back();
|
{
|
||||||
|
for (auto const & object : getTile(guardPos)->visitableObjects)
|
||||||
|
if (object->ID == MapObjectID::MONSTER) // exclude other objects, such as hero flying above monster
|
||||||
|
guardian = object;
|
||||||
|
}
|
||||||
|
|
||||||
const bool embarking = !h->boat && objectToVisit && objectToVisit->ID == Obj::BOAT;
|
const bool embarking = !h->boat && objectToVisit && objectToVisit->ID == Obj::BOAT;
|
||||||
const bool disembarking = h->boat
|
const bool disembarking = h->boat
|
||||||
|
@ -165,6 +165,9 @@ void CVCMIServer::onNewConnection(const std::shared_ptr<INetworkConnection> & co
|
|||||||
void CVCMIServer::onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message)
|
void CVCMIServer::onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CConnection> c = findConnection(connection);
|
std::shared_ptr<CConnection> c = findConnection(connection);
|
||||||
|
if (c == nullptr)
|
||||||
|
throw std::out_of_range("Unknown connection received in CVCMIServer::findConnection");
|
||||||
|
|
||||||
auto pack = c->retrievePack(message);
|
auto pack = c->retrievePack(message);
|
||||||
pack->c = c;
|
pack->c = c;
|
||||||
CVCMIServerPackVisitor visitor(*this, this->gh);
|
CVCMIServerPackVisitor visitor(*this, this->gh);
|
||||||
@ -197,7 +200,7 @@ std::shared_ptr<CConnection> CVCMIServer::findConnection(const std::shared_ptr<I
|
|||||||
return gameConnection;
|
return gameConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Unknown connection received in CVCMIServer::findConnection");
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVCMIServer::wasStartedByClient() const
|
bool CVCMIServer::wasStartedByClient() const
|
||||||
@ -342,6 +345,9 @@ void CVCMIServer::onDisconnected(const std::shared_ptr<INetworkConnection> & con
|
|||||||
logNetwork->error("Network error receiving a pack. Connection has been closed");
|
logNetwork->error("Network error receiving a pack. Connection has been closed");
|
||||||
|
|
||||||
std::shared_ptr<CConnection> c = findConnection(connection);
|
std::shared_ptr<CConnection> c = findConnection(connection);
|
||||||
|
if (!c)
|
||||||
|
return; // player have already disconnected via clientDisconnected call
|
||||||
|
|
||||||
vstd::erase(activeConnections, c);
|
vstd::erase(activeConnections, c);
|
||||||
|
|
||||||
if(activeConnections.empty() || hostClientId == c->connectionID)
|
if(activeConnections.empty() || hostClientId == c->connectionID)
|
||||||
|
Loading…
Reference in New Issue
Block a user