~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/engine/ePlayer.cpp

  • Committer: SwagTron
  • Date: 2019-08-07 00:21:38 UTC
  • Revision ID: swagtron-20190807002138-fsfvnmhk3d27mrsd
Made the shorthandle for local commands configurable.
Added the settings to english_base and settings.cfg.
Seems to update only when you restart chat by rejoining the server currently.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4650
4650
 
4651
4651
#ifndef DEDICATED
4652
4652
static bool se_enableChatCommands = true;
4653
 
static tConfItem<bool> se_enableChatCommandsConf( "CHAT_LOCAL_COMMANDS", se_enableChatCommands );
 
4653
static tConfItem<bool> se_enableChatCommandsConf( "LOCAL_CHAT_COMMANDS", se_enableChatCommands );
4654
4654
 
4655
4655
static bool se_showPlayerCommand = true;
4656
4656
static tConfItem<bool> se_showPlayerCommandConf( "SHOW_IP_PLAYERS", se_showPlayerCommand );
4657
4657
 
4658
 
//our local commands (should always be lowercase)
4659
 
static char const * const se_localChatCommands[] = {
4660
 
    "/console",
4661
 
    "/listcolors",
4662
 
    "/colors",
4663
 
    "/info",
4664
 
    "/rgb"
4665
 
};
 
4658
static tString se_consoleComand("/console");
 
4659
static tConfItem<tString> se_consoleComandConf("LOCAL_CONSOLE_COMMAND", se_consoleComand);
 
4660
 
 
4661
static tString se_listcolorsCommand("/listcolors");
 
4662
static tConfItem<tString> se_listcolorsCommandConf("LOCAL_LISTCOLORS_COMMAND", se_listcolorsCommand);
 
4663
 
 
4664
static tString se_colorsCommand("/colors");
 
4665
static tConfItem<tString> se_colorsCommandConf("LOCAL_COLORS_COMMAND", se_colorsCommand);
 
4666
 
 
4667
static tString se_infoCommand("/info");
 
4668
static tConfItem<tString> se_infoCommandConf("LOCAL_INFO_COMMAND", se_infoCommand);
 
4669
 
 
4670
static tString se_rgbCommand("/rgb");
 
4671
static tConfItem<tString> se_rgbCommandConf("LOCAL_RGB_COMMAND", se_rgbCommand);
4666
4672
#endif //if not dedicated
4667
4673
 
4668
4674
void ePlayerNetID::Chat(const tString& s_orig)
4669
4675
{
 
4676
    // our local commands (should always be lowercase)
 
4677
    static char const* const se_localChatCommands[] = { se_consoleComand, se_listcolorsCommand,
 
4678
        se_colorsCommand, se_infoCommand, se_rgbCommand };
4670
4679
    tColoredString s(s_orig);
4671
4680
    s.NetFilter();
4672
4681
 
4691
4700
        }
4692
4701
    }
4693
4702
 
4694
 
    if ((!se_showPlayerCommand) && s_orig.StartsWith("/") && (command == "/players" || command == "/listplayers"))
 
4703
    if ((!se_showPlayerCommand) && s_orig.StartsWith("/")
 
4704
        && (command == "/players" || command == "/listplayers"))
4695
4705
    {
4696
4706
        tCurrentAccessLevel level(tAccessLevel_Owner, true);
4697
4707
        tString params("PLAYERS");
4702
4712
    if (isLocalCommand && se_enableChatCommands && (s_orig.StartsWith("/")))
4703
4713
    {
4704
4714
        // check for direct console commands
4705
 
        if (command == "/console")
 
4715
        if (command == se_consoleComand)
4706
4716
        {
4707
4717
            // direct commands are executed at owner level
4708
4718
            tCurrentAccessLevel level(tAccessLevel_Owner, true);
4724
4734
            }
4725
4735
        }
4726
4736
        // Short handle for grabbing player colors.
4727
 
        else if ((command == "/listcolors") || (command == "/colors"))
 
4737
        else if ((command == se_listcolorsCommand) || (command == se_colorsCommand))
4728
4738
        {
4729
4739
            listPlayerColors(tString(s_orig));
4730
4740
        }
4731
4741
        // Short handle for grabbing player information.
4732
 
        else if (command == "/info")
 
4742
        else if (command == se_infoCommand)
4733
4743
        {
4734
4744
            listPlayerInfo(tString(s_orig));
4735
4745
        }
4736
4746
        // Short handle for changing our RGB values.
4737
 
        else if (command == "/rgb")
 
4747
        else if (command == se_rgbCommand)
4738
4748
        {
4739
4749
            currentPlayerRGB(tString(s_orig));
4740
4750
        }