Skip to content

Commit

Permalink
Added new registerCustomBoolBZDB()
Browse files Browse the repository at this point in the history
  • Loading branch information
allejo committed Aug 20, 2015
1 parent 6972380 commit e90abde
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions LeagueOverseer-Helpers.cpp
Expand Up @@ -249,4 +249,14 @@ int registerCustomIntBZDB(const char* bzdbVar, int value, int perms, bool persis
}

return bz_getBZDBInt(bzdbVar);
}

bool registerCustomBoolBZDB(const char* bzdbVar, bool value, int perms, bool persistent)
{
if (!bz_BZDBItemExists(bzdbVar))
{
bz_setBZDBBool(bzdbVar, value, perms, persistent);
}

return bz_getBZDBBool(bzdbVar);
}
13 changes: 13 additions & 0 deletions LeagueOverseer-Helpers.h
Expand Up @@ -173,4 +173,17 @@ bool toBool (std::string str);
*/
int registerCustomIntBZDB (const char* bzdbVar, int value, int perms = 0, bool persistent = false);

/**
* Create a BZDB variable if it doesn't exist. This is used because if the variable already exists via -setforced in
* the configuration file, then this value would be overloaded and we don't want that
*
* @param bzdbVar The name of the BZDB variable
* @param value The value of the variable
* @param perms What to set the permission value to. (Range: 1-3. Using 0 sets it to the default [2], and using a higher number sets it to 3.)
* @param persistent Whether or not the variable will be persistent.
*
* @return The value of the BZDB variable
*/
bool registerCustomBoolBZDB (const char* bzdbVar, bool value, int perms = 0, bool persistent = false);

#endif

0 comments on commit e90abde

Please sign in to comment.