1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

- fixes crash on giving banned skills to hero (partial #1427)

- fixes hover text for prisons - they should not display name of imprisoned hero
- missing bits for launcher, Linux-specific
This commit is contained in:
Ivan Savenko
2013-09-04 23:00:51 +00:00
parent 6fc87d0df1
commit 0a627698d8
5 changed files with 38 additions and 18 deletions

View File

@ -2,7 +2,6 @@ This readme covers VCMI compilation on Unix-like systems.
To run the game you will need:
1) Heroes 3 data files (SoD or Complete editions);
2) Unofficial WoG addon
2) VCMI data pack (http://download.vcmi.eu/core.zip)
All of them can be installed manually or using vcmibuilder script
@ -11,7 +10,7 @@ http://wiki.vcmi.eu/index.php?title=Installation_on_Linux#Preparing_data
I. Prerequisites
To compile, at least the following packages (and their development counterparts) are needed to build:
To compile, the following packages (and their development counterparts) are needed to build:
* libstdc++ devel
* CMake build system
* SDL and SDL-devel
@ -19,6 +18,7 @@ To compile, at least the following packages (and their development counterparts)
* SDL_image and SDL_image-devel
* SDL_ttf and SDL_ttf-devel
* zlib and zlib-devel
* (optional) Qt 5, widget and network modules
* the ffmpeg libraries (libavformat and libswscale). Their name could be libavformat-devel and libswscale-devel, or ffmpeg-libs-devel or similar names.
* boost c++ libraries v1.46+ (www.boost.org):
- program-options
@ -47,7 +47,11 @@ III. Compilation
Run configure:
mkdir build && cd build
cmake ../src -DCMAKE_BUILD_TYPE=Debug (to enable debugging)
cmake ../src <any other options, see below>
Additional options that you may want to use:
To enable debugging: -DCMAKE_BUILD_TYPE=Debug
To enable launcher: -DENABLE_LAUNCHER=Yes
Notice:
The ../src/ is not a typo, it will place makefile scripts into the build dir
@ -60,14 +64,14 @@ That will generate vcmiclient, vcmiserver as well as 3 .so libraries.
III. Installing binaries
To install VCMI type (as root):
make install
To install VCMI you can use "make install" command however generation of distribution-specific packages is usually a better idea. In most cases this can be achieved using tool called "checkinstall"
For development puposes, it's better to use links instead.
If you're compiling vcmi for development puposes, it's better to use links instead.
Go to /BIN_PATH/, and type:
ln -s .../trunk/build/client/vcmiclient
ln -s .../trunk/build/server/vcmiserver
ln -s .../trunk/build/launcher/vcmilauncher
Go to /LIB_PATH/vcmi, and type:

View File

@ -54,5 +54,7 @@ target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIB
if (NOT APPLE) # Already inside bundle
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
# copy whole directory but .svn control files
install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher PATTERN ".svn" EXCLUDE)
endif()

View File

@ -23,13 +23,13 @@
SecondarySkill CHeroClass::chooseSecSkill(const std::set<SecondarySkill> & possibles) const //picks secondary skill out from given possibilities
{
if(possibles.size()==1)
return *possibles.begin();
int totalProb = 0;
for(auto & possible : possibles)
{
totalProb += secSkillProbability[possible];
}
if (totalProb != 0) // may trigger if set contains only banned skills (0 probability)
{
int ran = rand()%totalProb;
for(auto & possible : possibles)
{
@ -37,7 +37,9 @@ SecondarySkill CHeroClass::chooseSecSkill(const std::set<SecondarySkill> & possi
if(ran<0)
return possible;
}
throw std::runtime_error("Cannot pick secondary skill!");
}
// FIXME: select randomly? How H3 handles such rare situation?
return *possibles.begin();
}
EAlignment::EAlignment CHeroClass::getAlignment() const

View File

@ -828,10 +828,6 @@ void CGHeroInstance::initHero()
commander->giveStackExp (exp); //after our exp is set
}
hoverName = VLC->generaltexth->allTexts[15];
boost::algorithm::replace_first(hoverName,"%s",name);
boost::algorithm::replace_first(hoverName,"%s", type->heroClass->name);
if (mana < 0)
mana = manaLimit();
}
@ -969,6 +965,21 @@ void CGHeroInstance::onHeroVisit(const CGHeroInstance * h) const
}
}
const std::string & CGHeroInstance::getHoverText() const
{
if(ID != Obj::PRISON)
{
hoverName = VLC->generaltexth->allTexts[15];
boost::algorithm::replace_first(hoverName,"%s",name);
boost::algorithm::replace_first(hoverName,"%s", type->heroClass->name);
return hoverName;
}
else
hoverName = VLC->generaltexth->names[ID];
return hoverName;
}
const std::string & CGHeroInstance::getBiography() const
{
if (biography.length())

View File

@ -431,6 +431,7 @@ public:
void initObj() override;
void onHeroVisit(const CGHeroInstance * h) const override;
const std::string & getHoverText() const override;
protected:
void setPropertyDer(ui8 what, ui32 val) override;//synchr
};