Permalink
Browse files

Added ability to shut down your vServer with /stop

  • Loading branch information...
sprenger120 committed May 6, 2012
1 parent ee14c93 commit b513880871a4fe464ac7fc7345136e9a675a18c9
Showing with 6 additions and 5 deletions.
  1. +6 −5 FastCraft/main.cpp
View
@@ -96,15 +96,16 @@ int main(int argc, char *argv[]) {
bool fSomethingRuns = false;
while(1) {
- Thread::sleep(1000);
+ Thread::sleep(100);
//Check if there is at least one server that runs
fSomethingRuns=false;
if (!vpServer.empty()) {
- for (x=0;x<=vpServer.size()-1;x++) {
- if (vpServer[x]->isRunning()) {
- fSomethingRuns=true;
- break;
+ for (x=vpServer.size()-1;x>=0;x--) {
+ if (vpServer[x]->isRunning()) {fSomethingRuns=true;}
+ if (vpServer[x]->isMarkedForShutdown()) {
+ delete vpServer[x];
+ vpServer.erase(vpServer.begin()+x);
}
}
}else {

0 comments on commit b513880

Please sign in to comment.