- bugfixes for load / save game for in progress joining

This commit is contained in:
Mark Vejvoda 2013-02-19 06:41:56 +00:00
parent 69925fb887
commit 8916a86b8c
20 changed files with 146 additions and 118 deletions

View File

@ -1505,7 +1505,7 @@ void PathFinder::saveGame(XmlNode *rootNode) {
int prevIdx = findNodeIndex(curNode->prev, factionState.nodePool); int prevIdx = findNodeIndex(curNode->prev, factionState.nodePool);
nodePoolNode->addAttribute("prev",intToStr(prevIdx), mapTagReplacements); nodePoolNode->addAttribute("prev",intToStr(prevIdx), mapTagReplacements);
// float heuristic; // float heuristic;
nodePoolNode->addAttribute("heuristic",floatToStr(curNode->heuristic), mapTagReplacements); nodePoolNode->addAttribute("heuristic",floatToStr(curNode->heuristic,16), mapTagReplacements);
// bool exploredCell; // bool exploredCell;
nodePoolNode->addAttribute("exploredCell",intToStr(curNode->exploredCell), mapTagReplacements); nodePoolNode->addAttribute("exploredCell",intToStr(curNode->exploredCell), mapTagReplacements);
} }

View File

@ -5633,7 +5633,7 @@ string Game::saveGame(string name, string path) {
//bool showFullConsole; //bool showFullConsole;
//bool mouseMoved; //bool mouseMoved;
//float scrollSpeed; //float scrollSpeed;
gameNode->addAttribute("scrollSpeed",floatToStr(scrollSpeed), mapTagReplacements); gameNode->addAttribute("scrollSpeed",floatToStr(scrollSpeed,16), mapTagReplacements);
//bool camLeftButtonDown; //bool camLeftButtonDown;
//bool camRightButtonDown; //bool camRightButtonDown;
//bool camUpButtonDown; //bool camUpButtonDown;
@ -5727,8 +5727,8 @@ string Game::saveGame(string name, string path) {
HighlightSpecialUnitInfo &info = iterMap->second; HighlightSpecialUnitInfo &info = iterMap->second;
XmlNode *infoNode = unitHighlightListNode->addChild("info"); XmlNode *infoNode = unitHighlightListNode->addChild("info");
infoNode->addAttribute("unitid",intToStr(iterMap->first), mapTagReplacements); infoNode->addAttribute("unitid",intToStr(iterMap->first), mapTagReplacements);
infoNode->addAttribute("radius",floatToStr(info.radius), mapTagReplacements); infoNode->addAttribute("radius",floatToStr(info.radius,16), mapTagReplacements);
infoNode->addAttribute("thickness",floatToStr(info.thickness), mapTagReplacements); infoNode->addAttribute("thickness",floatToStr(info.thickness,16), mapTagReplacements);
infoNode->addAttribute("color",info.color.getString(), mapTagReplacements); infoNode->addAttribute("color",info.color.getString(), mapTagReplacements);
} }
@ -5843,6 +5843,9 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode,cons
XmlNode *guiNode = gameNode->getChild("Gui"); XmlNode *guiNode = gameNode->getChild("Gui");
XmlNode *selectionNode = guiNode->getChild("Selection"); XmlNode *selectionNode = guiNode->getChild("Selection");
XmlNode *statsNode = worldNode->getChild("Stats"); XmlNode *statsNode = worldNode->getChild("Stats");
XmlNode *minimapNode = worldNode->getChild("Minimap");
// This is explored fog of war for the host player, clear it
minimapNode->clearChild("fowPixmap1");
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
NetworkRole role = networkManager.getNetworkRole(); NetworkRole role = networkManager.getNetworkRole();

View File

