Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config var improvements #103

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

config var improvements #103

wants to merge 10 commits into from

Conversation

duralakun
Copy link
Collaborator

@duralakun duralakun commented Feb 15, 2019

I am still working on this and want to add more stuff.

What is working already is a new command called "print_cfg"
You can type it in rcon console (F2) to get information about config vars.

For example "print_cfg hero" outputs this for me:

inf_hero_limit 10
inf_enable_hero 1
inf_hero_flag_indicator 0

"print_cfg map" outputs this for me:

sv_maprotation infc_skull infc_warehouse infc_damascus infc_hardcorepit
sv_rounds_per_map 8
sv_mapupdaterate 5
sv_map infc_hardcorepit
inf_map_window 15
inf_maprotation_random 1
inf_min_rounds_map_vote 0
inf_min_player_percent_map_vote 100
inf_min_player_number_map_vote 3
sv_maprotation infc_skull infc_warehouse infc_damascus infc_hardcorepit
sv_rounds_per_map 8
sv_mapupdaterate 5

@duralakun duralakun added in progress will be fixed soon DO NOT MERGE YET cucumber A green vegetable labels Feb 15, 2019
@duralakun
Copy link
Collaborator Author

duralakun commented Feb 15, 2019

Added new command "print_cmd", it works similar to "print_cfg", Examples:

print_cmd map

Printing all commands containing 'map' :
change_map ?"text..." -> Change map
skip_map -> Change map to the next in the rotation

print_cmd ban

Printing all commands containing 'ban' :
ban "clientid" ?minutes ?"reason" -> Ban player with ip/client id for x minutes for any reason
ban_range "text" -> Ban ip range for x minutes for any reason
bans -> Show banlist
bans_save "text" -> Save banlist in a file
unban "text" -> Unban ip/banlist entry
unban_all -> Unban all entries
unban_range "text" -> Unban ip range

…print_round_cfg + improved previous commits + created fr_boooper.cfg
@duralakun
Copy link
Collaborator Author

duralakun commented Feb 16, 2019

About the last commit:

I renamed printcfg and printcmd to print_cfg and print_cmd, also improved related code to it a bit.

Created new commands: set_cfg_for_nextround_begin, set_cfg_for_nextround_end, print_round_cfg
You can now type set_cfg_for_nextround_begin into the console in order to let the server remember upcoming config variable changes, then type set_cfg_for_nextround_end if you dont want to add more vars. These vars will be reset at the start of the next round.
While these vars are not reset you can see them with print_round_cfg.

This gives the option to create fun rounds with config files.
To demonstrate it i added another file called fr_boooper.cfg
https://github.com/yavl/teeworlds-infclassR/pull/103/files#diff-7df5e64bdd184dc65fdb6a4756b7cc74R1
the name fr_boooper means FunRound_BoomerLooper
to start this funround type "exec fr_boooper.cfg" into the rcon console.
i added comments inside the cfg file to explain it.

@duralakun duralakun requested review from bretonium and yavl February 16, 2019 20:12
@duralakun
Copy link
Collaborator Author

duralakun commented Feb 16, 2019

I want to add more features related to this. But for now i am finished with it and would like to test and if it works, merge it.

@duralakun duralakun removed DO NOT MERGE YET in progress will be fixed soon labels Feb 16, 2019
@duralakun duralakun added the in progress will be fixed soon label Feb 17, 2019
@duralakun duralakun removed the in progress will be fixed soon label Feb 17, 2019
@duralakun duralakun added enhancement New feature or request and removed cucumber A green vegetable labels Feb 17, 2019
@duralakun
Copy link
Collaborator Author

duralakun commented Feb 18, 2019

breton asked me in game why this define stuff inside the function, please take a look at here:
https://github.com/yavl/teeworlds-infclassR/blob/master/src/engine/shared/console.cpp#L727
i did it like it is done here

The way it works is that you define 2 functions MACRO_CONFIG_INT and MACRO_CONFIG_STR and then you include the config files, the included files will than call your defined functions, this way you can get all the information about the config variables

Here the MACROs will be called: https://github.com/yavl/teeworlds-infclassR/blob/master/src/engine/shared/config_variables.h

You can also see a lot of defines inside functions here: https://github.com/yavl/teeworlds-infclassR/blob/master/src/engine/shared/config.cpp#L53

@teoman002 teoman002 added the incl. in dev This feature is already used in master_dev label Feb 20, 2019
@teoman002
Copy link
Collaborator

Closed #96

bool CCfgVarBuffer::IsConfigVar(const char* pStr)
bool CCfgVarBuffer::ConResetCfgNextRound_Start(IConsole::IResult *pResult, void *pUserData)
{
//((CConsole*)pUserData)->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Console", "Reset upcomming config variables at the end of next round");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this line need to be here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for debug purposes. I also uncomment these lines, because they can be useful for debugging.
We could introduce a verbose flag set during the compile-process, which would activate this line.

}

/*
// puts all config vars and their values inside a string
// returns false if it runs out of memory
bool CCfgVarBuffer::GetCfgStr(char *pStr, int StrSize)
{
for (int i = 0; i < m_CfgVarsCounter; i++)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change on commented out code? Changes like this make it harder to review the changes. The reviewer, instead of reviewing actual change, has to waste attention on this

m_BackupRoundCfgVars = false;
}

/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please just remove unused code at all?

@teoman002 teoman002 removed the incl. in dev This feature is already used in master_dev label Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants