Development Thread

Sorry, I forgot to add that to the list of bugs. Yes, I can do that this weekend, but I don't think you need to wait. I posted above that I will make sure that however I add the icons will not affect the pages you create. The columns you'll be defining will all be much wider than needed for the icons, so that shouldn't be a problem.

We still have the question of whether or not to swap out "actual building" for "civ-specifc building". I can see the need for both.

Example: Mint (replaces Forge)

The Forge (generic building) should show on the "Production Buildings" and "Happiness Buildings" pages since it provides +25% :hammers: and +1 :) for fur,
ivory and whale.

In addition to this, the Mint -- not the Forge -- should show on the "Gold Buildings" because it provides +10% :gold:.

What are your thoughts on this wrinkle? Maybe you answered before, but I don't have time to look right now.

Uhm, let me think... if I'm not wrong, you told me that we can have building columns which are for normal buildings but switch to the civ specific building when you are using that civ, is this correct? If it is, I say to use them. Plus, yuo can add columns for the civ reltated buildings themselves, or even only for those civ reltated buildings which have as additional effect one that gives "another type" of bonus (as the Mint). Doing so, I can put the Forge column in the "Production Buildings" and "Happiness Buildings" (and it will become the Mint column if I'm playng Malinese) and the Mint column in the "Gold Buildings". Is this possible?

Note: another small thing to do for the CDA mod is to move the CustomDomAdv.txt location.
 
@Cammagno - Yes, your description is exactly what I meant. I should probably do it for both "types" of building columns: the one set showing the effects and the other showing whether or not you have built, can build or are building the building. I'll take a look at doing it tomorrow, but it's going to be a lot of work.

@Alerum (and Cammagno) - Yes, moving the CDA config file is on my SF.net list and should be relatively easy.
 
I looked at the changes that would be necessary to implement the extra building type and class columns for CDA, and honestly I just don't have the time to dig into the existing code well enough to do them correctly. Sorry guys, but we're stuck with this version for now.

Cammagno, I can still replace the names with the icons in the headers for the buildings sometime this week. That change alone won't affect whatever you do in setting up pages.
 
I looked at the changes that would be necessary to implement the extra building type and class columns for CDA, and honestly I just don't have the time to dig into the existing code well enough to do them correctly. Sorry guys, but we're stuck with this version for now.

Cammagno, I can still replace the names with the icons in the headers for the buildings sometime this week. That change alone won't affect whatever you do in setting up pages.

ok :)



###this is for the stupid rule about short messages###
 
EF would you be able to put a code snippette up for this that would allow someone with little to no coding ability in python to make this work?
 
@EF (and all the other modders)
I've made some little changes to CvCustomizableDomesticAdvisor.py, changing some of the column headers (the purpose was to differentiate them).
I tested it and it works fine for me, but if (and when) you can, give a look at it, because my python skills are poor :blush:

The changes that I made are the following:
ADVISE_NUTTY changed from "Nutty Professor" to "NUTTY"
AUTOMATION changed from "Automation" to "AUTO"
BASE_COMMERCE added a "B" before the icon to differentiate itfrom COMMERCE
BASE_FOOD added a "B" before the icon
BASE_PRODUCTION added a "B" before the icon
COULD_CONSCRIPT_UNIT added a "#" after the text to differentiate it from CONSCRIPT_UNIT
CULTURE changed from "TOT" to culture icon
CULTURE_RATE added a "R" after the icon to differentiate it from CULTURE
GREATPEOPLE changed from "TOT" to GP icon
GREATPEOPLE_RATE added a "R" after the icon to differentiate it from above
POPULATION_REAL added a "#" after the text to differentiate it from POPULATION

GRANK_something and NRANK_something: changed the "#" after the icons with a "g" and a "n" respectively, to differentiate between the two classes.
There are 3 GRANK_BASE_something and 3 NRANK_BASE_something, so for these I added before the icons a "B" and after it a "g" or a "n" (to differentiate them from the respective GRANK_something and NRANK_something); only for these 6 columns, I had to increase the size from 38 to 42 (40 is enough, but 42 looks better).