@ -457,18 +457,18 @@ void GameCamera::saveGame(XmlNode *rootNode) {
gamecameraNode->addAttribute("destPos",destPos.getString(), mapTagReplacements); gamecameraNode->addAttribute("destPos",destPos.getString(), mapTagReplacements);
// //
// float hAng; //YZ plane positive -Z axis // float hAng; //YZ plane positive -Z axis
gamecameraNode->addAttribute("hAng",floatToStr(hAng), mapTagReplacements); gamecameraNode->addAttribute("hAng",floatToStr(hAng,16), mapTagReplacements);
// float vAng; //XZ plane positive +Z axis // float vAng; //XZ plane positive +Z axis
gamecameraNode->addAttribute("vAng",floatToStr(vAng), mapTagReplacements); gamecameraNode->addAttribute("vAng",floatToStr(vAng,16), mapTagReplacements);
// float lastHAng; // float lastHAng;
gamecameraNode->addAttribute("lastHAng",floatToStr(lastHAng), mapTagReplacements); gamecameraNode->addAttribute("lastHAng",floatToStr(lastHAng,16), mapTagReplacements);
// float lastVAng; // float lastVAng;
gamecameraNode->addAttribute("lastVAng",floatToStr(lastVAng), mapTagReplacements); gamecameraNode->addAttribute("lastVAng",floatToStr(lastVAng,16), mapTagReplacements);
// Vec2f destAng; // Vec2f destAng;
gamecameraNode->addAttribute("destAng",destAng.getString(), mapTagReplacements); gamecameraNode->addAttribute("destAng",destAng.getString(), mapTagReplacements);
// float rotate; // float rotate;
gamecameraNode->addAttribute("rotate",floatToStr(rotate), mapTagReplacements); gamecameraNode->addAttribute("rotate",floatToStr(rotate,16), mapTagReplacements);
// Vec3f move; // Vec3f move;
gamecameraNode->addAttribute("move",move.getString(), mapTagReplacements); gamecameraNode->addAttribute("move",move.getString(), mapTagReplacements);
// State state; // State state;
@ -479,24 +479,24 @@ void GameCamera::saveGame(XmlNode *rootNode) {
gamecameraNode->addAttribute("limitY",intToStr(limitY), mapTagReplacements); gamecameraNode->addAttribute("limitY",intToStr(limitY), mapTagReplacements);
// //config // //config
// float speed; // float speed;
gamecameraNode->addAttribute("speed",floatToStr(speed), mapTagReplacements); gamecameraNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements);
// bool clampBounds; // bool clampBounds;
gamecameraNode->addAttribute("clampBounds",intToStr(clampBounds), mapTagReplacements); gamecameraNode->addAttribute("clampBounds",intToStr(clampBounds), mapTagReplacements);
// //float maxRenderDistance; // //float maxRenderDistance;
// float maxHeight; // float maxHeight;
gamecameraNode->addAttribute("maxHeight",floatToStr(maxHeight), mapTagReplacements); gamecameraNode->addAttribute("maxHeight",floatToStr(maxHeight,16), mapTagReplacements);
// float minHeight; // float minHeight;
gamecameraNode->addAttribute("minHeight",floatToStr(minHeight), mapTagReplacements); gamecameraNode->addAttribute("minHeight",floatToStr(minHeight,16), mapTagReplacements);
// //float maxCameraDist; // //float maxCameraDist;
// //float minCameraDist; // //float minCameraDist;
// float minVAng; // float minVAng;
gamecameraNode->addAttribute("minVAng",floatToStr(minVAng), mapTagReplacements); gamecameraNode->addAttribute("minVAng",floatToStr(minVAng,16), mapTagReplacements);
// float maxVAng; // float maxVAng;
gamecameraNode->addAttribute("maxVAng",floatToStr(maxVAng), mapTagReplacements); gamecameraNode->addAttribute("maxVAng",floatToStr(maxVAng,16), mapTagReplacements);
// float fov; // float fov;
gamecameraNode->addAttribute("fov",floatToStr(fov), mapTagReplacements); gamecameraNode->addAttribute("fov",floatToStr(fov,16), mapTagReplacements);
// float calculatedDefault; // float calculatedDefault;
gamecameraNode->addAttribute("calculatedDefault",floatToStr(calculatedDefault), mapTagReplacements); gamecameraNode->addAttribute("calculatedDefault",floatToStr(calculatedDefault,16), mapTagReplacements);
// std::map<float, std::map<float, std::map<Vec3f, Quad2i> > > cacheVisibleQuad; // std::map<float, std::map<float, std::map<Vec3f, Quad2i> > > cacheVisibleQuad;
// int MaxVisibleQuadItemCache; // int MaxVisibleQuadItemCache;
gamecameraNode->addAttribute("MaxVisibleQuadItemCache",intToStr(MaxVisibleQuadItemCache), mapTagReplacements); gamecameraNode->addAttribute("MaxVisibleQuadItemCache",intToStr(MaxVisibleQuadItemCache), mapTagReplacements);

View File

@ -179,7 +179,7 @@ void Stats::saveGame(XmlNode *rootNode) {
// ControlType control; // ControlType control;
statsNodePlayer->addAttribute("control",intToStr(stat.control), mapTagReplacements); statsNodePlayer->addAttribute("control",intToStr(stat.control), mapTagReplacements);
// float resourceMultiplier; // float resourceMultiplier;
statsNodePlayer->addAttribute("resourceMultiplier",floatToStr(stat.resourceMultiplier), mapTagReplacements); statsNodePlayer->addAttribute("resourceMultiplier",floatToStr(stat.resourceMultiplier,16), mapTagReplacements);
// string factionTypeName; // string factionTypeName;
statsNodePlayer->addAttribute("factionTypeName",stat.factionTypeName, mapTagReplacements); statsNodePlayer->addAttribute("factionTypeName",stat.factionTypeName, mapTagReplacements);
// FactionPersonalityType personalityType; // FactionPersonalityType personalityType;
@ -211,7 +211,7 @@ void Stats::saveGame(XmlNode *rootNode) {
statsNode->addAttribute("thisFactionIndex",intToStr(thisFactionIndex), mapTagReplacements); statsNode->addAttribute("thisFactionIndex",intToStr(thisFactionIndex), mapTagReplacements);
// //
// float worldTimeElapsed; // float worldTimeElapsed;
statsNode->addAttribute("worldTimeElapsed",floatToStr(worldTimeElapsed), mapTagReplacements); statsNode->addAttribute("worldTimeElapsed",floatToStr(worldTimeElapsed,16), mapTagReplacements);
// int framesPlayed; // int framesPlayed;
statsNode->addAttribute("framesPlayed",intToStr(framesPlayed), mapTagReplacements); statsNode->addAttribute("framesPlayed",intToStr(framesPlayed), mapTagReplacements);
// int framesToCalculatePlaytime; // int framesToCalculatePlaytime;

View File

@ -316,7 +316,7 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) {
// Texture2D *texture; // Texture2D *texture;
// Model *model; // Model *model;
// float modelCycle; // float modelCycle;
particleSystemTypeNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements); particleSystemTypeNode->addAttribute("modelCycle",floatToStr(modelCycle,16), mapTagReplacements);
// string primitive; // string primitive;
particleSystemTypeNode->addAttribute("primitive",primitive, mapTagReplacements); particleSystemTypeNode->addAttribute("primitive",primitive, mapTagReplacements);
// Vec3f offset; // Vec3f offset;
@ -326,15 +326,15 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) {
// Vec4f colorNoEnergy; // Vec4f colorNoEnergy;
particleSystemTypeNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements); particleSystemTypeNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements);
// float size; // float size;
particleSystemTypeNode->addAttribute("size",floatToStr(size), mapTagReplacements); particleSystemTypeNode->addAttribute("size",floatToStr(size,16), mapTagReplacements);
// float sizeNoEnergy; // float sizeNoEnergy;
particleSystemTypeNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy), mapTagReplacements); particleSystemTypeNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
// float speed; // float speed;
particleSystemTypeNode->addAttribute("speed",floatToStr(speed), mapTagReplacements); particleSystemTypeNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements);
// float gravity; // float gravity;
particleSystemTypeNode->addAttribute("gravity",floatToStr(gravity), mapTagReplacements); particleSystemTypeNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
// float emissionRate; // float emissionRate;
particleSystemTypeNode->addAttribute("emissionRate",floatToStr(emissionRate), mapTagReplacements); particleSystemTypeNode->addAttribute("emissionRate",floatToStr(emissionRate,16), mapTagReplacements);
// int energyMax; // int energyMax;
particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements); particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements);
// int energyVar; // int energyVar;
@ -455,11 +455,11 @@ void ParticleSystemTypeProjectile::saveGame(XmlNode *rootNode) {
// string trajectory; // string trajectory;
particleSystemTypeProjectileNode->addAttribute("trajectory",trajectory, mapTagReplacements); particleSystemTypeProjectileNode->addAttribute("trajectory",trajectory, mapTagReplacements);
// float trajectorySpeed; // float trajectorySpeed;
particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed), mapTagReplacements); particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,16), mapTagReplacements);
// float trajectoryScale; // float trajectoryScale;
particleSystemTypeProjectileNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale), mapTagReplacements); particleSystemTypeProjectileNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,16), mapTagReplacements);
// float trajectoryFrequency; // float trajectoryFrequency;
particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency), mapTagReplacements); particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,16), mapTagReplacements);
} }
// =========================================================== // ===========================================================
@ -538,15 +538,15 @@ void ParticleSystemTypeSplash::saveGame(XmlNode *rootNode) {
XmlNode *particleSystemTypeSplashNode = rootNode->addChild("ParticleSystemTypeSplash"); XmlNode *particleSystemTypeSplashNode = rootNode->addChild("ParticleSystemTypeSplash");
// float emissionRateFade; // float emissionRateFade;
particleSystemTypeSplashNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements); particleSystemTypeSplashNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
// float verticalSpreadA; // float verticalSpreadA;
particleSystemTypeSplashNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA), mapTagReplacements); particleSystemTypeSplashNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA,16), mapTagReplacements);
// float verticalSpreadB; // float verticalSpreadB;
particleSystemTypeSplashNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB), mapTagReplacements); particleSystemTypeSplashNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB,16), mapTagReplacements);
// float horizontalSpreadA; // float horizontalSpreadA;
particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA), mapTagReplacements); particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA,16), mapTagReplacements);
// float horizontalSpreadB; // float horizontalSpreadB;
particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB), mapTagReplacements); particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB,16), mapTagReplacements);
} }
}}//end mamespace }}//end mamespace

