Examine City at Conquest

That looks like the spot. You need to add the button to the popup itself, too. This code merely handles the click. Also, you might want to put Examine as the first option since that's where it is on other popups, right?
 
I got it to work, however I need it to loop back to the popup afterwords, it just exits out after the 'examine' at the moment, not long now to go!

6nairobi_lead_wideweb__470x3010.jpg


edit: updated Screenshot
 
Code:
	case BUTTONPOPUP_RAZECITY:
		// examine city start
		if (pPopupReturn->getButtonClicked() == 2)
		{
			gDLL->sendDoTask(info.getData1(), TASK_RAZE, -1, -1, false, false, false, false);
		}
		else if (pPopupReturn->getButtonClicked() == 3)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(), pCity);
			}

			gDLL->sendDoTask(info.getData1(), TASK_GIFT, info.getData2(), -1, false, false, false, false);
		}
		else if (pPopupReturn->getButtonClicked() == 1)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				pCity->chooseProduction();
				gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(), pCity);
			}
		}
		else if (pPopupReturn->getButtonClicked() == 0)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				gDLL->getInterfaceIFace()->selectCity(pCity);
			}
		}
		// examine city end
		break;

and

Code:
bool CvDLLButtonPopup::launchRazeCityPopup(CvPopup* pPopup, CvPopupInfo &info)
{
	CvPlayer& player = GET_PLAYER(GC.getGameINLINE().getActivePlayer());

	CvCity* pNewCity = player.getCity(info.getData1());
	if (NULL == pNewCity)
	{
		FAssert(false);
		return (false);
	}

	if (0 != GC.getDefineINT("PLAYER_ALWAYS_RAZES_CITIES"))
	{
		player.raze(pNewCity);
		return false;
	}

	PlayerTypes eHighestCulturePlayer = (PlayerTypes)info.getData2();

	int iCaptureGold = info.getData3();
	bool bRaze = player.canRaze(pNewCity);
	bool bGift = ((eHighestCulturePlayer != NO_PLAYER) 
		&& (eHighestCulturePlayer != player.getID()) 
		&& ((player.getTeam() == GET_PLAYER(eHighestCulturePlayer).getTeam()) || 

GET_TEAM(player.getTeam()).isOpenBorders(GET_PLAYER(eHighestCulturePlayer).getTeam()) || 

GET_TEAM(GET_PLAYER(eHighestCulturePlayer).getTeam()).isVassal(player.getTeam())));
	
	CvWString szBuffer;
	if (iCaptureGold > 0)
	{
		szBuffer = gDLL->getText("TXT_KEY_POPUP_GOLD_CITY_CAPTURE", iCaptureGold, pNewCity->getNameKey());
	}
	else
	{
		szBuffer = gDLL->getText("TXT_KEY_POPUP_CITY_CAPTURE_KEEP", pNewCity->getNameKey());
	}
	gDLL->getInterfaceIFace()->popupSetBodyString(pPopup, szBuffer);
// examine city start
	gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_POPUP_EXAMINE_CITY2").c_str(), NULL, 0, 

WIDGET_GENERAL);
	gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_POPUP_KEEP_CAPTURED_CITY").c_str(), NULL, 1, 

WIDGET_GENERAL);

	if (bRaze)
	{
		gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_POPUP_RAZE_CAPTURED_CITY").c_str(), NULL, 2, 

WIDGET_GENERAL);
	}
	if (bGift)
	{
		szBuffer = gDLL->getText("TXT_KEY_POPUP_RETURN_ALLIED_CITY", 

GET_PLAYER(eHighestCulturePlayer).getCivilizationDescriptionKey());
		gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, szBuffer, NULL, 2, WIDGET_GENERAL, 3, eHighestCulturePlayer);
	}
// examine city end
	gDLL->getInterfaceIFace()->popupLaunch(pPopup, false, POPUPSTATE_IMMEDIATE);
	gDLL->getInterfaceIFace()->playGeneralSound("AS2D_CITYCAPTURE");

	return (true);
}
 
Now that I see it, I think the Examine button would be better below the No button. :lol: You don't have to change it, of course. I didn't think of it in terms of a question but more like the "Choose Production" popup.

In any case, what happens with the looping now? Is it not working, or you just haven't coded it to loop yet?
 
