Added symbolic constants (flags) to remove integrations

Since not all places where tcoin runs have tildebot, minerbot and daily-adventure, these integrations are now disabled in the code through preprocessor directives (symbolic constants that act as flags)
This commit is contained in:
~login@aussies.space 2019-09-30 20:06:03 +00:00
parent 5067e392f1
commit 74152c106b
1 changed files with 19 additions and 4 deletions

View File

@ -49,13 +49,24 @@
#define TCOIN_PATH_W_SLASH "/home/login/tcoin/"
#define TCOIN_SCRYPT_PATH "/home/login/bin/scrypt"
*/
#define KROWBAR_OFF
#define DA_OFF
#define MINERCOIN_OFF
#define LS_HOME_CMD "/bin/ls /home"
#define BIN_ECHO_CMD "/bin/echo $$"
#define KROWBAR_SCORE_PATH "/home/krowbar/Code/irc/data/tildescores.txt"
#ifndef KROWBAR_OFF
#define KROWBAR_SCORE_PATH "/home/krowbar/Code/irc/data/tildescores.txt"
#endif
#define WHOAMI_PATH "/usr/bin/whoami"
#define TROIDO_DACOINS_CMD "cd /home/troido/daily_adventure/client/ && /home/troido/daily_adventure/client/daclient printinfo 2>&1 | /bin/grep -oP '(?<=\"Coins\", )\[[:digit:]]+'"
#define MINERCOIN_CMD_PRE_USERNAME "/bin/grep -oP '(?<=\"~"
#define MINERCOIN_CMD_POST_USERNAME "\": )[[:digit:]]+' /home/minerobber/Code/minerbot/minercoin.json"
#ifndef DA_OFF
#define TROIDO_DACOINS_CMD "cd /home/troido/daily_adventure/client/ && /home/troido/daily_adventure/client/daclient printinfo 2>&1 | /bin/grep -oP '(?<=\"Coins\", )\[[:digit:]]+'"
#endif
#ifndef MINERCOIN_OFF
#define MINERCOIN_CMD_PRE_USERNAME "/bin/grep -oP '(?<=\"~"
#define MINERCOIN_CMD_POST_USERNAME "\": )[[:digit:]]+' /home/minerobber/Code/minerbot/minercoin.json"
#endif
#define USERNAME_LENGTH_LIMIT 25
void exit_program(const int error_number)
@ -1569,6 +1580,7 @@ int main(int argc, char *argv[])
krowbar_amount = 0;
minercoin_amount = 0;
#ifndef KROWBAR_OFF
//adding tildebot scores from krowbar to base amount
{
std::string line;
@ -1607,7 +1619,9 @@ int main(int argc, char *argv[])
delete[] line_c_string;
}
}
#endif
#ifndef DA_OFF
//adding minercoin scores from minerobber to base amount
{
std::string command_to_exec = std::string(MINERCOIN_CMD_PRE_USERNAME) + get_username() + std::string(MINERCOIN_CMD_POST_USERNAME);
@ -1620,6 +1634,7 @@ int main(int argc, char *argv[])
//multiplied by 100 to convert tildecoins to centitildecoins, which
//is the unit used throughout the program (and converted appropriately when displayed)
}
#endif
user_amount = get_file_value(get_username().c_str());