Browse Source

Changes related to Debian packaging, based on josch patch
- AUTHORS file is now in UTF-8
- tags for desktop files
- fixed some typos
- better reaction on --help and --version commands
- vcmibuilder should work with both avconf and ffmpeg

Ivan Savenko 11 years ago
parent
commit
760ae7d44a
10 changed files with 54 additions and 20 deletions
  1. 1 1
      AUTHORS
  2. 5 12
      client/CMT.cpp
  3. 1 0
      client/icons/vcmiclient.desktop
  4. 1 0
      launcher/vcmilauncher.desktop
  5. 3 3
      lib/Connection.cpp
  6. 1 1
      lib/NetPacksLib.cpp
  7. 13 0
      lib/VCMIDirs.cpp
  8. 2 0
      lib/VCMIDirs.h
  9. 19 0
      server/CVCMIServer.cpp
  10. 8 3
      vcmibuilder

+ 1 - 1
AUTHORS

@@ -1,6 +1,6 @@
 VCMI PROJECT CODE CONTRIBUTORS:
 
-Micha³ Urbañczyk aka Tow,        <[email protected]>
+MichaÅ‚ UrbaÅ„czyk aka Tow,        <[email protected]>
    * project originator; programming, making releases, website
 maintenance, reverse engineering, general support.
 

+ 5 - 12
client/CMT.cpp

@@ -171,14 +171,7 @@ void init()
 static void prog_version(void)
 {
 	printf("%s\n", GameConstants::VCMI_VERSION.c_str());
-	printf("  game data:   %s\n", boost::algorithm::join(VCMIDirs::get().dataPaths(), ":").c_str());
-	printf("  libraries:   %s\n", VCMIDirs::get().libraryPath().c_str());
-	printf("  server:      %s\n", VCMIDirs::get().serverPath().c_str());
-	printf("\n");
-	printf("  user data:   %s\n", VCMIDirs::get().userDataPath().c_str());
-	printf("  user cache:  %s\n", VCMIDirs::get().userCachePath().c_str());
-	printf("  user config: %s\n", VCMIDirs::get().userConfigPath().c_str());
-	printf("  user saves:  %s\n", VCMIDirs::get().userSavePath().c_str());
+	std::cout << VCMIDirs::get().genHelpString();
 }
 
 static void prog_help(const po::options_description &opts)
@@ -770,7 +763,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo
 	int suggestedBpp = SDL_VideoModeOK(w, h, bpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0));
 	if(suggestedBpp == 0)
 	{
-        logGlobal->errorStream() << "Error: SDL says that " << w << "x" << h << " resolution is not available!";
+		logGlobal->errorStream() << "Error: SDL says that " << w << "x" << h << " resolution is not available!";
 		return;
 	}
 
@@ -778,7 +771,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo
 
 	if(suggestedBpp != bpp)
 	{
-		logGlobal->infoStream() << boost::format("Using %s bpp (bits per pixel) for the video mode. Default or overriden setting was %s bpp.") % suggestedBpp % bpp;
+		logGlobal->infoStream() << boost::format("Using %s bpp (bits per pixel) for the video mode. Default or overridden setting was %s bpp.") % suggestedBpp % bpp;
 	}
 
 	//For some reason changing fullscreen via config window checkbox result in SDL_Quit event
@@ -791,11 +784,11 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo
 
 	if((screen = SDL_SetVideoMode(w, h, suggestedBpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0))) == nullptr)
 	{
-        logGlobal->errorStream() << "Requested screen resolution is not available (" << w << "x" << h << "x" << suggestedBpp << "bpp)";
+		logGlobal->errorStream() << "Requested screen resolution is not available (" << w << "x" << h << "x" << suggestedBpp << "bpp)";
 		throw std::runtime_error("Requested screen resolution is not available\n");
 	}
 
-    logGlobal->infoStream() << "New screen flags: " << screen->flags;
+	logGlobal->infoStream() << "New screen flags: " << screen->flags;
 
 	if(screen2)
 		SDL_FreeSurface(screen2);

+ 1 - 0
client/icons/vcmiclient.desktop

@@ -7,3 +7,4 @@ Icon=vcmiclient
 Exec=vcmiclient
 Categories=Game;StrategyGame;
 Version=1.0
+Keywords=heroes;homm3;

+ 1 - 0
launcher/vcmilauncher.desktop

@@ -7,3 +7,4 @@ Icon=vcmiclient
 Exec=vcmilauncher
 Categories=Game;StrategyGame;
 Version=1.0
+Keywords=heroes;homm3;

+ 3 - 3
lib/Connection.cpp

