mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Merge branch 'develop' into feature/pathfinderLayers
This commit is contained in:
commit
5106738160
@ -3374,7 +3374,8 @@ int3 SectorMap::findFirstVisitableTile (HeroPtr h, crint3 dst)
|
|||||||
while(curtile != h->visitablePos())
|
while(curtile != h->visitablePos())
|
||||||
{
|
{
|
||||||
auto topObj = cb->getTopObj(curtile);
|
auto topObj = cb->getTopObj(curtile);
|
||||||
if (topObj && topObj->ID == Obj::HERO && h->tempOwner == topObj->tempOwner && topObj != h.h)
|
if(topObj && topObj->ID == Obj::HERO && topObj != h.h &&
|
||||||
|
cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != PlayerRelations::ENEMIES)
|
||||||
{
|
{
|
||||||
logAi->warnStream() << ("Another allied hero stands in our way");
|
logAi->warnStream() << ("Another allied hero stands in our way");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
0.98 -> 0.next
|
0.98 -> 0.next
|
||||||
|
|
||||||
|
GENERAL:
|
||||||
|
* New Bonus NO_TERRAIN_PENALTY
|
||||||
|
* Nomads will remove Sand movement penalty from army
|
||||||
|
|
||||||
ADVETURE AI:
|
ADVETURE AI:
|
||||||
* Fixed AI trying to go through underground rock
|
* Fixed AI trying to go through underground rock
|
||||||
* Fixed several cases causing AI wandering aimlessly
|
* Fixed several cases causing AI wandering aimlessly
|
||||||
|
@ -529,8 +529,9 @@ void processCommand(const std::string &message)
|
|||||||
std::string cn; //command name
|
std::string cn; //command name
|
||||||
readed >> cn;
|
readed >> cn;
|
||||||
|
|
||||||
if(LOCPLINT && LOCPLINT->cingconsole)
|
// Check mantis issue 2292 for details
|
||||||
LOCPLINT->cingconsole->print(message);
|
// if(LOCPLINT && LOCPLINT->cingconsole)
|
||||||
|
// LOCPLINT->cingconsole->print(message);
|
||||||
|
|
||||||
if(ermInteractiveMode)
|
if(ermInteractiveMode)
|
||||||
{
|
{
|
||||||
@ -789,11 +790,12 @@ void processCommand(const std::string &message)
|
|||||||
Settings session = settings.write["session"];
|
Settings session = settings.write["session"];
|
||||||
session["autoSkip"].Bool() = !session["autoSkip"].Bool();
|
session["autoSkip"].Bool() = !session["autoSkip"].Bool();
|
||||||
}
|
}
|
||||||
else if(client && client->serv && client->serv->connected && LOCPLINT) //send to server
|
// Check mantis issue 2292 for details
|
||||||
|
/* else if(client && client->serv && client->serv->connected && LOCPLINT) //send to server
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||||
LOCPLINT->cb->sendMessage(message);
|
LOCPLINT->cb->sendMessage(message);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//plays intro, ends when intro is over or button has been pressed (handles events)
|
//plays intro, ends when intro is over or button has been pressed (handles events)
|
||||||
|
@ -151,7 +151,11 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allocate video frame
|
// Allocate video frame
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 52
|
||||||
|
frame = av_alloc_frame();
|
||||||
|
#else
|
||||||
frame = avcodec_alloc_frame();
|
frame = avcodec_alloc_frame();
|
||||||
|
#endif
|
||||||
|
|
||||||
//setup scaling
|
//setup scaling
|
||||||
|
|
||||||
@ -185,21 +189,36 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal
|
|||||||
if (texture)
|
if (texture)
|
||||||
{ // Convert the image into YUV format that SDL uses
|
{ // Convert the image into YUV format that SDL uses
|
||||||
sws = sws_getContext(codecContext->width, codecContext->height, codecContext->pix_fmt,
|
sws = sws_getContext(codecContext->width, codecContext->height, codecContext->pix_fmt,
|
||||||
pos.w, pos.h, PIX_FMT_YUV420P,
|
pos.w, pos.h,
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 51
|
||||||
|
AV_PIX_FMT_YUV420P,
|
||||||
|
#else
|
||||||
|
PIX_FMT_YUV420P,
|
||||||
|
#endif
|
||||||
SWS_BICUBIC, nullptr, nullptr, nullptr);
|
SWS_BICUBIC, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 51
|
||||||
|
AVPixelFormat screenFormat = AV_PIX_FMT_NONE;
|
||||||
|
#else
|
||||||
PixelFormat screenFormat = PIX_FMT_NONE;
|
PixelFormat screenFormat = PIX_FMT_NONE;
|
||||||
|
#endif
|
||||||
if (screen->format->Bshift > screen->format->Rshift)
|
if (screen->format->Bshift > screen->format->Rshift)
|
||||||
{
|
{
|
||||||
// this a BGR surface
|
// this a BGR surface
|
||||||
switch (screen->format->BytesPerPixel)
|
switch (screen->format->BytesPerPixel)
|
||||||
{
|
{
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 51
|
||||||
|
case 2: screenFormat = AV_PIX_FMT_BGR565; break;
|
||||||
|
case 3: screenFormat = AV_PIX_FMT_BGR24; break;
|
||||||
|
case 4: screenFormat = AV_PIX_FMT_BGR32; break;
|
||||||
|
#else
|
||||||
case 2: screenFormat = PIX_FMT_BGR565; break;
|
case 2: screenFormat = PIX_FMT_BGR565; break;
|
||||||
case 3: screenFormat = PIX_FMT_BGR24; break;
|
case 3: screenFormat = PIX_FMT_BGR24; break;
|
||||||
case 4: screenFormat = PIX_FMT_BGR32; break;
|
case 4: screenFormat = PIX_FMT_BGR32; break;
|
||||||
|
#endif
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,9 +227,15 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal
|
|||||||
// this a RGB surface
|
// this a RGB surface
|
||||||
switch (screen->format->BytesPerPixel)
|
switch (screen->format->BytesPerPixel)
|
||||||
{
|
{
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 51
|
||||||
|
case 2: screenFormat = AV_PIX_FMT_RGB565; break;
|
||||||
|
case 3: screenFormat = AV_PIX_FMT_RGB24; break;
|
||||||
|
case 4: screenFormat = AV_PIX_FMT_RGB32; break;
|
||||||
|
#else
|
||||||
case 2: screenFormat = PIX_FMT_RGB565; break;
|
case 2: screenFormat = PIX_FMT_RGB565; break;
|
||||||
case 3: screenFormat = PIX_FMT_RGB24; break;
|
case 3: screenFormat = PIX_FMT_RGB24; break;
|
||||||
case 4: screenFormat = PIX_FMT_RGB32; break;
|
case 4: screenFormat = PIX_FMT_RGB32; break;
|
||||||
|
#endif
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,7 +392,11 @@ void CVideoPlayer::close()
|
|||||||
|
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 52
|
||||||
|
av_frame_free(frame);
|
||||||
|
#else
|
||||||
av_free(frame);
|
av_free(frame);
|
||||||
|
#endif
|
||||||
frame = nullptr;
|
frame = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,10 +819,10 @@ void SaveGame::applyCl(CClient *cl)
|
|||||||
|
|
||||||
void PlayerMessage::applyCl(CClient *cl)
|
void PlayerMessage::applyCl(CClient *cl)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
logNetwork->debugStream() << "Player "<< player <<" sends a message: " << text;
|
||||||
str << "Player "<< player <<" sends a message: " << text;
|
|
||||||
|
|
||||||
logNetwork->debugStream() << str.str();
|
std::ostringstream str;
|
||||||
|
str << cl->getPlayer(player)->nodeName() <<": " << text;
|
||||||
if(LOCPLINT)
|
if(LOCPLINT)
|
||||||
LOCPLINT->cingconsole->print(str.str());
|
LOCPLINT->cingconsole->print(str.str());
|
||||||
}
|
}
|
||||||
|
@ -881,7 +881,7 @@ void CAdvMapInt::showAll(SDL_Surface * to)
|
|||||||
|
|
||||||
statusbar.show(to);
|
statusbar.show(to);
|
||||||
|
|
||||||
LOCPLINT->cingconsole->showAll(to);
|
LOCPLINT->cingconsole->show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAdvMapInt::isHeroSleeping(const CGHeroInstance *hero)
|
bool CAdvMapInt::isHeroSleeping(const CGHeroInstance *hero)
|
||||||
@ -958,7 +958,7 @@ void CAdvMapInt::show(SDL_Surface * to)
|
|||||||
for(int i=0;i<4;i++)
|
for(int i=0;i<4;i++)
|
||||||
blitAt(gems[i]->ourImages[LOCPLINT->playerID.getNum()].bitmap,ADVOPT.gemX[i],ADVOPT.gemY[i],to);
|
blitAt(gems[i]->ourImages[LOCPLINT->playerID.getNum()].bitmap,ADVOPT.gemX[i],ADVOPT.gemY[i],to);
|
||||||
updateScreen=false;
|
updateScreen=false;
|
||||||
LOCPLINT->cingconsole->showAll(to);
|
LOCPLINT->cingconsole->show(to);
|
||||||
}
|
}
|
||||||
else if (terrain.needsAnimUpdate())
|
else if (terrain.needsAnimUpdate())
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"resolution": { "x": 800, "y": 600 },
|
"resolution": { "x": 800, "y": 600 },
|
||||||
"InGameConsole": { "maxInputPerLine": 60, "maxOutputPerLine": 39 },
|
"InGameConsole": { "maxInputPerLine": 60, "maxOutputPerLine": 60 },
|
||||||
"AdvMap": { "x": 7, "y": 7, "width": 594, "height": 546, "smoothMove": 1, "puzzleSepia": 1, "objectFading" : 1, "screenFading" : 1 },
|
"AdvMap": { "x": 7, "y": 7, "width": 594, "height": 546, "smoothMove": 1, "puzzleSepia": 1, "objectFading" : 1, "screenFading" : 1 },
|
||||||
"InfoBox": { "x": 605, "y": 389 },
|
"InfoBox": { "x": 605, "y": 389 },
|
||||||
"gem0": { "x": 6, "y": 508, "graphic": "agemLL.def" },
|
"gem0": { "x": 6, "y": 508, "graphic": "agemLL.def" },
|
||||||
|
@ -738,8 +738,8 @@ std::string CArtifactInstance::nodeName() const
|
|||||||
|
|
||||||
CArtifactInstance * CArtifactInstance::createScroll( const CSpell *s)
|
CArtifactInstance * CArtifactInstance::createScroll( const CSpell *s)
|
||||||
{
|
{
|
||||||
auto ret = new CArtifactInstance(VLC->arth->artifacts[1]);
|
auto ret = new CArtifactInstance(VLC->arth->artifacts[ArtifactID::SPELL_SCROLL]);
|
||||||
auto b = new Bonus(Bonus::PERMANENT, Bonus::SPELL, Bonus::ARTIFACT_INSTANCE, -1, 1, s->id);
|
auto b = new Bonus(Bonus::PERMANENT, Bonus::SPELL, Bonus::ARTIFACT_INSTANCE, -1, ArtifactID::SPELL_SCROLL, s->id);
|
||||||
ret->addNewBonus(b);
|
ret->addNewBonus(b);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ DLL_LINKAGE CConsoleHandler * console = nullptr;
|
|||||||
#define CONSOLE_GRAY "\x1b[1;30m"
|
#define CONSOLE_GRAY "\x1b[1;30m"
|
||||||
#define CONSOLE_TEAL "\x1b[1;36m"
|
#define CONSOLE_TEAL "\x1b[1;36m"
|
||||||
#else
|
#else
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
#pragma comment(lib, "dbghelp.lib")
|
#pragma comment(lib, "dbghelp.lib")
|
||||||
|
@ -907,7 +907,7 @@ void CGameState::initDuel()
|
|||||||
|
|
||||||
if(!ss.spells.empty())
|
if(!ss.spells.empty())
|
||||||
{
|
{
|
||||||
h->putArtifact(ArtifactPosition::SPELLBOOK, CArtifactInstance::createNewArtifactInstance(0));
|
h->putArtifact(ArtifactPosition::SPELLBOOK, CArtifactInstance::createNewArtifactInstance(ArtifactID::SPELLBOOK));
|
||||||
boost::copy(ss.spells, std::inserter(h->spells, h->spells.begin()));
|
boost::copy(ss.spells, std::inserter(h->spells, h->spells.begin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace GameConstants
|
namespace GameConstants
|
||||||
{
|
{
|
||||||
const std::string VCMI_VERSION = "VCMI 0.98e";
|
const std::string VCMI_VERSION = "VCMI 0.98f";
|
||||||
|
|
||||||
const int BFIELD_WIDTH = 17;
|
const int BFIELD_WIDTH = 17;
|
||||||
const int BFIELD_HEIGHT = 11;
|
const int BFIELD_HEIGHT = 11;
|
||||||
@ -843,6 +843,7 @@ public:
|
|||||||
FIRST_AID_TENT = 6,
|
FIRST_AID_TENT = 6,
|
||||||
//CENTAUR_AXE = 7,
|
//CENTAUR_AXE = 7,
|
||||||
//BLACKSHARD_OF_THE_DEAD_KNIGHT = 8,
|
//BLACKSHARD_OF_THE_DEAD_KNIGHT = 8,
|
||||||
|
ARMAGEDDONS_BLADE = 128,
|
||||||
TITANS_THUNDER = 135,
|
TITANS_THUNDER = 135,
|
||||||
//CORNUCOPIA = 140,
|
//CORNUCOPIA = 140,
|
||||||
//FIXME: the following is only true if WoG is enabled. Otherwise other mod artifacts will take these slots.
|
//FIXME: the following is only true if WoG is enabled. Otherwise other mod artifacts will take these slots.
|
||||||
|
@ -763,6 +763,21 @@ void CBonusSystemNode::popBonuses(const CSelector &s)
|
|||||||
child->popBonuses(s);
|
child->popBonuses(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBonusSystemNode::updateBonuses(const CSelector &s)
|
||||||
|
{
|
||||||
|
BonusList bl;
|
||||||
|
exportedBonuses.getBonuses(bl, s);
|
||||||
|
for(Bonus *b : bl)
|
||||||
|
{
|
||||||
|
b->turnsRemain--;
|
||||||
|
if(b->turnsRemain <= 0)
|
||||||
|
removeBonus(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(CBonusSystemNode *child : children)
|
||||||
|
child->updateBonuses(s);
|
||||||
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::addNewBonus(Bonus *b)
|
void CBonusSystemNode::addNewBonus(Bonus *b)
|
||||||
{
|
{
|
||||||
assert(!vstd::contains(exportedBonuses,b));
|
assert(!vstd::contains(exportedBonuses,b));
|
||||||
@ -950,18 +965,7 @@ void CBonusSystemNode::getRedDescendants(TNodes &out)
|
|||||||
|
|
||||||
void CBonusSystemNode::battleTurnPassed()
|
void CBonusSystemNode::battleTurnPassed()
|
||||||
{
|
{
|
||||||
BonusList bonusesCpy = exportedBonuses; //copy, because removing bonuses invalidates iters
|
updateBonuses(Bonus::NTurns);
|
||||||
for (auto & elem : bonusesCpy)
|
|
||||||
{
|
|
||||||
Bonus *b = elem;
|
|
||||||
|
|
||||||
if(b->duration & Bonus::N_TURNS)
|
|
||||||
{
|
|
||||||
b->turnsRemain--;
|
|
||||||
if(b->turnsRemain <= 0)
|
|
||||||
removeBonus(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::exportBonus(Bonus * b)
|
void CBonusSystemNode::exportBonus(Bonus * b)
|
||||||
@ -1183,6 +1187,7 @@ namespace Selector
|
|||||||
DLL_LINKAGE CSelectFieldEqual<Bonus::BonusSource> sourceType(&Bonus::source);
|
DLL_LINKAGE CSelectFieldEqual<Bonus::BonusSource> sourceType(&Bonus::source);
|
||||||
DLL_LINKAGE CSelectFieldEqual<Bonus::LimitEffect> effectRange(&Bonus::effectRange);
|
DLL_LINKAGE CSelectFieldEqual<Bonus::LimitEffect> effectRange(&Bonus::effectRange);
|
||||||
DLL_LINKAGE CWillLastTurns turns;
|
DLL_LINKAGE CWillLastTurns turns;
|
||||||
|
DLL_LINKAGE CWillLastDays days;
|
||||||
DLL_LINKAGE CSelectFieldAny<Bonus::LimitEffect> anyRange(&Bonus::effectRange);
|
DLL_LINKAGE CSelectFieldAny<Bonus::LimitEffect> anyRange(&Bonus::effectRange);
|
||||||
|
|
||||||
CSelector DLL_LINKAGE typeSubtype(Bonus::BonusType Type, TBonusSubtype Subtype)
|
CSelector DLL_LINKAGE typeSubtype(Bonus::BonusType Type, TBonusSubtype Subtype)
|
||||||
|
@ -686,6 +686,7 @@ public:
|
|||||||
//bool isLimitedOnUs(Bonus *b) const; //if bonus should be removed from list acquired from this node
|
//bool isLimitedOnUs(Bonus *b) const; //if bonus should be removed from list acquired from this node
|
||||||
|
|
||||||
void popBonuses(const CSelector &s);
|
void popBonuses(const CSelector &s);
|
||||||
|
void updateBonuses(const CSelector &s);
|
||||||
virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
||||||
virtual std::string nodeName() const;
|
virtual std::string nodeName() const;
|
||||||
|
|
||||||
@ -820,6 +821,33 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DLL_LINKAGE CWillLastDays
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int daysRequested;
|
||||||
|
|
||||||
|
bool operator()(const Bonus *bonus) const
|
||||||
|
{
|
||||||
|
if(daysRequested <= 0)
|
||||||
|
return true;
|
||||||
|
else if(bonus->duration & Bonus::ONE_DAY)
|
||||||
|
return false;
|
||||||
|
else if(bonus->duration & Bonus::PERMANENT || bonus->duration & Bonus::ONE_BATTLE)
|
||||||
|
return true;
|
||||||
|
else if(bonus->duration & Bonus::N_DAYS)
|
||||||
|
{
|
||||||
|
return bonus->turnsRemain > daysRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // TODO: ONE_WEEK need support for turnsRemain, but for now we'll exclude all unhandled durations
|
||||||
|
}
|
||||||
|
CWillLastDays& operator()(const int &setVal)
|
||||||
|
{
|
||||||
|
daysRequested = setVal;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//Stores multiple limiters. If any of them fails -> bonus is dropped.
|
//Stores multiple limiters. If any of them fails -> bonus is dropped.
|
||||||
class DLL_LINKAGE LimiterList : public ILimiter
|
class DLL_LINKAGE LimiterList : public ILimiter
|
||||||
{
|
{
|
||||||
@ -958,6 +986,7 @@ namespace Selector
|
|||||||
extern DLL_LINKAGE CSelectFieldEqual<Bonus::BonusSource> sourceType;
|
extern DLL_LINKAGE CSelectFieldEqual<Bonus::BonusSource> sourceType;
|
||||||
extern DLL_LINKAGE CSelectFieldEqual<Bonus::LimitEffect> effectRange;
|
extern DLL_LINKAGE CSelectFieldEqual<Bonus::LimitEffect> effectRange;
|
||||||
extern DLL_LINKAGE CWillLastTurns turns;
|
extern DLL_LINKAGE CWillLastTurns turns;
|
||||||
|
extern DLL_LINKAGE CWillLastDays days;
|
||||||
extern DLL_LINKAGE CSelectFieldAny<Bonus::LimitEffect> anyRange;
|
extern DLL_LINKAGE CSelectFieldAny<Bonus::LimitEffect> anyRange;
|
||||||
|
|
||||||
CSelector DLL_LINKAGE typeSubtype(Bonus::BonusType Type, TBonusSubtype Subtype);
|
CSelector DLL_LINKAGE typeSubtype(Bonus::BonusType Type, TBonusSubtype Subtype);
|
||||||
|
@ -1026,6 +1026,7 @@ DLL_LINKAGE void NewTurn::applyGs( CGameState *gs )
|
|||||||
if(gs->getDate(Date::DAY_OF_WEEK) == 1) //new week
|
if(gs->getDate(Date::DAY_OF_WEEK) == 1) //new week
|
||||||
gs->globalEffects.popBonuses(Bonus::OneWeek); //works for children -> all game objs
|
gs->globalEffects.popBonuses(Bonus::OneWeek); //works for children -> all game objs
|
||||||
|
|
||||||
|
gs->globalEffects.updateBonuses(Bonus::NDays);
|
||||||
//TODO not really a single root hierarchy, what about bonuses placed elsewhere? [not an issue with H3 mechanics but in the future...]
|
//TODO not really a single root hierarchy, what about bonuses placed elsewhere? [not an issue with H3 mechanics but in the future...]
|
||||||
|
|
||||||
for(CGTownInstance* t : gs->map->towns)
|
for(CGTownInstance* t : gs->map->towns)
|
||||||
|
@ -34,9 +34,9 @@ void IVCMIDirs::init()
|
|||||||
#endif
|
#endif
|
||||||
#endif // __MINGW32__
|
#endif // __MINGW32__
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
#include <Shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <Shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
// Generates script file named _temp.bat in 'to' directory and runs it
|
// Generates script file named _temp.bat in 'to' directory and runs it
|
||||||
// Script will:
|
// Script will:
|
||||||
|
@ -261,10 +261,10 @@ void CGHeroInstance::initHero()
|
|||||||
spells -= SpellID::PRESET;
|
spells -= SpellID::PRESET;
|
||||||
|
|
||||||
if(!getArt(ArtifactPosition::MACH4) && !getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook) //no catapult means we haven't read pre-existent set -> use default rules for spellbook
|
if(!getArt(ArtifactPosition::MACH4) && !getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook) //no catapult means we haven't read pre-existent set -> use default rules for spellbook
|
||||||
putArtifact(ArtifactPosition::SPELLBOOK, CArtifactInstance::createNewArtifactInstance(0));
|
putArtifact(ArtifactPosition::SPELLBOOK, CArtifactInstance::createNewArtifactInstance(ArtifactID::SPELLBOOK));
|
||||||
|
|
||||||
if(!getArt(ArtifactPosition::MACH4))
|
if(!getArt(ArtifactPosition::MACH4))
|
||||||
putArtifact(ArtifactPosition::MACH4, CArtifactInstance::createNewArtifactInstance(3)); //everyone has a catapult
|
putArtifact(ArtifactPosition::MACH4, CArtifactInstance::createNewArtifactInstance(ArtifactID::CATAPULT)); //everyone has a catapult
|
||||||
|
|
||||||
if(portrait < 0 || portrait == 255)
|
if(portrait < 0 || portrait == 255)
|
||||||
portrait = type->imageIndex;
|
portrait = type->imageIndex;
|
||||||
|
@ -668,8 +668,7 @@ void CMapLoaderH3M::readAllowedArtifacts()
|
|||||||
}
|
}
|
||||||
if (map->version == EMapFormat::ROE)
|
if (map->version == EMapFormat::ROE)
|
||||||
{
|
{
|
||||||
// Armageddon's Blade
|
map->allowedArtifact[ArtifactID::ARMAGEDDONS_BLADE] = false;
|
||||||
map->allowedArtifact[128] = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1975,7 +1975,8 @@ void CGameHandler::setOwner(const CGObjectInstance * obj, PlayerColor owner)
|
|||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = oldOwner;
|
iw.player = oldOwner;
|
||||||
iw.text.addTxt (MetaString::GENERAL_TXT, 6); //%s, you have lost your last town. If you do not conquer another town in the next week, you will be eliminated.
|
iw.text.addTxt(MetaString::GENERAL_TXT, 6); //%s, you have lost your last town. If you do not conquer another town in the next week, you will be eliminated.
|
||||||
|
iw.text.addReplacement(MetaString::COLOR, oldOwner.getNum());
|
||||||
sendAndApply(&iw);
|
sendAndApply(&iw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2786,14 +2787,14 @@ bool CGameHandler::recruitCreatures(ObjectInstanceID objid, ObjectInstanceID dst
|
|||||||
|
|
||||||
switch(crid)
|
switch(crid)
|
||||||
{
|
{
|
||||||
case 146:
|
case CreatureID::BALLISTA:
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts[4], ArtifactPosition::MACH1);
|
giveHeroNewArtifact(h, VLC->arth->artifacts[ArtifactID::BALLISTA], ArtifactPosition::MACH1);
|
||||||
break;
|
break;
|
||||||
case 147:
|
case CreatureID::FIRST_AID_TENT:
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts[6], ArtifactPosition::MACH3);
|
giveHeroNewArtifact(h, VLC->arth->artifacts[ArtifactID::FIRST_AID_TENT], ArtifactPosition::MACH3);
|
||||||
break;
|
break;
|
||||||
case 148:
|
case CreatureID::AMMO_CART:
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts[5], ArtifactPosition::MACH2);
|
giveHeroNewArtifact(h, VLC->arth->artifacts[ArtifactID::AMMO_CART], ArtifactPosition::MACH2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
complain("This war machine cannot be recruited!");
|
complain("This war machine cannot be recruited!");
|
||||||
@ -3012,7 +3013,7 @@ bool CGameHandler::assembleArtifacts (ObjectInstanceID heroID, ArtifactPosition
|
|||||||
|
|
||||||
if(assemble)
|
if(assemble)
|
||||||
{
|
{
|
||||||
CArtifact *combinedArt = VLC->arth->artifacts.at(assembleTo);
|
CArtifact *combinedArt = VLC->arth->artifacts[assembleTo];
|
||||||
if(!combinedArt->constituents)
|
if(!combinedArt->constituents)
|
||||||
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
|
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
|
||||||
if(!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
|
if(!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
|
||||||
@ -3056,7 +3057,7 @@ bool CGameHandler::buyArtifact( ObjectInstanceID hid, ArtifactID aid )
|
|||||||
}
|
}
|
||||||
else if(aid < 7 && aid > 3) //war machine
|
else if(aid < 7 && aid > 3) //war machine
|
||||||
{
|
{
|
||||||
int price = VLC->arth->artifacts.at(aid)->price;
|
int price = VLC->arth->artifacts[aid]->price;
|
||||||
|
|
||||||
if(( hero->getArt(ArtifactPosition(9+aid)) && complain("Hero already has this machine!"))
|
if(( hero->getArt(ArtifactPosition(9+aid)) && complain("Hero already has this machine!"))
|
||||||
|| (gs->getPlayer(hero->getOwner())->resources.at(Res::GOLD) < price && complain("Not enough gold!")))
|
|| (gs->getPlayer(hero->getOwner())->resources.at(Res::GOLD) < price && complain("Not enough gold!")))
|
||||||
@ -3067,7 +3068,7 @@ bool CGameHandler::buyArtifact( ObjectInstanceID hid, ArtifactID aid )
|
|||||||
|| ((town->hasBuilt(BuildingID::BALLISTA_YARD, ETownType::STRONGHOLD)) && aid == ArtifactID::BALLISTA))
|
|| ((town->hasBuilt(BuildingID::BALLISTA_YARD, ETownType::STRONGHOLD)) && aid == ArtifactID::BALLISTA))
|
||||||
{
|
{
|
||||||
giveResource(hero->getOwner(),Res::GOLD,-price);
|
giveResource(hero->getOwner(),Res::GOLD,-price);
|
||||||
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(aid), ArtifactPosition(9+aid));
|
giveHeroNewArtifact(hero, VLC->arth->artifacts[aid], ArtifactPosition(9+aid));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3124,7 +3125,7 @@ bool CGameHandler::buyArtifact(const IMarket *m, const CGHeroInstance *h, Res::E
|
|||||||
|
|
||||||
sendAndApply(&saa);
|
sendAndApply(&saa);
|
||||||
|
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts.at(aid), ArtifactPosition::FIRST_AVAILABLE);
|
giveHeroNewArtifact(h, VLC->arth->artifacts[aid], ArtifactPosition::FIRST_AVAILABLE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3975,7 +3976,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|||||||
sm.absolute = true;
|
sm.absolute = true;
|
||||||
|
|
||||||
if(!h->hasSpellbook()) //hero doesn't have spellbook
|
if(!h->hasSpellbook()) //hero doesn't have spellbook
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts.at(0), ArtifactPosition::SPELLBOOK); //give spellbook
|
giveHeroNewArtifact(h, VLC->arth->artifacts[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK); //give spellbook
|
||||||
|
|
||||||
sendAndApply(&sm);
|
sendAndApply(&sm);
|
||||||
}
|
}
|
||||||
@ -4028,18 +4029,18 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|||||||
if(!hero) return;
|
if(!hero) return;
|
||||||
|
|
||||||
if(!hero->getArt(ArtifactPosition::MACH1))
|
if(!hero->getArt(ArtifactPosition::MACH1))
|
||||||
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(4), ArtifactPosition::MACH1);
|
giveHeroNewArtifact(hero, VLC->arth->artifacts[ArtifactID::BALLISTA], ArtifactPosition::MACH1);
|
||||||
if(!hero->getArt(ArtifactPosition::MACH2))
|
if(!hero->getArt(ArtifactPosition::MACH2))
|
||||||
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(5), ArtifactPosition::MACH2);
|
giveHeroNewArtifact(hero, VLC->arth->artifacts[ArtifactID::AMMO_CART], ArtifactPosition::MACH2);
|
||||||
if(!hero->getArt(ArtifactPosition::MACH3))
|
if(!hero->getArt(ArtifactPosition::MACH3))
|
||||||
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(6), ArtifactPosition::MACH3);
|
giveHeroNewArtifact(hero, VLC->arth->artifacts[ArtifactID::FIRST_AID_TENT], ArtifactPosition::MACH3);
|
||||||
}
|
}
|
||||||
else if (message == "vcmiforgeofnoldorking") //hero gets all artifacts except war machines, spell scrolls and spell book
|
else if (message == "vcmiforgeofnoldorking") //hero gets all artifacts except war machines, spell scrolls and spell book
|
||||||
{
|
{
|
||||||
CGHeroInstance *hero = gs->getHero(currObj);
|
CGHeroInstance *hero = gs->getHero(currObj);
|
||||||
if(!hero) return;
|
if(!hero) return;
|
||||||
for (int g = 7; g < VLC->arth->artifacts.size(); ++g) //including artifacts from mods
|
for (int g = 7; g < VLC->arth->artifacts.size(); ++g) //including artifacts from mods
|
||||||
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(g), ArtifactPosition::PRE_FIRST);
|
giveHeroNewArtifact(hero, VLC->arth->artifacts[g], ArtifactPosition::PRE_FIRST);
|
||||||
}
|
}
|
||||||
else if(message == "vcmiglorfindel") //selected hero gains a new level
|
else if(message == "vcmiglorfindel") //selected hero gains a new level
|
||||||
{
|
{
|
||||||
@ -4913,14 +4914,14 @@ bool CGameHandler::dig( const CGHeroInstance *h )
|
|||||||
if(gs->map->grailPos == h->getPosition())
|
if(gs->map->grailPos == h->getPosition())
|
||||||
{
|
{
|
||||||
iw.text.addTxt(MetaString::GENERAL_TXT, 58); //"Congratulations! After spending many hours digging here, your hero has uncovered the "
|
iw.text.addTxt(MetaString::GENERAL_TXT, 58); //"Congratulations! After spending many hours digging here, your hero has uncovered the "
|
||||||
iw.text.addTxt(MetaString::ART_NAMES, 2);
|
iw.text.addTxt(MetaString::ART_NAMES, ArtifactID::GRAIL);
|
||||||
iw.soundID = soundBase::ULTIMATEARTIFACT;
|
iw.soundID = soundBase::ULTIMATEARTIFACT;
|
||||||
giveHeroNewArtifact(h, VLC->arth->artifacts.at(2), ArtifactPosition::PRE_FIRST); //give grail
|
giveHeroNewArtifact(h, VLC->arth->artifacts[ArtifactID::GRAIL], ArtifactPosition::PRE_FIRST); //give grail
|
||||||
sendAndApply(&iw);
|
sendAndApply(&iw);
|
||||||
|
|
||||||
iw.soundID = soundBase::invalid;
|
iw.soundID = soundBase::invalid;
|
||||||
iw.text.clear();
|
iw.text.clear();
|
||||||
iw.text.addTxt(MetaString::ART_DESCR, 2);
|
iw.text.addTxt(MetaString::ART_DESCR, ArtifactID::GRAIL);
|
||||||
sendAndApply(&iw);
|
sendAndApply(&iw);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user