1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Modder's Documentation

Discussion in 'Civ4 - Caveman 2 Cosmos' started by Dancing Hoskuld, Sep 27, 2011.

  1. Morlark

    Morlark Chieftain

    Joined:
    Aug 6, 2009
    Messages:
    192
    Ok, so, I'm still having a problem with these building-destruction events. I've updated the conditional check to:

    Code:
        if (city.getNumRealBuilding(iBuilding) > 0 and gc.getBuildingInfo(iBuilding).getProductionCost() > 0 and not isLimitedWonderClass(gc.getBuildingInfo(iBuilding).getBuildingClassType()) and not gc.getTeam(player.getTeam()).isObsoleteBuilding(gc.getBuildingInfo(iBuilding).getBuildingClassType())):
    In the particular example that I spotted the problem, the building affected is a Termite Mound, and I already have the Cooking tech, but the building is still being destroyed. I've verified via debugging that isObsoleteBuilding is indeed returning FALSE, even though the building is definitely obsolete.

    Am I just misunderstanding what this function does? Or what am I doing wrong here?
     
  2. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    Should you be calling to the BuildingClassType or the BuildingType?
     
  3. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,290
    Gender:
    Male
    Location:
    Canberra, Australia
    Looking at Class covers UBs so that is what you would look at in vanilla BtS. Otherwise you would need to know that there were UBs and check each one.
     
  4. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    Right I get that. But the obsolete tag he's calling for specifically I think would require the Civilization Building check for that BuildingClass so as to derive the Building Type, which is a legal entry, rather than the incorrect reference directly to a building class, which the obsolete call may not ask for. I'd have to check the code to be sure but it strikes me as unlikely that
    gc.getTeam(player.getTeam()).isObsoleteBuilding(xxxxxxx) is asking for a BuildingClass because the function is named .isObsoleteBuilding rather than .isObsoleteBuildingClass. This would mean that since we're checking the direct building TYPE in other areas of this filter call, I think we can safely get around the need to check Building Classes at all but rather go directly to Building Type.

    In theory.
     
    Morlark likes this.
  5. Morlark

    Morlark Chieftain

    Joined:
    Aug 6, 2009
    Messages:
    192
    You are completely correct. I guess I was just totally overthinking it when I wrote that line of code. I made the change you suggested, and it works perfectly now.

    Thanks, TBird!
     
  6. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    It's nice to be able to take the role of wizened advisor for a while. You're very welcome.
     
    Osk21 likes this.
  7. KaTiON_PT

    KaTiON_PT Warlord

    Joined:
    Jan 2, 2010
    Messages:
    1,067
    Location:
    Portugal
    A quick question, the guides I've been following all recommend using Visual Studio Express 2010 but looking around in Caveman2Cosmos\Sources there seems to be a possibility of using VS2017. Which one is recommended for C2C?
     
  8. alberts2

    alberts2 Chieftain

    Joined:
    Aug 16, 2012
    Messages:
    1,940
    Gender:
    Male
    Location:
    Germany
    Doesn't matter i use the free VS2017 community edition.

    But for C2C you need the updated compiler from
     
    Osk21 and KaTiON_PT like this.
  9. KaTiON_PT

    KaTiON_PT Warlord

    Joined:
    Jan 2, 2010
    Messages:
    1,067
    Location:
    Portugal
    I'm trying to debug @strategyonly crash as a way to practice using VS and the debugger.

    Got as far as this and I don't know how to proceed beyond this (see attachment). What am I supposed to do now?
     

    Attached Files:

    Osk21 likes this.
  10. alberts2

    alberts2 Chieftain

    Joined:
    Aug 16, 2012
    Messages:
    1,940
    Gender:
    Male
    Location:
    Germany
    You can see in the callstack that the crash happens in the ntdll.dll.

    So there's nothing you as a programmer can do because those crashes are mostly caused by corrupt or missing art files
     
    Osk21 and KaTiON_PT like this.
  11. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,290
    Gender:
    Male
    Location:
    Canberra, Australia
    I found a copy of the utility to check Civ Art on my hard drive and added it to the first post. If anyone knows where this comes from please post a link so I can include it in the first post instead. Let us give credit where it is due.
     
    Osk21 likes this.
  12. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    Now that I'm getting setup to program on the new computer (cross my fingers that this will work) I have found that I was incorrect about unversioning a file and what that will mean to a fresh checkout. Therefore, an example 'MakefilePaths' must be obtainable somehow. So... for those who would program, here it is!
     

    Attached Files:

    Osk21 and KaTiON_PT like this.
  13. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    For the record, if you update to using VS2017 and can't access intellisense capabilities (hoverover info about functions and automatic suggested functions to fill in after '->' or '.') this first piece of advice proved to make a breakthrough. You'll probably still be plagued with intellisense errors you can't do much about but they no longer get in the way of the functioning of these VERY critical features.

    https://stackoverflow.com/questions/9753887/error-cannot-open-source-file
     
    Osk21 and KaTiON_PT like this.
  14. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,124
    Gender:
    Male
    Location:
    Las Vegas
    DH has asked me to provide the base art templates I work with here. Whisperr has some stuff coming as well but this is what's on my system. It's best with these to use Macromedia Fireworks to open the png files so you can manipulate the shapes as vectors and copy/paste over the settings on those shapes to new shapes. IF you don't have that capacity (which you can pick up for free with just a little searching for Fireworks these days, which has been purchased by Adobe so they could sit on it and stop it from being further developed) I did include some templates without symbols in them, though you'll need to find a way to get the right color background in most cases from the textures provided on the more standard graphic download package we have around here somewhere.

    This also includes the alpha channels for these alternative promotion backgrounds. Those are easily applied with DXT.bmp (another free program) but it does make the image fuzzy to do that for pic based images like tech buttons and buildings, so it's better to do those through the photoshop file systems you'll see in Whisperr's files.
     

    Attached Files:

    Osk21 likes this.
  15. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,290
    Gender:
    Male
    Location:
    Canberra, Australia
    Link added to the first post
     
    Osk21 likes this.
  16. Whisperr

    Whisperr Chieftain

    Joined:
    Oct 15, 2011
    Messages:
    226
    This is the background for the missionary, Border, one corner and two corner borders and the alpha channel. Also the PSD buttonmakers that are set up to do religious building, Wonders, and regular buildings.
     

    Attached Files:

    Osk21 and KaTiON_PT like this.
  17. pepper2000

    pepper2000 Chieftain

    Joined:
    Apr 14, 2013
    Messages:
    889
    Osk21, raxo2222 and KaTiON_PT like this.
  18. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    6,167
    Location:
    Poland
    I think that one was outdated, updated ones were few posts below.

    Use this one instead:
    https://forums.civfanatics.com/threads/modders-documentation.441325/page-10#post-14723083
    National Wonders are 2x
    Group wonders are 4x
    Great Wonders are 6x
    Projects are 8x
    Guidelines were updated in December 2017.

    Except projects were renormalized, as their global wasn't set as 100.

    I'm checking now if you didn't revert my fixes.
    Regular building cost at certain X grid is 6155 not 6165.
    And looks like somehow I missed few things here and there.
     
    Last edited: Feb 22, 2019
    Osk21 likes this.
  19. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    15,675
    Gender:
    Male
    Location:
    Western IL. cornfields
    Osk21 likes this.
  20. pepper2000

    pepper2000 Chieftain

    Joined:
    Apr 14, 2013
    Messages:
    889
    OK, I see that. I'll check everything else and hopefully get my scripted synced back up with current standards.
     
    Osk21 likes this.

Share This Page