@@ -389,15 +389,15 @@ void CLoadFile::openNextFile(const std::string &fname, int minimalVersion)
 
 		if(fileVersion > version)
 		{
-            logGlobal->warnStream() << boost::format("Warning format version mismatch: found %d when current is %d! (file %s)\n") % fileVersion % version % fname;
+			logGlobal->warnStream() << boost::format("Warning format version mismatch: found %d when current is %d! (file %s)\n") % fileVersion % version % fname;
 
 			auto versionptr = (char*)&fileVersion;
 			std::reverse(versionptr, versionptr + 4);
-            logGlobal->warnStream() << "Version number reversed is " << fileVersion << ", checking...";
+			logGlobal->warnStream() << "Version number reversed is " << fileVersion << ", checking...";
 
 			if(fileVersion == version)
 			{
-                logGlobal->warnStream() << fname << " seems to have different endianess! Entering reversing mode.";
+				logGlobal->warnStream() << fname << " seems to have different endianness! Entering reversing mode.";
 				reverseEndianess = true;
 			}
 			else

+ 1 - 1
lib/NetPacksLib.cpp

@@ -632,7 +632,7 @@ DLL_LINKAGE const CStackInstance * StackLocation::getStack()
 {
 	if(!army->hasStackAtSlot(slot))
 	{
-        logNetwork->warnStream() << "Warning: " << army->nodeName() << " dont have a stack at slot " << slot;
+		logNetwork->warnStream() << "Warning: " << army->nodeName() << " don't have a stack at slot " << slot;
 		return nullptr;
 	}
 	return &army->getStack(slot);

+ 13 - 0
lib/VCMIDirs.cpp

@@ -220,3 +220,16 @@ std::vector<std::string> VCMIDirs::dataPaths() const
 }
 
 #endif
+
+std::string VCMIDirs::genHelpString() const
+{
+	return
+	"  game data:   " + boost::algorithm::join(dataPaths(), ":") + "\n" +
+	"  libraries:   " + libraryPath() + "\n" +
+	"  server:      " + serverPath() + "\n" +
+	"\n" +
+	"  user data:   " + userDataPath() + "\n" +
+	"  user cache:  " + userCachePath() + "\n" +
+	"  user config: " + userConfigPath() + "\n" +
+	"  user saves:  " + userSavePath() + "\n";
+}

+ 2 - 0
lib/VCMIDirs.h

@@ -47,4 +47,6 @@ public:
 
 	/// Returns system-specific name for dynamic libraries ( StupidAI => "libStupidAI.so" or "StupidAI.dll")
 	std::string libraryName(std::string basename) const;
+
+	std::string genHelpString() const;
 };

+ 19 - 0
server/CVCMIServer.cpp

@@ -533,6 +533,25 @@ static void handleCommandOptions(int argc, char *argv[])
 	}
 
 	po::notify(cmdLineOptions);
+
+	if (cmdLineOptions.count("help"))
+	{
+		printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
+		printf("Copyright (C) 2007-2014 VCMI dev team - see AUTHORS file\n");
+		printf("This is free software; see the source for copying conditions. There is NO\n");
+		printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
+		printf("\n");
+		printf("Usage:\n");
+		std::cout << opts;
+		exit(0);
+	}
+
+	if (cmdLineOptions.count("version"))
+	{
+		printf("%s\n", GameConstants::VCMI_VERSION.c_str());
+		std::cout << VCMIDirs::get().genHelpString();
+		exit(0);
+	}
 }
 
 #if defined(__GNUC__) && !defined (__MINGW32__)

+ 8 - 3
vcmibuilder

@@ -59,7 +59,7 @@ then
 	echo "                  " "Requires unzip"
 	echo
 	echo " --convertMP3     " "Convert all mp3 files into ogg/vorbis"
-	echo "                  " "Requires ffmpeg"
+	echo "                  " "Requires ffmpeg or avconv"
 	echo
 	echo " --download       " "Automatically download requied packages using wget"
 	echo "                  " "Requires wget and Internet connection"
@@ -116,7 +116,12 @@ fi
 
 if [[ -n "$useffmpeg" ]] 
 then
-	test_utility "ffmpeg" "-version"
+	ffmpeg -version > /dev/null 2>&1 && AUDIO_CONV=ffmpeg
+	avconv -version > /dev/null 2>&1 && AUDIO_CONV=avconv
+	if [[ -z "$AUDIO_CONV" ]]
+	then
+		fail "Error: neither ffmpeg nor avconv were found. Please install it."
+	fi
 fi
 
 if [[ -n "$cd1_dir" ]] 
@@ -277,7 +282,7 @@ then
 	do
 		echo "Converting $file"
 		ogg=${file%.*}
-		ffmpeg -y -i "$file" -acodec libvorbis "$ogg".ogg 2>/dev/null || fail "Error: failed to convert $file to ogg/vorbis using ffmpeg" "rm -f "$ogg".ogg"
+		$AUDIO_CONV -y -i "$file" -acodec libvorbis "$ogg".ogg 2>/dev/null || fail "Error: failed to convert $file to ogg/vorbis using $AUDIO_CONV" "rm -f "$ogg".ogg"
 		rm -f $file
 	done