mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
* capitol bar in town hall is grey (not red) if already one exists
* disabled autosaving on first turn * bonuses from bonus artifacts * fixed crash on battle with neutral creatures * minor improvements
This commit is contained in:
parent
7d9da8974d
commit
db2f8c1d7c
@ -1014,11 +1014,11 @@ void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
||||
pom2 = 2;
|
||||
pom = 2;
|
||||
break;
|
||||
case 0: case 5: case 8:
|
||||
case 5: case 8:
|
||||
pom2 = 1;
|
||||
pom = 2;
|
||||
break;
|
||||
case 2: case 1: default:
|
||||
case 0: case 2: case 1: default:
|
||||
pom = 3;
|
||||
break;
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ int main(int argc, char** argv)
|
||||
std::cout.flags(std::ios::unitbuf);
|
||||
logfile = new std::ofstream("VCMI_Client_log.txt");
|
||||
console = new CConsoleHandler;
|
||||
*console->cb = boost::bind(&processCommand, _1, boost::ref(client));
|
||||
console->start();
|
||||
atexit(dispose);
|
||||
tlog0 <<"Creating console and logfile: "<<pomtime.getDif() << std::endl;
|
||||
|
@ -132,8 +132,14 @@ void CPlayerInterface::yourTurn()
|
||||
LOCPLINT = this;
|
||||
makingTurn = true;
|
||||
|
||||
static bool firstCall = true;
|
||||
static int autosaveCount = 0;
|
||||
LOCPLINT->cb->save("Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
|
||||
|
||||
if(firstCall)
|
||||
firstCall = false;
|
||||
else
|
||||
LOCPLINT->cb->save("Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
|
||||
|
||||
autosaveCount %= 5;
|
||||
|
||||
for(std::map<int,SDL_Surface*>::iterator i=graphics->heroWins.begin(); i!=graphics->heroWins.end();i++) //redraw hero infoboxes
|
||||
|
@ -568,14 +568,7 @@ void CGHeroInstance::initHero()
|
||||
boost::algorithm::replace_first(hoverName,"%s",name);
|
||||
boost::algorithm::replace_first(hoverName,"%s", type->heroClass->name);
|
||||
|
||||
//clear all bonuses from artifacts (if present) and give them again
|
||||
std::remove_if(bonuses.begin(), bonuses.end(), boost::bind(HeroBonus::IsFrom,_1,HeroBonus::ARTIFACT,0xffffff));
|
||||
for (std::map<ui16,ui32>::iterator ari = artifWorn.begin(); ari != artifWorn.end(); ari++)
|
||||
{
|
||||
CArtifact &art = VLC->arth->artifacts[ari->second];
|
||||
for(std::list<HeroBonus>::iterator i = art.bonuses.begin(); i != art.bonuses.end(); i++)
|
||||
bonuses.push_back(*i);
|
||||
}
|
||||
recreateArtBonuses();
|
||||
}
|
||||
|
||||
void CGHeroInstance::initHeroDefInfo()
|
||||
@ -903,6 +896,18 @@ si32 CGHeroInstance::getArtPos(int aid) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CGHeroInstance::recreateArtBonuses()
|
||||
{
|
||||
//clear all bonuses from artifacts (if present) and give them again
|
||||
std::remove_if(bonuses.begin(), bonuses.end(), boost::bind(HeroBonus::IsFrom,_1,HeroBonus::ARTIFACT,0xffffff));
|
||||
for (std::map<ui16,ui32>::iterator ari = artifWorn.begin(); ari != artifWorn.end(); ari++)
|
||||
{
|
||||
CArtifact &art = VLC->arth->artifacts[ari->second];
|
||||
for(std::list<HeroBonus>::iterator i = art.bonuses.begin(); i != art.bonuses.end(); i++)
|
||||
bonuses.push_back(*i);
|
||||
}
|
||||
}
|
||||
|
||||
void CGDwelling::initObj()
|
||||
{
|
||||
switch(ID)
|
||||
|
@ -273,6 +273,7 @@ public:
|
||||
|
||||
void initHero();
|
||||
void initHero(int SUBID);
|
||||
void recreateArtBonuses();
|
||||
void initHeroDefInfo();
|
||||
CGHeroInstance();
|
||||
virtual ~CGHeroInstance();
|
||||
|
@ -1219,7 +1219,10 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
||||
CGHeroInstance *hero = k->second.heroes[0];
|
||||
std::vector<ui16>::iterator slot = vstd::findFirstNot(hero->artifWorn,toGive->possibleSlots);
|
||||
if(slot!=toGive->possibleSlots.end())
|
||||
{
|
||||
hero->artifWorn[*slot] = toGive->id;
|
||||
hero->recreateArtBonuses();
|
||||
}
|
||||
else
|
||||
hero->artifacts.push_back(toGive->id);
|
||||
}
|
||||
@ -1296,19 +1299,6 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
||||
{
|
||||
if(k->first==-1 || k->first==255)
|
||||
continue;
|
||||
// for(int xd=0; xd<map->width; ++xd) //revealing part of map around towns
|
||||
// {
|
||||
// for(int yd=0; yd<map->height; ++yd)
|
||||
// {
|
||||
// for(int ch=0; ch<k->second.towns.size(); ++ch)
|
||||
// {
|
||||
// int deltaX = (k->second.towns[ch]->pos.x-xd)*(k->second.towns[ch]->pos.x-xd);
|
||||
// int deltaY = (k->second.towns[ch]->pos.y-yd)*(k->second.towns[ch]->pos.y-yd);
|
||||
// if(deltaX+deltaY<k->second.towns[ch]->getSightDistance()*k->second.towns[ch]->getSightDistance())
|
||||
// k->second.fogOfWarMap[xd][yd][k->second.towns[ch]->pos.z] = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//init visiting and garrisoned heroes
|
||||
for(unsigned int l=0; l<k->second.heroes.size();l++)
|
||||
|
@ -938,7 +938,8 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
|
||||
//adding native terrain bonuses
|
||||
for(int g=0; g<stacks.size(); ++g)
|
||||
{
|
||||
if( VLC->heroh->nativeTerrains[stacks[g]->creature->faction] == gs->map->terrain[tile.x][tile.y][tile.z].tertype )
|
||||
int faction = stacks[g]->creature->faction;
|
||||
if(faction >= 0 && VLC->heroh->nativeTerrains[faction] == gs->map->terrain[tile.x][tile.y][tile.z].tertype )
|
||||
{
|
||||
stacks[g]->features.push_back(makeFeature(StackFeature::SPEED_BONUS, StackFeature::WHOLE_BATTLE, 0, 1, StackFeature::OTHER_SOURCE));
|
||||
stacks[g]->features.push_back(makeFeature(StackFeature::ATTACK_BONUS, StackFeature::WHOLE_BATTLE, 0, 1, StackFeature::OTHER_SOURCE));
|
||||
@ -995,7 +996,7 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
|
||||
stacks.back()->luck = hero2->getCurrentLuck(stacks.back()->ID,false);
|
||||
}
|
||||
}
|
||||
//war machiens added
|
||||
//war machines added
|
||||
std::stable_sort(stacks.begin(),stacks.end(),cmpst);
|
||||
|
||||
//randomize obstacles
|
||||
@ -1674,13 +1675,21 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid )
|
||||
ns.bid.insert(19);
|
||||
else if(t->getHordeLevel(1) == (bid-37))
|
||||
ns.bid.insert(25);
|
||||
}
|
||||
else if(bid >= 30) //bas. dwelling
|
||||
{
|
||||
|
||||
SetAvailableCreatures ssi;
|
||||
ssi.tid = tid;
|
||||
ssi.creatures = t->creatures;
|
||||
ssi.creatures[bid-30].first = VLC->creh->creatures[t->town->basicCreatures[bid-30]].growth;
|
||||
ssi.creatures[bid-37].second.push_back(t->town->upgradedCreatures[bid-37]);
|
||||
sendAndApply(&ssi);
|
||||
}
|
||||
else if(bid >= 30) //bas. dwelling
|
||||
{
|
||||
int crid = t->town->basicCreatures[bid-30];
|
||||
SetAvailableCreatures ssi;
|
||||
ssi.tid = tid;
|
||||
ssi.creatures = t->creatures;
|
||||
ssi.creatures[bid-30].first = VLC->creh->creatures[crid].growth;
|
||||
ssi.creatures[bid-30].second.push_back(crid);
|
||||
sendAndApply(&ssi);
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ CGameState* CPackForServer::GS(CGameHandler *gh)
|
||||
|
||||
bool SaveGame::applyGh( CGameHandler *gh )
|
||||
{
|
||||
gh->sendMessageTo(*c,"Saving...");
|
||||
//gh->sendMessageTo(*c,"Saving...");
|
||||
gh->save(fname);
|
||||
gh->sendMessageTo(*c,"Game has been succesfully saved!");
|
||||
gh->sendMessageTo(*c,"Game has been saved as " + fname);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user