2014-03-17 19:51:07 +00:00
|
|
|
/*
|
|
|
|
* IGameCallback.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-12-13 21:23:17 +00:00
|
|
|
#include "StdInc.h"
|
2008-12-27 01:01:59 +00:00
|
|
|
#include "IGameCallback.h"
|
2011-12-13 21:23:17 +00:00
|
|
|
|
2014-04-19 21:44:21 +04:00
|
|
|
/*#include "CGameState.h"
|
2013-04-07 10:48:07 +00:00
|
|
|
#include "mapping/CMap.h"
|
2010-12-20 21:22:53 +00:00
|
|
|
#include "CObjectHandler.h"
|
2011-05-03 03:14:18 +00:00
|
|
|
#include "CHeroHandler.h"
|
2011-12-13 21:23:17 +00:00
|
|
|
#include "StartInfo.h"
|
2010-12-20 21:22:53 +00:00
|
|
|
#include "CArtHandler.h"
|
|
|
|
#include "CSpellHandler.h"
|
2012-09-05 12:49:23 +00:00
|
|
|
#include "VCMI_Lib.h"
|
2010-12-20 21:22:53 +00:00
|
|
|
#include "CTownHandler.h"
|
2014-04-19 21:44:21 +04:00
|
|
|
#include "BattleState.h"*/
|
2011-05-03 03:14:18 +00:00
|
|
|
#include "NetPacks.h"
|
2014-04-19 21:44:21 +04:00
|
|
|
/*#include "CBuildingHandler.h"
|
2011-12-13 21:23:17 +00:00
|
|
|
#include "GameConstants.h"
|
2012-09-05 12:49:23 +00:00
|
|
|
#include "CModHandler.h"
|
2013-02-18 22:37:22 +00:00
|
|
|
#include "CDefObjInfoHandler.h"
|
2013-03-06 18:49:56 +00:00
|
|
|
#include "CBonusTypeHandler.h"
|
2013-02-18 22:37:22 +00:00
|
|
|
|
2014-04-19 21:44:21 +04:00
|
|
|
#include "Connection.h"*/
|
2008-12-27 01:01:59 +00:00
|
|
|
|
2011-05-09 22:20:47 +00:00
|
|
|
//TODO make clean
|
2014-04-19 21:44:21 +04:00
|
|
|
/*#define ERROR_SILENT_RET_VAL_IF(cond, txt, retVal) do {if(cond){return retVal;}} while(0)
|
2013-04-09 14:31:36 +00:00
|
|
|
#define ERROR_VERBOSE_OR_NOT_RET_VAL_IF(cond, verbose, txt, retVal) do {if(cond){if(verbose)logGlobal->errorStream() << BOOST_CURRENT_FUNCTION << ": " << txt; return retVal;}} while(0)
|
|
|
|
#define ERROR_RET_IF(cond, txt) do {if(cond){logGlobal->errorStream() << BOOST_CURRENT_FUNCTION << ": " << txt; return;}} while(0)
|
2014-04-19 21:44:21 +04:00
|
|
|
#define ERROR_RET_VAL_IF(cond, txt, retVal) do {if(cond){logGlobal->errorStream() << BOOST_CURRENT_FUNCTION << ": " << txt; return retVal;}} while(0)*/
|
2011-05-28 01:02:28 +00:00
|
|
|
|
2013-02-10 23:24:57 +00:00
|
|
|
const CGObjectInstance * IGameCallback::putNewObject(Obj ID, int subID, int3 pos)
|
2011-05-28 01:02:28 +00:00
|
|
|
{
|
|
|
|
NewObject no;
|
|
|
|
no.ID = ID; //creature
|
|
|
|
no.subID= subID;
|
|
|
|
no.pos = pos;
|
|
|
|
commitPackage(&no);
|
2011-07-05 06:14:07 +00:00
|
|
|
return getObj(no.id); //id field will be filled during applying on gs
|
2011-05-28 01:02:28 +00:00
|
|
|
}
|
|
|
|
|
2013-03-03 17:06:03 +00:00
|
|
|
const CGCreature * IGameCallback::putNewMonster(CreatureID creID, int count, int3 pos)
|
2011-05-28 01:02:28 +00:00
|
|
|
{
|
2013-02-07 17:34:50 +00:00
|
|
|
const CGObjectInstance *m = putNewObject(Obj::MONSTER, creID, pos);
|
2011-05-28 01:02:28 +00:00
|
|
|
setObjProperty(m->id, ObjProperty::MONSTER_COUNT, count);
|
|
|
|
setObjProperty(m->id, ObjProperty::MONSTER_POWER, (si64)1000*count);
|
|
|
|
return dynamic_cast<const CGCreature*>(m);
|
|
|
|
}
|
2013-05-27 21:46:04 +00:00
|
|
|
|
|
|
|
bool IGameCallback::isVisitCoveredByAnotherQuery(const CGObjectInstance *obj, const CGHeroInstance *hero)
|
|
|
|
{
|
|
|
|
//only server knows
|
|
|
|
assert(0);
|
|
|
|
return false;
|
|
|
|
}
|