diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-13 08:47:41 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-13 08:47:41 -0400 |
commit | fa4b6e00fd204998f6011420bdad60477b7a2f12 (patch) | |
tree | 4fd37e92f375ddb49e156b07811b8a2fe1ad6c0d /src/quest.cpp | |
parent | 03130c5bcec3c885a1be005c24e192dfb57f3fe5 (diff) |
parentheses
Diffstat (limited to 'src/quest.cpp')
-rw-r--r-- | src/quest.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/quest.cpp b/src/quest.cpp index 4ab827f..afeec6b 100644 --- a/src/quest.cpp +++ b/src/quest.cpp @@ -12,45 +12,45 @@ int QuestHandler::assign(std::string title,std::string desc,std::string req){ tmp.title = title;
tmp.desc = desc;
- tok = strtok( &req[0], "\n\r\t," );
- tmp.need.emplace_back( "", 0 );
+ tok = strtok(&req[0], "\n\r\t,");
+ tmp.need.emplace_back("", 0);
- while ( tok ) {
- if ( !tmp.need.back().first.empty() ) {
- tmp.need.back().second = atoi( tok );
- tmp.need.emplace_back( "", 0 );
+ while (tok) {
+ if (!tmp.need.back().first.empty()) {
+ tmp.need.back().second = atoi(tok);
+ tmp.need.emplace_back("", 0);
} else
tmp.need.back().first = tok;
- tok = strtok( NULL, "\n\r\t," );
+ tok = strtok(NULL, "\n\r\t,");
}
tmp.need.pop_back();
- current.push_back( tmp );
+ current.push_back(tmp);
return 0;
}
int QuestHandler::drop(std::string title){
- current.erase( std::remove_if( current.begin(),
+ current.erase(std::remove_if(current.begin(),
current.end(),
[&](Quest q){ return q.title == title; }),
- current.end() );
+ current.end());
return 0;
}
int QuestHandler::finish(std::string t){
- for ( auto c = current.begin(); c != current.end(); c++ ) {
- if ( (*c).title == t ) {
- for ( auto &n : (*c).need ) {
- if ( player->inv->hasItem( n.first ) < n.second )
+ for (auto c = current.begin(); c != current.end(); c++) {
+ if ((*c).title == t) {
+ for (auto &n : (*c).need) {
+ if (player->inv->hasItem(n.first) < n.second)
return 0;
}
- for ( auto &n : (*c).need )
- player->inv->takeItem( n.first, n.second );
- current.erase( c );
+ for (auto &n : (*c).need)
+ player->inv->takeItem(n.first, n.second);
+ current.erase(c);
return 1;
}
}
@@ -59,8 +59,8 @@ int QuestHandler::finish(std::string t){ }
bool QuestHandler::hasQuest(std::string t){
- for ( auto &c : current ) {
- if ( c.title == t )
+ for (auto &c : current) {
+ if (c.title == t)
return true;
}
|