M.A.D. Nuclear warhead manager bug

Joined
Jun 7, 2008
Messages
6,123
Location
Just wonder...
I haven't tried it in C2C but I suppose it's broken here as well as in AND since the relevant dll and python code looks identical. It's probably not a big problem since I guess I'm the only one that ever complained; it was broken back in AND1.76 years ago and never fixed but probably no one ever used it but me. Anyway it's broken; you should have 2 different screens showing incoming and outgoing nukes but only outgoing ones are displayed and if you click on "Incoming warheads" nothing happens. There's probably something wrong in the python code of CvMADNukesManager.py but I can't find the bug. I'm trying to rewrite that part of the code but if someone is able to spot quickly where the problem might be, that would save me a lot of work. Also another problem is that units and cities don't blink on the minimap when they're selected in the warhead manager.
 
PM CivFuhrer on this one I'd say.

I guess I did it 3 years ago, but IIRC he worked on Advanced Nukes Mod (which included new nukes) but not on MAD civic (which I think it was an idea of The Lopez - and he's gone from the forum since a long time).
Here's my discussion with Afforess and CivFuehrer (although that problem reported there was different and now solved):
http://forums.civfanatics.com/showthread.php?t=424122
And here's another discussion with myself since no one else cared at the time. :p
http://forums.civfanatics.com/showthread.php?t=455004
Well, if nobody is able to find a quick solution I guess I'll have to try to rewrite that part of the code myself. I guess it's not easy but it shouldn't be impossible for my skills.

Edit: LOL, I've read again the last sentence and it looks like I'm bragging. :D I wanted to say that perhaps I can do it even with my limited skills, of course.
 
I believe it has been. I, nor the individual who removed it, was not aware there was any additional function to the civic beyond it's basic display. I'm now curious what that's all about because I've never encountered the screens you're talking about in the first post there. Sounds interesting.
 
Here you go, that's how it works:
when you switch to MAD you get a bonus for building nukes (civic may be tweaked) but the main feature is that you enable that Nuke Manager (it's a button just next to BUG options, you can see it in the following screenshots). You can then pre-target nukes to some cities and as soon as a nuke is fired at you, all your pre-targeted nukes are fired against that civ. The nuke manager displays which nukes you have pre-targeted to enemy cities and which of your cities are under a threat from enemy nukes. According to Afforess, AI was aware on how to use this feature although I doubt it worked very good, if it worked at all. I guess it's fun nevertheless, especially between human players.

Edit: MAD civic was removed by civ4player8 in C2C rev5243 almost 1 year ago. I suppose nobody ever got that far in C2C so nobody noticed it.
 

Attachments

  • Civ4ScreenShot0140.JPG
    Civ4ScreenShot0140.JPG
    286.1 KB · Views: 73
  • Civ4ScreenShot0139.JPG
    Civ4ScreenShot0139.JPG
    305.9 KB · Views: 62
I'd made it that far a couple of times but I never knew about those screens and probably had never adopted the MAD civic because it wasn't very compelling to my usual game strategy, even if I AM using nukes.

That's a pretty cool feature for it though...
 
It looks like I've been able to fix it, there were some errors in the dll and python files. I'll upload these fixes in AND next revision if you're interested, should you reintroduce MAD civic again in C2C.
 
If you can post the files and the edits here I can update them here as well. It's a cool idea that should be possible to re-implement at least! (Modifiers might differ a bit in C2C but overall the added screens and such are quite a nice touch.)
 
I have no idea what World View is because I've probably not imported that feature in AND, but if you want here's how I solved the problem. Problem was that clicking on the missile icon next to BUG icon was opening the MAD Nuke Manager but only the first tab was available (outgoing missiles), while the second one (incoming missiles) was never showing up. After some comparison with other files, I've discovered that MAD Nukes Screen is working differently from other advisors screens, so basically what I've done is to modifly it to make it work like other advisors do. Here's what I've changed:

Added to CIV4ControlInfos.xml

Code:
		<ControlInfo>
			<Type>CONTROL_MAD</Type>
			<Description>TXT_KEY_MAD</Description>
			<Help/>
			<HotKey>KB_N</HotKey>
			<bAltDown>1</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<HotKeyAlt/>
			<bAltDownAlt>0</bAltDownAlt>
			<bShiftDownAlt>0</bShiftDownAlt>
			<bCtrlDownAlt>0</bCtrlDownAlt>
			<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
		</ControlInfo>

added at the end of enum ControlTypes in cvEnums.h

Code:
	CONTROL_MAD,

added in bool CvGame::canDoControl(ControlTypes eControl) const in CvGameInterface.cpp

Code:
	case CONTROL_MAD:

and just before the end of the function

Code:
	case CONTROL_MAD:
		PYTHON_CALL_FUNCTION2(__FUNCTION__, PYScreensModule, "showMADNukesManager");
		break;

Added in CyEnumsInterface.cpp

Code:
		.value("CONTROL_MAD", CONTROL_MAD)

just before
Code:
.value("NUM_CONTROL_TYPES", NUM_CONTROL_TYPES)

In CvMADNukesManager.py

Code:
		self.INCOMING_SUMMARY_LABEL_ID = "MADNukesManagerOutgoingSummaryLabelWidget"
		self.INCOMING_LABEL_ID = "MADNukesManagerOutgoingLabelWidget"

becomes

Code:
		self.INCOMING_SUMMARY_LABEL_ID = "MADNukesManagerIncomingSummaryLabelWidget"
		self.INCOMING_LABEL_ID = "MADNukesManagerIncomingLabelWidget"

And finally in CvScreensInterface.py I've added

Code:
import CvMADNukesManager
after import CvEspionageAdvisor

and then this part in red

Code:
[COLOR="Red"]MADNukesManager = CvMADNukesManager.CvMADNukesManager(MAD_NUKES_MANAGER)
def showMADNukesManager():
	if (-1 != CyGame().getActivePlayer()):
		MADNukesManager.interfaceScreen()[/COLOR]
				
espionageAdvisor = CvEspionageAdvisor.CvEspionageAdvisor()
def showEspionageAdvisor():
	if (-1 != CyGame().getActivePlayer()):
		espionageAdvisor.interfaceScreen()

and

Code:
					MAD_NUKES_MANAGER: MADNukesManager,

just before

Code:
					WORLDBUILDER_SCREEN : worldBuilderScreen,

That's it, although it took me a while to reverse engineer the code to understand what was doing what. :)
 
Top Bottom