Fixed code formatting

* moved braces to new lines
 * fixed some function/variable names
 * fixed whitespace issues
dev-ui
Piotr Dziwinski 2013-05-26 17:47:54 +02:00
parent 538745a731
commit 8765d58b02
233 changed files with 1616 additions and 1217 deletions

View File

@ -1703,4 +1703,3 @@ public:
bool GetPosition(int& start, int& stop, CBotGet modestart, CBotGet modestop); bool GetPosition(int& start, int& stop, CBotGet modestart, CBotGet modestop);
}; };

View File

@ -141,4 +141,3 @@ bool CBotAddExpr::Execute(CBotStack* &pStack)
return pStack->Return(pStk1); // transmits the result return pStack->Return(pStk1); // transmits the result
} }

View File

@ -1646,3 +1646,4 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack)
pStack->SetError(TX_ENDOF, p); pStack->SetError(TX_ENDOF, p);
return NULL; return NULL;
} }

View File

@ -36,3 +36,4 @@
extern bool IsOfType(CBotToken* &p, int type1, int type2 = -1); extern bool IsOfType(CBotToken* &p, int type1, int type2 = -1);
extern bool IsOfTypeList(CBotToken* &p, int type1, ...); extern bool IsOfTypeList(CBotToken* &p, int type1, ...);

View File

@ -566,3 +566,4 @@ void t(bool t)
t ? 0 : "test"; t ? 0 : "test";
} }
#endif #endif

View File

@ -2245,4 +2245,3 @@ CBotTypResult&
return *this; return *this;
} }

View File

@ -21,3 +21,4 @@ else()
ARCHIVE DESTINATION ${COLOBOT_INSTALL_LIB_DIR} ARCHIVE DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR}) RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
endif() endif()

View File

@ -434,3 +434,4 @@ void InitStringFunctions()
CBotProgram::AddFunction("strupper", rStrUpper, cStrStr ); CBotProgram::AddFunction("strupper", rStrUpper, cStrStr );
CBotProgram::AddFunction("strlower", rStrLower, cStrStr ); CBotProgram::AddFunction("strlower", rStrLower, cStrStr );
} }

View File

@ -39,3 +39,4 @@ the object being created with CBotVar :: Create (name, pClasse)
not destroy the object when there imédiatement pointers not destroy the object when there imédiatement pointers
but marked as virtually destroyed but marked as virtually destroyed

View File

@ -176,3 +176,4 @@ enum EID
#define TX_ERRWRITE 6015 #define TX_ERRWRITE 6015
#define TX_MAX 6016 #define TX_MAX 6016

View File

@ -229,3 +229,4 @@ target_link_libraries(colobot ${LIBS})
install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR}) install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR}) set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})

View File

@ -2,3 +2,4 @@
* \dir src/app * \dir src/app
* Main class of the application and system functions * Main class of the application and system functions
*/ */

View File

@ -122,3 +122,4 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
} }
} // extern "C" } // extern "C"

View File

@ -188,12 +188,13 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte
return result; return result;
} }
std::string CSystemUtils::profileFileLocation() std::string CSystemUtils::GetProfileFileLocation()
{ {
return std::string("colobot.ini"); return std::string("colobot.ini");
} }
std::string CSystemUtils::savegameDirectoryLocation() std::string CSystemUtils::GetSavegameDirectoryLocation()
{ {
return std::string("savegame"); return std::string("savegame");
} }

View File

@ -131,10 +131,10 @@ public:
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
//! Returns the profile (colobot.ini) file location //! Returns the profile (colobot.ini) file location
virtual std::string profileFileLocation(); virtual std::string GetProfileFileLocation();
//! Returns the savegame directory location //! Returns the savegame directory location
virtual std::string savegameDirectoryLocation(); virtual std::string GetSavegameDirectoryLocation();
}; };
//! Global function to get CSystemUtils instance //! Global function to get CSystemUtils instance
@ -142,3 +142,4 @@ inline CSystemUtils* GetSystemUtils()
{ {
return CSystemUtils::GetInstancePointer(); return CSystemUtils::GetInstancePointer();
} }

