1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Version set to 0.8. (not release yet, waiting for a few more fixes)

* fixed possible crash on visiting Obelisk
* fixed #394, #391, #395, #373
This commit is contained in:
Michał W. Urbańczyk 2010-03-01 18:22:22 +00:00
parent d7ba3571bd
commit 9e6d3a4453
8 changed files with 54 additions and 11 deletions

View File

@ -418,7 +418,8 @@ void CPlayerInterface::heroManaPointsChanged(const CGHeroInstance * hero)
void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
{
boost::unique_lock<boost::recursive_mutex> un(*pim);
//adventureInt->heroList.draw();
if(makingTurn && hero->tempOwner == playerID)
adventureInt->heroList.redraw();
}
void CPlayerInterface::receivedResource(int type, int val)
{
@ -1797,6 +1798,7 @@ void CPlayerInterface::playerBonusChanged( const HeroBonus &bonus, bool gain )
void CPlayerInterface::showPuzzleMap()
{
waitWhileDialog();
boost::unique_lock<boost::recursive_mutex> un(*pim);
//TODO: interface should not know the real position of Grail...
float ratio = 0;

View File

@ -109,8 +109,17 @@ void CMapInfo::mapInit(const std::string &fname, const unsigned char *map )
mapHeader = new CMapHeader();
mapHeader->version = CMapHeader::invalid;
mapHeader->initFromMemory(map, i);
countPlayers();
try
{
mapHeader->initFromMemory(map, i);
countPlayers();
}
catch (const std::string &e)
{
tlog1 << "\t\tWarning: evil map file: " << fname << ": " << e << std::endl;
delete mapHeader;
mapHeader = NULL;
}
}
CMapInfo::~CMapInfo()
@ -567,9 +576,20 @@ void SelectionTab::getFiles(std::vector<FileInfo> &out, const std::string &dirna
if(fs::is_regular_file(file->status())
&& boost::ends_with(file->path().filename(), ext))
{
out.resize(out.size()+1);
out.back().date = fs::last_write_time(file->path());
out.back().name = file->path().string();
std::time_t date = 0;
try
{
date = fs::last_write_time(file->path());
out.resize(out.size()+1);
out.back().date = date;
out.back().name = file->path().string();
}
catch(...)
{
tlog2 << "\t\tWarning: very corrupted map file: " << file->path().string() << std::endl;
}
}
}

View File

@ -87,6 +87,12 @@ void SetMana::applyCl( CClient *cl )
void SetMovePoints::applyCl( CClient *cl )
{
CGHeroInstance *h = GS(cl)->getHero(hid);
if (cl->IGameCallback::getSelectedHero(LOCPLINT->playerID) == h)//if we have selected that hero
{
GS(cl)->calculatePaths(h, *cl->pathInfo);
}
if(vstd::contains(cl->playerint,h->tempOwner))
cl->playerint[h->tempOwner]->heroMovePointsChanged(h);
}

View File

@ -2,6 +2,7 @@
#define __GLOBAL_H__
#include <iostream>
#include <algorithm> //std::find
#include <string> //std::find
#include <boost/logic/tribool.hpp>
using boost::logic::tribool;
#include <boost/cstdint.hpp>
@ -20,7 +21,7 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte)
#define THC
#endif
#define NAME_VER ("VCMI 0.75e")
#define NAME_VER ("VCMI 0.8")
extern std::string NAME; //full name
extern std::string NAME_AFFIX; //client / server
#define CONSOLE_LOGGING_LEVEL 5
@ -353,10 +354,10 @@ extern DLL_EXPORT CLogger<5> tlog5; //gray - minor log info
tlog1 << e.what() << std::endl; \
throw; \
} \
catch (const std::exception * e) \
catch (const std::string &e) \
{ \
COMMAND; \
tlog1 << e->what()<< std::endl; \
tlog1 << e << std::endl; \
throw; \
}

View File

@ -182,6 +182,10 @@ void MetaString::getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst
{
dst = VLC->creh->creatures[ser].nameSing;
}
else if(type == ART_DESCR)
{
dst = VLC->arth->artifacts[ser].Description();
}
else
{
std::vector<std::string> *vec;

View File

@ -73,7 +73,7 @@ private:
enum EMessage {TEXACT_STRING, TLOCAL_STRING, TNUMBER, TREPLACE_ESTRING, TREPLACE_LSTRING, TREPLACE_NUMBER};
public:
enum {GENERAL_TXT=1, XTRAINFO_TXT, OBJ_NAMES, RES_NAMES, ART_NAMES, ARRAY_TXT, CRE_PL_NAMES, CREGENS, MINE_NAMES,
MINE_EVNTS, ADVOB_TXT, ART_EVNTS, SPELL_NAME, SEC_SKILL_NAME, CRE_SING_NAMES, CREGENS4, COLOR};
MINE_EVNTS, ADVOB_TXT, ART_EVNTS, SPELL_NAME, SEC_SKILL_NAME, CRE_SING_NAMES, CREGENS4, COLOR, ART_DESCR};
std::vector<ui8> message; //vector of EMessage

View File

@ -195,6 +195,10 @@ CMapHeader::CMapHeader()
void CMapHeader::initFromMemory( const unsigned char *bufor, int &i )
{
version = (Eformat)(readNormalNr(bufor,i)); i+=4; //map version
if(version != RoE && version != AB && version != SoD && version != WoG)
{
throw std::string("Invalid map format!");
}
areAnyPLayers = readChar(bufor,i); //invalid on some maps
height = width = (readNormalNr(bufor,i)); i+=4; // dimensions of map
twoLevel = readChar(bufor,i); //if there is underground

View File

@ -4059,15 +4059,21 @@ bool CGameHandler::dig( const CGHeroInstance *h )
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::ART_NAMES, 2);
iw.soundID = soundBase::ULTIMATEARTIFACT;
giveHeroArtifact(2, h->id, -1); //give grail
sendAndApply(&iw);
iw.text.clear();
iw.text.addTxt(MetaString::ART_DESCR, 2);
sendAndApply(&iw);
}
else
{
iw.text.addTxt(MetaString::GENERAL_TXT, 59); //"Nothing here. \n Where could it be?"
iw.soundID = soundBase::Dig;
sendAndApply(&iw);
}
sendAndApply(&iw);
return true;
}