Commits

Anonymous committed 5216de2 Draft

Small fix for non-MSVC

Comments (0)

Files changed (2)

Aquaria/Continuity.cpp

 }
 
 IngredientType Continuity::getIngredientTypeFromName(const std::string &name) const
-{	
+{
 	if (name == "Meat")
 		return IT_MEAT;
 	else if (name == "Oil")
 	sortByType.push_back(FoodSortOrder(IT_ICECHUNK));
 	sortByType.push_back(FoodSortOrder(IT_BONE));
 	sortByType.push_back(FoodSortOrder(IT_FOOD));
-	
+
 	sortByHeal.clear();
 	sortByHeal.push_back(FoodSortOrder(IT_NONE, IET_MAXHP));
 	for (int i = 10; i >= -10; i--)
 	}
 	sortByHeal.push_back(FoodSortOrder(IT_NONE, IET_DEFENSE));
 	sortByHeal.push_back(FoodSortOrder(IT_NONE, IET_SPEED));
-	
+
 	sortByIngredients.clear();
 	for (int i = 0; i < IT_INGREDIENTSEND; i++)
 	{
 void Continuity::sortFood()
 {
 	std::vector<FoodSortOrder> sortOrder;
-	
+
 	bool doSort = true;
-	
+
 	switch (dsq->continuity.foodSortType)
 	{
 	/*
 
 	if (doSort)
 	{
-		
+
 
 		std::vector<IngredientData*> sort;
 
 	IngredientEffectType useType = fx.type;
 
 	std::ostringstream os;
-	
+
 	switch(useType)
 	{
 	case IET_HP:
 	case IET_REGEN:
 		os << dsq->continuity.stringBank.get(206) << " " << fx.magnitude;
 		return os.str();
-	break; 
+	break;
 	case IET_TRIP:
 		return dsq->continuity.stringBank.get(207);
 	break;
 		{
 
 			debugLog("ingredient effect: defense");
-			
+
 			if (fx.magnitude <= 1)
 				dsq->continuity.setDefenseMultiplier(0.75, defenseTime);
 			else if (fx.magnitude == 2)
 		break;
 		case IET_SPEED:
 		{
-			
+
 			dsq->continuity.setSpeedMultiplier(1.0f + fx.magnitude*0.5f, speedTime);
 			debugLog("ingredient effect: speed");
 
 		break;
 		case IET_LI:
 		{
-			// this should do nothing, its just here to catch the ingredient effect so it doesn't 
+			// this should do nothing, its just here to catch the ingredient effect so it doesn't
 			// give the "default:" error message
 			// this item should only affect li if naija drops it and li eats it.
 		}
 				s.notes.push_back(note);
 			}
 		}
-		
+
 		if (song->Attribute("script"))
 		{
 			s.script = atoi(song->Attribute("script"));
 						d.useTimer = 0;
 						d.damageType = DT_ENEMY_ACTIVEPOISON;
 						dsq->game->avatar->damage(d);
-						
+
 						dsq->spawnParticleEffect("PoisonBubbles", dsq->game->avatar->position);
 					}
 				}
 	dsq->user.save();
 
 	TiXmlDocument doc;
-	
+
 	TiXmlElement version("Version");
 	{
 		version.SetAttribute("major",		VERSION_MAJOR);
 		{
 			os << (*i).name << " " << (*i).pos.x << " " << (*i).pos.y << " ";
 			os << (*i).canMove << " ";
-			
+
 			hasUserString = !(*i).userString.empty();
-			
+
 			os << hasUserString << " ";
-			
+
 			if (hasUserString)
 				os << spacesToUnderscores((*i).userString) << " ";
-			
+
 			/*
 			std::ostringstream os2;
 			os2 << "Saving a Gem called [" << (*i).name << "] with userString [" << (*i).userString << "] pos (" << (*i).pos.x << ", " << (*i).pos.y << ")\n";
 
 			os << dsq->continuity.voiceOversPlayed[i] << " ";
 		}
-		vox.SetAttribute("v", os.str());	
+		vox.SetAttribute("v", os.str());
 	}
 	doc.InsertEndChild(vox);
 
 	{
 		unsigned long size = 0;
 		char *buf = readCompressedFile(teh_file, &size);
-		if (!buf || !doc.LoadMem(buf, size))
-			errorLog("Failed to load save data: " + teh_file);
-		return;
+		if (!buf)
+		{
+			errorLog("Failed to decompress save file: " + teh_file);
+			return;
+		}
+		if (!doc.LoadMem(buf, size))
+		{
+			errorLog("Failed to load save data: " + teh_file + " -- Error: " + doc.ErrorDesc());
+			return;
+		}
 	}
 
 	teh_file = dsq->continuity.getSaveFileName(slot, "xml");
 			while (is >> g.name)
 			{
 				hasUserString=false;
-				
+
 				is >> g.pos.x >> g.pos.y;
 				is >> g.canMove;
 				is >> hasUserString;
-				
+
 				if (hasUserString)
 					is >> g.userString;
-				
+
 				std::ostringstream os;
 				os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")\n";
 				debugLog(os.str());
-				
+
 				g.userString = underscoresToSpaces(g.userString);
 				this->gems.push_back(g);
 			}
 		{
 			std::string s = gems->Attribute("c");
 			std::istringstream is(s);
-			
+
 			int num = 0;
 			is >> num;
-			
+
 			bool hasUserString = false;
 			GemData g;
-			
+
 			std::ostringstream os;
 			os << "continuity num: [" << num << "]" << std::endl;
 			os << "data: [" << s << "]" << std::endl;
 			debugLog(os.str());
-			
+
 			for (int i = 0; i < num; i++)
 			{
 				g.pos = Vector(0,0,0);
 				g.canMove = false;
 				g.userString = "";
-				
+
 				hasUserString=false;
-				
+
 				is >> g.name;
 				is >> g.pos.x >> g.pos.y;
 				is >> g.canMove;
 				is >> hasUserString;
-				
+
 				if (hasUserString)
 					is >> g.userString;
 				else
 					g.userString = "";
-				
+
 				g.userString = underscoresToSpaces(g.userString);
 				this->gems.push_back(g);
-				
+
 				std::ostringstream os;
 				os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")\n";
 				debugLog(os.str());
 			}
 		}
 
-		
+
 #ifdef AQUARIA_BUILD_MAPVIS
 		if (worldMap->Attribute("va") && dsq->continuity.worldMap.getNumWorldMapTiles())
 		{
 		if (startData->Attribute("rec"))
 		{
 			std::istringstream is(startData->Attribute("rec"));
-			
+
 			for (int i = 0; i < recipes.size(); i++)
 			{
 				bool known = false;
 {
 	std::ostringstream os;
 	os << sceneName << ":" << id;
-	
+
 	std::ostringstream os2;
 	os2 << hash(os.str());
-	
+
 	return entityFlags[os2.str()];
 }
 
 {
 	std::ostringstream os;
 	os << sceneName << ":" << id;
-	
+
 	std::ostringstream os2;
 	os2 << hash(os.str());
-	
+
 	entityFlags[os2.str()] = v;
 }
 
 {
 	std::ostringstream os;
 	os << "p:" << dsq->game->sceneName << ":" << p->nodes[0].position.x << ":" << p->nodes[0].position.y << ":" << removeSpaces(p->name);
-	
+
 	std::ostringstream os2;
 	os2 << hash(os.str());
-	
+
 	entityFlags[os2.str()] = v;
 }
 
 
 	lastMenuPage = MENUPAGE_NONE;
 	lastOptionsMenuPage = MENUPAGE_NONE;
-	
+
 	if (dsq->game)
 	{
 		dsq->game->currentMenuPage = MENUPAGE_NONE;
 	worldMap.load();
 
 	ingredients.clear();
-	
+
 	foodSortType = 0;
 
 	//load ingredients
 	{
 		learnSong(SONG_SHIELDAURA);
 	}
-	
+
 	initFoodSort();
 
 	core->resetTimer();

ExternalLibs/DeflateCompressor.cpp

 // for weird gcc/mingw hackfix below
 #include <string.h>
 
-#define PRINTFAIL(s, ...) fprintf(stderr, (s "\n"), __VA_ARGS__)
-
 
 DeflateCompressor::DeflateCompressor()
 :   _windowBits(-MAX_WBITS), // negative, because we want a raw deflate stream, and not zlib-wrapped
 }
 
 GzipCompressor::GzipCompressor()
-: DeflateCompressor()  
+: DeflateCompressor()
 {
     _windowBits = MAX_WBITS + 16; // this makes zlib wrap a minimal gzip header around the stream
     _forceCompress = true; // we want this for gzip
         case Z_STREAM_END:
             break; // all good
         case Z_OK:
-            PRINTFAIL("ZLIB: Output buffer not large enough");
             *dst_size = 0;
             return;
         default:
-            PRINTFAIL("ZLIB: Error %d", ret);
             *dst_size = 0;
             return;
     }
 
     if (Z_OK != deflateEnd(&c_stream))
     {
-        PRINTFAIL("Can't compress (zlib: deflateEnd)");
         *dst_size = 0;
         return;
     }
         return;
 
     char *buf;
-    
+
 
     uint32 oldsize = size();
     uint32 newsize = compressBound(oldsize) + 30; // for optional gzip header
         decompress((void*)target, &origsize, (const void*)contents(), size(), _windowBits);
         if(origsize != rs)
         {
-            PRINTFAIL("DeflateCompressor: Inflate error! cursize=%u origsize=%u realsize=%u",size(),origsize,rs);
             delete [] target;
             return;
         }
     rpos(size() - sizeof(uint32)); // according to RFC 1952, input size are the last 4 bytes at the end of the file, in little endian
     *this >> t;
     _real_size = t;
-    
+
     // !! NOTE: this fixes a gcc/mingw bug where _real_size would be set incorrectly
 #if __GNUC__
     char xx[20];