View File

@ -95,9 +95,9 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT
(after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll; (after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll;
} }
std::string CSystemUtilsLinux::profileFileLocation() std::string CSystemUtilsLinux::GetProfileFileLocation()
{ {
std::string m_profileFile; std::string profileFile;
// Determine profileFile according to XDG Base Directory Specification // Determine profileFile according to XDG Base Directory Specification
char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME"); char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME");
@ -106,25 +106,25 @@ std::string CSystemUtilsLinux::profileFileLocation()
char *envHOME = getenv("HOME"); char *envHOME = getenv("HOME");
if (envHOME == NULL) if (envHOME == NULL)
{ {
m_profileFile = "colobot.ini"; profileFile = "colobot.ini";
} }
else else
{ {
m_profileFile = std::string(envHOME) + "/.config/colobot.ini"; profileFile = std::string(envHOME) + "/.config/colobot.ini";
} }
} }
else else
{ {
m_profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini"; profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini";
} }
GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str()); GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
return m_profileFile; return profileFile;
} }
std::string CSystemUtilsLinux::savegameDirectoryLocation() std::string CSystemUtilsLinux::GetSavegameDirectoryLocation()
{ {
std::string m_savegameDir; std::string savegameDir;
// Determine savegame dir according to XDG Base Directory Specification // Determine savegame dir according to XDG Base Directory Specification
char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA"); char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA");
@ -133,18 +133,19 @@ std::string CSystemUtilsLinux::savegameDirectoryLocation()
char *envHOME = getenv("HOME"); char *envHOME = getenv("HOME");
if (envHOME == NULL) if (envHOME == NULL)
{ {
m_savegameDir = "/tmp/colobot-savegame"; savegameDir = "/tmp/colobot-savegame";
} }
else else
{ {
m_savegameDir = std::string(envHOME) + "/.local/share/colobot"; savegameDir = std::string(envHOME) + "/.local/share/colobot";
} }
} }
else else
{ {
m_savegameDir = std::string(envXDG_DATA_HOME) + "/colobot"; savegameDir = std::string(envXDG_DATA_HOME) + "/colobot";
} }
GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str()); GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
return m_savegameDir; return savegameDir;
} }

View File

@ -46,9 +46,10 @@ public:
virtual long long GetTimeStampExactResolution() override; virtual long long GetTimeStampExactResolution() override;
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
virtual std::string profileFileLocation() override; virtual std::string GetProfileFileLocation() override;
virtual std::string savegameDirectoryLocation() override; virtual std::string GetSavegameDirectoryLocation() override;
private: private:
bool m_zenityAvailable; bool m_zenityAvailable;
}; };

View File

@ -37,3 +37,4 @@ long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, Sys
{ {
return (after->sdlTicks - before->sdlTicks) * 1000000ll; return (after->sdlTicks - before->sdlTicks) * 1000000ll;
} }

View File

@ -46,3 +46,4 @@ public:
virtual long long GetTimeStampExactResolution() override; virtual long long GetTimeStampExactResolution() override;
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
}; };

View File

@ -111,38 +111,39 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str)
} }
std::string CSystemUtilsWindows::profileFileLocation() std::string CSystemUtilsWindows::GetProfileFileLocation()
{ {
std::string m_profileFile; std::string profileFile;
char* envUSERPROFILE = getenv("USERPROFILE"); char* envUSERPROFILE = getenv("USERPROFILE");
if (envUSERPROFILE == NULL) if (envUSERPROFILE == NULL)
{ {
m_profileFile = "colobot.ini"; profileFile = "colobot.ini";
} }
else else
{ {
m_profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini"; profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini";
} }
GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str()); GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
return m_profileFile; return profileFile;
} }
std::string CSystemUtilsWindows::savegameDirectoryLocation() std::string CSystemUtilsWindows::GetSavegameDirectoryLocation()
{ {
std::string m_savegameDir; std::string savegameDir;
char* envUSERPROFILE = getenv("USERPROFILE"); char* envUSERPROFILE = getenv("USERPROFILE");
if (envUSERPROFILE == NULL) if (envUSERPROFILE == NULL)
{ {
m_savegameDir = "savegame"; savegameDir = "savegame";
} }
else else
{ {
m_savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame"; savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame";
} }
GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str()); GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
return m_savegameDir; return savegameDir;
} }

