]> jfr.im git - irc/gameservirc.git/commitdiff
Cleaned up boolean.cpp
authorkainazzzo <redacted>
Thu, 25 Jan 2007 20:30:51 +0000 (20:30 +0000)
committerkainazzzo <redacted>
Thu, 25 Jan 2007 20:30:51 +0000 (20:30 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@484 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/boolean.cpp

index a6011dd7936ff7540088b3da09877b61e68ff4e3..e3c4e90b7c88388d2e4fe02d4dd4a4ac0d9db844 100755 (executable)
@@ -24,165 +24,167 @@ bool alphaNumeric(const char *str); // Returns true if all of the characters in
 
 bool is_playing(char *u)
 {
-  aClient *user;
-  if (!(user = find(u)))
-       return false;
-  else
-       return is_playing(user);
+   aClient *user;
+   if (!(user = find(u)))
+      return false;
+   else
+      return is_playing(user);
 }
 
 bool is_playing(aClient *user)
 {
-  if (!user)
-    {
-         return false;
-    }
-  else if (!user->stats)
-       {
-         return false;
-       }
-  else if (!FL_is_playing(user))
-    {
-         return false;
-    }
-  else if (user->stats->getClient() != user)
-    {
-         return false;
-    }
-  else
-       return true;
+   if (!user)
+   {
+      return false;
+   }
+   else if (!user->stats)
+   {
+      return false;
+   }
+   else if (!FL_is_playing(user))
+   {
+      return false;
+   }
+   else if (user->stats->getClient() != user)
+   {
+      return false;
+   }
+   else
+      return true;
 }
 
 bool is_fighting(char *u)
 {
-  aClient *user;
-  
-  if (!(user = find(u)))
-       return false;
-  else
-       return is_fighting(user);
+   aClient *user;
+
+   if (!(user = find(u)))
+      return false;
+   else
+      return is_fighting(user);
 }
 
 bool is_fighting(aClient *user)
 {
-  if (!is_playing(user))
-       return false;
-  else
-       return player_fight(user) || master_fight(user) || user->stats->getMonster() != NULL;
+   if (!is_playing(user))
+      return false;
+   else
+      return player_fight(user) || master_fight(user) || 
+             user->stats->getMonster() != NULL;
 }
 
 bool player_fight(char *u)
 {
-  aClient *user;
-  
-  if (!(user = find(u)))
-       return false;
-  else 
-       return player_fight(user);
+   aClient *user;
+
+   if (!(user = find(u)))
+      return false;
+   else 
+      return player_fight(user);
 }
 
 bool player_fight(aClient *user)
 {
-  if (!is_playing(user))
-       return false;
-  else if (is_playing(user->stats->getBattle()))
-    {
-         return true;
-    }
-  return false;
+   if (!is_playing(user))
+      return false;
+   else if (is_playing(user->stats->getBattle()))
+   {
+      return true;
+   }
+   
+   return false;
 }
 
 bool master_fight(char *u)
 {
-  aClient *user;
-  
-  if (!(user = find(u)))
-       return false;
-  else
-       return master_fight(user);
+   aClient *user;
+
+   if (!(user = find(u)))
+      return false;
+   else
+      return master_fight(user);
 }
 
 bool master_fight(aClient *user)
 {
-  if (!is_playing(user))
-       return false;
-  else
-       return user->stats->getMaster() != NULL;
+   if (!is_playing(user))
+      return false;
+   else
+      return user->stats->getMaster() != NULL;
 }
 
 bool dragon_fight(char *u)
 {
-  aClient *user;
-  if (!(user = find(u)))
-       return false;
-  else
-       return dragon_fight(user);
+   aClient *user;
+   if (!(user = find(u)))
+      return false;
+   else
+      return dragon_fight(user);
 }
 
 bool dragon_fight(aClient *user)
 {
-  if (!is_playing(user))
-       return false;
-  else
-       return (isDragonFight(user->stats));
+   if (!is_playing(user))
+      return false;
+   else
+      return (isDragonFight(user->stats));
 }
 
 bool alphaNumeric(const char *str)
 {
-  int len = strlen(str);
-  for (int x = 0; x < len; x++)
-       {
-         if (!((int(str[x]) >= 65 && int(str[x]) <= 90) || (int(str[x]) >= 97 && int(str[x]) <= 122) || (int(str[x]) >= 48 && int(str[x]) <= 57) || int(str[x]) == 95))
-               return false;
-       }
-  return true;
+   int len = strlen(str);
+   for (int x = 0; x < len; x++)
+   {
+      if (!((int(str[x]) >= 65 && int(str[x]) <= 90) || (int(str[x]) >= 97 && int(str[x]) <= 122) || (int(str[x]) >= 48 && int(str[x]) <= 57) || int(str[x]) == 95))
+      return false;
+   }
+   return true;
 }
 
 bool passcmp(const char *encrypted, char *plaintext)
 {
-  char salt[3];
-  char *plaintext2, *plainToencrypt;
-  bool same = false;
-  
-  plaintext2 = new char[strlen(encrypted) + strlen(plaintext)]; // Extra
-  strcpy(plaintext2, plaintext);
-  
-  salt[0] = encrypted[0];
-  salt[1] = encrypted[1];
-  salt[3] = '\0';
-  
-  plainToencrypt = crypt(plaintext2, salt);
-  
-  same = (strcmp((const char *)encrypted, plainToencrypt) == 0 ? true : false);
-  
-  delete []plaintext2;
-  
-  return same;
+   char salt[3];
+   char *plaintext2, *plainToencrypt;
+   bool same = false;
+
+   plaintext2 = new char[strlen(encrypted) + strlen(plaintext)]; // Extra
+   strcpy(plaintext2, plaintext);
+
+   salt[0] = encrypted[0];
+   salt[1] = encrypted[1];
+   salt[3] = '\0';
+
+   plainToencrypt = crypt(plaintext2, salt);
+
+   same = (strcmp((const char *)encrypted, plainToencrypt) == 0 ? true : false);
+
+   delete []plaintext2;
+
+   return same;
 }
 
 bool check_password(char *name, char *plaintext)
 {
-  Player *p;
-  
-  if (!(p = findplayer(name)))
-    return false;
-  else
-    {
+   Player *p;
+
+   if (!(p = findplayer(name)))
+      return false;
+   else
+   {
       return passcmp(p->getPassword().c_str(), plaintext);
-    }
+   }
 }
 
 bool timedOut(Player *p)
 {
-  if (!p)
-       return false;
-  else if (p->lastcommand == 0)
-       return false;
-  else
-    {
-         if ((time(NULL) - p->lastcommand) >= maxidletime)
-           return true;
-         
-         return false;
-    }
+   if (!p)
+      return false;
+   else if (p->lastcommand == 0)
+      eturn false;
+   else
+   {
+      if ((time(NULL) - p->lastcommand) >= maxidletime)
+         return true;
+
+      return false;
+   }
 }