Little help with BULL's source code...

NotSoGood

Emperor
Joined
Jan 25, 2009
Messages
1,077
Location
Finland
I consider adding BUG and BULL into my mod. They add lots of useful info. And because I have borrowed pretty much from them, I think I should add the rest too. :D
I downloaded both and merging BUG seems pretty straightforward. BUT, I took a look at BULL's sources and at the first look I find it kinda hard to spot what needs to be added.
Are all the "normal" BULL code marked with // BUG start and // BUG end? Also if I understand correctly there are also classifyed (I don't know if that's the right word...) modcomps, like AI autoplay and sentry actions. Can I find all code they need by searching that flag thingy?

Thanks for your help!
NotSoGood
 
All code I have added to BULL except the Unofficial Patch changes are marked between

Code:
// BUG - <feature> - start

and

Code:
// BUG - <feature> - end

comments, but honestly that's not how I would find things to add. Instead you should use WinMerge to compare BULL to the Unofficial Patch if you have the UP in your code or don't want it, or to stock BTS if you don't. This will highlight the differences in color across all the files.

As there are a lot of changes in BULL at this time, if your mod's DLL has few changes you may want to add your changes to BULL. You'll have to do a quick comparison first to see which way will be faster.

As for the compile-time optional components like AIAutoPlay and Fractional Trade Routes, they are also marked the same way. In addition they are guarded by

Code:
#ifdef _MOD_<feature>

and

Code:
#endif

to make them optional with compiler settings. I would merge them as-is to make future updates easier and then turn them on or off as you like in your makefile.

Note, I haven't had time to try the new, faster makefile, but DannyDaemonic said it should work with BULL. Lemme know how that goes if you try it.
 
All code I have added to BULL except the Unofficial Patch changes are marked between

Code:
// BUG - <feature> - start

and

Code:
// BUG - <feature> - end

comments, but honestly that's not how I would find things to add. Instead you should use WinMerge to compare BULL to the Unofficial Patch if you have the UP in your code or don't want it, or to stock BTS if you don't. This will highlight the differences in color across all the files.

As there are a lot of changes in BULL at this time, if your mod's DLL has few changes you may want to add your changes to BULL. You'll have to do a quick comparison first to see which way will be faster.
I guess that's a problem when merging three quite big mods. Better BTS AI, BUG/BULL and my own changes. :lol: I hope winmerge can do something...

As for the compile-time optional components like AIAutoPlay and Fractional Trade Routes, they are also marked the same way. In addition they are guarded by

Code:
#ifdef _MOD_<feature>

and

Code:
#endif

to make them optional with compiler settings. I would merge them as-is to make future updates easier and then turn them on or off as you like in your makefile.

Note, I haven't had time to try the new, faster makefile, but DannyDaemonic said it should work with BULL. Lemme know how that goes if you try it.

Okay, that sounds resonable. I haven't tried that makefile yet but it sounds pretty fast.
 
I guess that's a problem when merging three quite big mods. Better BTS AI, BUG/BULL and my own changes.

Oh! Did you know that Fuyu already maintains an active Better BTS AI + BULL + BUG merge? You might find it easier to merge your mod and his.
 
Oh! Did you know that Fuyu already maintains an active Better BTS AI + BULL + BUG merge? You might find it easier to merge your mod and his.

Oh! :eek: That'd be just what I'm looking for. Now that you mentioned it, I think I might have actually heard about it. I wonder if he would let me use his sources.
 
Note, I haven't had time to try the new, faster makefile, but DannyDaemonic said it should work with BULL. Lemme know how that goes if you try it.

Well it seems that the makefile (or then the problem is with me :)) is having troubles adding the CxImage folder.

EDIT: I know, it's kinda late edit, but where do you need those files in CxImage? What if I just removed it completely?
 
If you remove them completely, and everything that depends on it, then it will most likely compile. CxImage is only needed for MapFinder, which is something for the HoF people to cheat without cheating ;)
 
Okay, I removed the CxImage and got the sources compile. I merged in my changes and the DLL sems to work. But when starting a new game I get few python exeptions.
Code:
Traceback (most recent call last):
  File "BugInit", line 93, in callInits
  File "CvScreensInterface", line 1159, in init
  File "CvScreensInterface", line 141, in createDomesticAdvisor
  File "CvCustomizableDomesticAdvisor", line 212, in __init__
AttributeError: type object 'CyCity' has no attribute 'getName'

Traceback (most recent call last):
  File "BugInit", line 93, in callInits
  File "TradeUtil", line 643, in init
  File "TradeUtil", line 424, in initFractionalTrade
AttributeError: type object 'CyCity' has no attribute 'calculateTradeProfit'
First, I'm not a python expert. (BUG = lots and lots of python :D) I didn't change anything in BULL or those two files. Can you give me any advice where to look the problem?
 
Make sure you are using the right versions of CyCity.cpp/h
The right one will be the one with CyCity::calculateTradeProfit and CyCity::getName in it.
If you're using the fancy new makefile, try recompiling from scratch.
 
Okay, BULL does not add getName() to CyCity; that was there originally AFAIR. BULL adds an option for fractional trade routes, but BUG checks if it is available before trying to use it, and getTradeProfit() I believe is the non-fractional version. Are you using BUG or just BULL?
 
Sorry, it seems that because of the new makefile I had to divide CyCityInterface1 to CyCityInterface1 and CyCityInterface2. I somehow messed it up but got it work now. :blush:
Sorry to bother you with one more question. I added a new page to the BUG screen and added my own options there where you can change things but I haven't understood how it can change the values that are used. If you could give me atleast a hint where to look, I would be very thankful.
 
BUG changes the values automatically when you (un)check the options. My problem was that the options are in DLL, so how can I check there what the value is?

EDIT: Could it possible be this
Code:
getBugOptionBOOL(...)
and this
Code:
getBugOptionINT(...)
 
Oh yes, I didn't catch the SDK part. Yes, those two functions allow you to pull the current value from BUG. They take the full BUG option ID, the fallback XML key, and the default value if neither of those exist. The BUG ID is "<mod-id>__<option-id>", for example "ReminderMod__Enabled". The XML key is whatever is in the GlobalDefine[Alt].xml.

Just use "Find References" in Visual Studio on the functions to find plenty of examples in BULL.
 
Top Bottom