View File

@ -44,8 +44,8 @@ public:
virtual long long GetTimeStampExactResolution() override; virtual long long GetTimeStampExactResolution() override;
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
virtual std::string profileFileLocation() override; virtual std::string GetProfileFileLocation() override;
virtual std::string savegameDirectoryLocation() override; virtual std::string GetSavegameDirectoryLocation() override;
private: private:
std::string UTF8_Encode(const std::wstring &wstr); std::string UTF8_Encode(const std::wstring &wstr);
@ -54,3 +54,4 @@ private:
protected: protected:
long long m_counterFrequency; long long m_counterFrequency;
}; };

View File

@ -2,3 +2,4 @@
* \dir src/common * \dir src/common
* \brief Structs and utils shared throughout the application * \brief Structs and utils shared throughout the application
*/ */

View File

@ -23,3 +23,4 @@
#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@" #define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@" #define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"

View File

@ -779,3 +779,4 @@ protected:
int m_tail; int m_tail;
int m_total; int m_total;
}; };

View File

@ -297,3 +297,4 @@ extern int g_build; // constructible buildings
extern int g_researchDone; // research done extern int g_researchDone; // research done
extern long g_researchEnable; // research available extern long g_researchEnable; // research available
extern float g_unit; // conversion factor extern float g_unit; // conversion factor

View File

@ -110,7 +110,8 @@ bool PNGSaveSurface(const char *filename, SDL_Surface *surf)
return false; return false;
} }
if (setjmp(png_jmpbuf(png_ptr))) { if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp); fclose(fp);
return false; return false;
@ -396,3 +397,4 @@ bool CImage::SavePNG(const std::string& fileName)
return true; return true;
} }

View File

@ -112,3 +112,4 @@ private:
//! Image data //! Image data
ImageData* m_data; ImageData* m_data;
}; };

View File

@ -111,3 +111,4 @@ void CInstanceManager::Compress(ManagedClassType classType)
} }
m_table[classType].usedCount = j; m_table[classType].usedCount = j;
} }

View File

@ -93,4 +93,3 @@ protected:
ManagedClassInstances m_table[CLASS_MAX]; ManagedClassInstances m_table[CLASS_MAX];
}; };

View File

@ -146,3 +146,4 @@ std::string ReadBinaryString(std::istream &istr)
} }
}; // namespace IOUtils }; // namespace IOUtils

View File

@ -61,3 +61,4 @@ enum VirtualKmod
//! Special value for invalid key bindings //! Special value for invalid key bindings
const unsigned int KEY_INVALID = SDLK_LAST + 1000; const unsigned int KEY_INVALID = SDLK_LAST + 1000;

View File

@ -125,6 +125,8 @@ private:
//! Global function to get Logger instance //! Global function to get Logger instance
inline CLogger* GetLogger() { inline CLogger* GetLogger()
{
return CLogger::GetInstancePointer(); return CLogger::GetInstancePointer();
} }

View File

@ -31,3 +31,4 @@ extern void TimeToAscii(time_t time, char *buffer);
extern bool CopyFileListToTemp(char* filename, int* list, int total); extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, const char* ext); extern void AddExt(char* filename, const char* ext);

View File

