Squash bugs and warnings, optimise CMake builds.

This commit is contained in:
Jack Bond-Preston 2016-08-15 21:12:47 +02:00
parent 4b2d0ee50a
commit 9c7e4f5a6d
5 changed files with 13 additions and 6 deletions

8
.gitignore vendored
View File

@ -14,4 +14,10 @@
config.json config.json
# Compiled sqlite file # Compiled sqlite file
sqlite3.obj sqlite3.obj
# V8 lib
lib/v8
# Built files
build/

View File

@ -52,3 +52,5 @@ include_directories(
# don't know if necessary, too scared to remove # don't know if necessary, too scared to remove
add_definitions(-D_WEBSOCKETPP_CPP11_STL_) add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
set(CMAKE_BUILD_TYPE Release)

View File

@ -62,6 +62,5 @@ int main(int argc, char *argv[]) {
Logger::write("Cleaned up", Logger::LogLevel::Info); Logger::write("Cleaned up", Logger::LogLevel::Info);
std::getchar();
return exit_code; return exit_code;
} }

View File

@ -15,7 +15,7 @@
#include "Logger.hpp" #include "Logger.hpp"
#include "BotConfig.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->gh = gh;
this->channel_id = channel_id; 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 // yeah it probably loses accuracy here, doesn't really matter
average_times[user_id] = (int) (total / questions_answered); average_times[user_id] = (int) (total / questions_answered);
} }
} }

View File

@ -14,7 +14,7 @@ namespace CommandHelper {
sqlite3 *db; int return_code; sqlite3 *db; int return_code;
return_code = sqlite3_open("bot/db/trivia.db", &db); 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; sqlite3_stmt *stmt;
return_code = sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, 0); return_code = sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, 0);
@ -161,4 +161,4 @@ namespace CommandHelper {
return exists; return exists;
} }
} }