mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	* show icons at visitable position * do not duplicate visible objects icons
This commit is contained in:
		| @@ -346,17 +346,22 @@ ESpellCastResult ViewMechanics::applyAdventureEffects(const SpellCastEnvironment | ||||
| { | ||||
| 	ShowWorldViewEx pack; | ||||
|  | ||||
| 	pack.player = parameters.caster->tempOwner; | ||||
| 	pack.player = parameters.caster->getOwner(); | ||||
|  | ||||
| 	const int spellLevel = parameters.caster->getSpellSchoolLevel(owner); | ||||
|  | ||||
| 	const auto & fowMap = env->getCb()->getPlayerTeam(parameters.caster->getOwner())->fogOfWarMap; | ||||
|  | ||||
| 	for(const CGObjectInstance * obj : env->getMap()->objects) | ||||
| 	{ | ||||
| 		//todo:we need to send only not visible objects | ||||
| 		//deleted object remain as empty pointer | ||||
| 		if(obj && filterObject(obj, spellLevel)) | ||||
| 		{ | ||||
| 			ObjectPosInfo posInfo(obj); | ||||
|  | ||||
| 		if(obj)//for some reason deleted object remain as empty pointer | ||||
| 			if(filterObject(obj, spellLevel)) | ||||
| 				pack.objectPositions.push_back(ObjectPosInfo(obj)); | ||||
| 			if(fowMap[posInfo.pos.x][posInfo.pos.y][posInfo.pos.z] == 0) | ||||
| 				pack.objectPositions.push_back(posInfo); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	env->sendAndApply(&pack); | ||||
|   | ||||
| @@ -15,13 +15,13 @@ | ||||
| #include "../mapObjects/CObjectHandler.h" | ||||
|  | ||||
| ObjectPosInfo::ObjectPosInfo(): | ||||
| 	pos(),id(Obj::NO_OBJ), subId(-1), owner(PlayerColor::CANNOT_DETERMINE) | ||||
| 	pos(), id(Obj::NO_OBJ), subId(-1), owner(PlayerColor::CANNOT_DETERMINE) | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| ObjectPosInfo::ObjectPosInfo(const CGObjectInstance * obj): | ||||
| 	pos(obj->pos),id(obj->ID), subId(obj->subID), owner(obj->tempOwner) | ||||
| 	pos(obj->visitablePos()), id(obj->ID), subId(obj->subID), owner(obj->tempOwner) | ||||
| { | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user