I don't know if this might make things even more complicated, but you could remove the pop-up entirely and just add a Raze City button to the city screen (probably accompanied by some sort of "Yes or No?" confirmation popup). Would at least solve the problem with looping.

Good luck with getting it working, regardless.
 
There is already a raze/city mod out there that kinda does this:
http://forums.civfanatics.com/showthread.php?t=252243

I'm still going through the code to get this to work, I'm just trying to follow the code to see how it works at the moment.

It seems it jumps around to several functions.

I'm definitely missing something so far :( everything I've tried hasn't worked yet.
 
attempt 1: Attempted to call the popup again based off code from Cvplayer.cpp, result: nothing happens. I think because the
Code:
gDLL->getInterfaceIFace()->selectCity(pCity);
statement breaks out of the subroutine so further code is not activated, could also be errors in call to popup again or god knows. Get the following errors with the code as it is from the compiler:

error C3861: 'getID': identifier not found, even with argument-dependent lookup
error C2065: 'eHighestCulturePlayer' : undeclared identifier
error C2065: 'iCaptureGold' : undeclared identifier

I think I can fudge some of these variables but not so sure about the icapturegold bit, may cause problems when messing with it as could possibly keep pulling gold from conquered player?? I was thinking to just make it 0 but that may not be best as will change popup on subsequent loops if it even worked.
Code:
		}
		else if (pPopupReturn->getButtonClicked() == 0)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				gDLL->getInterfaceIFace()->selectCity(pCity);
				// modify this to call again
				CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_RAZECITY);
				pInfo->setData1(pCity->getID());
				pInfo->setData2(eHighestCulturePlayer);
				pInfo->setData3(iCaptureGold);
				gDLL->getInterfaceIFace()->addPopup(pInfo, getID());
				
			}			
		}
		// examine city end
		break;




attempt 2: Attempted to create a while loop so that these would loop around. Result: game hangs - probably endless loop :) Probably because the check for getButtonClicked is never activated again.

Code:
	{	
		bool launEx = true;
		while (launEx)
		{
		if (pPopupReturn->getButtonClicked() == 2)
		{
			launEx = false;
			gDLL->sendDoTask(info.getData1(), TASK_RAZE, -1, -1, false, false, false, false);
		}
		else if (pPopupReturn->getButtonClicked() == 3)
		{
			launEx = false;
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(), pCity);
			}

			gDLL->sendDoTask(info.getData1(), TASK_GIFT, info.getData2(), -1, false, false, false, false);
		}
		else if (pPopupReturn->getButtonClicked() == 1)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
			launEx = false;
				pCity->chooseProduction();
				gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(), pCity);
			}
		}
		else if (pPopupReturn->getButtonClicked() == 0)
		{
			CvCity* pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
			if (NULL != pCity)
			{
				gDLL->getInterfaceIFace()->selectCity(pCity);
			}			
		}
		}
	}

edit: Maybe it'd be best to call the popup again from cvplayer.cpp if the result is buttonclicked 0 but I haven't any idea if cvplayer has any idea about which buttons you clicked from the functions in the popup.cpp
 
You should be able to pass in the same values from the original CvPopupInfo (info parameter to this function):

Code:
pInfo->setData1(info.getData1());
pInfo->setData2(info.getData2());
pInfo->setData3(info.getData3());
 
Ok I tried that and it worked. I say again, it worked, the eagle has landed. Thanks 1 million EF and all who worked on this.. I even switched to another city and it still brings you back to the original, brilliant!

I'll throw together a SDK modcomp and post it in the appropriate section!
 
EF, could you include this in BULL?
 
EF, could you include this in BULL?

I have been contemplating this very question since I first saw the thread. It does alter the game rules a little in that you get much more previously-unavailable information on which to base your raze-or-keep decision. I'll pose it to the group, however.
 
Without this, the information on what you'd get from this conquering a city could be guessed fairly accurately.

You can tell if there are wonders there through the other screens. As for buildings that would be left after conquering, if you zoom in really close to the city you can see all the buildings. If it's an AI city, you can guess based on the the fact that the AI seems to make the same buildings in the same order in every city. And finally just remember that a few buildings would be lost when you take over.

All that adds up to a pretty good picture of what you get.
 
Except this would show you the settled great people, and that's probably the most valuable information when there are some. My best so far included 4 GGs, 2 GSs, and a GP. And this was still pretty early in the game, circa 500 AD IIRC.
 
Top Bottom