mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	- game won't crash on missing dwellings (instead random one will generated)
- added disabled code that can be used to fix buildings blit order - minor fixes
This commit is contained in:
		| @@ -1141,6 +1141,35 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key ) | ||||
|  | ||||
| 	switch(key.keysym.sym) | ||||
| 	{ | ||||
| #if 0 // code that can be used to fix blit order in towns using +/- keys. Quite ugly but works | ||||
| 	case SDLK_KP_PLUS : | ||||
| 		if (builds->selectedBuilding) | ||||
| 		{ | ||||
| 			OBJ_CONSTRUCTION_CAPTURING_ALL; | ||||
| 			CStructure * str = const_cast<CStructure *>(builds->selectedBuilding->str); | ||||
| 			str->pos.z++; | ||||
| 			delete builds; | ||||
| 			builds = new CCastleBuildings(town); | ||||
|  | ||||
| 			BOOST_FOREACH(const CStructure * str, town->town->clientInfo.structures) | ||||
| 				tlog1 << int(str->building->bid) << " -> " << int(str->pos.z) << "\n"; | ||||
| 		} | ||||
| 		break; | ||||
| 	case SDLK_KP_MINUS: | ||||
| 		if (builds->selectedBuilding) | ||||
| 		{ | ||||
| 			OBJ_CONSTRUCTION_CAPTURING_ALL; | ||||
| 			CStructure * str = const_cast<CStructure *>(builds->selectedBuilding->str); | ||||
| 			str->pos.z--; | ||||
| 			delete builds; | ||||
| 			builds = new CCastleBuildings(town); | ||||
|  | ||||
| 			BOOST_FOREACH(const CStructure * str, town->town->clientInfo.structures) | ||||
| 				tlog1 << int(str->building->bid) << " -> " << int(str->pos.z) << "\n"; | ||||
|  | ||||
| 		} | ||||
| 		break; | ||||
| #endif | ||||
| 	case SDLK_UP: | ||||
| 		townlist->selectPrev(); | ||||
| 		break; | ||||
|   | ||||
| @@ -1386,6 +1386,7 @@ void CRecruitmentWindow::select(CCreatureCard *card) | ||||
| 		totalCostValue->createItems(card->creature->cost); | ||||
|  | ||||
| 		costPerTroopValue->set(card->creature->cost); | ||||
| 		totalCostValue->set(card->creature->cost * maxAmount); | ||||
|  | ||||
| 		//Recruit %s | ||||
| 		title->setTxt(boost::str(boost::format(CGI->generaltexth->tcommands[21]) % card->creature->namePl)); | ||||
|   | ||||
| @@ -636,7 +636,12 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj) | ||||
| 					result = std::pair<int,int>(17, iter.first); | ||||
|  | ||||
| 			if (result.first == -1) | ||||
| 			{ | ||||
| 				tlog0 << "Error: failed to find creature for dwelling of "<< int(faction) << " of level " << int(level) << "\n"; | ||||
| 				auto iter = VLC->objh->cregens.begin(); | ||||
| 				std::advance(iter, ran() % VLC->objh->cregens.size() ); | ||||
| 				result = std::pair<int, int>(17, iter->first); | ||||
| 			} | ||||
|  | ||||
| 			return result; | ||||
| 		} | ||||
|   | ||||
| @@ -2506,7 +2506,7 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid, bool force /*=false*/ ) | ||||
| 	FoWChange fw; | ||||
| 	fw.player = t->tempOwner; | ||||
| 	fw.mode = 1; | ||||
| 	getTilesInRange(fw.tiles,t->pos,t->getSightRadious(),t->tempOwner,1); | ||||
| 	t->getSightTiles(fw.tiles); | ||||
| 	sendAndApply(&fw); | ||||
|  | ||||
| 	if (!force) | ||||
| @@ -3815,9 +3815,9 @@ void CGameHandler::playerMessage( ui8 player, const std::string &message ) | ||||
| 		SetResources sr; | ||||
| 		sr.player = player; | ||||
| 		sr.res = gs->getPlayer(player)->resources; | ||||
| 		for(int i=0;i<7;i++) | ||||
| 		for(int i=0;i<Res::GOLD;i++) | ||||
| 			sr.res[i] += 100; | ||||
| 		sr.res[6] += 19900; | ||||
| 		sr.res[Res::GOLD] += 100000; //100k | ||||
| 		sendAndApply(&sr); | ||||
| 	} | ||||
| 	else if(message == "vcmieagles") //reveal FoW | ||||
|   | ||||
		Reference in New Issue
	
	Block a user