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

Mod for Pitboss Games

Discussion in 'Civ4 - PitBoss Games' started by Ramkhamhaeng, Sep 4, 2014.

  1. Ramkhamhaeng

    Ramkhamhaeng Chieftain

    Joined:
    Feb 24, 2014
    Messages:
    142
    Hello DarkLunaPhantom,

    there are a few 'reasons' for this approach.
    1. Previous versions of PBSpy parses the year information only. The month information was attached later and adding it in the upper bits was the easiest solution.
    2. I prefer the storage of numbers over strings.
    3. For security reasons the input string should not be stored/displayed without any parsing. I wrote the most restrictive parsing function and wait until somebody needs a more flexible solution.
    (Well, this point is not 100% valid because two fields, game name and mod name, are string fields the values were currently saved raw. :) I will update this in the next version and strip out tags, etc...)
    4. The Pitboss server method CyPitboss().getGamedate(bSavegameSyntax) depends on the selected language. This could mess up the displayed string on the interface. A new more robust/general solution should respect this.

    =========
    It exists two possible solution.
    A) Simply display the full calendar string, given getGamedate() a.k.a. CyGameTextMgr::getDateStr(...). This approach will work for all mods, too. (Your suggestion)
    B) Write an own function, similar to getDateStr, which returns all information in a predefined, language independent form. This is secure, but do not respect new/fancy calendar types. Disadvantage is complexity and redundancy.

    Currently, I prefer solution B.
     
  2. DarkLunaPhantom

    DarkLunaPhantom Chieftain Supporter

    Joined:
    Feb 4, 2013
    Messages:
    365
    Just adding all other months (other than January and July) to current parsing function would cover most use cases. That should be more than enough until (and if) someone is eventually willing to spend time to implement solution B.
     
  3. Ramkhamhaeng

    Ramkhamhaeng Chieftain

    Joined:
    Feb 24, 2014
    Messages:
    142
    Ok, I've added the missing month and the seasons. Should be merged by Zulan on his server soon.
    Sketch of changes:
    PHP:
    date_string PB.getGamedate(False)  # PB Server side, i.e 'January, 1 AD'

    # PBSpy side
    (monthyearqual) = year_str.split()
    MONTH_NAMES_ENG = ["undefined""january""february""march",
                       
    "april""may""june""july""august",
                       
    "september""october""november""december"]
    # Seasons treated as extra months
    MONTH_NAMES_ENG.extend(["winter""spring""summer""fall"])

    month month.replace(",""")  # Remove tailing ','
    try:
        
    imonth MONTH_NAMES_ENG.index(month.lower())
    except ValueError:
        
    raise ValueError('Failed to parse month/season part of date')
     
  4. Ramkhamhaeng

    Ramkhamhaeng Chieftain

    Joined:
    Feb 24, 2014
    Messages:
    142
    Hello DarkLunaPhantom,

    Could you please update the stored PBSpy-Url in your pbSettings.json to
    Code:
    "url": "http:\/\/civ.zulan.net\/pbspy\/update",
    ?

    We want get rid of this ancient url redirection on our server. :)
    Thanks.
     
  5. DarkLunaPhantom

    DarkLunaPhantom Chieftain Supporter

    Joined:
    Feb 4, 2013
    Messages:
    365
    Sure, I changed it. Thanks for the notification.
     
  6. DarkLunaPhantom

    DarkLunaPhantom Chieftain Supporter

    Joined:
    Feb 4, 2013
    Messages:
    365
    I am having some trouble merging some parts of PBMod. Are you using a newer version of boost?

    Spoiler :

    One of the error messages I am getting is:
    Code:
    unresolved external symbol "int __cdecl boost::xtime_get(struct boost::xtime *,int)"
    
    used inside Timer::calc_next_time in CvGame.cpp, but this function should be included via boost/thread.hpp in CvGame.h...
     
  7. Ramkhamhaeng

    Ramkhamhaeng Chieftain

    Joined:
    Feb 24, 2014
    Messages:
    142
    Hui, thanks for posting this!
    I didn't use a newer boost version, but add some boost library functions. The required files wasn't added to the PBStats repository. I will push a commit in the next minutes to fix this. Please note that you must alter the Makefile.

    Background:
    Normally, the boost stuff is completely header based but xtime_get needs to be compiled… It was (at least for me) difficult to build up a proper environment to compile the required parts of the ancient boost version but fortunately the C2C-guys provides pre-compiled files their SVN.

    I've adapted this solution and added the *.obj-files with the required library functions.
    Here, you could restrict it to xtime.obj, I assume.
     
    Last edited: Mar 6, 2019
    DarkLunaPhantom likes this.

Share This Page