Exemplo n.º 1
0
void CCmpPathfinder::Serialize(ISerializer& serialize)
{
	SerializeVector<SerializeLongRequest>()(serialize, "long requests", m_AsyncLongPathRequests);
	SerializeVector<SerializeShortRequest>()(serialize, "short requests", m_AsyncShortPathRequests);
	serialize.NumberU32_Unbounded("next ticket", m_NextAsyncTicket);
	serialize.NumberU16_Unbounded("same turn moves count", m_SameTurnMovesCount);
}
	virtual void Serialize(ISerializer& serialize)
	{
		// Because this is just graphical effects, and because it's all non-deterministic floating point,
		// we don't do much serialization here.
		// (That means projectiles will vanish if you save/load - is that okay?)
		
		// The attack code stores the id so that the projectile gets deleted when it hits the target
		serialize.NumberU32_Unbounded("next id", m_NextId);
	}
Exemplo n.º 3
0
	virtual void Serialize(ISerializer& serialize)
	{
		serialize.Bool("in world", m_InWorld);
		if (m_InWorld)
		{
			serialize.NumberFixed_Unbounded("x", m_X);
			serialize.NumberFixed_Unbounded("y", m_Y);
			serialize.NumberFixed_Unbounded("z", m_Z);
			serialize.NumberFixed_Unbounded("last x", m_LastX);
			serialize.NumberFixed_Unbounded("last y diff", m_LastYDifference);
			serialize.NumberFixed_Unbounded("last z", m_LastZ);
		}
		serialize.NumberI32_Unbounded("territory", m_Territory);
		serialize.NumberFixed_Unbounded("rot x", m_RotX);
		serialize.NumberFixed_Unbounded("rot y", m_RotY);
		serialize.NumberFixed_Unbounded("rot z", m_RotZ);
		serialize.NumberFixed_Unbounded("altitude", m_Y);
		serialize.Bool("relative", m_RelativeToGround);
		serialize.Bool("floating", m_Floating);
		serialize.NumberFixed_Unbounded("constructionprogress", m_ConstructionProgress);

		if (serialize.IsDebug())
		{
			const char* anchor = "???";
			switch (m_AnchorType)
			{
			case PITCH:
				anchor = "pitch";
				break;

			case PITCH_ROLL:
				anchor = "pitch-roll";
				break;

			case ROLL:
				anchor = "roll";
				break;

			case UPRIGHT: // upright is the default
			default:
				anchor = "upright";
				break;
			}
			serialize.StringASCII("anchor", anchor, 0, 16);
		}
		serialize.NumberU32_Unbounded("turret parent", m_TurretParent);
		if (m_TurretParent != INVALID_ENTITY)
		{
			serialize.NumberFixed_Unbounded("x", m_TurretPosition.X);
			serialize.NumberFixed_Unbounded("y", m_TurretPosition.Y);
			serialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
		}
	}
Exemplo n.º 4
0
	virtual void Serialize(ISerializer& serialize)
	{
		JSContext* cx = GetSimContext().GetScriptInterface().GetContext();
		JSAutoRequest rq(cx);

		serialize.NumberU32_Unbounded("num commands", (u32)m_LocalQueue.size());
		for (size_t i = 0; i < m_LocalQueue.size(); ++i)
		{
			serialize.NumberI32_Unbounded("player", m_LocalQueue[i].player);
			serialize.ScriptVal("data", &m_LocalQueue[i].data);
		}
	}
Exemplo n.º 5
0
    virtual void Serialize(ISerializer& serialize)
    {
        size_t count = 0;

        for (std::map<entity_id_t, std::string>::const_iterator it = m_LatestTemplates.begin(); it != m_LatestTemplates.end(); ++it)
        {
            if (ENTITY_IS_LOCAL(it->first))
                continue;
            ++count;
        }
        serialize.NumberU32_Unbounded("num entities", (u32)count);

        for (std::map<entity_id_t, std::string>::const_iterator it = m_LatestTemplates.begin(); it != m_LatestTemplates.end(); ++it)
        {
            if (ENTITY_IS_LOCAL(it->first))
                continue;
            serialize.NumberU32_Unbounded("id", it->first);
            serialize.StringASCII("template", it->second, 0, 256);
        }
        // TODO: maybe we should do some kind of interning thing instead of printing so many strings?

        // TODO: will need to serialize techs too, because we need to be giving out
        // template data before other components (like the tech components) have been deserialized
    }