Beispiel #1
0
 function &getRace($race)
 {
     if (!isset($race)) {
         trigger_error("Someone did some sloppy coding, pick a race!", E_USER_ERROR);
         die("Are we still alive here? DIE ALREADY!");
     }
     $cleanedRace = clsRace::cleanRaceName($race);
     //check wether we need to load this race
     if (!isset($GLOBALS['obj' . $cleanedRace])) {
         $filepath = 'inc/races/' . $cleanedRace . '.php';
         $racefunction = 'create_' . $cleanedRace . '_object';
         if (!file_exists($filepath)) {
             trigger_error("Race not found: {$race}", E_USER_ERROR);
             die("Are we still alive here? DIE ALREADY!");
         }
         require_once $filepath;
         $GLOBALS['obj' . $cleanedRace] = $racefunction();
     }
     return $GLOBALS['obj' . $cleanedRace];
 }