void PlanetProxyObject::sendAddProxy(uint32 proxyServer)
{
	if (ConfigPlanetServer::getLogObjectLoading())
		LOG("ObjectLoading",("Gameserver %lu needs a proxy of object %s",proxyServer,m_objectId.getValueString().c_str()));
	if (isAuthorityClean())
	{
		LoadObjectMessage const loadMsg(getObjectId(), proxyServer);
		PlanetServer::getInstance().sendToGameServer(m_authoritativeServer, loadMsg);
	}
	else
	{
		LoadObjectMessage * const loadMsg = new LoadObjectMessage(getObjectId(), proxyServer);
		PlanetServer::getInstance().queueMessageForObject(getObjectId(), loadMsg);
	}
}
void PlanetProxyObject::sendRemoveProxy(uint32 proxyServer)
{
	if (ConfigPlanetServer::getLogObjectLoading())
		LOG("ObjectLoading",("Gameserver %lu no longer needs a proxy of object %s",proxyServer,m_objectId.getValueString().c_str()));
	if (isAuthorityClean())
	{
		UnloadProxyMessage msg(getObjectId(),proxyServer);
		PlanetServer::getInstance().sendToGameServer(m_authoritativeServer, msg);
	}
	else
	{
		UnloadProxyMessage *msg = new UnloadProxyMessage(getObjectId(),proxyServer);
		PlanetServer::getInstance().queueMessageForObject(getObjectId(), msg);
	}
}
Example #3
0
/**
 * Called when the JavaObject is invoked as a function.
 * We ignore the JSObject* argument, which is the 'this' context, which is
 * usually the window object. The JavaObject instance is in argv[-2].
 *
 * Returns a JS array, with the first element being a boolean indicating that
 * an exception occured, and the second element is either the return value or
 * the exception which was thrown.  In this case, we always return false and
 * raise the exception ourselves.
 */
