* @return bool true if the place exists ; otherwise, false.
*
* @todo Handle alias
*/
functionexists(){
$db=$this->getDatabase();
$n=count($this->data);
//If not defined, it doesn't exist
if($n==0){
returnfalse;
}
//Checks global location
switch($this->data[0][0]){
case'B':
switch(strlen($this->data[0])){
case9:
if(!$place=Place::from_code($db,$this->data[0])){
returnfalse;
}
break;
case6:
$body=newBody($db,substr($this->data[0],1));
if($body->lastError){
returnfalse;
}
break;
default:
message_die(GENERAL_ERROR,"Invalid global location expression size: ".$this->data[0],"Location exists method",__LINE__,__FILE__);
}
break;
case'S':
$ship=newShip($db,substr($this->data[0],1));
if($ship->lastError){
returnfalse;
}
break;
default:
message_die(GENERAL_ERROR,"Invalid global location expression size: ".$this->data[0],"Location exists method",__LINE__,__FILE__);
returnfalse;
}
if($n>1){
if(!isset($place)){
message_die(GENERAL_ERROR,"Can't check if a local place exists for the following location: ".$this->data[0],"Location exists method",__LINE__,__FILE__);