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

DLL coding thread

Discussion in 'Civ4Col - Medieval: Conquests' started by Nightinggale, Feb 11, 2014.

  1. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    Ignorants rarely grasp how patient some experts are.
     
  2. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I wrote a new wiki page, which is ready for the ignorance test :p
    https://sourceforge.net/p/colonizationmodcollection/wiki/InfoArray/

    I really should learn how to get a proper layout in that wiki. It doesn't look at all like I intended :(
    (now you know why I do C++ core functions and leave graphical stuff to other people:lol:)

    Target audience is people who know C++ and/or python. Well to be very precise the direct target right now is Kailric as he is forced to learn what I did in the CivEffect branch :aargh::whipped:
     
  3. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
  4. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I'm wondering about a problem I encountered when I tried to get col2071 to compile again. It complained about yields, which are hardcoded in the DLL and since they aren't in the col2071 header, it didn't compile. I added them to get it to compile, but that isn't really a solution. We need some sort of system to prevent this from happening :think:

    The yields in question are: YIELD_LEATHER_ARMOR, YIELD_HIDES and YIELD_SCALE_ARMOR. Kailric added the first on the 27th of May last year. I didn't bother to check the other two. That's not important and the code itself is fine. Nothing is wrong as such, but still it prevented col2071 from compiling, which is a big issue.

    When mistakes are made, it is way too easy to blame whoever happened to make the mistake. However often the real issue is that the design allows for such mistakes to be made in the first place and we all make mistakes like this when there are aspects of the code we aren't aware of (yeah, me too). This mean we need a design, which prevent such mistakes from happening again.

    I started thinking about compiling some test DLL to detect errors. However that will not detect mistakes when they are made and it will have to be tested actively and odds are that we will not do that often enough.

    I came up with another idea. After the yield enum and yield groups, but in the same header, we add a define for each yield like
    Code:
    #define YIELD_ALE YIELD_ALE_OFF
    This way the compiler will replace YIELD_ALE in the code with YIELD_ALE_OFF. Since this define is after the enum, the enum itself isn't changed and the compiler will encounter an error. Naturally the actually hardcoded yields shouldn't have this define. This will make the compiler check for mistakes automatically each time the code is compiled.

    I think I need to make that yield script I have been talking about, which can be called automatically when compiling. It can be configured to do something like this automatically as well.
     
  5. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    What version of microsoft VS are you guys using, I need to find a free download so I can hit FTTW with a hammer, but I am having trouble find ing anything, VS2013 is a trial poop that locks after 30 days..
     
  6. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    If you use the express edition, you should get an email with an activation code, which unlocks it after the 30 days and it should be free to get such a mail. At least that's how it works with the 2010 edition.

    https://www.visualstudio.com/products/visual-studio-express-vs
    Near the bottom, there is a link to "Visual C++ 2010 Express". That's the one we use.

    Actually I downloaded the all in one ISO. It's a much bigger download (700 MB or something), but it's an offline installer, which is useful in case they remove the download link. Also I installed in virtual machines to test network stability and that makes it beneficial for me not to download the installer for each install.
     

Share This Page