Can I use the BUG mod? YES!

Okay, just from poking around a bit...
The function being called is actually addColoredPlotAlt. From looking at the API, the only different I can tell from addColoredPlot and addColoredPlotAlt is addColoredPlot uses an rgba constructor(?) called NiColorA, while AddColoredPlotAlt draws the color from a string value.

Is there maybe a chance that we could use addColoredPlot instead of alt? I hope that's not also broken...
 
dr_s said:
'Nother question.

In looking at the BUG Options, under the advisors tab, under Domestic Advisor, I see this:

Missing: Advisors__CustDomAdv
Missing: Advisors__CDASpaceTop
Missing: Advisors__CDASpaceSides
Missing: Advisors__CDAProdGroup

Normal? Operator error? Bug?

This is a bug in BUG, the author is aware of it and is apparently going to put out version 4.1.1 soon to fix it and a few other things.

I'm sorry but my english is poor, so I'm not sure if this was answered, is there a way to use the "normal" advisors until we have the 4.1.1?

Thanks
 
@Gerard - You can modify "BUG Custom Domestic Advisor.ini" to disable the advisor or set the options manually. It should contain comments explaining the values of each setting.

About the addColoredPlotAlt() call that's failing, why did you originally suspect addColoredPlot() instead? I would bet that the Alt() form looks up the color's RGBA values using the XML key I provide and passes them to addColoredPlot(), but we could certainly look up those values ourselves and pass them to addColoredPlot() from Python.

Hmm, getColoredPlot() doesn't accept a dot style. Well, someone give this code a try and see what happens. Maybe the API I have is wrong and it takes a style. Replace lines 563-4 of CvStrategyOverlay.py with these lines:

Code:
			color = gc.getColorInfo(city.color).getColor()
			actualColor = NiColorA(color.r, color.g, color.b, alpha)
			CyEngine().addColoredPlot(x, y, actualColor, self.DOT_LAYER)

If you get a Python exception about the arguments/parameters not matching the C++ signature, try this for that last line:

Code:
			CyEngine().addColoredPlot(x, y, self.DOT_STYLE, self.DOT_LAYER, actualColor)

Otherwise post the exception you get.

Has anyone tried turning off the "Draw City Dot" setting so that you get only the outline and no dot in the center of it? I'm curious if that would have an effect. Given that the dot is drawn with the above function while the outlines are done with a different one, this may solve the problem temporarily.

[The following applies to the BFC outlines--not the dots. But it's good background just the same.]

Finally, in order to allow the same color to overlap I am passing in on of 36 values for the layer, yet the layer enumeration displayed in the API has fewer values. On Windows I tested being able to use a layer up to 2.147+ billion (MAX_INT) with no issues, but perhaps Aspyr implemented it in such a way that it's not liking the higher numbers. However, if that were the case I would expect that you could replicate the crash by placing a dot on the same tile every time. That it's intermittent makes this a much tougher problem to track down. :(
 
Okay, here is the exception. I'm not sure what r was supposed to do, so you'll have to fix this one.

It happens using either CyEngine() line, although the second caused a crash after placing a city, while the first allowed me to place one, but when I tried placing another or hit cmd-x to hide it, I got a popup about a kbdevent throwing an error.

Code:
AttributeError: 'CvColorInfo' object has no attribute 'r'
Traceback (most recent call last):

  File "CvScreensInterface", line 888, in mouseOverPlot

  File "CvOverlayScreenUtils", line 128, in mouseOverPlot

  File "CvDotMapOverlayScreen", line 227, in onMouseOverPlot

  File "CvStrategyOverlay", line 463, in highlightCity

  File "CvStrategyOverlay", line 486, in unhighlightCity

  File "CvStrategyOverlay", line 545, in drawCity

  File "CvStrategyOverlay", line 564, in drawDot
 
Okay, that fixed the exception, but now we're back to the addColoredPlotAlt() crash. Line 573 uses this function, I'm guessing that also should be changed? FYI the crash occurred this time when I changed colors and passed over the first dotmap I placed.
 
1. What is is showing in the center of the BFC for the dot now? There are about 21 different dots I can pick from, but the non-Alt() function doesn't allow you to specify which one you want.

2. As you move the mouse around, BUG is drawing a temporary BFC using your chosen color.

3. When you remove a BFC, it uses addColoredPlotAlt() with an empty color ("") because there is no removeColoredPlotAlt() function (way to go Firaxis). But BUG doesn't use this to change the color of a dot--only to remove. But that's constantly being used as you move around the mouse. We need to change the second call (just below the first one).

Try this:

Code:
CyEngine().addColoredPlot(x, y, None, self.DOT_LAYER)

It will probably not like the "None" there. This will use 0% black which should be invisible:

Code:
blankColor = NiColorA(0, 0, 0, 0)
CyEngine().addColoredPlot(x, y, blankColor, self.DOT_LAYER)

This will remove all calls to addColorPlotAlt(). That should verify whether or not this is the culprit.
 
For the dotmap center, see the screenshot below:
Spoiler :


It seems taking out addColoredPlotAlt() seemed to do the trick! You were right that the game didn't like the none, but using an invisible color seemed to work. I couldn't replicate the crash or find any other errors, so thank you! :goodjob:
 
Can you try putting "self.DOT_STYLE, " before "self.DOT_LAYER, " in both calls? I bet the API docs just left it out accidentally and that the layer is being used for the style.
 
Okay, I guess you'll just have to be content with a square for the city dot. I'm mystified that this crashes randomly though. C'est la vie!
 
Well, I'd much rather have a square city dot than a crash! I'm curious though; will you put this in the next BUG patch or do something else?

Anyway I figure I should post my file for others to use. (Belongs in Python/Contrib)
 

Attachments

  • CvStrategyOverlay.py.zip
    4.6 KB · Views: 118
I can check if BUG is running on a Mac and use the new method if so. I'll squeeze it into 4.1.1.
 
@Gerard - You can modify "BUG Custom Domestic Advisor.ini" to disable the advisor or set the options manually. It should contain comments explaining the values of each setting.

Thanks, but I haven't this file :confused: I have a CustDomAdv.ini and a BUG Advisors.ini but not the BUG Custom Domestic Advisor.ini. And no one appears to have settings for that.

I installed the BUG by installing BUFFY. Is it wrong? :blush:
 
In CustDomAdv.ini, try changing:
Code:
[CustDomAdv]

# When checked, uses the Customizable Domestic Advisor (requires restart).
# Default: True

Enabled = True

to:

Code:
[CustDomAdv]

# When checked, uses the Customizable Domestic Advisor (requires restart).
# Default: True

Enabled = False
 
I installed the BUG by installing BUFFY. Is it wrong? :blush:

Ah, in BUFFY 3.19.001 it is in the "BUG Advisors.ini" file.
 
Oops, I didn't realize what thread this was. It's possible that Gerard is running Bootcamp or some other Windows booting/emulation software and running the Windows version of BTS on the Mac. In this case you can install BUFFY.
 
Top Bottom