help with making a new tab

Questions or HOWTOs about the above? Post 'em here...
Post Reply
User avatar
the panda next door
Private First Class
Private First Class
Posts: 42
Joined: Sun Mar 16, 2008 3:55 am
Location: Las Vegas

help with making a new tab

Post by the panda next door »

I find that when I have been sent private messages, they are stuck in between other chat messages and I need to scroll up or down and find flashing messages. Because of that, I want to make a new tab and bind it to "Shift+F5", but what I'm trying obviously isn't working. I have already made the tab appear with the text "->you". How to filter and insert text into the tab also eludes me.
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Post by joevano »

Why don't you run debugger on the code and see what happens when you switch tabs, that may give you a clue...
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

Look in playing.cxx around line 2568 for 'case MsgMessage:' . That seems to be where the player to player messages are handled. You can follow the logic to figure out how to code your own message mode.
Enigma
Private First Class
Private First Class
Posts: 212
Joined: Sat Apr 23, 2005 3:13 am

Post by Enigma »

If you followed what anomaly said, you should have ended up looking in the function handleMessage(void*) in playing.cxx. If you scroll to the end of the function, you'll see some calls to addMessage(). This function calls ControlPanel::addMessage(), and, as you would expect, adds a message to the console. The integer constant passed to addMessage() in playing.cxx is the tab the text will show up in. The integer constant corresponds to an enumeration in ControlPanel.h:

Code: Select all

enum MessageModes {
      MessageAllTabs = -2,
      MessageCurrent = -1,
      MessageAll     = 0,
      MessageChat    = 1,
      MessageServer  = 2,
      MessageMisc    = 3,
      MessageAdmin   = 4,  //I added this to try adding a tab
      MessageModeCount
    };
The enumeration is private, which explains why integer constants are used instead of the enumeration names.

In playing.cxx, I just added a small "if(toAdmin)" to the code:

Code: Select all

if (fromServer)
      addMessage(NULL, fullMsg, 2, false, oldcolor.c_str());
    else if(toAdmin)
      addMessage(NULL, fullMsg, 4, false, oldcolor.c_str());
    else
      addMessage(NULL, fullMsg, 1, false, oldcolor.c_str());
Attachments
Picture 1.png
(306.73 KiB) Downloaded 26 times
User avatar
the panda next door
Private First Class
Private First Class
Posts: 42
Joined: Sun Mar 16, 2008 3:55 am
Location: Las Vegas

binding tab to F5

Post by the panda next door »

I finally got it to work!
Explanation in this pic:
Attachments
Picture 1.png
(186.22 KiB) Downloaded 32 times
Post Reply