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

Fixed crash on closing. Fixed #326. Max movement points values follow H3 more closely. Minor fixes.

This commit is contained in:
Michał W. Urbańczyk 2009-12-31 11:04:29 +00:00
parent d50a3785bd
commit 5be449b6ca
4 changed files with 18 additions and 1 deletions

View File

@ -173,6 +173,7 @@ void CClient::stop()
// Tell the network thread and interface thread to reach a stable state
terminate = true;
LOCPLINT->terminate = true;
LOCPLINT->pim->lock();
endGame();
}

View File

@ -97,6 +97,8 @@ void FoWChange::applyCl( CClient *cl )
cl->playerint[player]->tileRevealed(tiles);
else
cl->playerint[player]->tileHidden(tiles);
GS(cl)->calculatePaths(cl->IGameCallback::getSelectedHero(player), *cl->pathInfo);
}
void SetAvailableHeroes::applyCl( CClient *cl )

View File

@ -578,7 +578,12 @@ ui8 CGHeroInstance::getSecSkillLevel(const int & ID) const
}
int CGHeroInstance::maxMovePoints(bool onLand) const
{
int ret = std::min(2000, 1270+70*lowestSpeed(this)),
static const int moveForSpeed[] = { 1500, 1560, 1630, 1700, 1760, 1830, 1900, 1960, 2000 }; //first element for 3 and lower; last for 11 and more
int index = lowestSpeed(this) - 3;
amin(index, ARRAY_COUNT(moveForSpeed)-1);
amax(index, 0);
int ret = moveForSpeed[index],
bonus = valOfBonuses(HeroBonus::MOVEMENT) + (onLand ? valOfBonuses(HeroBonus::LAND_MOVEMENT) : valOfBonuses(HeroBonus::SEA_MOVEMENT));
double modifier = 0;

View File

@ -234,6 +234,7 @@ class CBasicPointerSaver
{
public:
virtual void savePtr(CSaverBase &ar, const void *data) const =0;
~CBasicPointerSaver(){}
};
template <typename Serializer, typename T> class CPointerSaver : public CBasicPointerSaver
@ -263,6 +264,13 @@ public:
saving=true;
smartPointerSerialization = true;
}
~COSer()
{
std::map<ui16,CBasicPointerSaver*>::iterator iter;
for(iter = savers.begin(); iter != savers.end(); iter++)
delete iter->second;
}
template<typename T> void registerType(const T * t=NULL)
{
@ -431,6 +439,7 @@ class CBasicPointerLoader
{
public:
virtual void loadPtr(CLoaderBase &ar, void *data) const =0; //data is pointer to the ACTUAL POINTER
virtual ~CBasicPointerLoader(){}
};
template <typename Serializer, typename T> class CPointerLoader : public CBasicPointerLoader