void CSm3ReadMap::LoadFeatureData() { // returns MapFeatureInfo[GetNumFeatures()] std::string fd = GetMapDefParser().SGetValueDef(std::string(),"map\\featuredata"); if (!fd.empty()) { CFileHandler fh(fd); if (!fh.FileExists()) throw content_error("Failed to open feature data file: " + fd); unsigned char version; fh.Read(&version, 1); if (version > 0) throw content_error("Map feature data has incorrect version, you are probably using an outdated spring version."); unsigned int nf; fh.Read(&nf, 4); numFeatures = swabdword(nf); featureInfo = new MapFeatureInfo[numFeatures]; for (unsigned int a=0;a<numFeatures;a++) { MapFeatureInfo& fi = featureInfo[a]; fh.Read(&fi.featureType, 4); fh.Read(&fi.pos, 12); fh.Read(&fi.rotation, 4); fi.featureType = swabdword(fi.featureType); fi.pos.x = swabfloat(fi.pos.x); fi.pos.y = swabfloat(fi.pos.y); fi.pos.z = swabfloat(fi.pos.z); fi.rotation = swabfloat(fi.rotation); } }/* //testing features... else { featureTypes.push_back(new std::string("TreeType0")); numFeatures = 1000; featureInfo = new MapFeatureInfo[numFeatures]; for (int a=0;a<numFeatures;a++) { MapFeatureInfo& fi = featureInfo[a]; fi.featureType = featureTypes.size()-1; fi.pos.x = gs->randFloat() * width * SQUARE_SIZE; fi.pos.z = gs->randFloat() * height * SQUARE_SIZE; fi.rotation = 0.0f; } }*/ }
void TeamStatistics::swab() { metalUsed = swabfloat(metalUsed); energyUsed = swabfloat(energyUsed); metalProduced = swabfloat(metalProduced); energyProduced = swabfloat(energyProduced); metalExcess = swabfloat(metalExcess); energyExcess = swabfloat(energyExcess); metalReceived = swabfloat(metalReceived); energyReceived = swabfloat(energyReceived); metalSent = swabfloat(metalSent); energySent = swabfloat(energySent); damageDealt = swabfloat(damageDealt); damageReceived = swabfloat(damageReceived); unitsProduced = swabdword(unitsProduced); unitsDied = swabdword(unitsDied); unitsReceived = swabdword(unitsReceived); unitsSent = swabdword(unitsSent); unitsCaptured = swabdword(unitsCaptured); unitsOutCaptured = swabdword(unitsOutCaptured); unitsKilled = swabdword(unitsKilled); }