mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/vcmi/vcmi into RMG
This commit is contained in:
		| @@ -3939,6 +3939,7 @@ void CInGameConsole::keyPressed (const SDL_KeyboardEvent & key) | ||||
| 			{ | ||||
| 				captureAllKeys = false; | ||||
| 				endEnteringText(true); | ||||
|                 CCS->soundh->playSound("CHAT"); | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
|   | ||||
| @@ -834,6 +834,19 @@ void CShootingAnimation::nextFrame() | ||||
|  | ||||
| void CShootingAnimation::endAnim() | ||||
| { | ||||
|     // play wall hit/miss sound for catapult attack | ||||
|     if(!attackedStack) | ||||
|     { | ||||
|         if(catapultDamage > 0) | ||||
|         { | ||||
|             CCS->soundh->playSound("WALLHIT"); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             CCS->soundh->playSound("WALLMISS"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| 	CAttackAnimation::endAnim(); | ||||
| 	delete this; | ||||
| } | ||||
|   | ||||
| @@ -20,7 +20,7 @@ void CMapGenerator::foreach_neighbour(const int3 &pos, std::function<void(int3& | ||||
| 	{ | ||||
| 		int3 n = pos + dir; | ||||
| 		if(map->isInTheMap(n)) | ||||
| 			foo(pos+dir); | ||||
| 			foo(n); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -191,7 +191,6 @@ void CMapGenerator::genZones() | ||||
| 	zones = tmpl->getZones(); //copy from template (refactor?) | ||||
|  | ||||
| 	int player_per_side = zones.size() > 4 ? 3 : 2; | ||||
| 	int zones_cnt = zones.size() > 4 ? 9 : 4; | ||||
| 		 | ||||
| 	logGlobal->infoStream() << boost::format("Map size %d %d, players per side %d") % w % h % player_per_side; | ||||
|  | ||||
| @@ -200,9 +199,6 @@ void CMapGenerator::genZones() | ||||
| 	placer.assignZones(mapGenOptions); | ||||
|  | ||||
| 	int i = 0; | ||||
| 	int part_w = w/player_per_side; | ||||
| 	int part_h = h/player_per_side; | ||||
|  | ||||
|  | ||||
| 	for(auto const it : zones) | ||||
| 	{ | ||||
| @@ -328,7 +324,7 @@ bool CMapGenerator::isFree(const int3 &tile) const | ||||
|  | ||||
| 	return tiles[tile.x][tile.y][tile.z].isFree(); | ||||
| } | ||||
| void CMapGenerator::setOccupied(int3 &tile, ETileType::ETileType state) | ||||
| void CMapGenerator::setOccupied(const int3 &tile, ETileType::ETileType state) | ||||
| { | ||||
| 	if (!map->isInTheMap(tile)) | ||||
| 		throw  rmgException(boost::to_string(boost::format("Tile %s is outside the map") % tile)); | ||||
| @@ -336,7 +332,7 @@ void CMapGenerator::setOccupied(int3 &tile, ETileType::ETileType state) | ||||
| 	tiles[tile.x][tile.y][tile.z].setOccupied(state); | ||||
| } | ||||
|  | ||||
| CTileInfo CMapGenerator::getTile(int3 tile) const | ||||
| CTileInfo CMapGenerator::getTile(const int3&  tile) const | ||||
| { | ||||
| 	if (!map->isInTheMap(tile)) | ||||
| 		throw  rmgException(boost::to_string(boost::format("Tile %s is outside the map") % tile)); | ||||
| @@ -363,4 +359,4 @@ int CMapGenerator::getNearestObjectDistance(const int3 &tile) const | ||||
| int CMapGenerator::getNextMonlithIndex() | ||||
| { | ||||
| 	return monolithIndex++; | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -71,8 +71,8 @@ public: | ||||
| 	bool shouldBeBlocked(const int3 &tile) const; | ||||
| 	bool isPossible(const int3 &tile) const; | ||||
| 	bool isFree(const int3 &tile) const; | ||||
| 	void setOccupied(int3 &tile, ETileType::ETileType state); | ||||
| 	CTileInfo getTile(int3 tile) const; | ||||
| 	void setOccupied(const int3 &tile, ETileType::ETileType state); | ||||
| 	CTileInfo getTile(const int3 & tile) const; | ||||
|  | ||||
| 	int getNearestObjectDistance(const int3 &tile) const;  | ||||
| 	void setNearestObjectDistance(int3 &tile, int value); | ||||
| @@ -94,4 +94,4 @@ private: | ||||
| 	void genZones(); | ||||
| 	void fillZones(); | ||||
|  | ||||
| }; | ||||
| }; | ||||
|   | ||||
| @@ -335,7 +335,7 @@ void CRmgTemplateZone::createBorder(CMapGenerator* gen) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| bool CRmgTemplateZone::crunchPath (CMapGenerator* gen, int3 &src, int3 &dst, TRmgTemplateZoneId zone) | ||||
| bool CRmgTemplateZone::crunchPath (CMapGenerator* gen, const int3 &src, const int3 &dst, TRmgTemplateZoneId zone) | ||||
| { | ||||
| /* | ||||
| make shortest path with free tiles, reachning dst or closest already free tile. Avoid blocks. | ||||
| @@ -586,12 +586,11 @@ bool CRmgTemplateZone::findPlaceForObject(CMapGenerator* gen, CGObjectInstance* | ||||
| 	bool result = false; | ||||
| 	si32 w = gen->map->width; | ||||
| 	si32 h = gen->map->height;  | ||||
| 	auto ow = obj->getWidth(); | ||||
| 	auto oh = obj->getHeight(); | ||||
|  | ||||
| 	//logGlobal->infoStream() << boost::format("Min dist for density %f is %d") % density % min_dist; | ||||
| 	for(auto tile : tileinfo) | ||||
| 	{ | ||||
| 		auto &ti = gen->getTile(tile); | ||||
| 		auto ti = gen->getTile(tile); | ||||
| 		auto dist = ti.getNearestObjectDistance(); | ||||
| 		//avoid borders | ||||
| 		if ((tile.x < 3) || (w - tile.x < 3) || (tile.y < 3) || (h - tile.y < 3)) | ||||
|   | ||||
| @@ -116,7 +116,7 @@ public: | ||||
| 	void addMonster(CMapGenerator* gen, int3 &pos, si32 strength); | ||||
| 	bool fill(CMapGenerator* gen); | ||||
| 	void createBorder(CMapGenerator* gen); | ||||
| 	bool crunchPath (CMapGenerator* gen, int3 &src, int3 &dst, TRmgTemplateZoneId zone); | ||||
| 	bool crunchPath (CMapGenerator* gen, const int3 &src, const int3 &dst, TRmgTemplateZoneId zone); | ||||
|  | ||||
| 	void addConnection(TRmgTemplateZoneId otherZone); | ||||
| 	std::vector<TRmgTemplateZoneId> getConnections() const; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user