@ -47,8 +47,9 @@ bool CProfile::InitCurrentDirectory()
{ {
try try
{ {
// TODO: NDEBUG should be replaced with something like BUILD_TYPE == "DEBUG"/"RELEASE"
#ifdef NDEBUG #ifdef NDEBUG
bp::ini_parser::read_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree); bp::ini_parser::read_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree);
#else #else
bp::ini_parser::read_ini("colobot.ini", m_propertyTree); bp::ini_parser::read_ini("colobot.ini", m_propertyTree);
#endif #endif
@ -68,7 +69,7 @@ bool CProfile::SaveCurrentDirectory()
try try
{ {
#ifdef NDEBUG #ifdef NDEBUG
bp::ini_parser::write_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree); bp::ini_parser::write_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree);
#else #else
bp::ini_parser::write_ini("colobot.ini", m_propertyTree); bp::ini_parser::write_ini("colobot.ini", m_propertyTree);
#endif #endif
@ -209,13 +210,17 @@ std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir)
{ {
std::string path = dir; std::string path = dir;
boost::replace_all(path, "\\", "/"); boost::replace_all(path, "\\", "/");
if (dir.find("/") == std::string::npos) { if (dir.find("/") == std::string::npos)
{
path = default_dir + "/" + dir; path = default_dir + "/" + dir;
} }
if (m_userDirectory.length() > 0) { if (m_userDirectory.length() > 0)
{
boost::replace_all(path, "%user%", m_userDirectory); boost::replace_all(path, "%user%", m_userDirectory);
} else { }
else
{
boost::replace_all(path, "%user%", default_dir); boost::replace_all(path, "%user%", default_dir);
} }
@ -235,7 +240,8 @@ bool CProfile::CopyFileToTemp(std::string filename)
fs::create_directory(fs::path(dst).parent_path().make_preferred().string()); fs::create_directory(fs::path(dst).parent_path().make_preferred().string());
fs::copy_file(src, dst, fs::copy_option::overwrite_if_exists); fs::copy_file(src, dst, fs::copy_option::overwrite_if_exists);
if (fs::exists(dst)) { if (fs::exists(dst))
{
return true; return true;
} }

View File

@ -41,101 +41,103 @@ namespace fs = boost::filesystem;
*/ */
class CProfile : public CSingleton<CProfile> class CProfile : public CSingleton<CProfile>
{ {
public: public:
CProfile(); CProfile();
~CProfile(); ~CProfile();
/** Loads colobot.ini from current directory /** Loads colobot.ini from current directory
* \return return true on success * \return return true on success
*/ */
bool InitCurrentDirectory(); bool InitCurrentDirectory();
/** Saves colobot.ini to current directory /** Saves colobot.ini to current directory
* \return return true on success * \return return true on success
*/ */
bool SaveCurrentDirectory(); bool SaveCurrentDirectory();
/** Sets string value in section under specified key /** Sets string value in section under specified key
* \param section * \param section
* \param key * \param key
* \param value * \param value
* \return return true on success * \return return true on success
*/ */
bool SetLocalProfileString(std::string section, std::string key, std::string value); bool SetLocalProfileString(std::string section, std::string key, std::string value);
/** Gets string value in section under specified key /** Gets string value in section under specified key
* \param section * \param section
* \param key * \param key
* \param buffer * \param buffer
* \return return true on success * \return return true on success
*/ */
bool GetLocalProfileString(std::string section, std::string key, std::string& buffer); bool GetLocalProfileString(std::string section, std::string key, std::string& buffer);
/** Sets int value in section under specified key /** Sets int value in section under specified key
* \param section * \param section
* \param key * \param key
* \param value * \param value
* \return return true on success * \return return true on success
*/ */
bool SetLocalProfileInt(std::string section, std::string key, int value); bool SetLocalProfileInt(std::string section, std::string key, int value);
/** Gets int value in section under specified key /** Gets int value in section under specified key
* \param section * \param section
* \param key * \param key
* \param value * \param value
* \return return true on success * \return return true on success
*/ */
bool GetLocalProfileInt(std::string section, std::string key, int &value); bool GetLocalProfileInt(std::string section, std::string key, int &value);
/** Sets float value in section under specified key /** Sets float value in section under specified key
* \param section * \param section
* \param key * \param key
* \param value * \param value
* \return return true on success * \return return true on success
*/ */
bool SetLocalProfileFloat(std::string section, std::string key, float value); bool SetLocalProfileFloat(std::string section, std::string key, float value);
/** Gets float value in section under specified key /** Gets float value in section under specified key
* \param section * \param section
* \param key * \param key
* \param value * \param value
* \return return true on success * \return return true on success
*/ */
bool GetLocalProfileFloat(std::string section, std::string key, float &value); bool GetLocalProfileFloat(std::string section, std::string key, float &value);
/** Gets all values in section under specified key /** Gets all values in section under specified key
* \param section * \param section
* \param key * \param key
* \return vector of values * \return vector of values
*/ */
std::vector< std::string > GetLocalProfileSection(std::string section, std::string key); std::vector< std::string > GetLocalProfileSection(std::string section, std::string key);
/** Sets current user directory /** Sets current user directory
* \param dir * \param dir
*/ */
void SetUserDir(std::string dir); void SetUserDir(std::string dir);
/** Returns path based on current user. Replaces %user% in path with current user dir or /** Returns path based on current user. Replaces %user% in path with current user dir or
* uses default_dir param if no user dir is specified * uses default_dir param if no user dir is specified
* \param dir * \param dir
* \param default_dir * \param default_dir
* \return path * \return path
*/ */
std::string GetUserBasedPath(std::string dir, std::string default_dir); std::string GetUserBasedPath(std::string dir, std::string default_dir);
/** opy a file into the temporary folder. /** opy a file into the temporary folder.
* \param filename * \param filename
* \return true on success * \return true on success
*/ */
bool CopyFileToTemp(std::string filename); bool CopyFileToTemp(std::string filename);
private: private:
boost::property_tree::ptree m_propertyTree; boost::property_tree::ptree m_propertyTree;
bool m_profileNeedSave; bool m_profileNeedSave;
std::string m_userDirectory; std::string m_userDirectory;
}; };
//! Global function to get profile instance //! Global function to get profile instance
inline CProfile & GetProfile() { inline CProfile & GetProfile()
{
return *CProfile::GetInstancePointer(); return *CProfile::GetInstancePointer();
} }

View File

@ -920,3 +920,4 @@ bool GetResource(ResType type, int num, char* text)
PutKeyName(text, tmpl); PutKeyName(text, tmpl);
return true; return true;
} }

View File

@ -158,3 +158,4 @@ void InitializeRestext();
void SetGlobalGamerName(std::string name); void SetGlobalGamerName(std::string name);
bool SearchKey(const char *cmd, InputSlot& slot); bool SearchKey(const char *cmd, InputSlot& slot);
bool GetResource(ResType type, int num, char* text); bool GetResource(ResType type, int num, char* text);

View File

@ -74,3 +74,4 @@ private:
CSingleton& operator=(const CSingleton<T> &); CSingleton& operator=(const CSingleton<T> &);
CSingleton(const CSingleton<T> &); CSingleton(const CSingleton<T> &);
}; };

