General DLL programming questions

It Works!

Edit:

I was correct the first time, something wierd is going on. Here is my mission XML.
Code:
		<MissionInfo>
			<Type>MISSION_GOTO</Type>
			<Description>TXT_KEY_MISSION_GOTO</Description>
			<Help>TXT_KEY_MISSION_GOTO_HELP</Help>
			<Waypoint>NONE</Waypoint>
			<iTime>0</iTime>
			<bTarget>0</bTarget>
			<bBuild>0</bBuild>
			<bSound>0</bSound>
			<HotKey>KB_V</HotKey>
			<bAltDown>0</bAltDown>
			<bShiftDown>1</bShiftDown>
			<bCtrlDown>1</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<bAltDownAlt>0</bAltDownAlt>
			<bShiftDownAlt>0</bShiftDownAlt>
			<bCtrlDownAlt>0</bCtrlDownAlt>
			<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
			<bVisible>1</bVisible>
			<Button>Art/Interface/MainScreen/CityScreen/slave.dds</Button>
		</MissionInfo>

But the screenshot is what is displayed ingame. Note that I have actually tested it and it is the Go To City mission. :confused:

Also, it does work accross Viewports no changes needed.
 

Attachments

  • Civ4ScreenShot0051.JPG
    Civ4ScreenShot0051.JPG
    232.7 KB · Views: 51
It Works!

Edit:

I was correct the first time, something wierd is going on. Here is my mission XML.
Code:
		<MissionInfo>
			<Type>MISSION_GOTO</Type>
			<Description>TXT_KEY_MISSION_GOTO</Description>
			<Help>TXT_KEY_MISSION_GOTO_HELP</Help>
			<Waypoint>NONE</Waypoint>
			<iTime>0</iTime>
			<bTarget>0</bTarget>
			<bBuild>0</bBuild>
			<bSound>0</bSound>
			<HotKey>KB_V</HotKey>
			<bAltDown>0</bAltDown>
			<bShiftDown>1</bShiftDown>
			<bCtrlDown>1</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<bAltDownAlt>0</bAltDownAlt>
			<bShiftDownAlt>0</bShiftDownAlt>
			<bCtrlDownAlt>0</bCtrlDownAlt>
			<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
			<bVisible>1</bVisible>
			<Button>Art/Interface/MainScreen/CityScreen/slave.dds</Button>
		</MissionInfo>

But the screenshot is what is displayed ingame. Note that I have actually tested it and it is the Go To City mission. :confused:

Also, it does work accross Viewports no changes needed.
Check your enum. Best insert your new mission before the pretarget_nuke thing both in the XML and the enum.
 
@ls612: You made a mistake in the CvGame::handleAction function (as a hint: you added a mission, not a command and it is not good moving code out of a conditional block when that code uses a variable that is only initialized in that block).
 
@ls612: You made a mistake in the CvGame::handleAction function (as a hint: you added a mission, not a command and it is not good moving code out of a conditional block when that code uses a variable that is only initialized in that block).

Oops. If that's a game breaking bug you might want to fix it yourself, because I won't be at my modding computer until tomorrow morning. Otherwise I'll fix it then.
 
Oops. If that's a game breaking bug you might want to fix it yourself, because I won't be at my modding computer until tomorrow morning. Otherwise I'll fix it then.
It is pushing NO_COMMAND commands which hopefully should not do anything.
 
Someone in the bugs/crashes thread was complaining about how there was no way to cancel the go to city mission after you clicked the button. So I tried making a mickey-mouse solution to that by adding the following code after the loop for cities in the popup.

Code:
gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_NEVER_MIND"), NULL, (iI + 1), WIDGET_CITY_GOTO, -1);

I also added supporting code for that in the widget handler to ignore widgets with an ID of -1, but when I tested this it crashed. What is the 'correct' way to create a cancel/nevermind button for a popup?
 
Feasibly, if done right, one should be able to select the unit and give it any command, even pass turn, to cancel any pending mission completion... just like you can with workers before they complete their builds. Not sure how that works though.
 
Once you get this fully working will you extend it for other case that need it? The crucial one is airdrop I think (which would be a list of cities capable of talking the airdrop).

