Author Topic: XML for slider not complete?  (Read 2392 times)

0 Members and 1 Guest are viewing this topic.

Offline Anon21

  • Full Member
  • ***
  • Posts: 244
XML for slider not complete?
« on: July 24, 2011, 07:35:18 AM »
This is the XML from building_setup_screen.xml that sets up the Advertising Budget Slider ... in theory.

Code: [Select]
  <Slider Name        = "AdvertisingSlider"
        XPos        = "24"
        YPos        = "143"
        Width        = "324"
        MinValue    = "0"
        MaxValue    = "2000"
        Value        = "0"
        Increment    = "100"
        LiveUpdate    = "true"
        Hidden        = "false"
        Disabled    = "false"
    />

However it appears that the values for Min Max and Increment are not actually used in the code

Code: [Select]
    // let's limit advertising budget to multiples of 50 gold (~3 added customers), from 0 - 2000
    int advert = g_Brothels.GetBrothel(g_CurrBrothel)->m_AdvertisingBudget / 50;
    advert = SliderRange(advertsli_id, 0, (2000 / 50), advert, 4);  // set slider min/max range
    ss.str("");
    ss << "Advertising Budget: " << (advert * 50) << " gold / week";
    EditTextItem(ss.str(), advertamt_id);

Anyway, when I added the slider to the Mayor screen it turned out that the Increment value from the XML is not actually used. The min and max values are, though.  So this is what that XML ended up looking like...

Code: [Select]
  <Slider Name        = "BribeSlider"
        XPos        = "8"
        YPos        = "220"
        Width        = "328"
        MinValue    = "0"
        MaxValue    = "60"
        Value        = "0"
        Increment    = "50"
        LiveUpdate    = "true"
        Hidden        = "false"
        Disabled    = "false"
    />

(The 'x 50' is hardcoded in cScreenMayor.cpp)

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: XML for slider not complete?
« Reply #1 on: July 24, 2011, 08:03:26 AM »
Kewl "_"

Did you get any further with the image click event?
Like what we're doing?

Offline Anon21

  • Full Member
  • ***
  • Posts: 244
Re: XML for slider not complete?
« Reply #2 on: July 24, 2011, 08:09:28 AM »
Kewl "_"

Did you get any further with the image click event?

Nah, I commented out all the code.  I might get further by adding the image handling code to the Button object, but that's on the backburner for now.