View File

@ -142,3 +142,4 @@ size_t StrUtils::Utf8StringLength(const std::string &str)
} }
return result; return result;
} }

View File

@ -78,3 +78,4 @@ int Utf8CharSizeAt(const std::string &str, unsigned int pos);
size_t Utf8StringLength(const std::string &str); size_t Utf8StringLength(const std::string &str);
}; // namespace StrUtil }; // namespace StrUtil

View File

@ -1 +1,2 @@
lang/ lang/

View File

@ -3,72 +3,72 @@ cmake_minimum_required(VERSION 2.8)
# Install Desktop Entry file # Install Desktop Entry file
set(COLOBOT_DESKTOP_FILE colobot.desktop) set(COLOBOT_DESKTOP_FILE colobot.desktop)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Build ${COLOBOT_DESKTOP_FILE}" COMMENT "Build ${COLOBOT_DESKTOP_FILE}"
) )
add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}) add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE})
install( install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/
) )
# Install Icon # Install Icon
set(COLOBOT_ICON_FILE colobot.svg) set(COLOBOT_ICON_FILE colobot.svg)
install( install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
) )
# Render SVG icon in various sizes # Render SVG icon in various sizes
find_program(RSVG_CONVERT rsvg-convert) find_program(RSVG_CONVERT rsvg-convert)
if(RSVG_CONVERT) if(RSVG_CONVERT)
foreach(PNGSIZE "48" "32" "16") foreach(PNGSIZE "48" "32" "16")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE})
add_custom_target(resize_icon_${PNGSIZE} ALL add_custom_target(resize_icon_${PNGSIZE} ALL
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
> ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png > ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
) )
install( install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
) )
endforeach() endforeach()
endif() endif()
# Create manpage from pod-formatted file # Create manpage from pod-formatted file
find_program(POD2MAN pod2man) find_program(POD2MAN pod2man)
if(POD2MAN AND (NOT MSYS)) if(POD2MAN AND (NOT MSYS))
set(COLOBOT_MANPAGE_SECTION 6) set(COLOBOT_MANPAGE_SECTION 6)
macro(podman) macro(podman)
cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN}) cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN})
if(PM_LOCALE) if(PM_LOCALE)
# This copes with the fact that english has no "/LANG" in the paths and filenames. # This copes with the fact that english has no "/LANG" in the paths and filenames.
set(SLASHLOCALE /${PM_LOCALE}) set(SLASHLOCALE /${PM_LOCALE})
endif() endif()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION} COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION}
--center="Colobot" --stderr --utf8 --center="Colobot" --stderr --utf8
--release="${COLOBOT_VERSION_FULL}" --release="${COLOBOT_VERSION_FULL}"
${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage" COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage"
) )
add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}) add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION})
install( install(
FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ ) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ )
add_dependencies(man man${PM_LOCALE}) add_dependencies(man man${PM_LOCALE})
endmacro() endmacro()
# Create the english manpage # Create the english manpage
podman(PODFILE colobot.pod) podman(PODFILE colobot.pod)
endif() endif()
@ -76,22 +76,23 @@ endif()
find_program(PO4A po4a) find_program(PO4A po4a)
if(PO4A) if(PO4A)
add_custom_target(desktop_po4a add_custom_target(desktop_po4a
COMMAND ${PO4A} po4a.cfg COMMAND ${PO4A} po4a.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_dependencies(desktopfile desktop_po4a) add_dependencies(desktopfile desktop_po4a)
if(POD2MAN) if(POD2MAN)
add_custom_target(man_po4a add_custom_target(man_po4a
COMMAND ${PO4A} po4a.cfg COMMAND ${PO4A} po4a.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_dependencies(man man_po4a) add_dependencies(man man_po4a)
file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po) file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO}) string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO})
foreach(LOCALE ${LINGUAS}) foreach(LOCALE ${LINGUAS})
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE}) podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
endforeach() endforeach()
endif() endif()
endif() endif()

