Skip to content
Permalink
8f3df44f17
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
39 lines (38 sloc) 1.39 KB
#include <iostream>
#include <string>
#include "battleEnd.h"
using namespace std;
int four() {
sqlite3* DB;
char* messaggeError;
int exit = sqlite3_open("gameDatabase", &DB);
string turnsql("SELECT TURN FROM PLAYER WHERE ID='p001'");
exit = sqlite3_exec(DB, turnsql.c_str(), NULL, 0, &messaggeError);
int turn = exit;
if ((turn % 2) == 0) {
cout << "yw" << endl;
//three()
};
string enemyhealthsql("SELECT HEALTH FROM ENEMY");
exit = sqlite3_exec(DB, enemyhealthsql.c_str(), NULL, 0, &messaggeError);
int enemy_health = exit; //temp, should be gettin from database
string enemyattacksql("SELECT ATTACK FROM ENEMY");
exit = sqlite3_exec(DB, enemyattacksql.c_str(), NULL, 0, &messaggeError);
int enemy_attack = exit; //also temp ^^^
string healthsql("SELECT HEALTH FROM PLAYER WHERE ID='p001'");
exit = sqlite3_exec(DB, healthsql.c_str(), NULL, 0, &messaggeError);
int health = exit;
health = health - enemy_attack; //health should be taken from database
string updatehealthsql("UPDATE PLAYER SET HEALTH = health");
exit = sqlite3_exec(DB, updatehealthsql.c_str(), NULL, 0, &messaggeError);
turn = turn - 1;
if (turn == 0) {
if (health >= 0) {
five(); //Battle end.h
}
//function five (BattleEndCheck)
//go to player turn function
return 0;
};
return 0;
};