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

Cannot Build Fishing Boats

Discussion in 'Bugs and Crashes' started by miccal2000, Jul 1, 2019.

  1. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
    Hello,

    I am playing a game on the SVN I downloaded a couple of days ago...and I can not build any fishing boats!

    I can build workboats, have discovered Fishing and Sailing...yet, nothing. Not even getting a grayed out option to build them.

    Any ideas? I can upload the savegame when I am home later. SVN version according to when I check is 10603.

    Thanks!
     
  2. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    7,427
    Location:
    Poland
    Go to BUG options, in Caveman2Cosmos unselect "Hide Obsolete/Unavailable Worker Actions"
     
  3. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
    It already was unselected.
     
  4. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    7,427
    Location:
    Poland
    @Toffer90 I think great farmer fix broke fishing boats when using Hide Obsolete or Unavailable Worker Actions lol
     
  5. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    7,427
    Location:
    Poland
    Fishing boats can be placed on water animals.
     
  6. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
    That's where I have them, over a murex, and over a shrimp. Still not getting the option to create them.
     
  7. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    16,013
    Gender:
    Male
    Location:
    Western IL. cornfields
    Screenshots Please.
     
  8. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
    Here you go
     
  9. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
  10. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    Before anyone would comment, I'd say wine on mac/linux can never be the issue. That old and trusted msvcp71 runtime is very stable on wine. (oh, not that term again lol!)
    I didn't follow the great farmer fix lately and am puzzled by this solution right now... Probably I should get some sleep from too much activity yesterday.
     
    Last edited: Jul 2, 2019
  11. miccal2000

    miccal2000 Chieftain

    Joined:
    Sep 6, 2006
    Messages:
    80
    I don't think it's Linux, as on all previous versions of C2C, I've had no issue with the workboats.
     
  12. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,264
    Gender:
    Male
    Location:
    Las Vegas
    I think this might be the issue but I can't be sure. We'd need to test just before the change and just after.
     
    raxo2222 likes this.
  13. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,630
    Location:
    Norway
    Yup, the inactive great farmer python code that I activated was flawed.
     
    raxo2222 likes this.
  14. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,264
    Gender:
    Male
    Location:
    Las Vegas
    You found the issue? Good job! I'm NOT meaning to pin blame, just sniffing out the most logical cause for the behavior. We got this report in immediately after that change from 2 or 3 sources and it seemed like that was a change in a region likely to create that potential impact. And it sounds like it wasn't even your problem so much as a lurking bug that was exposed by another fix, which happens a lot.
     
    raxo2222 likes this.
  15. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,630
    Location:
    Norway
    Yeah, whoever worked on the great farmer stufff tried to set up the python callback in such a way that the dll would only do the python callback for specific worker builds, the problem is that the dll side of that effort was never implemented.
    So the canBuild python code was assuming that it would only be called for a limited set of input builds where it could say that if the plot is water terrain then none of these can be built.
    The reality is that the canBuild python code is called for every single worker build that any unit can perform. That is how it should be as this allows python modders to quickly create python rules for any build when needed.

    Here's a crazy define that is set up in "\Assets\Modules\NotSoGood\AnimalPlacing\AnimalPlacing_PythonCallbackDefines.xml"
    Code:
    <Civ4Defines xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\..\..\Xml\Schema\Caveman2Cosmos.xsd">
        <Define>
            <DefineName>USE_CAN_BUILD_CALLBACK_GRANULAR</DefineName>
            <DefineTextVal>BUILD_BONUS_DONKEY,BUILD_BONUS_HORSE,BUILD_BONUS_ELEPHANT,BUILD_BONUS_BISON,BUILD_BONUS_CAMEL,BUILD_BONUS_COW,BUILD_BONUS_DEER,BUILD_BONUS_FUR,BUILD_BONUS_KANGAROO,BUILD_BONUS_LLAMA,BUILD_BONUS_MAMMOTH,BUILD_BONUS_PIG,BUILD_BONUS_POULTRY,BUILD_BONUS_RABBIT,BUILD_BONUS_SEA_LIONS,BUILD_BONUS_SHEEP,BUILD_BONUS_WALRUS,BUILD_BONUS_GUINEA_PIG,BUILD_BONUS_PARROTS,BUILD_BONUS_BARLEY,BUILD_BONUS_CORN,BUILD_BONUS_FLAX,BUILD_BONUS_MELON,BUILD_BONUS_POTATO,BUILD_BONUS_PUMPKIN,BUILD_BONUS_RICE,BUILD_BONUS_SQUASH,BUILD_BONUS_WHEAT,BUILD_BONUS_ALMONDS,BUILD_BONUS_APPLE,BUILD_BONUS_BANANA,BUILD_BONUS_COCONUT,BUILD_BONUS_DATES,BUILD_BONUS_FIG,BUILD_BONUS_LEMON,BUILD_BONUS_MANGO,BUILD_BONUS_OLIVES,BUILD_BONUS_PAPAYA,BUILD_BONUS_PISTACHIO,BUILD_BONUS_WINE,BUILD_BONUS_HENNA,BUILD_BONUS_INDIGO,BUILD_BONUS_RUBBER,BUILD_BONUS_TIMBER,BUILD_BONUS_CANNABIS,BUILD_BONUS_COCA,BUILD_BONUS_COCOA,BUILD_BONUS_COFFEE,BUILD_BONUS_COTTON,BUILD_BONUS_INCENSE,BUILD_BONUS_MUSHROOMS,BUILD_BONUS_OPIUM,BUILD_BONUS_PAPYRUS,BUILD_BONUS_PEYOTE,BUILD_BONUS_PRICKLY_PEAR,BUILD_BONUS_RESIN,BUILD_BONUS_SILK,BUILD_BONUS_SPICES,BUILD_BONUS_SUGAR,BUILD_BONUS_TEA,BUILD_BONUS_TOBACCO,BUILD_BONUS_VANILLA,BUILD_BONUS_POMEGRANATE,BUILD_BONUS_KAVA,BUILD_BONUS_GUAVA</DefineTextVal>
        </Define>
    </Civ4Defines>
    This weird define even has some read in code in the dll written by koshling, but what is read in by the dll is never used in other dll code.
    Spoiler I think koshling was sent on a goose chase by someone here as this granulation is close to pointless :
    Code:
        #ifdef GRANULAR_CALLBACK_CONTROL
                    //    KOSHLING - granular control over Python callbacks - so far implements
                    //        CanTrain
                    //        CannotTrain
                    //        CanBuild
                    const char* entityList;
                    //    CanTrain
                    if ( GC.getDefinesVarSystem()->GetValue("USE_CAN_TRAIN_CALLBACK_GRANULAR", entityList) )
                    {
                        cvInternalGlobals::getInstance().m_pythonCallbackController.RegisterUnitCallback(CALLBACK_TYPE_CAN_TRAIN, entityList);
    
                        GC.getDefinesVarSystem()->RemValue("USE_CAN_TRAIN_CALLBACK_GRANULAR");
                    }
                    //    CannotTrain
                    if ( GC.getDefinesVarSystem()->GetValue("USE_CANNOT_TRAIN_CALLBACK_GRANULAR", entityList) )
                    {
                        cvInternalGlobals::getInstance().m_pythonCallbackController.RegisterUnitCallback(CALLBACK_TYPE_CANNOT_TRAIN, entityList);
    
                        GC.getDefinesVarSystem()->RemValue("USE_CANNOT_TRAIN_CALLBACK_GRANULAR");
                    }
                    //    CanBuild
                    if ( GC.getDefinesVarSystem()->GetValue("USE_CAN_BUILD_CALLBACK_GRANULAR", entityList) )
                    {
                        cvInternalGlobals::getInstance().m_pythonCallbackController.RegisterBuildCallback(CALLBACK_TYPE_CAN_BUILD, entityList);
    
                        GC.getDefinesVarSystem()->RemValue("USE_CAN_BUILD_CALLBACK_GRANULAR");
                    }
    This file (AnimalPlacing_PythonCallbackDefines.xml) can be deleted without any problem, and that dll code set up by koshling should also be removed as the BUG mod already provide the tools to modularize these callbacks.

    What I just described can imo best be described as an ugly solution to an imaginary problem.
     
    Last edited: Jul 3, 2019
    JosEPh_II and Anq like this.
  16. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    How about adding BONUS_FISH and the like to that list? Does that work?

    Ah I see. koshling's code only dealt with BuildTypes.
     
  17. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,630
    Location:
    Norway
    You missed my point, that list is not used for anything. The entire xml define can be removed without impacting anything at all.

    But yeah, it would be easy to allow the great farmer unit to place e.g. fish bonus on water plots, but he would have to aboard a transport ship to do it.
    With PPIO one would only have to create the new build and improvement xml entry, and add the build type key to the build list within the unit xml entry of the unit that could build it.
    Without PPIO it is a bit more complicated to add more such builds as one would need to modify python code as well.
     
  18. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    So this USE_CAN_BUILD_CALLBACK_GRANULAR list is used exclusively by great farmers to allow them to place bonuses. How does CanBuild affect also placing fishing boats on water plots?

    Ah I see, in CvPlot::canBuild there is a line calling canBuildFromPython
     
  19. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    Assume you have fixed this in 10642, I wonder how workboats were calling canbuild from animalplacing.py code. Now that I am used to exploring the source code, I have become afraid of python. Just couldn't have a clue which calls which, they are more abstract than c++, there are function hooks everywhere.
     
    Last edited: Jul 3, 2019
  20. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,630
    Location:
    Norway
    No, USE_CAN_BUILD_CALLBACK_GRANULAR is meant to be used for any unit that can build any improvements, but currently it is not used for anything whatsoever as there is no dll code that use the value set in that define.
    Every unit that have any build improvement capability will call that function for all build types on a universal basis.

    I guess the idea behind the USE_CAN_BUILD_CALLBACK_GRANULAR was to stop the dll from calling python for builds that python does not have any build rules for. But what if a python modder adds in a universal rule that should affect all builds equally, then that granular callback define would have to contain all builds that exist in the game and the GRANULAR define becomes pointless as it won't reduce the amount of calls to python but complicate the dll code unnecessary instead.

    The potential minute performance improvement from having those possibly very large lists cached in RAM is not worth the effort and it makes it more complicated for python programmers when they have to activate a callback on a per object basis instead of having them as universal systems that are either turned on for all valid objects or for none. The current xml defines for turning on callbacks have this naming convention USE_CAN_BUILD_CALLBACK and they are boolean defines (1 / 0) instead of text defines (that contains a long text list).
     

Share This Page