View File

@ -4,3 +4,4 @@ Type=Application
Exec=colobot Exec=colobot
Icon=colobot Icon=colobot
Categories=Education;Robotics;Game;AdventureGame;StrategyGame; Categories=Education;Robotics;Game;AdventureGame;StrategyGame;

View File

@ -1,3 +1,4 @@
Name="Colobot" Name="Colobot"
GenericName="Game to learn programming" GenericName="Game to learn programming"
Comment="Colonize with bots" Comment="Colonize with bots"

View File

@ -45,3 +45,4 @@ Set language. Note that you can also fill the B<LANG> environment variable.
=head1 AUTHOR =head1 AUTHOR
This manpage was written by Didier Raboud <S<odyx@debian.org>>. This manpage was written by Didier Raboud <S<odyx@debian.org>>.

View File

@ -236,3 +236,4 @@
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -11,8 +11,8 @@ cat colobot.desktop.in
linguas=$([ ! -d lang ] || ( cd lang ; ls)); linguas=$([ ! -d lang ] || ( cd lang ; ls));
for type in Name GenericName Comment; do for type in Name GenericName Comment; do
egrep "^$type=" $fname | sed -e "s/^$type=\"\(.*\)\"$/$type=\1/g" egrep "^$type=" $fname | sed -e "s/^$type=\"\(.*\)\"$/$type=\1/g"
for l in $linguas; do for l in $linguas; do
egrep "^$type=" lang/$l/$fname | sed -e "s/^$type=\"\(.*\)\"$/$type[$l]=\1/g" egrep "^$type=" lang/$l/$fname | sed -e "s/^$type=\"\(.*\)\"$/$type[$l]=\1/g"
done done
done done

