1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

* town visiting

* improvements in garrisons
This commit is contained in:
Michał W. Urbańczyk
2008-01-28 14:01:09 +00:00
parent a30a6bc507
commit e6de19e17d
11 changed files with 155 additions and 33 deletions

View File

@@ -12,6 +12,7 @@
#include "CGameState.h"
#include <sstream>
#include "hch/CObjectHandler.h"
#include "hch/CTownHandler.h"
#include "CCallback.h"
#include "hch/CGeneralTextHandler.h"
#include <sstream>
@@ -589,4 +590,27 @@ std::vector<int> CPickable::yourObjects() //returns IDs of objects which are han
ret.push_back(5); //artifact
ret.push_back(101); //treasure chest / commander stone
return ret;
}
}
void CTownScript::onHeroVisit(CGObjectInstance *os, int heroID)
{
cb->heroVisitCastle(os,heroID);
}
void CTownScript::onHeroLeave(CGObjectInstance *os, int heroID)
{
cb->stopHeroVisitCastle(os,heroID);
}
std::string CTownScript::hoverText(CGObjectInstance *os)
{
CGTownInstance * n;
if(n = dynamic_cast<CGTownInstance*>(os))
return n->name + ", " + n->town->name;
else return "";
}
std::vector<int> CTownScript::yourObjects() //returns IDs of objects which are handled by script
{
std::vector<int> ret(1);
ret.push_back(98); //town
return ret;
}