View File

@ -299,13 +299,13 @@ void UnitParticleSystemType::saveGame(XmlNode *rootNode) {
// UnitParticleSystem::Shape shape; // UnitParticleSystem::Shape shape;
unitParticleSystemTypeNode->addAttribute("shape",intToStr(shape), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
// float angle; // float angle;
unitParticleSystemTypeNode->addAttribute("angle",floatToStr(angle), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("angle",floatToStr(angle,16), mapTagReplacements);
// float radius; // float radius;
unitParticleSystemTypeNode->addAttribute("radius",floatToStr(radius), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
// float minRadius; // float minRadius;
unitParticleSystemTypeNode->addAttribute("minRadius",floatToStr(minRadius), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("minRadius",floatToStr(minRadius,16), mapTagReplacements);
// float emissionRateFade; // float emissionRateFade;
unitParticleSystemTypeNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
// Vec3f direction; // Vec3f direction;
unitParticleSystemTypeNode->addAttribute("direction",direction.getString(), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("direction",direction.getString(), mapTagReplacements);
// bool relative; // bool relative;
@ -329,9 +329,9 @@ void UnitParticleSystemType::saveGame(XmlNode *rootNode) {
// int lifetime; // int lifetime;
unitParticleSystemTypeNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
// float startTime; // float startTime;
unitParticleSystemTypeNode->addAttribute("startTime",floatToStr(startTime), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("startTime",floatToStr(startTime,16), mapTagReplacements);
// float endTime; // float endTime;
unitParticleSystemTypeNode->addAttribute("endTime",floatToStr(endTime), mapTagReplacements); unitParticleSystemTypeNode->addAttribute("endTime",floatToStr(endTime,16), mapTagReplacements);
} }
}}//end mamespace }}//end mamespace

View File

@ -241,7 +241,7 @@ void Object::saveGame(XmlNode *rootNode) {
// Vec3f pos; // Vec3f pos;
objectNode->addAttribute("pos",pos.getString(), mapTagReplacements); objectNode->addAttribute("pos",pos.getString(), mapTagReplacements);
// float rotation; // float rotation;
objectNode->addAttribute("rotation",floatToStr(rotation), mapTagReplacements); objectNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
// int variation; // int variation;
objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements); objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements);
// int lastRenderFrame; // int lastRenderFrame;

View File

@ -3733,11 +3733,11 @@ std::string Unit::toString() const {
result += " ep = " + intToStr(this->ep); result += " ep = " + intToStr(this->ep);
result += " loadCount = " + intToStr(this->loadCount); result += " loadCount = " + intToStr(this->loadCount);
result += " deadCount = " + intToStr(this->deadCount); result += " deadCount = " + intToStr(this->deadCount);
result += " progress = " + floatToStr(this->progress); result += " progress = " + floatToStr(this->progress,16);
result += "\n"; result += "\n";
result += " lastAnimProgress = " + floatToStr(this->lastAnimProgress); result += " lastAnimProgress = " + floatToStr(this->lastAnimProgress,16);
result += " animProgress = " + floatToStr(this->animProgress); result += " animProgress = " + floatToStr(this->animProgress,16);
result += " highlight = " + floatToStr(this->highlight); result += " highlight = " + floatToStr(this->highlight,16);
result += " progress2 = " + intToStr(this->progress2); result += " progress2 = " + intToStr(this->progress2);
result += " kills = " + intToStr(this->kills); result += " kills = " + intToStr(this->kills);
result += " enemyKills = " + intToStr(this->enemyKills); result += " enemyKills = " + intToStr(this->enemyKills);
@ -3764,9 +3764,9 @@ std::string Unit::toString() const {
result += " meetingPos = " + meetingPos.getString(); result += " meetingPos = " + meetingPos.getString();
result += "\n"; result += "\n";
result += " lastRotation = " + floatToStr(this->lastRotation); result += " lastRotation = " + floatToStr(this->lastRotation,16);
result += " targetRotation = " + floatToStr(this->targetRotation); result += " targetRotation = " + floatToStr(this->targetRotation,16);
result += " rotation = " + floatToStr(this->rotation); result += " rotation = " + floatToStr(this->rotation,16);
if(loadType != NULL) { if(loadType != NULL) {
result += " loadType = " + loadType->getName(); result += " loadType = " + loadType->getName();
@ -3831,13 +3831,13 @@ void Unit::saveGame(XmlNode *rootNode) {
// int deadCount; // int deadCount;
unitNode->addAttribute("deadCount",intToStr(deadCount), mapTagReplacements); unitNode->addAttribute("deadCount",intToStr(deadCount), mapTagReplacements);
// float progress; //between 0 and 1 // float progress; //between 0 and 1
unitNode->addAttribute("progress",floatToStr(progress), mapTagReplacements); unitNode->addAttribute("progress",floatToStr(progress,16), mapTagReplacements);
// float lastAnimProgress; //between 0 and 1 // float lastAnimProgress; //between 0 and 1
unitNode->addAttribute("lastAnimProgress",floatToStr(lastAnimProgress), mapTagReplacements); unitNode->addAttribute("lastAnimProgress",floatToStr(lastAnimProgress,16), mapTagReplacements);
// float animProgress; //between 0 and 1 // float animProgress; //between 0 and 1
unitNode->addAttribute("animProgress",floatToStr(animProgress), mapTagReplacements); unitNode->addAttribute("animProgress",floatToStr(animProgress,16), mapTagReplacements);
// float highlight; // float highlight;
unitNode->addAttribute("highlight",floatToStr(highlight), mapTagReplacements); unitNode->addAttribute("highlight",floatToStr(highlight,16), mapTagReplacements);
// int progress2; // int progress2;
unitNode->addAttribute("progress2",intToStr(progress2), mapTagReplacements); unitNode->addAttribute("progress2",intToStr(progress2), mapTagReplacements);
// int kills; // int kills;
@ -3867,19 +3867,19 @@ void Unit::saveGame(XmlNode *rootNode) {
unitNode->addAttribute("meetingPos",meetingPos.getString(), mapTagReplacements); unitNode->addAttribute("meetingPos",meetingPos.getString(), mapTagReplacements);
// //
// float lastRotation; //in degrees // float lastRotation; //in degrees
unitNode->addAttribute("lastRotation",floatToStr(lastRotation), mapTagReplacements); unitNode->addAttribute("lastRotation",floatToStr(lastRotation,16), mapTagReplacements);
// float targetRotation; // float targetRotation;
unitNode->addAttribute("targetRotation",floatToStr(targetRotation), mapTagReplacements); unitNode->addAttribute("targetRotation",floatToStr(targetRotation,16), mapTagReplacements);
// float rotation; // float rotation;
unitNode->addAttribute("rotation",floatToStr(rotation), mapTagReplacements); unitNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
// float targetRotationZ; // float targetRotationZ;
unitNode->addAttribute("targetRotationZ",floatToStr(targetRotationZ), mapTagReplacements); unitNode->addAttribute("targetRotationZ",floatToStr(targetRotationZ,16), mapTagReplacements);
// float targetRotationX; // float targetRotationX;
unitNode->addAttribute("targetRotationX",floatToStr(targetRotationX), mapTagReplacements); unitNode->addAttribute("targetRotationX",floatToStr(targetRotationX,16), mapTagReplacements);
// float rotationZ; // float rotationZ;
unitNode->addAttribute("rotationZ",floatToStr(rotationZ), mapTagReplacements); unitNode->addAttribute("rotationZ",floatToStr(rotationZ,16), mapTagReplacements);
// float rotationX; // float rotationX;
unitNode->addAttribute("rotationX",floatToStr(rotationX), mapTagReplacements); unitNode->addAttribute("rotationX",floatToStr(rotationX,16), mapTagReplacements);
// const UnitType *type; // const UnitType *type;
unitNode->addAttribute("type",type->getName(), mapTagReplacements); unitNode->addAttribute("type",type->getName(), mapTagReplacements);
// const ResourceType *loadType; // const ResourceType *loadType;

View File

@ -665,7 +665,7 @@ void SkillType::saveGame(XmlNode *rootNode) {
// //
// SoundContainer sounds; // SoundContainer sounds;
// float soundStartTime; // float soundStartTime;
skillTypeNode->addAttribute("soundStartTime",floatToStr(soundStartTime), mapTagReplacements); skillTypeNode->addAttribute("soundStartTime",floatToStr(soundStartTime,16), mapTagReplacements);
// RandomGen random; // RandomGen random;
skillTypeNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements); skillTypeNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements);
// AttackBoost attackBoost; // AttackBoost attackBoost;
@ -886,7 +886,7 @@ void AttackSkillType::saveGame(XmlNode *rootNode) {
attackFieldsNode->addAttribute("value",intToStr(attackFields[i]), mapTagReplacements); attackFieldsNode->addAttribute("value",intToStr(attackFields[i]), mapTagReplacements);
} }
// float attackStartTime; // float attackStartTime;
attackSkillTypeNode->addAttribute("attackStartTime",floatToStr(attackStartTime), mapTagReplacements); attackSkillTypeNode->addAttribute("attackStartTime",floatToStr(attackStartTime,16), mapTagReplacements);
// string spawnUnit; // string spawnUnit;
attackSkillTypeNode->addAttribute("spawnUnit",spawnUnit, mapTagReplacements); attackSkillTypeNode->addAttribute("spawnUnit",spawnUnit, mapTagReplacements);
// int spawnUnitcount; // int spawnUnitcount;
@ -1173,7 +1173,7 @@ void FogOfWarSkillType::saveGame(XmlNode *rootNode) {
fogSkillTypeNode->addAttribute("enable-fog",intToStr(fowEnable), mapTagReplacements); fogSkillTypeNode->addAttribute("enable-fog",intToStr(fowEnable), mapTagReplacements);
fogSkillTypeNode->addAttribute("apply-team",intToStr(applyToTeam), mapTagReplacements); fogSkillTypeNode->addAttribute("apply-team",intToStr(applyToTeam), mapTagReplacements);
fogSkillTypeNode->addAttribute("duration",floatToStr(durationTime), mapTagReplacements); fogSkillTypeNode->addAttribute("duration",floatToStr(durationTime,16), mapTagReplacements);
} }
// ===================================================== // =====================================================

View File

@ -1080,7 +1080,7 @@ std::string UnitType::toString() const {
result += " sight = " + intToStr(sight); result += " sight = " + intToStr(sight);
result += " size = " + intToStr(size); result += " size = " + intToStr(size);
result += " height = " + intToStr(height); result += " height = " + intToStr(height);
result += " rotatedBuildPos = " + floatToStr(rotatedBuildPos); result += " rotatedBuildPos = " + floatToStr(rotatedBuildPos,16);
result += " rotationAllowed = " + intToStr(rotationAllowed); result += " rotationAllowed = " + intToStr(rotationAllowed);
if(cellMap != NULL) { if(cellMap != NULL) {

View File

@ -93,7 +93,7 @@ void Cell::saveGame(XmlNode *rootNode, int index) const {
} }
// float height; // float height;
cellNode->addAttribute("height",floatToStr(height), mapTagReplacements); cellNode->addAttribute("height",floatToStr(height,16), mapTagReplacements);
} }
} }
@ -1716,11 +1716,11 @@ void Map::saveGame(XmlNode *rootNode) const {
// string title; // string title;
mapNode->addAttribute("title",title, mapTagReplacements); mapNode->addAttribute("title",title, mapTagReplacements);
// float waterLevel; // float waterLevel;
mapNode->addAttribute("waterLevel",floatToStr(waterLevel), mapTagReplacements); mapNode->addAttribute("waterLevel",floatToStr(waterLevel,16), mapTagReplacements);
// float heightFactor; // float heightFactor;
mapNode->addAttribute("heightFactor",floatToStr(heightFactor), mapTagReplacements); mapNode->addAttribute("heightFactor",floatToStr(heightFactor,16), mapTagReplacements);
// float cliffLevel; // float cliffLevel;
mapNode->addAttribute("cliffLevel",floatToStr(cliffLevel), mapTagReplacements); mapNode->addAttribute("cliffLevel",floatToStr(cliffLevel,16), mapTagReplacements);
// int cameraHeight; // int cameraHeight;
mapNode->addAttribute("cameraHeight",intToStr(cameraHeight), mapTagReplacements); mapNode->addAttribute("cameraHeight",intToStr(cameraHeight), mapTagReplacements);
// int w; // int w;
@ -1800,7 +1800,7 @@ void Map::saveGame(XmlNode *rootNode) const {
// Checksum checksumValue; // Checksum checksumValue;
// mapNode->addAttribute("checksumValue",intToStr(checksumValue.getSum()), mapTagReplacements); // mapNode->addAttribute("checksumValue",intToStr(checksumValue.getSum()), mapTagReplacements);
// float maxMapHeight; // float maxMapHeight;
mapNode->addAttribute("maxMapHeight",floatToStr(maxMapHeight), mapTagReplacements); mapNode->addAttribute("maxMapHeight",floatToStr(maxMapHeight,16), mapTagReplacements);
// string mapFile; // string mapFile;
mapNode->addAttribute("mapFile",mapFile, mapTagReplacements); mapNode->addAttribute("mapFile",mapFile, mapTagReplacements);
} }

View File

@ -267,12 +267,14 @@ void Minimap::saveGame(XmlNode *rootNode) {
void Minimap::loadGame(const XmlNode *rootNode) { void Minimap::loadGame(const XmlNode *rootNode) {
const XmlNode *minimapNode = rootNode->getChild("Minimap"); const XmlNode *minimapNode = rootNode->getChild("Minimap");
vector<XmlNode *> fowPixmap1NodeList = minimapNode->getChildList("fowPixmap1"); if(minimapNode->hasChild("fowPixmap1") == true) {
for(unsigned int i = 0; i < fowPixmap1NodeList.size(); ++i) { vector<XmlNode *> fowPixmap1NodeList = minimapNode->getChildList("fowPixmap1");
XmlNode *fowPixmap1Node = fowPixmap1NodeList[i]; for(unsigned int i = 0; i < fowPixmap1NodeList.size(); ++i) {
XmlNode *fowPixmap1Node = fowPixmap1NodeList[i];
int pixelIndex = fowPixmap1Node->getAttribute("index")->getIntValue(); int pixelIndex = fowPixmap1Node->getAttribute("index")->getIntValue();
fowPixmap1->getPixels()[pixelIndex] = fowPixmap1Node->getAttribute("pixel")->getIntValue(); fowPixmap1->getPixels()[pixelIndex] = fowPixmap1Node->getAttribute("pixel")->getIntValue();
}
} }
} }

View File

@ -29,6 +29,15 @@ namespace Glest{ namespace Game{
const float TimeFlow::dusk= 18.f; const float TimeFlow::dusk= 18.f;
const float TimeFlow::dawn= 6.f; const float TimeFlow::dawn= 6.f;
TimeFlow::TimeFlow() {
firstTime = false;
tileset = NULL;
time = 0.0f;
lastTime = 0.0f;
timeInc = 0.0f;
//printf("#1a timeInc = %f\n",timeInc);
}
void TimeFlow::init(Tileset *tileset){ void TimeFlow::init(Tileset *tileset){
firstTime= true; firstTime= true;
this->tileset= tileset; this->tileset= tileset;
@ -36,17 +45,21 @@ void TimeFlow::init(Tileset *tileset){
lastTime= time; lastTime= time;
Config &config= Config::getInstance(); Config &config= Config::getInstance();
timeInc= 24.f * (1.f / config.getFloat("DayTime")) / GameConstants::updateFps; timeInc= 24.f * (1.f / config.getFloat("DayTime")) / GameConstants::updateFps;
//printf("#1 timeInc = %f\n",timeInc);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] timeInc = %f\n",__FILE__,__FUNCTION__,__LINE__,timeInc); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] timeInc = %f\n",__FILE__,__FUNCTION__,__LINE__,timeInc);
} }
void TimeFlow::update() { void TimeFlow::update() {
//printf("START TimeFlow::update() time = %f\n",time);
//update time //update time
time += isDay()? timeInc: timeInc*2; time += isDay()? timeInc: timeInc*2;
if(time > 24.f){ if(time > 24.f){
time -= 24.f; time -= 24.f;
} }
//printf("END TimeFlow::update() time = %f\n",time);
//sounds //sounds
SoundRenderer &soundRenderer= SoundRenderer::getInstance(); SoundRenderer &soundRenderer= SoundRenderer::getInstance();
AmbientSounds *ambientSounds= NULL; AmbientSounds *ambientSounds= NULL;
@ -147,11 +160,13 @@ void TimeFlow::saveGame(XmlNode *rootNode) {
// bool firstTime; // bool firstTime;
// Tileset *tileset; // Tileset *tileset;
// float time; // float time;
timeflowNode->addAttribute("time",floatToStr(time), mapTagReplacements); timeflowNode->addAttribute("time",floatToStr(time,16), mapTagReplacements);
// float lastTime; // float lastTime;
timeflowNode->addAttribute("lastTime",floatToStr(lastTime), mapTagReplacements); timeflowNode->addAttribute("lastTime",floatToStr(lastTime,16), mapTagReplacements);
// float timeInc; // float timeInc;
timeflowNode->addAttribute("timeInc",floatToStr(timeInc), mapTagReplacements); //printf("#2 timeInc = %f\n",timeInc);
timeflowNode->addAttribute("timeInc",floatToStr(timeInc,16), mapTagReplacements);
//printf("#3 timeInc = %f\n",timeInc);
} }
void TimeFlow::loadGame(const XmlNode *rootNode) { void TimeFlow::loadGame(const XmlNode *rootNode) {
@ -161,6 +176,7 @@ void TimeFlow::loadGame(const XmlNode *rootNode) {
time = timeflowNode->getAttribute("time")->getFloatValue(); time = timeflowNode->getAttribute("time")->getFloatValue();
lastTime = timeflowNode->getAttribute("lastTime")->getFloatValue(); lastTime = timeflowNode->getAttribute("lastTime")->getFloatValue();
timeInc = timeflowNode->getAttribute("timeInc")->getFloatValue(); timeInc = timeflowNode->getAttribute("timeInc")->getFloatValue();
//printf("#4 timeInc = %f\n",timeInc);
} }
}}//end namespace }}//end namespace

View File

@ -47,13 +47,7 @@ private:
float timeInc; float timeInc;
public: public:
TimeFlow() { TimeFlow();
firstTime = false;
tileset = NULL;
time = 0.0f;
lastTime = 0.0f;
timeInc = 0.0f;
}
void init(Tileset *tileset); void init(Tileset *tileset);
inline float getTime() const {return time;} inline float getTime() const {return time;}

View File

@ -2618,7 +2618,7 @@ void UnitUpdater::saveGame(XmlNode *rootNode) {
// RandomGen random; // RandomGen random;
//unitupdaterNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements); //unitupdaterNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements);
// float attackWarnRange; // float attackWarnRange;
unitupdaterNode->addAttribute("attackWarnRange",floatToStr(attackWarnRange), mapTagReplacements); unitupdaterNode->addAttribute("attackWarnRange",floatToStr(attackWarnRange,16), mapTagReplacements);
// AttackWarnings attackWarnings; // AttackWarnings attackWarnings;
// //
// Mutex mutexUnitRangeCellsLookupItemCache; // Mutex mutexUnitRangeCellsLookupItemCache;

View File

@ -148,6 +148,7 @@ public:
vector<XmlNode *> getChildList(const string &childName) const; vector<XmlNode *> getChildList(const string &childName) const;
bool hasChildAtIndex(const string &childName, int childIndex=0) const; bool hasChildAtIndex(const string &childName, int childIndex=0) const;
bool hasChild(const string &childName) const; bool hasChild(const string &childName) const;
int clearChild(const string &childName);
XmlNode *getParent() const; XmlNode *getParent() const;

View File

@ -85,7 +85,7 @@ void InterpolationData::updateVertices(float t, bool cycle) {
} }
//assert(t>=0.0f && t<=1.0f); //assert(t>=0.0f && t<=1.0f);
if(t < 0.0f || t > 1.0f) { if(t < 0.0f || t > 1.0f) {
throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t) + "]"); throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t,16) + "]");
assert(t >= 0.f && t <= 1.f); assert(t >= 0.f && t <= 1.f);
} }
@ -145,7 +145,7 @@ void InterpolationData::updateVertices(float t, bool cycle) {
void InterpolationData::updateNormals(float t, bool cycle){ void InterpolationData::updateNormals(float t, bool cycle){
if(t < 0.0f || t > 1.0f) { if(t < 0.0f || t > 1.0f) {
throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t) + "]"); throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t,16) + "]");
assert(t>=0.0f && t<=1.0f); assert(t>=0.0f && t<=1.0f);
} }

View File

@ -55,7 +55,7 @@ void Particle::saveGame(XmlNode *rootNode) {
// Vec4f color; // Vec4f color;
particleNode->addAttribute("color",color.getString(), mapTagReplacements); particleNode->addAttribute("color",color.getString(), mapTagReplacements);
// float size; // float size;
particleNode->addAttribute("size",floatToStr(size), mapTagReplacements); particleNode->addAttribute("size",floatToStr(size,16), mapTagReplacements);
// int energy; // int energy;
particleNode->addAttribute("energy",intToStr(energy), mapTagReplacements); particleNode->addAttribute("energy",intToStr(energy), mapTagReplacements);
} }
@ -290,12 +290,12 @@ string ParticleSystem::toString() const {
result += "\npos = " + pos.getString(); result += "\npos = " + pos.getString();
result += "\ncolor = " + color.getString(); result += "\ncolor = " + color.getString();
result += "\ncolorNoEnergy = " + colorNoEnergy.getString(); result += "\ncolorNoEnergy = " + colorNoEnergy.getString();
result += "\nemissionRate = " + floatToStr(emissionRate); result += "\nemissionRate = " + floatToStr(emissionRate,16);
result += "\nemissionState = " + floatToStr(emissionState); result += "\nemissionState = " + floatToStr(emissionState,16);
result += "\nmaxParticleEnergy = " + intToStr(maxParticleEnergy); result += "\nmaxParticleEnergy = " + intToStr(maxParticleEnergy);
result += "\nvarParticleEnergy = " + intToStr(varParticleEnergy); result += "\nvarParticleEnergy = " + intToStr(varParticleEnergy);
result += "\nparticleSize = " + floatToStr(particleSize); result += "\nparticleSize = " + floatToStr(particleSize,16);
result += "\nspeed = " + floatToStr(speed); result += "\nspeed = " + floatToStr(speed,16);
result += "\nfactionColor = " + factionColor.getString(); result += "\nfactionColor = " + factionColor.getString();
result += "\nteamcolorNoEnergy = " + intToStr(teamcolorNoEnergy); result += "\nteamcolorNoEnergy = " + intToStr(teamcolorNoEnergy);
result += "\nteamcolorEnergy = " + intToStr(teamcolorEnergy); result += "\nteamcolorEnergy = " + intToStr(teamcolorEnergy);
@ -348,17 +348,17 @@ void ParticleSystem::saveGame(XmlNode *rootNode) {
// Vec4f colorNoEnergy; // Vec4f colorNoEnergy;
particleSystemNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements); particleSystemNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements);
// float emissionRate; // float emissionRate;
particleSystemNode->addAttribute("emissionRate",floatToStr(emissionRate), mapTagReplacements); particleSystemNode->addAttribute("emissionRate",floatToStr(emissionRate,16), mapTagReplacements);
// float emissionState; // float emissionState;
particleSystemNode->addAttribute("emissionState",floatToStr(emissionState), mapTagReplacements); particleSystemNode->addAttribute("emissionState",floatToStr(emissionState,16), mapTagReplacements);
// int maxParticleEnergy; // int maxParticleEnergy;
particleSystemNode->addAttribute("maxParticleEnergy",intToStr(maxParticleEnergy), mapTagReplacements); particleSystemNode->addAttribute("maxParticleEnergy",intToStr(maxParticleEnergy), mapTagReplacements);
// int varParticleEnergy; // int varParticleEnergy;
particleSystemNode->addAttribute("varParticleEnergy",intToStr(varParticleEnergy), mapTagReplacements); particleSystemNode->addAttribute("varParticleEnergy",intToStr(varParticleEnergy), mapTagReplacements);
// float particleSize; // float particleSize;
particleSystemNode->addAttribute("particleSize",floatToStr(particleSize), mapTagReplacements); particleSystemNode->addAttribute("particleSize",floatToStr(particleSize,16), mapTagReplacements);
// float speed; // float speed;
particleSystemNode->addAttribute("speed",floatToStr(speed), mapTagReplacements); particleSystemNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements);
// Vec3f factionColor; // Vec3f factionColor;
particleSystemNode->addAttribute("factionColor",factionColor.getString(), mapTagReplacements); particleSystemNode->addAttribute("factionColor",factionColor.getString(), mapTagReplacements);
// bool teamcolorNoEnergy; // bool teamcolorNoEnergy;
@ -674,7 +674,7 @@ void FireParticleSystem::saveGame(XmlNode *rootNode) {
ParticleSystem::saveGame(fireParticleSystemNode); ParticleSystem::saveGame(fireParticleSystemNode);
// float radius; // float radius;
fireParticleSystemNode->addAttribute("radius",floatToStr(radius), mapTagReplacements); fireParticleSystemNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
// Vec3f windSpeed; // Vec3f windSpeed;
fireParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements); fireParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements);
} }
@ -841,13 +841,13 @@ void GameParticleSystem::saveGame(XmlNode *rootNode) {
gameParticleSystemNode->addAttribute("model",model->getFileName(), mapTagReplacements); gameParticleSystemNode->addAttribute("model",model->getFileName(), mapTagReplacements);
} }
// float modelCycle; // float modelCycle;
gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements); gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle,16), mapTagReplacements);
// Vec3f offset; // Vec3f offset;
gameParticleSystemNode->addAttribute("offset",offset.getString(), mapTagReplacements); gameParticleSystemNode->addAttribute("offset",offset.getString(), mapTagReplacements);
// Vec3f direction; // Vec3f direction;
gameParticleSystemNode->addAttribute("direction",direction.getString(), mapTagReplacements); gameParticleSystemNode->addAttribute("direction",direction.getString(), mapTagReplacements);
// float tween; // float tween;
gameParticleSystemNode->addAttribute("tween",floatToStr(tween), mapTagReplacements); gameParticleSystemNode->addAttribute("tween",floatToStr(tween,16), mapTagReplacements);
} }
void GameParticleSystem::loadGame(const XmlNode *rootNode) { void GameParticleSystem::loadGame(const XmlNode *rootNode) {
const XmlNode *gameParticleSystemNode = rootNode->getChild("GameParticleSystem"); const XmlNode *gameParticleSystemNode = rootNode->getChild("GameParticleSystem");
@ -1166,9 +1166,9 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
GameParticleSystem::saveGame(unitParticleSystemNode); GameParticleSystem::saveGame(unitParticleSystemNode);
// float radius; // float radius;
unitParticleSystemNode->addAttribute("radius",floatToStr(radius), mapTagReplacements); unitParticleSystemNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
// float minRadius; // float minRadius;
unitParticleSystemNode->addAttribute("minRadius",floatToStr(minRadius), mapTagReplacements); unitParticleSystemNode->addAttribute("minRadius",floatToStr(minRadius,16), mapTagReplacements);
// Vec3f windSpeed; // Vec3f windSpeed;
unitParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements); unitParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements);
// Vec3f cRotation; // Vec3f cRotation;
@ -1180,9 +1180,9 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
// bool energyUp; // bool energyUp;
unitParticleSystemNode->addAttribute("energyUp",intToStr(energyUp), mapTagReplacements); unitParticleSystemNode->addAttribute("energyUp",intToStr(energyUp), mapTagReplacements);
// float startTime; // float startTime;
unitParticleSystemNode->addAttribute("startTime",floatToStr(startTime), mapTagReplacements); unitParticleSystemNode->addAttribute("startTime",floatToStr(startTime,16), mapTagReplacements);
// float endTime; // float endTime;
unitParticleSystemNode->addAttribute("endTime",floatToStr(endTime), mapTagReplacements); unitParticleSystemNode->addAttribute("endTime",floatToStr(endTime,16), mapTagReplacements);
// bool relative; // bool relative;
unitParticleSystemNode->addAttribute("relative",intToStr(relative), mapTagReplacements); unitParticleSystemNode->addAttribute("relative",intToStr(relative), mapTagReplacements);
// bool relativeDirection; // bool relativeDirection;
@ -1192,13 +1192,13 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
// Shape shape; // Shape shape;
unitParticleSystemNode->addAttribute("shape",intToStr(shape), mapTagReplacements); unitParticleSystemNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
// float angle; // float angle;
unitParticleSystemNode->addAttribute("angle",floatToStr(angle), mapTagReplacements); unitParticleSystemNode->addAttribute("angle",floatToStr(angle,16), mapTagReplacements);
// float sizeNoEnergy; // float sizeNoEnergy;
unitParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy), mapTagReplacements); unitParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
// float gravity; // float gravity;
unitParticleSystemNode->addAttribute("gravity",floatToStr(gravity), mapTagReplacements); unitParticleSystemNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
// float rotation; // float rotation;
unitParticleSystemNode->addAttribute("rotation",floatToStr(rotation), mapTagReplacements); unitParticleSystemNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
// bool isVisibleAtNight; // bool isVisibleAtNight;
unitParticleSystemNode->addAttribute("isVisibleAtNight",intToStr(isVisibleAtNight), mapTagReplacements); unitParticleSystemNode->addAttribute("isVisibleAtNight",intToStr(isVisibleAtNight), mapTagReplacements);
// bool isVisibleAtDay; // bool isVisibleAtDay;
@ -1214,7 +1214,7 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
// int lifetime; // int lifetime;
unitParticleSystemNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements); unitParticleSystemNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
// float emissionRateFade; // float emissionRateFade;
unitParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements); unitParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
// GameParticleSystem* parent; // GameParticleSystem* parent;
//if(parent != NULL) { //if(parent != NULL) {
// parent->saveGame(unitParticleSystemNode); // parent->saveGame(unitParticleSystemNode);
@ -1416,9 +1416,9 @@ void AttackParticleSystem::saveGame(XmlNode *rootNode) {
GameParticleSystem::saveGame(attackParticleSystemNode); GameParticleSystem::saveGame(attackParticleSystemNode);
// float sizeNoEnergy; // float sizeNoEnergy;
attackParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy), mapTagReplacements); attackParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
// float gravity; // float gravity;
attackParticleSystemNode->addAttribute("gravity",floatToStr(gravity), mapTagReplacements); attackParticleSystemNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
} }
void AttackParticleSystem::loadGame(const XmlNode *rootNode) { void AttackParticleSystem::loadGame(const XmlNode *rootNode) {
@ -1668,12 +1668,12 @@ void ProjectileParticleSystem::saveGame(XmlNode *rootNode) {
// Trajectory trajectory; // Trajectory trajectory;
projectileParticleSystemNode->addAttribute("trajectory",intToStr(trajectory), mapTagReplacements); projectileParticleSystemNode->addAttribute("trajectory",intToStr(trajectory), mapTagReplacements);
// float trajectorySpeed; // float trajectorySpeed;
projectileParticleSystemNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed), mapTagReplacements); projectileParticleSystemNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,16), mapTagReplacements);
// //parabolic // //parabolic
// float trajectoryScale; // float trajectoryScale;
projectileParticleSystemNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale), mapTagReplacements); projectileParticleSystemNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,16), mapTagReplacements);
// float trajectoryFrequency; // float trajectoryFrequency;
projectileParticleSystemNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency), mapTagReplacements); projectileParticleSystemNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,16), mapTagReplacements);
} }
void ProjectileParticleSystem::loadGame(const XmlNode *rootNode) { void ProjectileParticleSystem::loadGame(const XmlNode *rootNode) {
@ -1802,18 +1802,18 @@ void SplashParticleSystem::saveGame(XmlNode *rootNode) {
} }
// float emissionRateFade; // float emissionRateFade;
splashParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements); splashParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
// float verticalSpreadA; // float verticalSpreadA;
splashParticleSystemNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA), mapTagReplacements); splashParticleSystemNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA,16), mapTagReplacements);
// float verticalSpreadB; // float verticalSpreadB;
splashParticleSystemNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB), mapTagReplacements); splashParticleSystemNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB,16), mapTagReplacements);
// float horizontalSpreadA; // float horizontalSpreadA;
splashParticleSystemNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA), mapTagReplacements); splashParticleSystemNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA,16), mapTagReplacements);
// float horizontalSpreadB; // float horizontalSpreadB;
splashParticleSystemNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB), mapTagReplacements); splashParticleSystemNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB,16), mapTagReplacements);
// //
// float startEmissionRate; // float startEmissionRate;
splashParticleSystemNode->addAttribute("startEmissionRate",floatToStr(startEmissionRate), mapTagReplacements); splashParticleSystemNode->addAttribute("startEmissionRate",floatToStr(startEmissionRate,16), mapTagReplacements);
} }
void SplashParticleSystem::loadGame(const XmlNode *rootNode) { void SplashParticleSystem::loadGame(const XmlNode *rootNode) {

View File

@ -413,7 +413,7 @@ float Properties::getFloat(const string &key, const char *defaultValueIfNotFound
float Properties::getFloat(const string &key, float min, float max, const char *defaultValueIfNotFound) const{ float Properties::getFloat(const string &key, float min, float max, const char *defaultValueIfNotFound) const{
float f= getFloat(key,defaultValueIfNotFound); float f= getFloat(key,defaultValueIfNotFound);
if(f<min || f>max){ if(f<min || f>max){
throw megaglest_runtime_error("Value out of range: " + key + ", min: " + floatToStr(min) + ", max: " + floatToStr(max)); throw megaglest_runtime_error("Value out of range: " + key + ", min: " + floatToStr(min,16) + ", max: " + floatToStr(max,16));
} }
return f; return f;
} }
@ -470,7 +470,7 @@ void Properties::setBool(const string &key, bool value){
} }
void Properties::setFloat(const string &key, float value){ void Properties::setFloat(const string &key, float value){
setString(key, floatToStr(value)); setString(key, floatToStr(value,16));
} }
void Properties::setString(const string &key, const string &value){ void Properties::setString(const string &key, const string &value){

View File

@ -613,6 +613,18 @@ bool XmlNode::hasAttribute(const string &name) const {
return result; return result;
} }
int XmlNode::clearChild(const string &childName) {
int clearChildCount = 0;
for(int i = children.size()-1; i >= 0; --i) {
if(children[i]->getName() == childName) {
delete children[i];
children.erase(children.begin()+i);
clearChildCount++;
}
}
return clearChildCount;
}
XmlNode *XmlNode::getChild(unsigned int i) const { XmlNode *XmlNode::getChild(unsigned int i) const {
assert(!superNode); assert(!superNode);
if(i >= children.size()) { if(i >= children.size()) {