JSBool JavaObject::call(JSContext* ctx, JSObject*, uintN argc, jsval* argv,
    jsval* rval) {
  // Get the JavaObject called as a function
  JSObject* obj = JSVAL_TO_OBJECT(argv[-2]);
  if (argc < 2 || !JSVAL_IS_INT(argv[0]) ||
#ifdef JSVAL_IS_OBJECT
  !JSVAL_IS_OBJECT(argv[1])) {
#else
    (JSVAL_IS_PRIMITIVE(argv[1]) && !JSVAL_IS_NULL(argv[1]))) {
#endif
    Debug::log(Debug::Error) << "JavaObject::call incorrect arguments" << Debug::flush;
    return JS_FALSE;
  }
  int dispId = JSVAL_TO_INT(argv[0]);
  if (Debug::level(Debug::Spam)) {
    Debug::DebugStream& dbg = Debug::log(Debug::Spam) << "JavaObject::call oid="
        << JavaObject::getObjectId(ctx, obj) << ",dispId=" << dispId << " (";
    for (unsigned i = 2; i < argc; ++i) {
      if (i > 2) {
        dbg << ", ";
      }
      dbg << dumpJsVal(ctx, argv[i]);
    }
    dbg << ")" << Debug::flush;
  }

  SessionData* data = JavaObject::getSessionData(ctx, obj);
  if (!data) {
    *rval = JSVAL_VOID;
    return JS_TRUE;
  }
  Debug::log(Debug::Spam) << "Data = " << data << Debug::flush;

  gwt::Value javaThis;
  if (!JSVAL_IS_NULL(argv[1])) {
    JSObject* thisObj = JSVAL_TO_OBJECT(argv[1]);
    if (isJavaObject(ctx, thisObj)) {
      javaThis.setJavaObject(getObjectId(ctx, thisObj));
    } else {
      data->makeValueFromJsval(javaThis, ctx, argv[1]);
    }
  } else {
    int oid = getObjectId(ctx, obj);
    javaThis.setJavaObject(oid);
  }
  return invokeJava(ctx, data, javaThis, dispId, argc - 2, &argv[2], rval);
}
void PlanetProxyObject::sendAuthorityChange(uint32 currentAuthServer, uint32 newAuthServer, bool handlingCrash)
{
	DEBUG_WARNING(!isAuthorityClean(), ("Object %s attempted to change authority before previous authority change was complete.",getObjectId().getValueString().c_str()));

	SetAuthoritativeMessage const auth(getObjectId(), newAuthServer, false, handlingCrash, NetworkId::cms_invalid, Transform::identity, false);
	PlanetServer::getInstance().sendToGameServer(currentAuthServer, auth);
	m_authTransferTimeMs = Clock::timeMs();
}
Example #5
0
void ObjectGroup::draw(cv::Mat& image)
{
	
	if(getContext()->getDrawingFlags()->mDrawBoundingBox)
	{
		cv::Rect_<float> r = mModel->getLastBoundingBox();

		cv::rectangle(image, r, getColor(), 2);

		cv::rectangle(image, cv::Rect_<float>(r.x - 5, r.y - 7, 12*getObjectId().size(), 14), cv::Scalar(0,0,0), CV_FILLED);
		cv::putText(image, getObjectId(), cv::Point(r.x-5, r.y+4), cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(255,255,255),1,8, false);

		std::string stateStr = getStateRepresentativeString(getState());
		cv::Point startPt(r.x-5, r.height+r.y);
		cv::rectangle(image, cv::Rect_<float>(startPt.x, startPt.y-12, 12*stateStr.size(), 14), cv::Scalar(0,0,0), CV_FILLED);
		cv::putText(image, stateStr, startPt, cv::FONT_HERSHEY_DUPLEX, 0.5, cv::Scalar(255,255,255),1,8, false);
	}

	//We don't want to show the Centroid of the blob
	/*if(getContext()->getDrawingFlags()->mDrawCentroid)
	{
		const std::map<int, Blob>& blobs = mModel->getBlobs();
		if(blobs.size() > 1)
		{
			auto it = blobs.begin();
			cv::Point2f lastPt = it->second.getCentroid();
			++it;
			for(; it != blobs.end(); ++it)
			{
				cv::Point2f currentPt = it->second.getCentroid();
				cv::line(image, lastPt, currentPt, getColor(), 3);
				lastPt = currentPt;
			}
		}
	}*/
	for(auto objectIt = mObjectList.begin(); objectIt != mObjectList.end(); ++objectIt)	
		(*objectIt)->draw(image);
	
}
void AiLocation::pack(Archive::ByteStream & target) const
{
	Archive::put(target, m_valid);
	Archive::put(target, m_attached);
	Archive::put(target, m_relativeOffset);
	Archive::put(target, m_hasChanged);
	Archive::put(target, m_cuttable);
	Archive::put(target, m_debugId);
	Archive::put(target, m_radius);

	if (getObjectId() != NetworkId::cms_invalid)
	{
		if (getOffset() == Vector::zero)
		{
			Archive::put(target, static_cast<uint8>(AiLocationArchive::ALP_Object));
			Archive::put(target, getObjectId());
		}
		else
		{
			Archive::put(target, static_cast<uint8>(AiLocationArchive::ALP_OffsetObject));
			Archive::put(target, getObjectId());
			Archive::put(target, getOffset());
		}
	}
	else if (getCellId() != NetworkId::cms_invalid)
	{
		Archive::put(target, static_cast<uint8>(AiLocationArchive::ALP_Cell));
		Archive::put(target, getCellId());
		Archive::put(target, getPosition_p());
	}
	else
	{
		Archive::put(target, static_cast<uint8>(AiLocationArchive::ALP_World));
		Archive::put(target, getPosition_w());
	}
}
Example #7
0
JSBool JavaObject::toString(JSContext* ctx, JSObject* obj, uintN argc,
    jsval* argv, jsval* rval) {
  SessionData* data = JavaObject::getSessionData(ctx, obj);
  if (!data) {
    *rval = JSVAL_VOID;
    return JS_TRUE;
  }
  int oid = getObjectId(ctx, obj);
  Debug::log(Debug::Spam) << "JavaObject::toString(id=" << oid << ")"
      << Debug::flush;
  Value javaThis;
  javaThis.setJavaObject(oid);
  // we ignore any supplied parameters
  return invokeJava(ctx, data, javaThis, InvokeMessage::TOSTRING_DISP_ID, 0,
      NULL, rval);
}
 EventDataPtr ObjectRemovedEventData::copy() const {
     return EventDataPtr(new ObjectRemovedEventData(getObjectId()));
 }
Example #9
0
int PathFinder::getObjId() {
    return getObjectId();
}