View File

@ -132,3 +132,4 @@ msgstr ""
#: colobot.pod:47 #: colobot.pod:47
msgid "This manpage was written by Didier Raboud <S<odyx@debian.org>>." msgid "This manpage was written by Didier Raboud <S<odyx@debian.org>>."
msgstr "" msgstr ""

View File

@ -2,3 +2,4 @@
[type:ini] colobot.ini $lang:lang/$lang/colobot.ini [type:ini] colobot.ini $lang:lang/$lang/colobot.ini
[type:pod] colobot.pod $lang:lang/$lang/colobot.pod [type:pod] colobot.pod $lang:lang/$lang/colobot.pod

View File

@ -10,3 +10,4 @@
* This namespace was created to avoid clashing with old code, but now it still serves, * This namespace was created to avoid clashing with old code, but now it still serves,
* defining a border between pure graphics engine and other parts of application. * defining a border between pure graphics engine and other parts of application.
*/ */

View File

@ -5,3 +5,4 @@
* Core types, enums, structs and CDevice abstract class that define * Core types, enums, structs and CDevice abstract class that define
* the abstract graphics device used in graphics engine * the abstract graphics device used in graphics engine
*/ */

View File

@ -106,3 +106,4 @@ Color HSV2RGB(ColorHSV color)
} // namespace Gfx } // namespace Gfx

View File

@ -154,3 +154,4 @@ Color HSV2RGB(ColorHSV color);
} // namespace Gfx } // namespace Gfx

View File

@ -401,3 +401,4 @@ public:
} // namespace Gfx } // namespace Gfx

View File

@ -98,3 +98,4 @@ struct Light
} // namespace Gfx } // namespace Gfx

View File

@ -60,3 +60,4 @@ struct Material
} // namespace Gfx } // namespace Gfx

View File

@ -269,3 +269,4 @@ struct Texture
} // namespace Gfx } // namespace Gfx

View File

@ -140,3 +140,4 @@ struct VertexTex2
} // namespace Gfx } // namespace Gfx

View File

@ -1 +1,2 @@
Possible future DirectX implementation of graphics engine Possible future DirectX implementation of graphics engine

View File

@ -7,3 +7,4 @@
* *
* Graphics operations are done on abstract interface from src/graphics/core * Graphics operations are done on abstract interface from src/graphics/core
*/ */

View File

@ -1676,3 +1676,4 @@ Math::Vector CCamera::ExcludeObject(Math::Vector eye, Math::Vector lookat,
} }

View File

@ -128,8 +128,7 @@ enum CameraOverEffect
... */ ... */
class CCamera { class CCamera {
public:
public:
CCamera(); CCamera();
~CCamera(); ~CCamera();
@ -391,3 +390,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -270,3 +270,4 @@ bool CCloud::GetEnabled()
} // namespace Gfx } // namespace Gfx

View File

@ -140,3 +140,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -4332,3 +4332,4 @@ void CEngine::DrawStats()
} // namespace Gfx } // namespace Gfx

View File

@ -1431,3 +1431,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -465,3 +465,4 @@ bool CLightManager::LightsComparator::operator()(const DynamicLight& left, const
} }
} // namespace Gfx } // namespace Gfx

View File

@ -216,3 +216,4 @@ protected:
}; };
}; // namespace Gfx }; // namespace Gfx

View File

@ -418,3 +418,4 @@ CObject* CLightning::SearchObject(Math::Vector pos)
} // namespace Gfx } // namespace Gfx

View File