As a nice-to-have being able to set up named waypoints (i.e. - arbitrary points on the map that you can name, and which having done so appear as choices in the go-to- destination list along with cities)
 
Once you get this fully working will you extend it for other case that need it? The crucial one is airdrop I think (which would be a list of cities capable of talking the airdrop).

As a nice-to-have being able to set up named waypoints (i.e. - arbitrary points on the map that you can name, and which having done so appear as choices in the go-to- destination list along with cities)

A case for Airdrop would be an almost entirely different mission. Instead of pushing a selectionListMove which can fail silently if the stack can't go there I'd be pushing a paradrop mission which IIRC won't fail nicely, meaning I'd have to make checks to see if it is valid. Also, you can't paradrop to any city.

I am though planning on extending this to Naval units today, and if you know how to make a nevermind/cancel type button for missions that would be quite helpful too.
 
A case for Airdrop would be an almost entirely different mission. Instead of pushing a selectionListMove which can fail silently if the stack can't go there I'd be pushing a paradrop mission which IIRC won't fail nicely, meaning I'd have to make checks to see if it is valid. Also, you can't paradrop to any city.

I am though planning on extending this to Naval units today, and if you know how to make a nevermind/cancel type button for missions that would be quite helpful too.

Yes, you would have to call canParadrop() before adding the city to the list so that only valid targets are added
 
Yes, you would have to call canParadrop() before adding the city to the list so that only valid targets are added

It is still an entirely new mission. I'd probably rather that if you select the paradrop mission for a unit that the Viewport automatically shifts to include all tiles that unit could paradrop to.
 
I think there is a confusion between the airlift mission and the paradrop mission going on here.
Airlift is the one that should get the same treatment as the goto mission.

Btw, you should try to preserve the shift/alt state through the goto city popup so you can properly queue missions.
 
I think there is a confusion between the airlift mission and the paradrop mission going on here.
Airlift is the one that should get the same treatment as the goto mission.

Btw, you should try to preserve the shift/alt state through the goto city popup so you can properly queue missions.

Sorry yes, that's the on I meant
 
I think there is a confusion between the airlift mission and the paradrop mission going on here.
Airlift is the one that should get the same treatment as the goto mission.

Btw, you should try to preserve the shift/alt state through the goto city popup so you can properly queue missions.

OK, that makes much more sense. I'll see if that is easy to do and if so can make a new mission for that (but not this week).

Also, two questions.

  1. What on earth is shift/alt state? Is this some sort of mission linking functionality that has been in since BtS that I've never used?
  2. How would I make a cancel button at the end of the popup, so that if someone clicks on it by accident they don't actually need to follow through?
 
[*]What on earth is shift/alt state? Is this some sort of mission linking functionality that has been in since BtS that I've never used?
You can queue missions with shift. Like if you want to move to a target plot over some other plot or first go to that plot, do this, then move to that plot. It does not always work right in Civ though.

[*]How would I make a cancel button at the end of the popup, so that if someone clicks on it by accident they don't actually need to follow through?
Something like this:
Code:
gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_NEVER_MIND"), NULL, 0, WIDGET_GENERAL);
 
You can queue missions with shift. Like if you want to move to a target plot over some other plot or first go to that plot, do this, then move to that plot. It does not always work right in Civ though.

So would I do that by changing the parameters in the selectionListMove function call in the widget?

Something like this:
Code:
gDLL->getInterfaceIFace()->popupAddGenericButton(pPopup, gDLL->getText("TXT_KEY_NEVER_MIND"), NULL, 0, WIDGET_GENERAL);

Thanks. :goodjob:
 
So would I do that by changing the parameters in the selectionListMove function call in the widget?
Yes, but I guess you need to pass the information what keys were pressed from handleAction to the popup launching code and then to the widget.
 
@Koshling:

I'm adding a new integer to CvUnit (a generic work rate modifier percent). Does the save/load code care about where I add the WRAPPER_READ() and WRAPPER_WRITE() functions, and if it does where should the tag go (at the very end?).
 
@Koshling:

I'm adding a new integer to CvUnit (a generic work rate modifier percent). Does the save/load code care about where I add the WRAPPER_READ() and WRAPPER_WRITE() functions, and if it does where should the tag go (at the very end?).
It does not care as long as you put both at the same position.
 
Back
Top Bottom