コード例 #1
0
ファイル: SlayerCorpse.cpp プロジェクト: hillwah/darkeden
SlayerCorpse::SlayerCorpse (Slayer* pSlayer)
	throw(Error)
{
	__BEGIN_TRY

	Assert(pSlayer != NULL);

	m_SlayerInfo = pSlayer->getSlayerInfo3();
	setObjectID(m_SlayerInfo.getObjectID());

	__END_CATCH
}
コード例 #2
0
ファイル: tt_db_object.C プロジェクト: juddy/edcde
bool_t _Tt_db_object::isObjectInDatabase (bool_t force)
{
  _Tt_string forward_pointer;

  if ((!checkedDatabase || force) && dbObjectHostname.len()) {
    // Get the DB connection for this objects DB host
    dbObjectDatabase = dbHostnameGlobalMapRef.getDB(dbObjectHostname,
						    dbObjectHostname,
						    dbResults);
    if (!dbObjectDatabase.is_null()) {
      setCurrentDBAccess();

      // See if the object is in the actual database and also check for
      // a forward pointer
      _Tt_string forward_pointer;
      dbResults = dbObjectDatabase->isObjectInDatabase(dbObjectID,
						       forward_pointer);
    }

    // Either a failure or a forward pointer...
    if (dbResults != TT_DB_OK) {
      if (dbResults == TT_DB_ERR_NO_SUCH_OBJECT) {
        dbHostnameGlobalMapRef.removeDB(dbObjectHostname);
        dbObjectDatabase = (_Tt_db_client *)NULL;
	dbResults = TT_DB_OK;
      }
      else if (dbResults == TT_DB_WRN_FORWARD_POINTER) {
	// Change this objects ID to the forward pointer.  The "setObjectID"
	// member function will call "isObjectInDatabase" again and the
	// forward pointer chain will eventually resolve to the final
	// resting place of the object.
	dbResults = setObjectID(forward_pointer);
	forwardPointerFlag = TRUE;
      }
    }

    checkedDatabase = TRUE;
  }

  return (dbObjectDatabase.is_null() ? FALSE : TRUE);
}
コード例 #3
0
ファイル: gffstructs.cpp プロジェクト: Hellzed/xoreos
void GFFVariable::read(const GFFStruct &strct, Common::UString &name) {
	clear();

	name = strct.getString("Name");

	Type type = (Type) strct.getUint("Type", kTypeNone);
	if ((type <= kTypeNone) || (type > kTypeLocation))
		throw Common::Exception("GFFVariable::read(): Unknown variable type %d", _type);

	if        (type == kTypeInt     ) {
		setInt(strct.getSint("Value"));
	} else if (type == kTypeFloat   ) {
		setFloat(strct.getDouble("Value"));
	} else if (type == kTypeString  ) {
		setString(strct.getString("Value"));
	} else if (type == kTypeObjectID) {
		setObjectID(strct.getUint("Value"));
	} else if (type == kTypeLocation) {
		_type = kTypeLocation;
		_value.typeLocation = new GFFLocation();
		_value.typeLocation->read(strct.getStruct("Value"));
	}

}
コード例 #4
0
void LLPreviewGesture::init(const LLUUID& item_id, const LLUUID& object_id)
{
	// Sets ID and adds to instance list
	setItemID(item_id);
	setObjectID(object_id);
}
コード例 #5
0
ファイル: CGUIService.cpp プロジェクト: tonyhu1983/Cobra2d
CGuiService::CGuiService(void)
{
	setObjectID(SERVICE_GUI);
	setObjType(COBRA_SERVICES);
}
コード例 #6
0
ファイル: tt_db_object.C プロジェクト: juddy/edcde
_Tt_string _Tt_db_object::move (const _Tt_string &new_file)
{
  _Tt_string new_objid;

  if (!new_file.len()) {
    dbResults = TT_DB_ERR_ILLEGAL_FILE;
    return new_objid;
  }

  if (isObjectInDatabase()) {
    dbObjectFile = getFile();

    _Tt_string new_local_file;
    _Tt_string new_hostname;
    _Tt_string new_partition;
    _Tt_string new_file_network_path;
    dbResults = _tt_db_network_path(new_file,
	                            new_local_file,
	                            new_hostname,
		                    new_partition,
	                            new_file_network_path);

    // If we're not moving to the exact same file
    if (dbObjectFile != new_file_network_path) {
      new_objid = makeEquivalentObjectID(new_hostname, new_partition);

      if ((dbResults == TT_DB_OK) && new_objid.len()) {
	// If the objids are still the same, we only need to change the
	// object's file in the database...
	if (dbObjectID == new_objid) {
	  dbResults = dbObjectDatabase->setObjectFile(dbObjectID,
						      new_file_network_path);

	  if (dbResults == TT_DB_OK) {
	    dbResults = TT_DB_WRN_SAME_OBJECT_ID;
	  }
	}
	// Different objids and therefore different partitions or hosts
	else {
	  _Tt_db_object_ptr new_object = new _Tt_db_object;
	  dbResults = new_object->setObjectID(new_objid);

	  // The new object should not exist, yet...
	  if (dbResults == TT_DB_ERR_NO_SUCH_OBJECT) {
	    new_object->dbObjectHostname = new_hostname;
	    new_object->dbObjectFile = new_file_network_path;

	    // Refresh the current object's info
	    dbResults = internalRefresh();
	    if (dbResults == TT_DB_OK) {
	      (void)new_object->setAccess(dbObjectAccess);
	      (void)new_object->setProperties(dbObjectProperties);
	      (void)new_object->setType(dbObjectType);
	      dbResults = new_object->write();
	    }
	  }
	  // If the new object already exists, then there is something
	  // weird going on...
	  else if (dbResults == TT_DB_OK) {
	    dbResults = TT_DB_ERR_CORRUPT_DB;
	  }

	  if (dbResults == TT_DB_OK) {
	    // Remove current object from the DB and specify the new objid
	    // as the forward pointer.
	    dbResults = remove(new_objid);

	    if (dbResults == TT_DB_OK) {
	      setTtDBObjectDefaults();
	      dbResults = setObjectID(new_objid);
	    }
	  }
	}
      }
      else {
	if (dbResults == TT_DB_OK) {
	  dbResults = TT_DB_ERR_ILLEGAL_OBJECT;
	}
      }
    }
    else {
      dbResults = TT_DB_ERR_SAME_OBJECT;
    }
  }
  else {
    dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
  }

  dbResults = processDBResults();
  return new_objid;
}