From 9c7e4f5a6d42e017d735eaf706ebd4ff0cfe491d Mon Sep 17 00:00:00 2001 From: jackb-p Date: Mon, 15 Aug 2016 21:12:47 +0200 Subject: [PATCH] Squash bugs and warnings, optimise CMake builds. --- .gitignore | 8 +++++++- TriviaBot/CMakeLists.txt | 2 ++ TriviaBot/bot/TriviaBot.cpp | 1 - TriviaBot/bot/TriviaGame.cpp | 4 ++-- TriviaBot/bot/js/CommandHelper.cpp | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5861706..e9b86b7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,10 @@ config.json # Compiled sqlite file -sqlite3.obj \ No newline at end of file +sqlite3.obj + +# V8 lib +lib/v8 + +# Built files +build/ diff --git a/TriviaBot/CMakeLists.txt b/TriviaBot/CMakeLists.txt index 2d7ba87..00b718f 100644 --- a/TriviaBot/CMakeLists.txt +++ b/TriviaBot/CMakeLists.txt @@ -52,3 +52,5 @@ include_directories( # don't know if necessary, too scared to remove add_definitions(-D_WEBSOCKETPP_CPP11_STL_) + +set(CMAKE_BUILD_TYPE Release) diff --git a/TriviaBot/bot/TriviaBot.cpp b/TriviaBot/bot/TriviaBot.cpp index 5e57aca..719735c 100644 --- a/TriviaBot/bot/TriviaBot.cpp +++ b/TriviaBot/bot/TriviaBot.cpp @@ -62,6 +62,5 @@ int main(int argc, char *argv[]) { Logger::write("Cleaned up", Logger::LogLevel::Info); - std::getchar(); return exit_code; } diff --git a/TriviaBot/bot/TriviaGame.cpp b/TriviaBot/bot/TriviaGame.cpp index b440b14..b2310e4 100644 --- a/TriviaBot/bot/TriviaGame.cpp +++ b/TriviaBot/bot/TriviaGame.cpp @@ -15,7 +15,7 @@ #include "Logger.hpp" #include "BotConfig.hpp" -TriviaGame::TriviaGame(BotConfig &c, GatewayHandler *gh, std::string channel_id, int total_questions, int delay) : interval(delay), config(c) { +TriviaGame::TriviaGame(BotConfig &c, GatewayHandler *gh, std::string channel_id, int total_questions, int delay) : config(c), interval(delay) { this->gh = gh; this->channel_id = channel_id; @@ -339,4 +339,4 @@ void TriviaGame::update_average_time(std::string user_id, int time) { // yeah it probably loses accuracy here, doesn't really matter average_times[user_id] = (int) (total / questions_answered); } -} \ No newline at end of file +} diff --git a/TriviaBot/bot/js/CommandHelper.cpp b/TriviaBot/bot/js/CommandHelper.cpp index afd8c2e..31f4bde 100644 --- a/TriviaBot/bot/js/CommandHelper.cpp +++ b/TriviaBot/bot/js/CommandHelper.cpp @@ -14,7 +14,7 @@ namespace CommandHelper { sqlite3 *db; int return_code; return_code = sqlite3_open("bot/db/trivia.db", &db); - std::string sql = "SELECT * FROM CustomJS"; + std::string sql = "SELECT GuildID, CommandName, Script FROM CustomJS"; sqlite3_stmt *stmt; return_code = sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, 0); @@ -161,4 +161,4 @@ namespace CommandHelper { return exists; } -} \ No newline at end of file +}