Author Topic: Disable Base-Buttons if not needed  (Read 8638 times)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Disable Base-Buttons if not needed
« on: July 02, 2014, 07:09:21 pm »
see image
it would be nice to disable unusable buttons in base
it already works for the "new base" button -> (it gets black)
no soldiers -> disable soldiers
no crafts -> disable craft equip
no scientist -> disable research
no engineer  -> disable manufacture

also possible but a little more complex:
no item/crafts/aliens/staff -> disable sell/transfer
no space left in base -> disable build new facilities
no storage/hangar/quarters/alien containment -> disable purchase

i sometime click on the wrong base to research stuff so i can likely avoid it

Offline Unknown Hero

  • Colonel
  • ****
  • Posts: 176
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #1 on: July 02, 2014, 07:36:41 pm »
Make sense, I support this proposal, there is no need to go to a screen if nothing can be done, apart to close the screen.  ;)

But why not in red?  ::)  8)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #2 on: July 02, 2014, 07:47:20 pm »
red = important = do something! <- thats not the case here

grey = disabled :)

+grey is easy to do if one shifts the button color by a specific range the same color range is not available in red in the base palette iirc

Offline Unknown Hero

  • Colonel
  • ****
  • Posts: 176
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #3 on: July 02, 2014, 07:58:41 pm »
It was just a joke.  :D

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11755
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Disable Base-Buttons if not needed
« Reply #4 on: July 11, 2014, 05:48:57 pm »
I wholly support this idea!
Well, the grey version. :D

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #5 on: July 11, 2014, 05:59:39 pm »
i have made the source changes already as test
additionally i made "new base" grey instead of black and removed the "clickable" function there but the rest of the grey button can still open their window

but no idea how to get this into the repository :(

niculinux

  • Guest
Re: Disable Base-Buttons if not needed
« Reply #6 on: July 11, 2014, 10:26:13 pm »
I wholly support this idea!
Well, the grey version. :D

Mee too. A confortable one

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #7 on: July 12, 2014, 03:00:10 pm »
+1

For the grey version !

Offline El Yahpo

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #8 on: July 14, 2014, 08:28:31 am »
Is there room for another button? (for the alien containment)

With this feature you could have a greyed out "Prisoners" button.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #9 on: July 14, 2014, 11:19:33 am »
the room is well used
i looked for a good space for a aliens-button in subwindows but could not find a good place

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #10 on: July 14, 2014, 01:54:58 pm »
Working code:

https://github.com/SupSuper/OpenXcom/pull/607

You can use it as you want, but IMHO this is not a good idea as it seems. Especially in basescape.
I tested it and I closed this pull request.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #11 on: July 14, 2014, 02:48:48 pm »
can you put this in basscapestate.cpp around line ~221?
Code: [Select]
if (_base->getScientists()>0)
{
_btnResearch->setColor(Palette::blockOffset(13)+5);
}else{
_btnResearch->setColor(Palette::blockOffset(13)+0);
}
if (_base->getEngineers()>0)
{
_btnManufacture->setColor(Palette::blockOffset(13)+5);
}else{
_btnManufacture->setColor(Palette::blockOffset(13)+0);
}
if (_base->getSoldiers()->size()>0)
{
_btnSoldiers->setColor(Palette::blockOffset(13)+5);
}else{
_btnSoldiers->setColor(Palette::blockOffset(13)+0);
}
if (_base->getCrafts()->size()>0)
{
_btnCrafts->setColor(Palette::blockOffset(13)+5);
}else{
_btnCrafts->setColor(Palette::blockOffset(13)+0);
}
if (_base->countAvailableSpace()>0)
{
_btnFacilities->setColor(Palette::blockOffset(13)+5);
}else{
_btnFacilities->setColor(Palette::blockOffset(13)+0);
}
if (_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES){
_btnNewBase->setColor(Palette::blockOffset(13)+5);
_btnNewBase->onMouseClick((ActionHandler)&BasescapeState::btnNewBaseClick);
}else{
_btnNewBase->setColor(Palette::blockOffset(13)+0);
_btnNewBase->onMouseClick(0);
}
https://_btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES);
why did you change the textbutton?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #12 on: July 14, 2014, 03:04:53 pm »
can you put this in basscapestate.cpp around line ~221?

First version of PR did it:
https://github.com/redv/OpenXcom/commit/96ccf669b0883bfd1797952ac4bfc827f56533ec
Just need change two strings in BasescapeState.cpp

why did you change the textbutton?

Because class TextButton has new field
Code: [Select]
_inactiveColor and new method
Code: [Select]
void setActive(bool active);https://github.com/SupSuper/OpenXcom/pull/607/files#diff-0a913ca0ca15ef780316dacfeac21158R74

Believe me, grey "New Base" is very annoying.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #13 on: July 14, 2014, 03:27:46 pm »
i found the non-clickable grey new base button not annoying in any way but besides that
could yo add the rest of my code that accomplishe the stuff i suggested in the start thread (grey for buttons that are not needed)
i just changed the color paltte from Palette::blockOffset(13)+5 to  to Palette::blockOffset(13)+0 without a need to change the text button
do you have a enable-option in you PR?
« Last Edit: July 14, 2014, 03:32:05 pm by Falko »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Disable Base-Buttons if not needed
« Reply #14 on: July 14, 2014, 03:41:22 pm »
do you have a enable-option in you PR?

Yes, you can use:
    btn->setActive(true);    https:// for activate a button
    btn->setActive(false);   https:// for deactivate.