Fixed code formatting

* moved braces to new lines
 * fixed some function/variable names
 * fixed whitespace issues
master
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);
};

View File

@ -141,4 +141,3 @@ bool CBotAddExpr::Execute(CBotStack* &pStack)
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);
return NULL;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -434,3 +434,4 @@ void InitStringFunctions()
CBotProgram::AddFunction("strupper", rStrUpper, 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
but marked as virtually destroyed

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -131,10 +131,10 @@ public:
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
//! Returns the profile (colobot.ini) file location
virtual std::string profileFileLocation();
virtual std::string GetProfileFileLocation();
//! Returns the savegame directory location
virtual std::string savegameDirectoryLocation();
virtual std::string GetSavegameDirectoryLocation();
};
//! Global function to get CSystemUtils instance
@ -142,3 +142,4 @@ inline CSystemUtils* GetSystemUtils()
{
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;
}
std::string CSystemUtilsLinux::profileFileLocation()
std::string CSystemUtilsLinux::GetProfileFileLocation()
{
std::string m_profileFile;
std::string profileFile;
// Determine profileFile according to XDG Base Directory Specification
char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME");
@ -106,25 +106,25 @@ std::string CSystemUtilsLinux::profileFileLocation()
char *envHOME = getenv("HOME");
if (envHOME == NULL)
{
m_profileFile = "colobot.ini";
profileFile = "colobot.ini";
}
else
{
m_profileFile = std::string(envHOME) + "/.config/colobot.ini";
profileFile = std::string(envHOME) + "/.config/colobot.ini";
}
}
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
char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA");
@ -133,18 +133,19 @@ std::string CSystemUtilsLinux::savegameDirectoryLocation()
char *envHOME = getenv("HOME");
if (envHOME == NULL)
{
m_savegameDir = "/tmp/colobot-savegame";
savegameDir = "/tmp/colobot-savegame";
}
else
{
m_savegameDir = std::string(envHOME) + "/.local/share/colobot";
savegameDir = std::string(envHOME) + "/.local/share/colobot";
}
}
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 TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
virtual std::string profileFileLocation() override;
virtual std::string savegameDirectoryLocation() override;
virtual std::string GetProfileFileLocation() override;
virtual std::string GetSavegameDirectoryLocation() override;
private:
bool m_zenityAvailable;
};

View File

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

View File

@ -46,3 +46,4 @@ public:
virtual long long GetTimeStampExactResolution() 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");
if (envUSERPROFILE == NULL)
{
m_profileFile = "colobot.ini";
profileFile = "colobot.ini";
}
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");
if (envUSERPROFILE == NULL)
{
m_savegameDir = "savegame";
savegameDir = "savegame";
}
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 TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
virtual std::string profileFileLocation() override;
virtual std::string savegameDirectoryLocation() override;
virtual std::string GetProfileFileLocation() override;
virtual std::string GetSavegameDirectoryLocation() override;
private:
std::string UTF8_Encode(const std::wstring &wstr);
@ -54,3 +54,4 @@ private:
protected:
long long m_counterFrequency;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -125,6 +125,8 @@ private:
//! Global function to get Logger instance
inline CLogger* GetLogger() {
inline CLogger* GetLogger()
{
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 void AddExt(char* filename, const char* ext);

View File

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

View File

@ -41,7 +41,7 @@ namespace fs = boost::filesystem;
*/
class CProfile : public CSingleton<CProfile>
{
public:
public:
CProfile();
~CProfile();
@ -129,13 +129,15 @@ class CProfile : public CSingleton<CProfile>
*/
bool CopyFileToTemp(std::string filename);
private:
private:
boost::property_tree::ptree m_propertyTree;
bool m_profileNeedSave;
std::string m_userDirectory;
};
//! Global function to get profile instance
inline CProfile & GetProfile() {
inline CProfile & GetProfile()
{
return *CProfile::GetInstancePointer();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1 +1,2 @@
lang/

View File

@ -95,3 +95,4 @@ if(PO4A)
endforeach()
endif()
endif()

View File

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

View File

@ -1,3 +1,4 @@
Name="Colobot"
GenericName="Game to learn programming"
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
This manpage was written by Didier Raboud <S<odyx@debian.org>>.

View File

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

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

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

View File

@ -2,3 +2,4 @@
[type:ini] colobot.ini $lang:lang/$lang/colobot.ini
[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,
* 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
* the abstract graphics device used in graphics engine
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,3 +7,4 @@
*
* 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 {
public:
public:
CCamera();
~CCamera();
@ -391,3 +390,4 @@ protected:
} // namespace Gfx

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -150,3 +150,4 @@ protected:
};
}; // 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,3 +10,4 @@
* 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.
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,3 +5,4 @@
* Contains the main class of game engine - CRobotMain and the various in-game objects:
* CObject and related auto, motion and task subclasses.
*/

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