1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00
Changes were reviewed manually
This commit is contained in:
Alexander Wilms
2024-06-24 03:23:26 +02:00
parent 820b1b446e
commit 02e429e973
277 changed files with 815 additions and 815 deletions

View File

@ -470,11 +470,11 @@ void CGameHandler::handleClientDisconnection(std::shared_ptr<CConnection> c)
void CGameHandler::handleReceivedPack(CPackForServer * pack)
{
//prepare struct informing that action was applied
auto sendPackageResponse = [&](bool succesfullyApplied)
auto sendPackageResponse = [&](bool successfullyApplied)
{
PackageApplied applied;
applied.player = pack->player;
applied.result = succesfullyApplied;
applied.result = successfullyApplied;
applied.packType = CTypeList::getInstance().getTypeID(pack);
applied.requestID = pack->requestID;
pack->c->sendPack(&applied);
@ -2336,7 +2336,7 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
if(upgradeNumber >= t->town->creatures.at(level).size())
{
complain(boost::str(boost::format("Error ecountered when building dwelling (bid=%s):"
complain(boost::str(boost::format("Error encountered when building dwelling (bid=%s):"
"no creature found (upgrade number %d, level %d!")
% buildingID % upgradeNumber % level));
return;
@ -2375,7 +2375,7 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
};
//Checks if all requirements will be met with expected building list "buildingsThatWillBe"
auto areRequirementsFullfilled = [&](const BuildingID & buildID)
auto areRequirementsFulfilled = [&](const BuildingID & buildID)
{
return buildingsThatWillBe.count(buildID);
};
@ -2397,7 +2397,7 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
//Prepare structure (list of building ids will be filled later)
NewStructures ns;
ns.tid = tid;
ns.builded = force ? t->builded : (t->builded+1);
ns.built = force ? t->built : (t->built+1);
std::queue<const CBuilding*> buildingsToAdd;
buildingsToAdd.push(requestedBuilding);
@ -2415,7 +2415,7 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
{
auto actualRequirements = t->genBuildingRequirements(autoBuilding->bid);
if(actualRequirements.test(areRequirementsFullfilled))
if(actualRequirements.test(areRequirementsFulfilled))
buildingsToAdd.push(autoBuilding);
}
}
@ -2613,7 +2613,7 @@ void CGameHandler::moveArmy(const CArmedInstance *src, const CArmedInstance *dst
{
//try to merge two other stacks to make place
std::pair<SlotID, SlotID> toMerge;
if (dst->mergableStacks(toMerge, i->first) && allowMerging)
if (dst->mergeableStacks(toMerge, i->first) && allowMerging)
{
moveStack(StackLocation(dst, toMerge.first), StackLocation(dst, toMerge.second)); //merge toMerge.first into toMerge.second
assert(!dst->hasStackAtSlot(toMerge.first)); //we have now a new free slot
@ -3335,7 +3335,7 @@ bool CGameHandler::queryReply(QueryID qid, std::optional<int32_t> answer, Player
void CGameHandler::handleTimeEvents()
{
gs->map->events.sort(evntCmp);
while(gs->map->events.size() && gs->map->events.front().firstOccurence+1 == gs->day)
while(gs->map->events.size() && gs->map->events.front().firstOccurrence+1 == gs->day)
{
CMapEvent ev = gs->map->events.front();
@ -3370,11 +3370,11 @@ void CGameHandler::handleTimeEvents()
}
} //PLAYERS LOOP
if (ev.nextOccurence)
if (ev.nextOccurrence)
{
gs->map->events.pop_front();
ev.firstOccurence += ev.nextOccurence;
ev.firstOccurrence += ev.nextOccurrence;
auto it = gs->map->events.begin();
while(it != gs->map->events.end() && it->earlierThanOrEqual(ev))
it++;
@ -3395,7 +3395,7 @@ void CGameHandler::handleTimeEvents()
void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
{
town->events.sort(evntCmp);
while(town->events.size() && town->events.front().firstOccurence == gs->day)
while(town->events.size() && town->events.front().firstOccurrence == gs->day)
{
PlayerColor player = town->tempOwner;
CCastleEvent ev = town->events.front();
@ -3453,11 +3453,11 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
sendAndApply(&iw); //show dialog
}
if (ev.nextOccurence)
if (ev.nextOccurrence)
{
town->events.pop_front();
ev.firstOccurence += ev.nextOccurence;
ev.firstOccurrence += ev.nextOccurrence;
auto it = town->events.begin();
while(it != town->events.end() && it->earlierThanOrEqual(ev))
it++;
@ -3663,9 +3663,9 @@ bool CGameHandler::buildBoat(ObjectInstanceID objid, PlayerColor playerID)
TResources boatCost;
obj->getBoatCost(boatCost);
TResources aviable = getPlayerState(playerID)->resources;
TResources available = getPlayerState(playerID)->resources;
if (!aviable.canAfford(boatCost))
if (!available.canAfford(boatCost))
{
complain("Not enough resources to build a boat!");
return false;