@ -107,3 +107,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -1199,3 +1199,4 @@ int CModelFile::GetTriangleCount()
} // namespace Gfx } // namespace Gfx

View File

@ -150,3 +150,4 @@ protected:
}; };
}; // namespace Gfx }; // namespace Gfx

View File

@ -201,3 +201,4 @@ float CModelManager::GetHeight(std::vector<ModelTriangle>& triangles, Math::Vect
} }

View File

@ -99,3 +99,4 @@ private:
}; };
} // namespace Gfx } // namespace Gfx

View File

@ -3917,3 +3917,4 @@ bool CParticle::WriteWheelTrace(const char *filename, int width, int height,
} }
} // namespace Gfx } // namespace Gfx

View File

@ -395,3 +395,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -185,3 +185,4 @@ int CPlanet::GetMode()
} // namespace Gfx } // namespace Gfx

View File

@ -118,3 +118,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -2399,3 +2399,4 @@ void CPyro::LightOperFrame(float rTime)
} // namespace Gfx } // namespace Gfx

View File

@ -219,3 +219,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -1801,3 +1801,4 @@ float CTerrain::GetFlyingLimit(Math::Vector pos, bool noLimit)
} // namespace Gfx } // namespace Gfx

View File

@ -418,3 +418,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -25,3 +25,4 @@ add_executable(modelfile_test ${MODELFILE_TEST_SOURCES})
target_link_libraries(modelfile_test gtest) target_link_libraries(modelfile_test gtest)
add_test(modelfile_test modelfile_test) add_test(modelfile_test modelfile_test)

View File

@ -260,3 +260,4 @@ int main(int argc, char **argv)
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }

View File

@ -913,3 +913,4 @@ CharTexture CText::CreateCharTexture(UTF8Char ch, CachedFont* font)
} // namespace Gfx } // namespace Gfx

View File

@ -342,3 +342,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -628,3 +628,4 @@ void CWater::AdjustEye(Math::Vector &eye)
} // namespace Gfx } // namespace Gfx

View File

@ -204,3 +204,4 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -5,3 +5,4 @@
* Contains the concrete implementation using OpenGL of abstract CDevice class * Contains the concrete implementation using OpenGL of abstract CDevice class
* from src/graphics/core * from src/graphics/core
*/ */

View File

@ -1689,3 +1689,4 @@ FillMode CGLDevice::GetFillMode()
} // namespace Gfx } // namespace Gfx

View File

@ -257,3 +257,4 @@ private:
} // namespace Gfx } // namespace Gfx

View File

@ -10,3 +10,4 @@
* This namespace was created to avoid clashing with old code, but now it still serves, * This namespace was created to avoid clashing with old code, but now it still serves,
* defining a border between math and non-math-related code. * defining a border between math and non-math-related code.
*/ */

View File

@ -28,3 +28,4 @@
#include "math/vector.h" #include "math/vector.h"
#include "math/matrix.h" #include "math/matrix.h"
#include "math/geometry.h" #include "math/geometry.h"

View File

@ -53,3 +53,4 @@ const float LOG_2 = log(2.0f);
} // namespace Math } // namespace Math

View File

@ -263,3 +263,4 @@ inline float Bounce(float progress, float middle = 0.3f, float bounce = 0.4f)
} // namespace Math } // namespace Math

View File

@ -643,3 +643,4 @@ inline Math::Vector RotateView(Math::Vector center, float angleH, float angleV,
} // namespace Math } // namespace Math

View File

@ -59,3 +59,4 @@ struct IntPoint
} // namespace Math } // namespace Math

View File

@ -462,3 +462,4 @@ inline Math::Vector MatrixVectorMultiply(const Math::Matrix &m, const Math::Vect
} // namespace Math } // namespace Math

View File

@ -191,3 +191,4 @@ inline float Distance(const Point &a, const Point &b)
} // namespace Math } // namespace Math

View File

@ -281,3 +281,4 @@ inline Vector Clamp(const Vector &vec, const Vector &min, const Vector &max)
} // namespace Math } // namespace Math

Some files were not shown because too many files have changed in this diff Show More