Oh, and I have also removed the long readme inside the file, because it isnìt up-to-date and because now there is a readme for this component mod (I made it from these comments and the author's posts in the original thread). I left there only some basic stuff like credits etc.

Edit: moved the "B" for "_BASE" before the icons.
Edit2: added a "#" after text in a couple di headers to differentiate them.
 
@Alerum - Two things make this a time-intensive or difficult task. The first is that to make the changes you'd need to study the code quite a bit to see what it's doing. If interested, start with the function

createDictionaries()

Near line 690 (I have made some changes locally, so line numbers will be off) this function builds the column definitions for the buildings and building classes.

A column definition looks complicated, but it's a little deceptive. You have a unique key for refering in code to the column, a width, a type ("text", "int", and I added "bldg") that tells how to format the value, a title/header (last field) and finally one of three functions for calculating the value (come before the title).

The calc function (look near line 440 for the built-in column definitions like culture, gold, etc.) consists of 5 fields. You put values in certain fields and set all others to None based on how the calc function is called.
  • Function called on a CyCity object with no parameters: first field holds function.
  • Function called on a CyCity object with one parameter: second field holds function and third field holds parameter value.
  • Function called on a CDA itself with one parameter*: fourth field holds function and fifth field holds parameter value.
* Functions called on CDA receive other parameters as well (the CyCity and the column key).

The columns you'd be building will be of the third type. See the existing building columns for an example.

Okay, if you understood that, now it gets complicated. :) For buildings, the author created extra arrays to hold information about the buildings:
  • BUILDING_DICT maps key to building ID -- the same ID you pass to gc.getBuildingInfo(int).
  • BUILDING_INFO_LIST maps building ID to its info (to avoid calling gc.gBI later).
  • BUILDING_ICONS_DICT maps key to building effects icon string.
...Crap. Okay I just realized it's easier than I first thought. CDA is already building the icons for all buildings -- not just the generic ones but also the civ-specific ones.

Here are the changes that need to be made.
  1. When the column for a building that the civ viewing the screen doesn't have, skip it. For example, the Malinese should see a Forge. Note that if you want the Malinese to see a Mint in this case, select the Forge building class instead.
  2. Add a set of building columns that show whether or not you have the building instead of its effects. See the similar column for building classes.
  3. Change building columns to use icon headers.
In any case, if you want to tackle it, it takes first delving into the code and following what variables and functions it uses. One key function is

drawContents()

especially around line 2070. This draws the actual table (headers and values). This is where the third change above needs to be made (mostly). If you can figure out what's going on in that function, you're doing pretty well. :) You can skip the whole

Code:
if(self.customizing):
    ...
block down to the "else". That's the code for drawing the customizing version of the page.

The code does a lot, so hopefully that gives you a little bit of a head start. At this point, it would be easier for you to ask specific questions over IRC or IM.
 
@Cammagno - Good call on those changes. That should be fine. If you commit them to the repo, I can diff the two versions and verify that you did them right. If they work for you, likely you have.

BTW, what the heck does the Nutty Professor column tell you?
 
It's always been in there, but hasn't worked very well. After you build a few basic things like barracks and granaries it just suggest civ unique buildings for OTHER civs.
 
It's always been in there, but hasn't worked very well. After you build a few basic things like barracks and granaries it just suggest civ unique buildings for OTHER civs.

Hey... of course he does, he's nutty! ;)
I think he's always been a sort of joke :)
 
@Cammagno - Good call on those changes. That should be fine. If you commit them to the repo, I can diff the two versions and verify that you did them right. If they work for you, likely you have.

BTW, what the heck does the Nutty Professor column tell you?

Yes, I commited it.

To tell the truth, I liked more to put the "B" for "BASE" before the icons instead than after, but when I tried I get some crashes.
Edit: Problem solved (I misplaced a " sign), so now I've put the "B" before the icons(more logical), and furthermore the GRANK_BASE_something and NRANK_BASE_something look much better, with a "B" before the icon and a "g" or "n" after it.


Nutty column is an advisor column, so he suggests what to build, as other advisor columns do. But his suggestion are... nutty, fool :)
 
Uploaded the city arrows & city bar resizing. I made sure to comment it, but it'll need options put in. Going to try and tackle the GP bar placement and also see about changing the number of units listed per a row from 9 to 10.
 
Uploaded the city arrows & city bar resizing.

Okay, I'll check it out.

Going to try and tackle the GP bar placement

Sounds good. You should be able to get away with moving it up like 5 pixels. Bummer because it looks nice with the top of the bar lining up with the little "supports" that stick out under the research bar. Shrinking it vertically wouldn't work with the text, though, so moving it is really the only option.

and also see about changing the number of units listed per a row from 9 to 10.

You might want to rethink that only because I do eventually plan to include PLE which will obliterate whatever you change. Not a problem, but if you have other things you'd like to tackle, you might put them higher on the list.
 
Alright, I'll hold off on the changes on units. And I was thinking would probably be better to have 8 instead of 10 because transports hold 8.

Another option would be to move the popup text down 5 pixels, but I don't know where that's located, while I do know where the GP bar is.

Edit: I think I was able to squeze it up enough to show all the popup, but to still have the text within the bar. Take a look and see if it looks alright.
 
Top Bottom