mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-21 17:17:06 +02:00
commit
339fad6e27
@ -10,8 +10,8 @@ android {
|
||||
applicationId "is.xyz.vcmi"
|
||||
minSdk 19
|
||||
targetSdk 33
|
||||
versionCode 1430
|
||||
versionName "1.4.3"
|
||||
versionCode 1440
|
||||
versionName "1.4.4"
|
||||
setProperty("archivesBaseName", "vcmi")
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
set(VCMI_VERSION_MAJOR 1)
|
||||
set(VCMI_VERSION_MINOR 4)
|
||||
set(VCMI_VERSION_PATCH 3)
|
||||
set(VCMI_VERSION_PATCH 4)
|
||||
add_definitions(
|
||||
-DVCMI_VERSION_MAJOR=${VCMI_VERSION_MAJOR}
|
||||
-DVCMI_VERSION_MINOR=${VCMI_VERSION_MINOR}
|
||||
|
@ -166,7 +166,10 @@
|
||||
"defaultGainChance" : {
|
||||
"type" : "number",
|
||||
"description" : "Gain chance by default for all factions"
|
||||
|
||||
},
|
||||
"canCastOnSelf" : {
|
||||
"type" : "boolean",
|
||||
"description" : "If used as creature spell, unit can cast this spell on itself"
|
||||
},
|
||||
"gainChance" : {
|
||||
"type" : "object",
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
vcmi (1.4.4) jammy; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Ivan Savenko <saven.ivan@gmail.com> Sat, 20 Jan 2024 12:00:00 +0200
|
||||
|
||||
vcmi (1.4.3) jammy; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
|
@ -76,7 +76,8 @@
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="1.4.3" date="2024-01-19" type="development"/>
|
||||
<release version="1.4.4" date="2024-01-20" type="stable"/>
|
||||
<release version="1.4.3" date="2024-01-19" type="stable"/>
|
||||
<release version="1.4.2" date="2023-12-25" type="stable"/>
|
||||
<release version="1.4.1" date="2023-12-12" type="stable"/>
|
||||
<release version="1.4.0" date="2023-12-08" type="stable"/>
|
||||
|
@ -12,4 +12,4 @@ Exec=vcmilauncher
|
||||
Categories=Game;StrategyGame;
|
||||
Version=1.5
|
||||
Keywords=heroes of might and magic;heroes;homm;homm3;strategy;
|
||||
SingleMainWindow=yes
|
||||
SingleMainWindow=true
|
||||
|
@ -138,6 +138,9 @@ void Object::Instance::setTemplate(TerrainId terrain, CRandomGenerator & rng)
|
||||
|
||||
void Object::Instance::clear()
|
||||
{
|
||||
if (onCleared)
|
||||
onCleared(&dObject);
|
||||
|
||||
delete &dObject;
|
||||
dBlockedAreaCache.clear();
|
||||
dAccessibleAreaCache.clear();
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
void finalize(RmgMap & map, CRandomGenerator &); //cache invalidation
|
||||
void clear();
|
||||
|
||||
std::function<void(CGObjectInstance *)> onCleared;
|
||||
private:
|
||||
mutable Area dBlockedAreaCache;
|
||||
int3 dPosition;
|
||||
|
@ -34,7 +34,7 @@
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
ObjectInfo::ObjectInfo():
|
||||
destroyObject([](){})
|
||||
destroyObject([](CGObjectInstance * obj){})
|
||||
{
|
||||
|
||||
}
|
||||
@ -123,15 +123,9 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
continue;
|
||||
}
|
||||
|
||||
oi.generateObject = [i, this, prisonHeroPlacer, &oi]() -> CGObjectInstance*
|
||||
oi.generateObject = [i, this, prisonHeroPlacer]() -> CGObjectInstance*
|
||||
{
|
||||
HeroTypeID hid = prisonHeroPlacer->drawRandomHero();
|
||||
oi.destroyObject = [hid, prisonHeroPlacer]()
|
||||
{
|
||||
// Hero can be used again
|
||||
prisonHeroPlacer->restoreDrawnHero(hid);
|
||||
};
|
||||
|
||||
auto factory = VLC->objtypeh->getHandlerFor(Obj::PRISON, 0);
|
||||
auto* obj = dynamic_cast<CGHeroInstance*>(factory->create());
|
||||
|
||||
@ -141,6 +135,13 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
|
||||
return obj;
|
||||
};
|
||||
oi.destroyObject = [prisonHeroPlacer](CGObjectInstance* obj)
|
||||
{
|
||||
// Hero can be used again
|
||||
auto* hero = dynamic_cast<CGHeroInstance*>(obj);
|
||||
prisonHeroPlacer->restoreDrawnHero(hero->getHeroType());
|
||||
};
|
||||
|
||||
oi.setTemplates(Obj::PRISON, 0, zone.getTerrainType());
|
||||
oi.value = generator.getConfig().prisonValues[i];
|
||||
oi.probability = 30;
|
||||
@ -464,18 +465,20 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
|
||||
RandomGeneratorUtil::randomShuffle(creatures, zone.getRand());
|
||||
|
||||
auto setRandomArtifact = [qap, &oi](CGSeerHut * obj)
|
||||
auto setRandomArtifact = [qap](CGSeerHut * obj)
|
||||
{
|
||||
ArtifactID artid = qap->drawRandomArtifact();
|
||||
oi.destroyObject = [artid, qap]()
|
||||
{
|
||||
// Artifact can be used again
|
||||
qap->addRandomArtifact(artid);
|
||||
qap->removeQuestArtifact(artid);
|
||||
};
|
||||
obj->quest->mission.artifacts.push_back(artid);
|
||||
qap->addQuestArtifact(artid);
|
||||
};
|
||||
auto destroyObject = [qap](CGObjectInstance * obj)
|
||||
{
|
||||
auto * seer = dynamic_cast<CGSeerHut *>(obj);
|
||||
// Artifact can be used again
|
||||
ArtifactID artid = seer->quest->mission.artifacts.front();
|
||||
qap->addRandomArtifact(artid);
|
||||
qap->removeQuestArtifact(artid);
|
||||
};
|
||||
|
||||
for(int i = 0; i < static_cast<int>(creatures.size()); i++)
|
||||
{
|
||||
@ -502,6 +505,7 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
|
||||
return obj;
|
||||
};
|
||||
oi.destroyObject = destroyObject;
|
||||
oi.probability = 3;
|
||||
oi.setTemplates(Obj::SEER_HUT, randomAppearance, zone.getTerrainType());
|
||||
oi.value = static_cast<ui32>(((2 * (creature->getAIValue()) * creaturesAmount * (1 + static_cast<float>(map.getZoneCount(creature->getFaction())) / map.getTotalZoneCount())) - 4000) / 3);
|
||||
@ -546,6 +550,7 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
|
||||
return obj;
|
||||
};
|
||||
oi.destroyObject = destroyObject;
|
||||
|
||||
if(!oi.templates.empty())
|
||||
possibleSeerHuts.push_back(oi);
|
||||
@ -564,6 +569,7 @@ void TreasurePlacer::addAllPossibleObjects()
|
||||
|
||||
return obj;
|
||||
};
|
||||
oi.destroyObject = destroyObject;
|
||||
|
||||
if(!oi.templates.empty())
|
||||
possibleSeerHuts.push_back(oi);
|
||||
@ -666,11 +672,10 @@ rmg::Object TreasurePlacer::constructTreasurePile(const std::vector<ObjectInfo*>
|
||||
}
|
||||
|
||||
auto * object = oi->generateObject();
|
||||
|
||||
if(oi->templates.empty())
|
||||
{
|
||||
logGlobal->warn("Deleting randomized object with no templates: %s", object->getObjectName());
|
||||
oi->destroyObject();
|
||||
oi->destroyObject(object);
|
||||
delete object;
|
||||
continue;
|
||||
}
|
||||
@ -695,6 +700,7 @@ rmg::Object TreasurePlacer::constructTreasurePile(const std::vector<ObjectInfo*>
|
||||
}
|
||||
|
||||
auto & instance = rmgObject.addInstance(*object);
|
||||
instance.onCleared = oi->destroyObject;
|
||||
|
||||
do
|
||||
{
|
||||
@ -831,7 +837,6 @@ void TreasurePlacer::createTreasures(ObjectManager& manager)
|
||||
{
|
||||
for (auto* oi : treasurePile)
|
||||
{
|
||||
oi->destroyObject();
|
||||
oi->maxPerZone++;
|
||||
}
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ struct ObjectInfo
|
||||
ui32 maxPerZone = 1;
|
||||
//ui32 maxPerMap; //unused
|
||||
std::function<CGObjectInstance *()> generateObject;
|
||||
std::function<void()> destroyObject;
|
||||
std::function<void(CGObjectInstance *)> destroyObject;
|
||||
|
||||
void setTemplates(MapObjectID type, MapObjectSubID subtype, TerrainId terrain);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user