-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
Added new command "print_cmd", it works similar to "print_cfg", Examples: print_cmd map
print_cmd ban
|
…print_round_cfg + improved previous commits + created fr_boooper.cfg
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 This gives the option to create fun rounds with config files. |
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. |
breton asked me in game why this define stuff inside the function, please take a look at 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 |
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"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/engine/shared/cfgvar_buffer.cpp
Outdated
} | ||
|
||
/* | ||
// 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++) |
There was a problem hiding this comment.
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; | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
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?
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:
"print_cfg map" outputs this for me: