Example #1
0
 virtual bool key(int key, int entnum, uimenu *menu) {
     if ( key == 't' && p->has_trait( vTraits[ entnum ] ) ) {
          if ( p->has_base_trait( vTraits[ entnum ] ) ) {
               p->toggle_trait( vTraits[ entnum ] );
               p->toggle_mutation( vTraits[ entnum ] );
          } else {
               p->toggle_mutation( vTraits[ entnum ] );
               p->toggle_trait( vTraits[ entnum ] );
          }
          menu->entries[ entnum ].text_color = ( p->has_trait( vTraits[ entnum ] ) ? c_green : menu->text_color );
          menu->entries[ entnum ].extratxt.txt= ( p->has_base_trait( vTraits[ entnum ] ) ? "T" : "" );
          return true;
     }
     return false;
 }
Example #2
0
        bool key( const input_event &event, int entnum, uimenu *menu ) override {
            if( event.get_first_input() == 't' && p->has_trait( vTraits[ entnum ] ) ) {
                if( p->has_base_trait( vTraits[ entnum ] ) ) {
                    p->toggle_trait( vTraits[ entnum ] );
                    p->unset_mutation( vTraits[ entnum ] );

                } else {
                    p->set_mutation( vTraits[ entnum ] );
                    p->toggle_trait( vTraits[ entnum ] );
                }
                menu->entries[ entnum ].text_color = ( p->has_trait( vTraits[ entnum ] ) ? c_green :
                                                       menu->text_color );
                menu->entries[ entnum ].extratxt.txt = ( p->has_base_trait( vTraits[ entnum ] ) ? "T" : "" );
                return true;
            }
            return false;
        }