1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

* a few fixes for darkness; more are needed

This commit is contained in:
mateuszb
2010-06-13 13:59:59 +00:00
parent 27722d9043
commit ea150305a2
3 changed files with 15 additions and 22 deletions

View File

@@ -1714,19 +1714,11 @@ void CGTownInstance::initObj()
case 7:
bonusingBuildings.push_back (new CTownBonus(17, this));
break;
case 4:
if (vstd::contains(builtBuildings, 17))
{
GiveBonus gb(GiveBonus::TOWN); //magic
gb.bonus.type = Bonus::DARKNESS;
gb.bonus.val = 20;
gb.id = id;
gb.bonus.duration = Bonus::PERMANENT;
gb.bonus.source = Bonus::TOWN_STRUCTURE;
gb.bonus.id = id;
cb->sendAndApply(&gb);
}
break;
}
//add special bonuses from buildings
if(subID == 4 && vstd::contains(builtBuildings, 17))
{
bonuses.push_back( Bonus(Bonus::PERMANENT, Bonus::DARKNESS, Bonus::TOWN_STRUCTURE, 20, 17) );
}
}

View File

@@ -370,7 +370,7 @@ struct GiveBonus : public CPackForClient //115
enum {HERO, PLAYER, TOWN};
ui8 who; //who receives bonus, uses enum above
ui32 id; //hero or player id
ui32 id; //hero. town or player id - whoever receives it
Bonus bonus;
MetaString bdescr;
@@ -432,9 +432,9 @@ struct RemoveBonus : public CPackForClient //118
void applyCl(CClient *cl);
DLL_EXPORT void applyGs(CGameState *gs);
enum {HERO, PLAYER};
enum {HERO, PLAYER, TOWN};
ui8 who; //who receives bonus, uses enum above
ui32 whoID; //hero or player id
ui32 whoID; //hero, town or player id - whoever loses bonus
//vars to identify bonus: its source
ui8 source;

View File

@@ -1049,6 +1049,7 @@ void CGameHandler::newTurn()
}
}
}
//unhiding what shouldn't be hidden?
}
sendAndApply(&n);
@@ -2497,13 +2498,13 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid )
ns.bid.insert(29);
else if (t->subID == 4 && bid == 17) //veil of darkness
{
GiveBonus gb(GiveBonus::PLAYER);
GiveBonus gb(GiveBonus::TOWN);
gb.bonus.type = Bonus::DARKNESS;
gb.bonus.val = 20;
gb.id = t->tempOwner;
gb.id = t->id;
gb.bonus.duration = Bonus::PERMANENT;
gb.bonus.source = Bonus::TOWN_STRUCTURE;
gb.bonus.id = t->id;
gb.bonus.id = 17;
sendAndApply(&gb);
}
@@ -2554,10 +2555,10 @@ bool CGameHandler::razeStructure (si32 tid, si32 bid)
//TODO: Remove dwellers
if (t->subID == 4 && bid == 17) //Veil of Darkness
{
RemoveBonus rb(RemoveBonus::PLAYER);
rb.whoID = t->getOwner();
RemoveBonus rb(RemoveBonus::TOWN);
rb.whoID = t->id;
rb.source = Bonus::TOWN_STRUCTURE;
rb.id = t->id;
rb.id = 17;
sendAndApply(&rb);
}
return true;