Skip to content
Permalink
12d06b305d
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
35 lines (31 sloc) 800 Bytes
#include "../include/Effect.hpp"
#include <iostream>
Effect::Effect(int _id)
{
string filename = "Database/Game_Database.sqlite";
try
{
sqlite::sqlite db(filename);
auto cur = db.get_statement();
cur->set_sql("SELECT * FROM Effects WHERE Effect_ID = ?;");
cur->prepare();
cur->bind(1, _id);
while(cur->step())
{
Effect_Name = cur->get_text(1);
Target_Stat = cur->get_text(2);
Duration = cur->get_int(3);
Impact = cur->get_double(4);
}
}
catch(sqlite::exception e)
{
cerr << e.what() << endl;
}
};
ostream& operator<<( ostream& os, const Effect& effect )
{
os << effect.Effect_Name << "affects the " << effect.Target_Stat << " of the targeted hero for "
<< effect.Duration << " turns and have an impact of " << effect.Impact << "." << endl;
return os;
}