From 470fac51362531a7100be732625adcc6ffbccfa8 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 13 Sep 2011 23:20:26 +0000 Subject: [PATCH] - bugfix for scripted scenario function registerCellTriggerEventForFactionToLocation not working properly --- source/glest_game/game/script_manager.cpp | 4 +++- source/glest_game/world/map.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index c457fb62..8663d42c 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -322,7 +322,9 @@ void ScriptManager::onCellTriggerEvent(Unit *movingUnit) { case ctet_FactionPos: { if(movingUnit->getFactionIndex() == event.sourceId) { - bool srcInDst = world->getMap()->isInUnitTypeCells(0, event.destPos,movingUnit->getPos()); + //printf("ctet_FactionPos event.destPos = [%s], movingUnit->getPos() [%s]\n",event.destPos.getString().c_str(),movingUnit->getPos().getString().c_str()); + + bool srcInDst = world->getMap()->isInUnitTypeCells(movingUnit->getType(), event.destPos,movingUnit->getPos()); if(srcInDst == true) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 74462733..0e2261c3 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -195,7 +195,11 @@ Cell *Map::getCell(int x, int y) const { Vec2i Map::getStartLocation(int locationIndex) const { if(locationIndex >= maxPlayers) { - throw runtime_error("locationIndex >= maxPlayers"); + char szBuf[4096]=""; + sprintf(szBuf,"locationIndex >= maxPlayers [%d] [%d]",locationIndex, maxPlayers); + printf("%s\n",szBuf); + //throw runtime_error(szBuf); + assert(locationIndex < maxPlayers); } else if(startLocations == NULL) { throw runtime_error("startLocations == NULL");