mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
A few bug fixes and arious warning fixes: unused code/variables, out of order initializations, ...
This commit is contained in:
parent
1406f89093
commit
dbe38a7062
@ -429,7 +429,7 @@ void CMinimap::show( SDL_Surface * to )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTerrainRect::CTerrainRect()
|
CTerrainRect::CTerrainRect()
|
||||||
:currentPath(NULL), curHoveredTile(-1,-1,-1)
|
:curHoveredTile(-1,-1,-1), currentPath(NULL)
|
||||||
{
|
{
|
||||||
tilesw=(ADVOPT.advmapW+31)/32;
|
tilesw=(ADVOPT.advmapW+31)/32;
|
||||||
tilesh=(ADVOPT.advmapH+31)/32;
|
tilesh=(ADVOPT.advmapH+31)/32;
|
||||||
|
@ -136,7 +136,7 @@ void CDummyAnim::endAnim()
|
|||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDummyAnim::CDummyAnim(CBattleInterface * _owner, int howManyFrames) : CBattleAnimation(_owner), howMany(howManyFrames), counter(0)
|
CDummyAnim::CDummyAnim(CBattleInterface * _owner, int howManyFrames) : CBattleAnimation(_owner), counter(0), howMany(howManyFrames)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ void CReverseAnim::endAnim()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CReverseAnim::CReverseAnim(CBattleInterface * _owner, int stack, int dest, bool _priority)
|
CReverseAnim::CReverseAnim(CBattleInterface * _owner, int stack, int dest, bool _priority)
|
||||||
: CBattleStackAnimation(_owner, stack), partOfAnim(1), hex(dest), secondPartSetup(false), priority(_priority)
|
: CBattleStackAnimation(_owner, stack), partOfAnim(1), secondPartSetup(false), hex(dest), priority(_priority)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,8 +514,6 @@ bool CDefenceAnim::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//initializing
|
//initializing
|
||||||
int maxLen = 0;
|
|
||||||
|
|
||||||
if(killed)
|
if(killed)
|
||||||
{
|
{
|
||||||
CGI->soundh->playSound(battle_sound(attacked->type, killed));
|
CGI->soundh->playSound(battle_sound(attacked->type, killed));
|
||||||
@ -1095,10 +1093,11 @@ void CBattleInterface::addNewAnim(CBattleAnimation * anim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2, const SDL_Rect & myRect, CPlayerInterface * att, CPlayerInterface * defen)
|
CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2, const SDL_Rect & myRect, CPlayerInterface * att, CPlayerInterface * defen)
|
||||||
: attackingHeroInstance(hero1), defendingHeroInstance(hero2), animCount(0), activeStack(-1), stackToActivate(-1),
|
: queue(NULL), attackingHeroInstance(hero1), defendingHeroInstance(hero2), animCount(0),
|
||||||
mouseHoveredStack(-1), previouslyHoveredHex(-1), currentlyHoveredHex(-1), spellDestSelectMode(false),
|
activeStack(-1), stackToActivate(-1), mouseHoveredStack(-1), previouslyHoveredHex(-1),
|
||||||
spellToCast(NULL), givenCommand(NULL), myTurn(false), resWindow(NULL), animIDhelper(0),
|
currentlyHoveredHex(-1), spellDestSelectMode(false), spellToCast(NULL), siegeH(NULL),
|
||||||
moveStarted(false), moveSh(-1), siegeH(NULL), bresult(NULL), queue(NULL), attackerInt(att), defenderInt(defen), curInt(att)
|
attackerInt(att), defenderInt(defen), curInt(att), animIDhelper(0), givenCommand(NULL),
|
||||||
|
myTurn(false), resWindow(NULL), moveStarted(false), moveSh(-1), bresult(NULL)
|
||||||
{
|
{
|
||||||
ObjectConstruction h__l__p(this);
|
ObjectConstruction h__l__p(this);
|
||||||
|
|
||||||
@ -4009,7 +4008,7 @@ void CBattleOptionsWindow::bExitf()
|
|||||||
std::string CBattleInterface::SiegeHelper::townTypeInfixes[F_NUMBER] = {"CS", "RM", "TW", "IN", "NC", "DN", "ST", "FR", "EL"};
|
std::string CBattleInterface::SiegeHelper::townTypeInfixes[F_NUMBER] = {"CS", "RM", "TW", "IN", "NC", "DN", "ST", "FR", "EL"};
|
||||||
|
|
||||||
CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner)
|
CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner)
|
||||||
: town(siegeTown), owner(_owner)
|
: owner(_owner), town(siegeTown)
|
||||||
{
|
{
|
||||||
for(int g=0; g<ARRAY_COUNT(walls); ++g)
|
for(int g=0; g<ARRAY_COUNT(walls); ++g)
|
||||||
{
|
{
|
||||||
@ -4220,7 +4219,7 @@ void CStackQueue::StackBox::setStack( const CStack *nStack )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CStackQueue::StackBox::StackBox(SDL_Surface *BG)
|
CStackQueue::StackBox::StackBox(SDL_Surface *BG)
|
||||||
:bg(BG), my(NULL)
|
:my(NULL), bg(BG)
|
||||||
{
|
{
|
||||||
if(bg)
|
if(bg)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ CCreatureAnimation::CCreatureAnimation(std::string name) : internalFrame(0), onc
|
|||||||
|
|
||||||
//init anim data
|
//init anim data
|
||||||
int i,j, totalInBlock;
|
int i,j, totalInBlock;
|
||||||
char Buffer[13];
|
|
||||||
defName=name;
|
defName=name;
|
||||||
i = 0;
|
i = 0;
|
||||||
DEFType = readNormalNr<4>(i,FDef); i+=4;
|
DEFType = readNormalNr<4>(i,FDef); i+=4;
|
||||||
|
@ -30,7 +30,7 @@ class CCursorHandler;
|
|||||||
class CGameState;
|
class CGameState;
|
||||||
class CVideoPlayer;
|
class CVideoPlayer;
|
||||||
|
|
||||||
class Mapa;
|
struct Mapa;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CGameInfo class
|
CGameInfo class
|
||||||
|
@ -396,8 +396,8 @@ SDL_Surface * CMessage::drawBoxTextBitmapSub( int player, std::string text, SDL_
|
|||||||
void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
|
void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
|
||||||
{
|
{
|
||||||
SDL_Surface * _or = NULL;
|
SDL_Surface * _or = NULL;
|
||||||
const Font &f = *graphics->fonts[FONT_MEDIUM];
|
//const Font &f = *graphics->fonts[FONT_MEDIUM];
|
||||||
int fontHeight = f.height;
|
//int fontHeight = f.height;
|
||||||
|
|
||||||
if(dynamic_cast<CSelWindow*>(ret)) //it's selection window, so we'll blit "or" between components
|
if(dynamic_cast<CSelWindow*>(ret)) //it's selection window, so we'll blit "or" between components
|
||||||
_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],zwykly);
|
_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],zwykly);
|
||||||
|
@ -329,10 +329,10 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
|
|||||||
if (directlyAttackingCreature) {
|
if (directlyAttackingCreature) {
|
||||||
// Get direction to attacker.
|
// Get direction to attacker.
|
||||||
int3 posOffset = details.attackedFrom - details.end + int3(2, 1, 0);
|
int3 posOffset = details.attackedFrom - details.end + int3(2, 1, 0);
|
||||||
const ui8 dirLookup[3][3] = {
|
static const ui8 dirLookup[3][3] = {
|
||||||
1, 2, 3,
|
{ 1, 2, 3 },
|
||||||
8, 0, 4,
|
{ 8, 0, 4 },
|
||||||
7, 6, 5
|
{ 7, 6, 5 }
|
||||||
};
|
};
|
||||||
// FIXME: Avoid const_cast, make moveDir mutable in some other way?
|
// FIXME: Avoid const_cast, make moveDir mutable in some other way?
|
||||||
const_cast<CGHeroInstance *>(ho)->moveDir = dirLookup[posOffset.y][posOffset.x];
|
const_cast<CGHeroInstance *>(ho)->moveDir = dirLookup[posOffset.y][posOffset.x];
|
||||||
|
@ -349,7 +349,8 @@ void CGPreGame::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui32, std::string> *Names /*= NULL*/)
|
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui32, std::string> *Names /*= NULL*/)
|
||||||
: ISelectionScreenInfo(Names), serv(NULL), ongoingClosing(false), serverHandlingThread(NULL), myNameID(255), mx(new boost::recursive_mutex)
|
: ISelectionScreenInfo(Names), serverHandlingThread(NULL), mx(new boost::recursive_mutex),
|
||||||
|
serv(NULL), ongoingClosing(false), myNameID(255)
|
||||||
{
|
{
|
||||||
screenType = Type;
|
screenType = Type;
|
||||||
multiPlayer = MultiPlayer;
|
multiPlayer = MultiPlayer;
|
||||||
@ -1397,7 +1398,8 @@ void CChatBox::addNewMessage(const std::string &text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InfoCard::InfoCard( bool Network )
|
InfoCard::InfoCard( bool Network )
|
||||||
: difficulty(NULL), sizes(NULL), sFlags(NULL), bg(NULL), chatOn(false), chat(NULL), network(Network), playerListBg(NULL)
|
: bg(NULL), network(Network), chatOn(false), chat(NULL), playerListBg(NULL),
|
||||||
|
difficulty(NULL), sizes(NULL), sFlags(NULL)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION;
|
OBJ_CONSTRUCTION;
|
||||||
pos.x += 393;
|
pos.x += 393;
|
||||||
@ -2018,7 +2020,7 @@ void OptionsTab::flagPressed( int color )
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSettings &S)
|
OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSettings &S)
|
||||||
:s(S), pi(SEL->current->mapHeader->players[S.color])
|
: pi(SEL->current->mapHeader->players[S.color]), s(S)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION;
|
OBJ_CONSTRUCTION;
|
||||||
defActions |= SHARE_POS;
|
defActions |= SHARE_POS;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct CMusicHandler;
|
class CMusicHandler;
|
||||||
class CMapHeader;
|
class CMapHeader;
|
||||||
class CCampaignHeader;
|
class CCampaignHeader;
|
||||||
class CTextInput;
|
class CTextInput;
|
||||||
@ -27,8 +27,8 @@ class CGStatusBar;
|
|||||||
class CTextBox;
|
class CTextBox;
|
||||||
class CCampaignState;
|
class CCampaignState;
|
||||||
class CConnection;
|
class CConnection;
|
||||||
class CPackForSelectionScreen;
|
struct CPackForSelectionScreen;
|
||||||
class PlayerInfo;
|
struct PlayerInfo;
|
||||||
|
|
||||||
namespace boost{ class thread; class recursive_mutex;}
|
namespace boost{ class thread; class recursive_mutex;}
|
||||||
|
|
||||||
|
@ -241,7 +241,6 @@ void CClient::loadGame( const std::string & fname )
|
|||||||
|
|
||||||
timeHandler tmh;
|
timeHandler tmh;
|
||||||
{
|
{
|
||||||
ui32 ver;
|
|
||||||
char sig[8];
|
char sig[8];
|
||||||
CMapHeader dum;
|
CMapHeader dum;
|
||||||
CGI->mh = new CMapHandler();
|
CGI->mh = new CMapHandler();
|
||||||
|
@ -50,7 +50,7 @@ template <typename T> struct CondSh;
|
|||||||
class CInGameConsole;
|
class CInGameConsole;
|
||||||
class CGarrisonInt;
|
class CGarrisonInt;
|
||||||
class CInGameConsole;
|
class CInGameConsole;
|
||||||
class Component;
|
struct Component;
|
||||||
class CArmedInstance;
|
class CArmedInstance;
|
||||||
class CGTownInstance;
|
class CGTownInstance;
|
||||||
class StackState;
|
class StackState;
|
||||||
|
@ -2866,7 +2866,7 @@ std::vector<int> *CTradeWindow::getItemsIds(bool Left)
|
|||||||
{
|
{
|
||||||
case PLAYER:
|
case PLAYER:
|
||||||
ids = new std::vector<int>;
|
ids = new std::vector<int>;
|
||||||
for(int i = 0, found = 0; i < PLAYER_LIMIT; i++)
|
for(int i = 0; i < PLAYER_LIMIT; i++)
|
||||||
if(i != LOCPLINT->playerID && LOCPLINT->cb->getPlayerStatus(i) == PlayerState::INGAME)
|
if(i != LOCPLINT->playerID && LOCPLINT->cb->getPlayerStatus(i) == PlayerState::INGAME)
|
||||||
ids->push_back(i);
|
ids->push_back(i);
|
||||||
break;
|
break;
|
||||||
|
@ -53,7 +53,7 @@ template <typename T> struct CondSh;
|
|||||||
class CInGameConsole;
|
class CInGameConsole;
|
||||||
class CGarrisonInt;
|
class CGarrisonInt;
|
||||||
class CInGameConsole;
|
class CInGameConsole;
|
||||||
class Component;
|
struct Component;
|
||||||
class CArmedInstance;
|
class CArmedInstance;
|
||||||
class CGTownInstance;
|
class CGTownInstance;
|
||||||
class StackState;
|
class StackState;
|
||||||
|
@ -825,11 +825,12 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
|||||||
processDef(obj->defInfo);
|
processDef(obj->defInfo);
|
||||||
|
|
||||||
const SDL_Surface *bitmap = obj->defInfo->handler->ourImages[0].bitmap;
|
const SDL_Surface *bitmap = obj->defInfo->handler->ourImages[0].bitmap;
|
||||||
int tilesW = bitmap->w/32,
|
const int tilesW = bitmap->w/32;
|
||||||
tilesH = bitmap->h/32;
|
const int tilesH = bitmap->h/32;
|
||||||
for(int fx=0; fx<bitmap->w/32; ++fx)
|
|
||||||
|
for(int fx=0; fx<tilesW; ++fx)
|
||||||
{
|
{
|
||||||
for(int fy=0; fy<bitmap->h/32; ++fy)
|
for(int fy=0; fy<tilesH; ++fy)
|
||||||
{
|
{
|
||||||
SDL_Rect cr;
|
SDL_Rect cr;
|
||||||
cr.w = 32;
|
cr.w = 32;
|
||||||
@ -837,9 +838,9 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
|||||||
cr.x = fx*32;
|
cr.x = fx*32;
|
||||||
cr.y = fy*32;
|
cr.y = fy*32;
|
||||||
std::pair<const CGObjectInstance*,SDL_Rect> toAdd = std::make_pair(obj, cr);
|
std::pair<const CGObjectInstance*,SDL_Rect> toAdd = std::make_pair(obj, cr);
|
||||||
if((obj->pos.x + fx - bitmap->w/32+1)>=0 && (obj->pos.x + fx - bitmap->w/32+1)<ttiles.size()-frameW && (obj->pos.y + fy - bitmap->h/32+1)>=0 && (obj->pos.y + fy - bitmap->h/32+1)<ttiles[0].size()-frameH)
|
if((obj->pos.x + fx - tilesW+1)>=0 && (obj->pos.x + fx - tilesW+1)<ttiles.size()-frameW && (obj->pos.y + fy - tilesH+1)>=0 && (obj->pos.y + fy - tilesH+1)<ttiles[0].size()-frameH)
|
||||||
{
|
{
|
||||||
TerrainTile2 & curt = ttiles[obj->pos.x + fx - bitmap->w/32+1][obj->pos.y + fy - bitmap->h/32+1][obj->pos.z];
|
TerrainTile2 & curt = ttiles[obj->pos.x + fx - tilesW+1][obj->pos.y + fy - tilesH+1][obj->pos.z];
|
||||||
|
|
||||||
std::vector< std::pair<const CGObjectInstance*,SDL_Rect> >::iterator i = curt.objects.begin();
|
std::vector< std::pair<const CGObjectInstance*,SDL_Rect> >::iterator i = curt.objects.begin();
|
||||||
for(; i != curt.objects.end(); i++)
|
for(; i != curt.objects.end(); i++)
|
||||||
@ -857,8 +858,8 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
|||||||
curt.objects.insert(i, toAdd);
|
curt.objects.insert(i, toAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for(int fy=0; fy<bitmap->h/32; ++fy)
|
} // for(int fy=0; fy<tilesH; ++fy)
|
||||||
} //for(int fx=0; fx<bitmap->w/32; ++fx)
|
} //for(int fx=0; fx<tilesW; ++fx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef unused
|
||||||
static long long pow(long long a, int b)
|
static long long pow(long long a, int b)
|
||||||
{
|
{
|
||||||
if (!b) return 1;
|
if (!b) return 1;
|
||||||
@ -24,6 +25,8 @@ static long long pow(long long a, int b)
|
|||||||
a*=c;
|
a*=c;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CDefHandler::CDefHandler()
|
CDefHandler::CDefHandler()
|
||||||
{
|
{
|
||||||
notFreeImgs = false;
|
notFreeImgs = false;
|
||||||
|
@ -2193,7 +2193,7 @@ void CGTownInstance::newTurn() const
|
|||||||
int n, i = rand() % std::min (ARMY_SIZE, cb->getDate(3)<<1);
|
int n, i = rand() % std::min (ARMY_SIZE, cb->getDate(3)<<1);
|
||||||
{//no lower tiers or above current month
|
{//no lower tiers or above current month
|
||||||
|
|
||||||
if (n = getSlotFor(town->basicCreatures[i], ARMY_SIZE));
|
if ((n = getSlotFor(town->basicCreatures[i], ARMY_SIZE)))
|
||||||
{
|
{
|
||||||
SetGarrisons sg;
|
SetGarrisons sg;
|
||||||
sg.garrs[id] = getArmy();
|
sg.garrs[id] = getArmy();
|
||||||
@ -6183,10 +6183,10 @@ int3 IBoatGenerator::bestLocation() const
|
|||||||
std::vector<int3> offsets;
|
std::vector<int3> offsets;
|
||||||
getOutOffsets(offsets);
|
getOutOffsets(offsets);
|
||||||
|
|
||||||
TerrainTile *tile;
|
|
||||||
for (int i = 0; i < offsets.size(); ++i)
|
for (int i = 0; i < offsets.size(); ++i)
|
||||||
{
|
{
|
||||||
if (tile = IObjectInterface::cb->getTile(o->pos + offsets[i])) //tile is in the map
|
TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offsets[i]);
|
||||||
|
if (tile) //tile is in the map
|
||||||
{
|
{
|
||||||
if (tile->tertype == TerrainTile::water && (!tile->blocked || tile->blockingObjects.front()->ID == 8)) //and is water and is not blocked or is blocked by boat
|
if (tile->tertype == TerrainTile::water && (!tile->blocked || tile->blockingObjects.front()->ID == 8)) //and is water and is not blocked or is blocked by boat
|
||||||
return o->pos + offsets[i];
|
return o->pos + offsets[i];
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct MetaString;
|
struct MetaString;
|
||||||
class BattleInfo;
|
struct BattleInfo;
|
||||||
class IGameCallback;
|
class IGameCallback;
|
||||||
struct BattleResult;
|
struct BattleResult;
|
||||||
class CCPPObjectScript;
|
class CCPPObjectScript;
|
||||||
|
@ -1061,8 +1061,8 @@ int CGameState::pickHero(int owner)
|
|||||||
const PlayerSettings &ps = scenarioOps->getIthPlayersSettings(owner);
|
const PlayerSettings &ps = scenarioOps->getIthPlayersSettings(owner);
|
||||||
if(!map->getHero(h = ps.hero,0) && h>=0) //we haven't used selected hero
|
if(!map->getHero(h = ps.hero,0) && h>=0) //we haven't used selected hero
|
||||||
return h;
|
return h;
|
||||||
int f = ps.castle;
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
do //try to find free hero of our faction
|
do //try to find free hero of our faction
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
@ -1666,7 +1666,6 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CGHeroPlaceholder * hp = static_cast<CGHeroPlaceholder*>(obj);
|
CGHeroPlaceholder * hp = static_cast<CGHeroPlaceholder*>(obj);
|
||||||
CGHeroInstance * substitution = NULL;
|
|
||||||
|
|
||||||
if(hp->subID != 0xFF) //select by type
|
if(hp->subID != 0xFF) //select by type
|
||||||
{
|
{
|
||||||
@ -1699,7 +1698,6 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CGHeroPlaceholder * hp = static_cast<CGHeroPlaceholder*>(obj);
|
CGHeroPlaceholder * hp = static_cast<CGHeroPlaceholder*>(obj);
|
||||||
CGHeroInstance * substitution = NULL;
|
|
||||||
|
|
||||||
if (hp->subID == 0xFF) //select by power
|
if (hp->subID == 0xFF) //select by power
|
||||||
{
|
{
|
||||||
@ -2023,7 +2021,9 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
|
|||||||
}
|
}
|
||||||
while(vti->possibleSpells.size())
|
while(vti->possibleSpells.size())
|
||||||
{
|
{
|
||||||
ui32 total=0, sel=-1;
|
ui32 total=0;
|
||||||
|
int sel = -1;
|
||||||
|
|
||||||
for(unsigned int ps=0;ps<vti->possibleSpells.size();ps++)
|
for(unsigned int ps=0;ps<vti->possibleSpells.size();ps++)
|
||||||
total += VLC->spellh->spells[vti->possibleSpells[ps]].probabilities[vti->subID];
|
total += VLC->spellh->spells[vti->possibleSpells[ps]].probabilities[vti->subID];
|
||||||
int r = (total)? ran()%total : -1;
|
int r = (total)? ran()%total : -1;
|
||||||
@ -4277,7 +4277,7 @@ si8 BattleInfo::hasWallPenalty( int stackID, int destHex )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const CStack * stack = getStack(stackID);
|
const CStack * stack = getStack(stackID);
|
||||||
if (stack->hasBonusOfType(Bonus::NO_WALL_PENALTY));
|
if (stack->hasBonusOfType(Bonus::NO_WALL_PENALTY))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -4486,8 +4486,8 @@ CMP_stack::CMP_stack( int Phase /*= 1*/, int Turn )
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerState::PlayerState()
|
PlayerState::PlayerState()
|
||||||
: color(-1), currentSelection(0xffffffff), status(INGAME), daysWithoutCastle(0),
|
: color(-1), currentSelection(0xffffffff), enteredWinningCheatCode(0),
|
||||||
enteredLosingCheatCode(0), enteredWinningCheatCode(0)
|
enteredLosingCheatCode(0), status(INGAME), daysWithoutCastle(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
class CMapHeader;
|
class CMapHeader;
|
||||||
class CCampaignHeader;
|
class CCampaignHeader;
|
||||||
class StartInfo;
|
struct StartInfo;
|
||||||
|
|
||||||
|
|
||||||
class DLL_EXPORT CMapInfo
|
class DLL_EXPORT CMapInfo
|
||||||
|
@ -30,7 +30,7 @@ class CGameState;
|
|||||||
class CCreature;
|
class CCreature;
|
||||||
class LibClasses;
|
class LibClasses;
|
||||||
class CHero;
|
class CHero;
|
||||||
class CPack;
|
struct CPack;
|
||||||
extern DLL_EXPORT LibClasses * VLC;
|
extern DLL_EXPORT LibClasses * VLC;
|
||||||
namespace mpl = boost::mpl;
|
namespace mpl = boost::mpl;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ namespace HHLP
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Bonus::BonusSource src;
|
Bonus::BonusSource src;
|
||||||
SourceComp(Bonus::BonusSource _src) : src(src)
|
SourceComp(Bonus::BonusSource _src) : src(_src)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
bool operator()(const Bonus & bon)
|
bool operator()(const Bonus & bon)
|
||||||
@ -186,7 +186,8 @@ Bonus * CBonusSystemNode::getBonus(const CSelector &selector)
|
|||||||
getParents (parents, this);
|
getParents (parents, this);
|
||||||
BOOST_FOREACH (CBonusSystemNode *pname, parents)
|
BOOST_FOREACH (CBonusSystemNode *pname, parents)
|
||||||
{
|
{
|
||||||
if(ret = pname->getBonus(selector))
|
ret = pname->getBonus(selector);
|
||||||
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,7 +1198,6 @@ void CGameHandler::newTurn()
|
|||||||
for (int i = 0; i < amount; ++i)
|
for (int i = 0; i < amount; ++i)
|
||||||
{
|
{
|
||||||
tile = tiles.begin();
|
tile = tiles.begin();
|
||||||
TerrainTile *tinfo = &gs->map->terrain[tile->x][tile->y][tile->z];
|
|
||||||
NewObject no;
|
NewObject no;
|
||||||
no.ID = 54; //creature
|
no.ID = 54; //creature
|
||||||
no.subID= n.creatureid;
|
no.subID= n.creatureid;
|
||||||
@ -1214,7 +1213,6 @@ void CGameHandler::newTurn()
|
|||||||
|
|
||||||
for(std::vector<CGTownInstance *>::iterator j = gs->map->towns.begin(); j!=gs->map->towns.end(); j++)//handle towns
|
for(std::vector<CGTownInstance *>::iterator j = gs->map->towns.begin(); j!=gs->map->towns.end(); j++)//handle towns
|
||||||
{
|
{
|
||||||
ui8 player = (*j)->tempOwner;
|
|
||||||
SetAvailableCreatures sac;
|
SetAvailableCreatures sac;
|
||||||
sac.tid = (**j).id;
|
sac.tid = (**j).id;
|
||||||
sac.creatures = (**j).creatures;
|
sac.creatures = (**j).creatures;
|
||||||
@ -4640,7 +4638,6 @@ void CGameHandler::objectVisited( const CGObjectInstance * obj, const CGHeroInst
|
|||||||
bool CGameHandler::buildBoat( ui32 objid )
|
bool CGameHandler::buildBoat( ui32 objid )
|
||||||
{
|
{
|
||||||
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
|
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
|
||||||
int boatType = 1;
|
|
||||||
|
|
||||||
if(obj->state())
|
if(obj->state())
|
||||||
{
|
{
|
||||||
@ -4788,7 +4785,7 @@ void CGameHandler::checkLossVictory( ui8 player )
|
|||||||
|
|
||||||
void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, InfoWindow &out ) const
|
void CGameHandler::getLossVicMessage( ui8 player, ui8 standard, bool victory, InfoWindow &out ) const
|
||||||
{
|
{
|
||||||
const PlayerState *p = gs->getPlayer(player);
|
// const PlayerState *p = gs->getPlayer(player);
|
||||||
// if(!p->human)
|
// if(!p->human)
|
||||||
// return; //AI doesn't need text info of loss
|
// return; //AI doesn't need text info of loss
|
||||||
|
|
||||||
@ -4971,7 +4968,7 @@ void CGameHandler::handleAfterAttackCasting( const BattleAttack & bat )
|
|||||||
int spellID = sf.subtype;
|
int spellID = sf.subtype;
|
||||||
int spellLevel = sf.val;
|
int spellLevel = sf.val;
|
||||||
int chance = sf.additionalInfo % 1000;
|
int chance = sf.additionalInfo % 1000;
|
||||||
int meleeRanged = sf.additionalInfo / 1000;
|
//int meleeRanged = sf.additionalInfo / 1000;
|
||||||
int destination = oneOfAttacked->position;
|
int destination = oneOfAttacked->position;
|
||||||
//check if spell should be casted (probability handling)
|
//check if spell should be casted (probability handling)
|
||||||
if( rand()%100 >= chance )
|
if( rand()%100 >= chance )
|
||||||
|
@ -60,8 +60,8 @@ static void vaccept(tcp::acceptor *ac, tcp::socket *s, boost::system::error_code
|
|||||||
|
|
||||||
|
|
||||||
CPregameServer::CPregameServer(CConnection *Host, TAcceptor *Acceptor /*= NULL*/)
|
CPregameServer::CPregameServer(CConnection *Host, TAcceptor *Acceptor /*= NULL*/)
|
||||||
: host(Host), state(RUNNING), acceptor(Acceptor), upcomingConnection(NULL), curmap(NULL), listeningThreads(0),
|
: host(Host), listeningThreads(0), acceptor(Acceptor), upcomingConnection(NULL),
|
||||||
curStartInfo(NULL)
|
curmap(NULL), curStartInfo(NULL), state(RUNNING)
|
||||||
{
|
{
|
||||||
initConnection(host);
|
initConnection(host);
|
||||||
}
|
}
|
||||||
@ -458,7 +458,6 @@ void CVCMIServer::loadGame()
|
|||||||
c >> clients >> fname; //how many clients should be connected - TODO: support more than one
|
c >> clients >> fname; //how many clients should be connected - TODO: support more than one
|
||||||
|
|
||||||
{
|
{
|
||||||
ui32 ver;
|
|
||||||
char sig[8];
|
char sig[8];
|
||||||
CMapHeader dum;
|
CMapHeader dum;
|
||||||
StartInfo *si;
|
StartInfo *si;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
class CMapInfo;
|
class CMapInfo;
|
||||||
|
|
||||||
class CConnection;
|
class CConnection;
|
||||||
class CPackForSelectionScreen;
|
struct CPackForSelectionScreen;
|
||||||
class CGameHandler;
|
class CGameHandler;
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
Loading…
Reference in New Issue
Block a user