예제 #1
0
파일: InMapDraw.cpp 프로젝트: eXLabT/spring
void SerializeColor(creg::ISerializer &s, unsigned char **color)
{
	if (s.IsWriting()) {
		char ColorType = 0;
		char ColorId = 0;
		if (!ColorType)
			for (int a = 0; a < teamHandler->ActiveTeams(); ++a)
				if (*color==teamHandler->Team(a)->color) {
					ColorType = 1;
					ColorId = a;
					break;
				}
		s.Serialize(&ColorId,sizeof(ColorId));
		s.Serialize(&ColorType,sizeof(ColorType));
	} else {
		char ColorType;
		char ColorId;
		s.Serialize(&ColorId,sizeof(ColorId));
		s.Serialize(&ColorType,sizeof(ColorType));
		switch (ColorType) {
			case 0:{
				*color = DefaultColor;
				break;
			}
			case 1:{
				*color = teamHandler->Team(ColorId)->color;
				break;
			}
		}
	}
}
예제 #2
0
void CPieceProjectile::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(numCallback, sizeof(int));
	for (int i = 0; i < 8; i++) {
		s.Serialize(oldInfos[i], sizeof(CPieceProjectile::OldInfo));
	}
}
예제 #3
0
void SerializeColor(creg::ISerializer &s, unsigned char **color)
{
	if (s.IsWriting()) {
		char ColorType = 0;
		char ColorId = 0;
		if (!ColorType) for (int a=0;a<MAX_TEAMS;a++) 
			if (*color==gs->Team(a)->color) {
				ColorType = 1;
				ColorId = a;
				break;
			}
		s.Serialize(&ColorId,sizeof(ColorId));
		s.Serialize(&ColorType,sizeof(ColorType));
	} else {
		char ColorType;
		char ColorId;
		s.Serialize(&ColorId,sizeof(ColorId));
		s.Serialize(&ColorType,sizeof(ColorType));
		switch (ColorType) {
			case 0:{
				*color = DefaultColor;
				break;
			}
			case 1:{
				*color = gs->Team(ColorId)->color;
				break;
			}
		}
	}
}
예제 #4
0
void CStarburstProjectile::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(numCallback, sizeof(int));
	// NOTE This could be tricky if gs is serialized after losHandler.
	for (int a = 0; a < 5; ++a) {
		s.Serialize(oldInfos[a],sizeof(struct CStarburstProjectile::OldInfo));
	}
}
예제 #5
0
void CLosHandler::creg_Serialize(creg::ISerializer& s)
{
	// NOTE This could be tricky if gs is serialized after losHandler.
	for (int a = 0; a < gs->activeAllyTeams; ++a) {
		s.Serialize(losMap[a], losSizeX*losSizeY*2);
		s.Serialize(airLosMap[a], airSizeX*airSizeY*2);
	}
}
static void SerializeString(creg::ISerializer& s, std::string& str)
{
	unsigned short size = (unsigned short)str.length();
	s.Serialize(&size,2);

	if (!s.IsWriting())
		str.resize(size);

	s.Serialize(&str[0], size);
}
예제 #7
0
void spring_time::Serialize(creg::ISerializer& s)
{
    if (s.IsWriting()) {
        int y = spring_tomsecs(*this - spring_gettime());
        s.SerializeInt(&y, 4);
    } else {
        int y;
        s.SerializeInt(&y, 4);
        *this = *this + spring_msecs(y);
    }
}
예제 #8
0
파일: QuadField.cpp 프로젝트: achoum/spring
void CQuadField::Serialize(creg::ISerializer& s)
{
	// no need to alloc quad array, this has already been done in constructor
	for (int z = 0; z < numQuadsZ; ++z)
		for (int x = 0; x < numQuadsX; ++x)
			s.SerializeObjectInstance(&baseQuads[z*numQuadsX+x], Quad::StaticClass());
}
예제 #9
0
void CStarburstProjectile::creg_Serialize(creg::ISerializer& s)
{
    // NOTE This could be tricky if gs is serialized after losHandler.
    for (int a = 0; a < NUM_TRACER_PARTS; ++a) {
        s.Serialize(&tracerParts[a], sizeof(struct CStarburstProjectile::TracerPart));
    }
}
예제 #10
0
void CRadarHandler::creg_Serialize(creg::ISerializer& s)
{
	const int size = xsize*ysize*2;

	// NOTE This could be tricky if gs is serialized after radarHandler.
	for(int a = 0; a < gs->activeAllyTeams; ++a) {
		s.Serialize(radarMaps[a], size);
		if (!circularRadar)
			s.Serialize(airRadarMaps[a], size);
		s.Serialize(sonarMaps[a], size);
		s.Serialize(jammerMaps[a], size);
		s.Serialize(seismicMaps[a], size);
	}
	s.Serialize(commonJammerMap, size);
	s.Serialize(commonSonarJammerMap, size);
}
예제 #11
0
void CMuzzleFlame::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(randSmokeDir, numSmoke*sizeof(float3));
}
void CGameStateCollector::Serialize(creg::ISerializer& s)
{
	// GetClass() works because readmap and uh both have to exist already
	s.SerializeObjectInstance(gs, gs->GetClass());
	s.SerializeObjectInstance(gu, gu->GetClass());
	s.SerializeObjectInstance(game, game->GetClass());
	s.SerializeObjectInstance(readmap, readmap->GetClass());
	s.SerializeObjectInstance(qf, qf->GetClass());
	s.SerializeObjectInstance(featureHandler, featureHandler->GetClass());
	s.SerializeObjectInstance(loshandler, loshandler->GetClass());
	s.SerializeObjectInstance(radarhandler, radarhandler->GetClass());
	s.SerializeObjectInstance(airBaseHandler, airBaseHandler->GetClass());
	s.SerializeObjectInstance(&interceptHandler, interceptHandler.GetClass());
	s.SerializeObjectInstance(CCategoryHandler::Instance(), CCategoryHandler::Instance()->GetClass());
	s.SerializeObjectInstance(uh, uh->GetClass());
	s.SerializeObjectInstance(ph, ph->GetClass());
//	std::map<std::string, int> unitRestrictions;
	s.SerializeObjectInstance(&waitCommandsAI, waitCommandsAI.GetClass());
	s.SerializeObjectInstance(&wind, wind.GetClass());
	s.SerializeObjectInstance(inMapDrawer,inMapDrawer->GetClass());
	for (int a=0;a<MAX_TEAMS;a++)
		s.SerializeObjectInstance(grouphandlers[a], grouphandlers[a]->GetClass());
	s.SerializeObjectInstance(globalAI, globalAI->GetClass());
	s.SerializeObjectInstance(&CBuilderCAI::reclaimers,CBuilderCAI::reclaimers.GetClass());
//	s.Serialize()
}
void CGameStateCollector::Serialize(creg::ISerializer& s)
{
    // GetClass() works because readmap and uh both have to exist already
    s.SerializeObjectInstance(gs, gs->GetClass());
    s.SerializeObjectInstance(gu, gu->GetClass());
    s.SerializeObjectInstance(game, game->GetClass());
    s.SerializeObjectInstance(readmap, readmap->GetClass());
    s.SerializeObjectInstance(qf, qf->GetClass());
    s.SerializeObjectInstance(featureHandler, featureHandler->GetClass());
    s.SerializeObjectInstance(loshandler, loshandler->GetClass());
    s.SerializeObjectInstance(radarhandler, radarhandler->GetClass());
    s.SerializeObjectInstance(airBaseHandler, airBaseHandler->GetClass());
    s.SerializeObjectInstance(&interceptHandler, interceptHandler.GetClass());
    s.SerializeObjectInstance(CCategoryHandler::Instance(), CCategoryHandler::Instance()->GetClass());
    s.SerializeObjectInstance(uh, uh->GetClass());
    s.SerializeObjectInstance(ph, ph->GetClass());
//	std::map<std::string, int> unitRestrictions;
    s.SerializeObjectInstance(&waitCommandsAI, waitCommandsAI.GetClass());
    s.SerializeObjectInstance(&wind, wind.GetClass());
    s.SerializeObjectInstance(inMapDrawerModel, inMapDrawerModel->GetClass());
    for (int a=0; a < teamHandler->ActiveTeams(); a++) {
        s.SerializeObjectInstance(grouphandlers[a], grouphandlers[a]->GetClass());
    }
    s.SerializeObjectInstance(eoh, eoh->GetClass());
//	s.Serialize()
}
예제 #14
0
void springLegacyAI::DamageArray::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(damages, numTypes * sizeof(damages[0]));
}
예제 #15
0
void DamageArray::creg_Serialize(creg::ISerializer& s)
{
	s.Serialize(damages, numTypes * sizeof(damages[0]));
}