Colobot Gold 0.1.2-alpha

dev-mp colobot-gold-0.1.2-alpha
Piotr Dziwinski 2013-11-26 00:42:46 +01:00
commit d6eb095f27
41 changed files with 2619 additions and 304 deletions

View File

@ -2,11 +2,11 @@ language: cpp
compiler: compiler:
- gcc - gcc
- clang - clang
script: mkdir build; cd build; cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DOPENAL_SOUND=0 -DTESTS=1 && make all doc test && DESTDIR=. make install script: mkdir build; cd build; cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DOPENAL_SOUND=1 -DTESTS=1 && make all doc test && DESTDIR=. make install
before_install: before_install:
- git submodule update --init --recursive - git submodule update --init --recursive
- sudo add-apt-repository ppa:mapnik/boost -y - sudo add-apt-repository ppa:mapnik/boost -y
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq --no-install-recommends libgl1-mesa-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libpng12-dev libglew-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev google-mock libgtest-dev doxygen graphviz po4a librsvg2-bin libsndfile-dev - sudo apt-get install -qq --no-install-recommends libgl1-mesa-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libpng12-dev libglew-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev google-mock libgtest-dev doxygen graphviz po4a librsvg2-bin libsndfile-dev libopenal-dev
notifications: notifications:
email: false email: false

View File

@ -13,7 +13,7 @@ project(colobot C CXX)
set(COLOBOT_VERSION_CODENAME "Gold") set(COLOBOT_VERSION_CODENAME "Gold")
set(COLOBOT_VERSION_MAJOR 0) set(COLOBOT_VERSION_MAJOR 0)
set(COLOBOT_VERSION_MINOR 1) set(COLOBOT_VERSION_MINOR 1)
set(COLOBOT_VERSION_REVISION 1) set(COLOBOT_VERSION_REVISION 2)
# Used on official releases # Used on official releases
set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha") set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
@ -45,12 +45,18 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(PLATFORM_LINUX 0) set(PLATFORM_LINUX 0)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
message(STATUS "Build for Linux system") message(STATUS "Build for Linux system")
set(PLATFORM_WINDOWS 0) set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 1) set(PLATFORM_LINUX 1)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_linux.cpp")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
message(STATUS "Build for Mac OSX system") message(STATUS "Build for Mac OSX system")
set(PLATFORM_WINDOWS 0) set(PLATFORM_WINDOWS 0)
@ -58,6 +64,9 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(PLATFORM_MACOSX 1) set(PLATFORM_MACOSX 1)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_macosx.cpp")
set(USE_SDL_MAIN 1) # fixes SDL_main set(USE_SDL_MAIN 1) # fixes SDL_main
else() else()
message(STATUS "Build for other system") message(STATUS "Build for other system")
@ -65,6 +74,9 @@ else()
set(PLATFORM_LINUX 0) set(PLATFORM_LINUX 0)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 1) set(PLATFORM_OTHER 1)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_other.cpp")
endif() endif()
@ -309,6 +321,12 @@ if(PLATFORM_WINDOWS)
set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/lang CACHE PATH "Colobot translations directory") set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/lang CACHE PATH "Colobot translations directory")
set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/doc CACHE PATH "Colobot documentation directory") set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/doc CACHE PATH "Colobot documentation directory")
endif() endif()
elseif(PLATFORM_MACOSX)
set(COLOBOT_INSTALL_BIN_DIR ../MacOS CACHE STRING "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ../MacOS CACHE STRING "Colobot libraries directory")
set(COLOBOT_INSTALL_DATA_DIR . CACHE STRING "Colobot shared data directory")
set(COLOBOT_INSTALL_I18N_DIR i18n CACHE SRING "Colobot translations directory")
set(COLOBOT_INSTALL_DOC_DIR doc CACHE STRING "Colobot documentation directory")
else() else()
set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/games CACHE PATH "Colobot binary directory") set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/games CACHE PATH "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/colobot CACHE PATH "Colobot libraries directory") set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/colobot CACHE PATH "Colobot libraries directory")

View File

@ -29,7 +29,6 @@ To cross-compile Colobot using MXE:
* check-requirements * check-requirements
* expat * expat
* flac * flac
* flac
* freetype * freetype
* gcc * gcc
* gcc-gmp * gcc-gmp
@ -55,15 +54,25 @@ To cross-compile Colobot using MXE:
* xz * xz
* zlib * zlib
4. Now `cd` to directory with colobot sources. To cross-compile a CMake project, 4. Now `cd` to directory with colobot sources.
you have to specify a CMake toolchain file. MXE has such file in MXE's directory: It is recommended that you create a separate directory for out-of-source build:
`usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake` `mkdir build-mxe && cd build-mxe`
Toolchain file is specified thus:`cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe-conf.cmake .`
In order to cross-compile a CMake project, you have to specify a CMake toolchain file.
MXE has such file in MXE's directory: `usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake`
So you should use the following cmake command: `cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe-conf.cmake ..`
CMake files in Colobot should detect that MXE is being used and they will CMake files in Colobot should detect that MXE is being used and they will
modify flags, paths, etc. as required. You should not run into any problems. modify flags, paths, etc. as required. You should not run into any problems.
*Note:* you may also want to use a separate out-of-source build directory for MXE.
5. `make` should now compile the game with the resulting exe in `bin/colobot.exe`. 5. `make` should now compile the game with the resulting executable as `colobot.exe`.
The exe is linked against all libraries *statically*, so there are no dependencies The exe is linked against all libraries *statically*, so there are no dependencies
on external DLLs. However, the resulting binary will be huge with all these libraries, on external DLLs. However, the resulting binary will be huge with all these libraries,
so you might want to do: `strip bin/colobot.exe`. so you might want to do: `strip colobot.exe`.
6. If you want to create a Colobot installer, you need to additionally build 'nsis'
in MXE. Then you can create the NSIS installer that way:
`PATH=/path/to/mxe/binaries:$PATH make package`
where `/path/to/mxe/binaries` is path to cross-compiled MXE binaries available
in MXE's directory under `usr/i686-pc-mingw32/bin`.
This will create a versioned colobot-$version.exe installer that will install Colobot
in system directories, add a shortcut in the start menu and setup an uninstaller.

60
INSTALL-MacOSX.md Normal file
View File

@ -0,0 +1,60 @@
# Compile and install instructions on MacOSX
To compile Colobot on MacOS X, you need to first get all tools, all
building dependencies (including the recompilation of some of them), and
finally compile colobot.
* Install git from [git-osx-installer on Google Code](https://code.google.com/p/git-osx-installer/)
* Install Xcode through the Mac AppStore
* Accept the Xcode license
xcodebuild -license
* Download and install Apple's Command Line Developer Tools from within Xcode (Preferences, Download, Components)
* Download and install [Mac Ports](http://www.macports.org/install.php#requirements)
* Install GCC 4.8 through MacPorts
sudo port install gcc48
* Install all colobot build depends
sudo port install cmake libsdl libsdl_image libsdl_ttf boost libsndfile glew libicns librsvg
> [po4a](http://po4a.alioth.debian.org/) should also be installed for the translation of levels, but the [MacPorts' Portfiles have not been accepted yet](http://trac.macports.org/ticket/41227).
* Rebuild libtiff locally
This is needed because of the following error:
> libtiff.5.dylib (for architecture x86_64) because larger updated load
> commands do not fit (the program must be relinked, and you may need to
> use -headerpad or -headerpad_max_install_names)
MacPorts changed the default linker flag, a simple local rebuild suffices:
sudo port -ns upgrade --force tiff
* Rebuild boost with the same gcc that we want to use
This is needed because boost is compiled against Mac's system libstdc++
which is older than the one used by gcc-4.8
sudo port -ns upgrade --force boost configure.compiler=macports-gcc-4.8
* Build colobot with gcc-4.8
mkdir -p build
cd build
CC=/opt/local/bin/gcc-mp-4.8 CXX=/opt/local/bin/g++-mp-4.8 cmake ..
make
* Build a Colobot drag-n-drop package
make package
* Open the package
open colobot-*.dmg
* Once opened, drag the Colobot application and drop it in the
Application directory. Then just launch it as any other application.

View File

@ -3,15 +3,40 @@
## Source and data files ## Source and data files
Colobot source files can be downloaded from Github repository (https://github.com/colobot/colobot). You can either download Colobot source files can be downloaded from Github repository (https://github.com/colobot/colobot). You can either download
the repository as a ZIP archive, or, clone the repository using git or a GUI frontent for git. the repository as a ZIP archive, or, clone the repository using git or a GUI frontend for git.
Make sure that once you download/clone the repository, you have the neeeded data files in `data/` subdirectory.These files Make sure that once you download/clone the repository, you have the needed data files in `data/` subdirectory.These files
are provided as git submodule, hosted at a separate Github repository (https://github.com/colobot/colobot-data). are provided as git submodule, hosted at a separate Github repository (https://github.com/colobot/colobot-data).
If you don't have them, you can either download the repository manually and unpack its content into `data/` or, If you don't have them, you can either download the repository manually and unpack its content into `data/` or,
if you're working with git cloned repository, `git submodule update --init` will download the data submodule repository. if you're working with git cloned repository, `git submodule update --init` will download the data submodule repository.
## Compiling on Windows ## Important notes
It is highly recommended that while compiling, you do an out-of-source build, that is create a separate directory where all build files
will be created. This isolates the generated CMake files and makes it easy to clean them (simply remove the build directory)
as CMake lacks "make clean" command.
As of 0.1.2-alpha, running the game with source data directory is no longer supported as the data files
are now generated to support multiple languages. You have to perform installation, at least of the data files, to a destination
directory. If you fail to do that, and try to run the game with source data directory, the game will run, but you will not be able to access
any of the missions.
## Compilation
### Compiling on Windows
The recommended way of compiling for Windows is using Linux in a cross-compilation environment called MXE.
This is the way our build bot service (http://colobot.info/files/compiled.php) prepares the release packages.
You can also try to compile with MSYS/MinGW but this is more difficult.
#### Cross-compiling using MXE
MXE (M cross environment, http://mxe.cc/) is a very good cross-compiling framework, complete with a suite of libraries
that make it extremely easy to port applications to Win32. It runs on pretty much any *nix flavor and generates generic,
statically linked Win32 binaries. More information is available in
[INSTALL-MXE.md](https://github.com/colobot/colobot/blob/master/INSTALL-MXE.md) file.
#### Compiling with MSYS/MinGW #### Compiling with MSYS/MinGW
@ -19,47 +44,53 @@ If you like challenges ;-), you can try to compile Colobot directly under MSYS/M
You need to manually compile about 20 packages and resolve many problems. Fortunately, the developers took pity on you, You need to manually compile about 20 packages and resolve many problems. Fortunately, the developers took pity on you,
and provide a download package containing all the necessary libraries and tools. and provide a download package containing all the necessary libraries and tools.
To use this package, you must first install a vanilla MSYS/MinGW enviromnent. To do this, download and run To use this package, you must first install a vanilla MSYS/MinGW environment. To do this, download and run
mingw-get installer (http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/). mingw-get installer (http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/).
When installing, select **all** possible packages in the installer. When installing, select **all** possible packages in the installer.
Next, download the development package available at Colobot site (http://colobot.info/) and unpack the files Next, download the development package available at Colobot site (http://colobot.info/files/ - files named msys-devpack-*)
from the archive to MinGW directory. This should provide a working environment, including CMake and and unpack the files from the archive to MinGW directory. This should provide a working environment, including CMake and
all necessary packages. However, make sure you get the right package. There are slight changes between GCC 4.6 and 4.7, all necessary packages. However, make sure you get the right package. There are slight changes between GCC 4.6 and 4.7,
especially with boost library which will result in build failure or error in runtime. especially with boost library which will result in build failure or error in runtime.
To compile Colobot, `cd` to directory with sources and run: Once you have installed the development package, run the MSYS shell. This shell works as a hybrid *nix/Windows environment,
$ cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release . so you have regular bash commands but can specify paths using Windows syntax: "C:\some\path", CRLF is the endline separator and so forth.
and then: CMake should automatically detect this build environment and use the Windows options to compile.
To compile colobot, change the directory to where you have downloaded the source files:
$ cd "C:\path\to\colobot\sources"
It is recommended that you create a build directory:
$ mkdir build
$ cd build
Then you have to configure CMake. You should specify the following options:
$ cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\some\directory" ..
where "C:\some\directory" is the directory you want to run colobot from. It can be a proper installation path if you want
to install it in system, or some temporary directory like "..\colobot-temporary-install" if you just want to try the game.
You can also skip this argument and use the default install path: "C:\Program Files\colobot".
Make sure you specify "MSYS Makefiles" as the CMake generator because otherwise, the default for Windows is to use MSVC nmake
and it will not work.
Then to compile:
$ make $ make
Everything should compile just fine. If you see any errors, it most likely means missing libraries or invalid installation. Everything should compile just fine. If you see any errors, it most likely means missing libraries or invalid installation.
Warnings may occur, but are mostly harmless. Warnings may occur, but are mostly harmless.
You'll get the binary `colobot.exe`, which you can run directly, pointing it to the data directory: Now you need to perform the installation:
$ colobot.exe -datadir ./data
You can also install Colobot in your system using
$ make install $ make install
The default install path is `C:\Program Files\colobot`, but you can change it by adding `-DCMAKE_INSTALL_PREFIX="C:\your\path"` You should get all files ready to use under the installation prefix you specified. Run `colobot.exe` and enjoy the game.
to CMake arguments.
See also "Hints and notes" below on some useful advice. ### Compiling on Linux
#### Cross-compiling using MXE Since there are so many Linux flavors, it is difficult to write generic instructions. However, here is the general gist of what
you will need to compile colobot.
MXE (http://mxe.cc/) is a very good cross-compiling framework, complete with a suite of libraries You will need:
that make it extremely easy to port applications to Win32. It runs on pretty much any *nix flavor and generates generic, * recent compiler (GCC >= 4.6 or a newer clang) since we are using some features of C++11
statically linked Win32 binaries. More information is available in INSTALL-MXE.md file. * CMake >= 2.8
## Compiling on Linux
Depending on your distribution, you'll need to install different packages, so here's just an outline, the details will
be different for different distros:
* recent compiler (GCC >= 4.6 or a newer clang) since we are using some features of C++11.
* CMake >= 2.8.
* Boost >= 1.51 (header files + components: filesystem and regex) * Boost >= 1.51 (header files + components: filesystem and regex)
* SDL >= 1.2.10 * SDL >= 1.2.10
* SDL_image >= 1.2 * SDL_image >= 1.2
@ -71,45 +102,66 @@ be different for different distros:
* libvorbis >= 1.3.2 * libvorbis >= 1.3.2
* libogg >= 1.3.0 * libogg >= 1.3.0
* OpenAL (OpenAL-Soft) >= 1.13 * OpenAL (OpenAL-Soft) >= 1.13
* po4a >= 0.45 (to generate translated data files)
Instructions for compiling are universal: Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements,
$ cmake -DCMAKE_BUILD_TYPE=Release . CMake should warn you.
$ make
To compile colobot, run your favorite shell and change the directory to where you downloaded colobot source files:
$ cd /path/to/colobot/sources
It is recommended that you create a build directory:
$ mkdir build
$ cd build
Now to configure CMake:
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/some/prefix ..
where "/some/prefix" is installation prefix where you want to put the game files. It could be a proper installation directory
if you want to install colobot in the system or simply temporary directory like "/tmp/colobot-temporary-install" if you just want to try it.
You can also use clang as the compiler. In that case, before issuing cmake, set the following variables:
$ export CC=clang CXX=clang++
Then to compile:
$ make
Everything should compile just fine. If you see any errors, it most likely means missing libraries. Warnings may occur, Everything should compile just fine. If you see any errors, it most likely means missing libraries. Warnings may occur,
but are mostly harmless. but are mostly harmless.
You'll get the binary in `bin/colobot`, which you can run directly, pointing it to the data directory: Now you need to install the game files:
$ bin/colobot -datadir ./data
To install colobot in the system, you can run:
$ make install $ make install
The default installation path is `/usr/local/` but you can change it by adding `-DCMAKE_INSTALL_PREFIX="/your/custom/path"` You can now run the game from the prefix you specified. Note that colobot binary is installed in `games/` subdirectory.
to CMake arguments. So if you provided prefix "/some/prefix", you can run:
$ /some/prefix/games/colobot
See also "Hints and notes" below on some useful advice. ### Compiling on MacOS X
As of 0.1.2-alpha, we have added MacOS X support. See [INSTALL-MacOSX.md](https://github.com/colobot/colobot/blob/master/INSTALL-MacOSX.md)
file for details.
## Other platforms
The code isn't particularly tied to any compiler or platform, so in theory it should work on any platform provided you have
the required libraries there. Also, other compilers than currently supported GCC >= 4.6 and Clang may happen to work with our code.
If you can, please try to compile the code on your platform and let us know how it goes.
## Compiling on other platforms ## Error reports and debugging
We haven't checked other platforms yet but the code isn't particularly tied to any compiler or platform, so in theory Before reporting errors, please make sure you compile the dev branch to make sure that the issue is not yet fixed there. Also, search the
it should work. If you can, please try to compile the code on your platform and let us know how it goes. existing issues (https://github.com/colobot/colobot/issues) to check if a similar error has not been already reported.
If you want to submit error reports, please use special Debug and Dev builds (add `-DDEV_BUILD=1 -DCMAKE_BUILD_TYPE=Debug` to CMake arguments)
## Hints and notes
CMake has a very useful feature - out-of-source builds - using a separate directory for the output of CMake and compiler.
This way, you can keep clean the directory with your source files. Example of use (starting from directory with sources):
$ mkdir build/
$ cd build/
$ cmake ../
$ make
If you want to submit debug reports, please use special Debug and Dev builds (`-DDEV_BUILD=1 -DCMAKE_BUILD_TYPE=Debug`)
and run the game in debug mode and with logging on higher level (commandline arguments: `-loglevel debug`). and run the game in debug mode and with logging on higher level (commandline arguments: `-loglevel debug`).
Also, `-help` will give full list of available arguments.
## Language support
In order to run colobot in different language, you need to run with fully installed data files.
If you run a system with locale settings set to your language, colobot should auto-detect it and use appropriate language. If that does not happen,
you can force a specific language using option `-language xx` where xx is language code like `en` or `de`. `-help` will show all possible settings.
## Help
If you encounter any problems, you can get help at our forum or IRC channels. If you encounter any problems, you can get help at our forum or IRC channels.

View File

@ -2,11 +2,11 @@
Welcome to the Colobot project code repository Welcome to the Colobot project code repository
This is official repository for the open-source Colobot project developed by Polish Portal of Colobot (PPC; in Polish: Polski Portal Colobota) with the official site at: http://colobot.info/. This is official repository for the open-source Colobot project developed by Polish Portal of Colobot (PPC; in Polish: Polski Portal Colobota) with the official site at: [colobot.info](http://colobot.info/joomla).
The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to PPC community in March 2012. Since then, we have been developing the game further. The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to PPC community in March 2012. Since then, we have been developing the game further.
More information for developers (in English) can be found on the [developer wiki](https://colobot.info/wiki/Dev:Main_Page) or [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below). More information for developers (in English) can be found on the [developer wiki](http://colobot.info/w/Dev:Main_Page) or (in Polish) [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below).
This repository contains only the source code of the project. The game requires also data files which are now provided as git submodule and are hosted in [separate repository](https://github.com/colobot/colobot-data). This repository contains only the source code of the project. The game requires also data files which are now provided as git submodule and are hosted in [separate repository](https://github.com/colobot/colobot-data).
@ -17,14 +17,23 @@ The original version of the game, as released to us by Epsitec, is available as
We are now working on refreshed and updated version of original game, codename Colobot Gold and this is the version currently hosted in this repository. The goal is to rewrite the game engine to be multi-platform, refresh the graphics, include some enhancements and refactor the code to make the game easier to modify. We are now working on refreshed and updated version of original game, codename Colobot Gold and this is the version currently hosted in this repository. The goal is to rewrite the game engine to be multi-platform, refresh the graphics, include some enhancements and refactor the code to make the game easier to modify.
The project at this point is in alpha stage - the game is mostly playable, both on Windows and Linux, and most major bugs have been corrected. However, there is still a lot of work to be done. We are now working steadily towards subsequent beta releases, correcting other bugs and introducing enhancements and new features. There is a lot of work ahead and we will gladly accept any and all help. The project at this point is in alpha stage - the game is mostly playable, both on Windows and Linux, and most major bugs have been corrected. We are now working steadily towards subsequent beta releases, correcting other bugs and introducing enhancements and new features. There is a lot of work ahead and we will gladly accept any and all help.
In the future, we will begin development on a new installment in the Colobot series, codename Colobot 2. We have many ideas for the new game and we are still discussing them. Generally, the development of this version will begin only after finishing Colobot Gold (it will be probably hosted in another repository, forked off the Colobot Gold code). In the future, we will begin development on a new installment in the Colobot series, codename Colobot 2. We have many ideas for the new game and we are still discussing them. Generally, the development of this version will begin only after finishing Colobot Gold (it will be probably hosted in another repository, forked off the Colobot Gold code).
## Download packages
We provide compiled packages of most recent versions using an [automated build bot service](http://colobot.info/files/compiled.php). Available versions include packages for Windows and Linux in both Release and Debug configurations.
On some Linux distributions there are also distribution packages available:
* Debian Sid (unstable): http://packages.debian.org/sid/colobot
* Arch Linux (AUR): https://aur.archlinux.org/packages/colobot-gold
## Compiling and running the game ## Compiling and running the game
For these instructions see INSTALL.md file. If you want to compile colobot yourself, see [INSTALL.md](https://github.com/colobot/colobot/blob/master/INSTALL.md) file.
## Contact ## Contact
@ -41,11 +50,11 @@ If you want to help in the project, please contact us on our IRC channels or [ou
Witamy w repozytorium projektu Colobot Witamy w repozytorium projektu Colobot
To jest oficjalne repozytorium z kodem projektu open-source Colobot rozwijanego przez Polski Portal Colobota (PPC; po angielsku: Polish Portal of Colobot) z oficjalną stroną: http://colobot.info/. To jest oficjalne repozytorium z kodem projektu open-source Colobot rozwijanego przez Polski Portal Colobota (PPC; po angielsku: Polish Portal of Colobot) z oficjalną stroną: [colobot.info](http://colobot.info/joomla/?lang=pl).
Kod źródłowy zawarty tutaj został wydany przez Epsitec -- oryginalnego twórcę gry -- na otwartej licencji (GPLv3). Kod został wydany i prawa nadane specjalnie dla społeczności PPC w marcu 2012. Od tamtej pory, zajmowaliśmy się dalszym rozwojem gry. Kod źródłowy zawarty tutaj został wydany przez Epsitec -- oryginalnego twórcę gry -- na otwartej licencji (GPLv3). Kod został wydany i prawa nadane specjalnie dla społeczności PPC w marcu 2012. Od tamtej pory, zajmowaliśmy się dalszym rozwojem gry.
Więcej informacji dla developerów projektu (po angielsku) można znaleźć na [wiki dla developerów](http://colobot.info/wiki/Dev:Main_Page) lub [naszym forum](http://colobot.info/forum/). Jednak źródłem najświeższych informacji są nasze kanały IRC (patrz niżej). Więcej informacji dla developerów projektu (po angielsku) można znaleźć na [wiki dla developerów](htt://colobot.info/w/Dev:Main_Page) lub (po polsku) na [naszym forum](http://colobot.info/forum/). Jednak źródłem najświeższych informacji są nasze kanały IRC (patrz niżej).
To repozytorium zawiera jedynie kod źródłowy projektu. Gra wymaga jeszcze plików danych, które są teraz udostępniane jako submoduł gita i hostowane w [osobnym repozytorium]((https://github.com/colobot/colobot-data). To repozytorium zawiera jedynie kod źródłowy projektu. Gra wymaga jeszcze plików danych, które są teraz udostępniane jako submoduł gita i hostowane w [osobnym repozytorium]((https://github.com/colobot/colobot-data).
@ -56,20 +65,30 @@ Oryginalna wersja gry, jaka została udostępniona nam przez Epsitec, jest dost
Obecnie pracujemy nad odświeżoną i uaktualnioną wersją oryginalnej gry, którą nazywamy Colobot Gold i jest to wersja obecnie dostępna w tym repozytorium. Celem tego projektu jest przepisanie silnika gry na wersję wieloplatformową, odświeżenie grafiki, dodanie pewnych usprawnień i zrefaktorowanie kodu tak, by dało się łatwiej modyfikować grę. Obecnie pracujemy nad odświeżoną i uaktualnioną wersją oryginalnej gry, którą nazywamy Colobot Gold i jest to wersja obecnie dostępna w tym repozytorium. Celem tego projektu jest przepisanie silnika gry na wersję wieloplatformową, odświeżenie grafiki, dodanie pewnych usprawnień i zrefaktorowanie kodu tak, by dało się łatwiej modyfikować grę.
W tym momencie, gra jest w stadium alpha - gra jest w większości grywalna, pod Windowsem i Linuksem i większość poważnych bugów została poprawiona. Jednakże, jest nadal sporo pracy do zrobienia. Teraz systematycznie pracujemy do kolejnych wydań w fazie beta, poprawiając pozostałe bugi i wprowadzając usprawnienia i nowe funkcje. Jest sporo pracy przed nami i chętnie przyjmiemy pomoc w jakielkolwiek formie. W tym momencie, gra jest w stadium alpha - gra jest w większości grywalna, pod Windowsem i Linuksem i większość poważnych bugów została poprawiona. Teraz systematycznie pracujemy do kolejnych wydań w fazie beta, poprawiając pozostałe bugi i wprowadzając usprawnienia i nowe funkcje. Jest sporo pracy przed nami i chętnie przyjmiemy pomoc w jakiejkolwiek formie.
W przyszłości, planujemy rozpocząć prace nad nową częścią z serii Colobot, pod nazwą Colobot 2.Mamy wiele pomysłów na nową grę i nadal dyskutujemy nad nimi. Ogólnie, rozwój tej wersji zacznie się po skończeniu wersji Colobot Gold (prawdopodobnie będzie hostowane w osobnym repozytorium, sforkowanym z kodu Colobot Gold). W przyszłości, planujemy rozpocząć prace nad nową częścią z serii Colobot, pod nazwą Colobot 2. Mamy wiele pomysłów na nową grę i nadal dyskutujemy nad nimi. Ogólnie, rozwój tej wersji zacznie się po skończeniu wersji Colobot Gold (prawdopodobnie będzie hostowane w osobnym repozytorium, sforkowanym z kodu Colobot Gold).
## Paczki do pobrania
Udostępniamy gotowe skompilowane paczki z ostatnich wersji używając [automatycznego build bota](http://colobot.info/files/compiled.php?lang=pl). Dostępne są paczki dla Windowsa i Linuksa w konfiguracjach Release i Debug.
Dla niektórych dystrybucji Linuksa, dostępne są pakiety danej dystrybucji:
* Debian Sid (unstable): http://packages.debian.org/sid/colobot
* Arch Linux (AUR): https://aur.archlinux.org/packages/colobot-gold
## Kompilacja i uruchomienie gry ## Kompilacja i uruchomienie gry
Instrukcje te znajdują się w pliku INSTALL.md (po angielsku). Jeżeli chcesz sam skompilować colobota, zobacz plik [INSTALL.md](https://github.com/colobot/colobot/blob/master/INSTALL.md) (po angielsku).
## Kontakt ## Kontakt
Jeżeli chcesz pomóc w projekcie, prosimy o kontakt na naszych kanałach IRC lub [naszym forum](http://colobot.info/forum/). Jeżeli chcesz pomóc w projekcie, prosimy o kontakt na naszych kanałach IRC lub [naszym forum](http://colobot.info/forum/).
### Kanały IRC ### Kanały IRC
* [#colobot on pirc.pl](irc://pirc.pl#colobot) polski; * [#colobot on pirc.pl](irc://pirc.pl#colobot) polski;

View File

@ -8,5 +8,4 @@ if (MSYS AND (NOT MXE))
set(COLOBOT_CXX_FLAGS "${COLOBOT_CXX_FLAGS} -U__STRICT_ANSI__") # fixes putenv() set(COLOBOT_CXX_FLAGS "${COLOBOT_CXX_FLAGS} -U__STRICT_ANSI__") # fixes putenv()
set(USE_SDL_MAIN 1) # fixes SDL_main set(USE_SDL_MAIN 1) # fixes SDL_main
set(DESKTOP OFF) # MSYS doesn't have the necessary tools
endif() endif()

View File

@ -41,6 +41,8 @@ if((${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS))
${CMAKE_FIND_ROOT_PATH}/lib/libbz2.a ${CMAKE_FIND_ROOT_PATH}/lib/libbz2.a
${OPENAL_MXE_LIBS} ${OPENAL_MXE_LIBS}
) )
# This fixes problem with multiple definition of `IID_IDirectSoundNotify'
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
else() else()
set(MXE 0) set(MXE 0)
endif() endif()

2
data

@ -1 +1 @@
Subproject commit bab520ebec08a3a8e8763918e3db52b95f0d29d0 Subproject commit 456ab4d4806ffe9aad93b7046f1b8074501f28f5

View File

@ -1,105 +1,180 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
if(NOT PLATFORM_WINDOWS) set(COLOBOT_ICON_FILE colobot.svg)
# Install Desktop Entry file
set(COLOBOT_DESKTOP_FILE colobot.desktop) # Render SVG icon in various sizes
add_custom_command( find_program(RSVG_CONVERT rsvg-convert)
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} add_custom_target(png-icons ALL)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" foreach(PNGSIZE 512 256 128 48 32 16)
COMMENT "Build ${COLOBOT_DESKTOP_FILE}" add_custom_command(
) OUTPUT ${PNGSIZE}/colobot.png
add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}) COMMAND mkdir -p ${PNGSIZE}
install( COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} > ${PNGSIZE}/colobot.png
FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} )
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/ add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png)
) add_dependencies(png-icons png-icon-${PNGSIZE})
# Install Icon if(PLATFORM_LINUX)
set(COLOBOT_ICON_FILE colobot.svg) install(
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/ )
) endif()
# Prepare the ICNS icon generation
# Render SVG icon in various sizes list(APPEND ICNS_SRCS "${PNGSIZE}/colobot.png")
find_program(RSVG_CONVERT rsvg-convert) endforeach()
if(RSVG_CONVERT)
foreach(PNGSIZE "48" "32" "16") # Pack icon for Mac OS
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}) find_program(PNG2ICNS png2icns)
add_custom_target(resize_icon_${PNGSIZE} ALL if(PNG2ICNS AND PLATFORM_MACOSX)
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} add_custom_command(OUTPUT Colobot.icns
> ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png COMMAND ${PNG2ICNS} Colobot.icns ${ICNS_SRCS}
) DEPENDS png-icons
install( )
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png add_custom_target(icns-icon ALL DEPENDS Colobot.icns)
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/ endif()
)
endforeach()
endif()
# Create manpage from pod-formatted file
find_program(POD2MAN pod2man)
if(POD2MAN)
set(COLOBOT_MANPAGE_SECTION 6)
macro(podman)
cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN})
if(PM_LOCALE)
# This copes with the fact that english has no "/LANG" in the paths and filenames.
set(SLASHLOCALE /${PM_LOCALE})
endif()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION}
--center="Colobot" --stderr --utf8
--release="${COLOBOT_VERSION_FULL}"
${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
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})
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ )
add_dependencies(man man${PM_LOCALE})
endmacro()
# Create the english manpage
podman(PODFILE colobot.pod)
endif()
else() # if(NOT PLATFORM_WINDOWS)
set(COLOBOT_VERSION_4COMMAS "${COLOBOT_VERSION_MAJOR},${COLOBOT_VERSION_MINOR},${COLOBOT_VERSION_REVISION},0")
configure_file(colobot.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/colobot.rc)
endif() endif()
# Translate translatable material if(PLATFORM_LINUX)
find_program(PO4A po4a) # Install Desktop Entry file
set(COLOBOT_DESKTOP_FILE colobot.desktop)
add_custom_command(
OUTPUT ${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}"
COMMENT "Build ${COLOBOT_DESKTOP_FILE}"
)
add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE})
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/
)
if(PO4A) # Install Icon
add_custom_target(desktop_po4a install(
COMMAND ${PO4A} po4a.cfg FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
) )
add_dependencies(desktopfile desktop_po4a)
if(POD2MAN) # Translate translatable material
add_custom_target(man_po4a find_program(PO4A po4a)
if(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(man man_po4a) add_dependencies(desktopfile desktop_po4a)
file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO})
foreach(LOCALE ${LINGUAS})
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
add_dependencies(man${PM_LOCALE} man_po4a)
endforeach()
endif() endif()
# Create manpage from pod-formatted file
find_program(POD2MAN pod2man)
if(POD2MAN)
set(COLOBOT_MANPAGE_SECTION 6)
macro(podman)
cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN})
if(PM_LOCALE)
# This copes with the fact that english has no "/LANG" in the paths and filenames.
set(SLASHLOCALE /${PM_LOCALE})
endif()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION}
--center="Colobot" --stderr --utf8
--release="${COLOBOT_VERSION_FULL}"
${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
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})
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ )
add_dependencies(man man${PM_LOCALE})
endmacro()
# Create the english manpage
podman(PODFILE colobot.pod)
if(PO4A)
# Translate the manpage to other languages
add_dependencies(man desktop_po4a)
file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO})
foreach(LOCALE ${LINGUAS})
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
add_dependencies(man${PM_LOCALE} desktop_po4a)
endforeach()
endif()
endif()
endif(PLATFORM_LINUX)
if(PLATFORM_MACOSX)
configure_file(Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
endif(PLATFORM_MACOSX)
if(PLATFORM_WINDOWS)
set(COLOBOT_VERSION_4COMMAS "${COLOBOT_VERSION_MAJOR},${COLOBOT_VERSION_MINOR},${COLOBOT_VERSION_REVISION},0")
configure_file(colobot.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/colobot.rc)
endif(PLATFORM_WINDOWS)
##
# Packaging
##
set(CPACK_BUNDLE_NAME "Colobot")
set(CPACK_PACKAGE_FILE_NAME "colobot-${COLOBOT_VERSION_FULL}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Colobot - Colonize with Bots")
set(CPACK_PACKAGE_VENDOR "Polish Portal of Colobot")
set(CPACK_PACKAGE_VERSION_MAJOR ${COLOBOT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${COLOBOT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${COLOBOT_VERSION_REVISION})
if(PLATFORM_WINDOWS)
set(CPACK_STRIP_FILES TRUE)
# Don't version the install directory, and allow overwriting
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Colobot")
set(CPACK_NSIS_DEFINES "SetOverwrite on\nBrandingText \\\"Colobot ${COLOBOT_VERSION_CODENAME} (${COLOBOT_VERSION_FULL})\\\"")
# Install the executable directly in Program Files/Colobot/
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_PACKAGE_EXECUTABLES "colobot" "Colobot ${COLOBOT_VERSION_CODENAME}")
# Branding
## Installation and uninstallation icons
set(CPACK_NSIS_MUI_ICON ${CMAKE_CURRENT_SOURCE_DIR}/colobot.ico)
set(CPACK_NSIS_MUI_UNIICON ${CMAKE_CURRENT_SOURCE_DIR}/colobot.ico)
## Header and Left banner images
set(CPACK_PACKAGE_ICON "")
set(CPACK_NSIS_INSTALLER_ICON_CODE "!define MUI_HEADERIMAGE_BITMAP \\\"${CMAKE_CURRENT_SOURCE_DIR}/colobot_nsis.bmp\\\"
!define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${CMAKE_CURRENT_SOURCE_DIR}/colobot_nsis_left.bmp\\\"")
## Allow to directly run Colobot at the end of the installation
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "colobot.exe")
## TODO: Find a way to have no license prompt. Until that, display the GPL-3
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt)
elseif(PLATFORM_MACOSX)
set(CPACK_GENERATOR "Bundle")
set(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_BINARY_DIR}/Colobot.icns)
set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_BINARY_DIR}/Colobot.icns)
set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
set(CPACK_BINARY_DRAGNDROP ON)
install(CODE "
include(BundleUtilities)
message(STATUS \"fixup_bundle(\${CMAKE_INSTALL_PREFIX}/${COLOBOT_INSTALL_BIN_DIR}/colobot/\")
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${COLOBOT_INSTALL_BIN_DIR}/colobot\" \"\" \"\")
")
endif() endif()
include(CPack)

27
desktop/Info.plist.cmake Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Colobot</string>
<key>CFBundleExecutable</key>
<string>colobot</string>
<key>CFBundleIconFile</key>
<string>Colobot</string>
<key>CFBundleIdentifier</key>
<string>info.colobot.colobot</string>
<key>CFBundleName</key>
<string>Colobot</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>cbot</string>
<key>CFBundleVersion</key>
<string>@COLOBOT_VERSION_FULL@</string>
</dict>
</plist>

BIN
desktop/colobot_nsis.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

1827
po/ru.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,9 @@
#include "CBot.h" #include "CBot.h"
#include <cassert>
CBotInstr::CBotInstr() CBotInstr::CBotInstr()
{ {
name = "CBotInstr"; name = "CBotInstr";
@ -285,7 +288,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
bool CBotInstr::Execute(CBotStack* &pj) bool CBotInstr::Execute(CBotStack* &pj)
{ {
CBotString ClassManquante = name; CBotString ClassManquante = name;
ASM_TRAP(); // should never go through this routine assert(0); // should never go through this routine
// but use the routines of the subclasses // but use the routines of the subclasses
return false; return false;
} }
@ -300,26 +303,26 @@ bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar)
void CBotInstr::RestoreState(CBotStack* &pj, bool bMain) void CBotInstr::RestoreState(CBotStack* &pj, bool bMain)
{ {
CBotString ClassManquante = name; CBotString ClassManquante = name;
ASM_TRAP(); // should never go through this routine assert(0); // should never go through this routine
// but use the routines of the subclasses // but use the routines of the subclasses
} }
bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{ {
ASM_TRAP(); // dad do not know, see the girls assert(0); // dad do not know, see the girls
return false; return false;
} }
bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, bool bStep, bool bExtend) bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, bool bStep, bool bExtend)
{ {
ASM_TRAP(); // dad do not know, see the girls assert(0); // dad do not know, see the girls
return false; return false;
} }
void CBotInstr::RestoreStateVar(CBotStack* &pile, bool bMain) void CBotInstr::RestoreStateVar(CBotStack* &pile, bool bMain)
{ {
ASM_TRAP(); // dad do not know, see the girls assert(0); // dad do not know, see the girls
} }
// this routine is defined only for the subclass CBotCase // this routine is defined only for the subclass CBotCase
@ -531,7 +534,7 @@ void CBotLeftExprVar::RestoreState(CBotStack* &pj, bool bMain)
CBotVar* var1; CBotVar* var1;
var1 = pj->FindVar(m_token.GetString()); var1 = pj->FindVar(m_token.GetString());
if (var1 == NULL) ASM_TRAP(); if (var1 == NULL) assert(0);
var1->SetUniqNum(m_nIdent); // with the unique identifier var1->SetUniqNum(m_nIdent); // with the unique identifier
} }
@ -1747,7 +1750,7 @@ bool CBotExpression::Execute(CBotStack* &pj)
pile2->SetVar(result); pile2->SetVar(result);
break; break;
default: default:
ASM_TRAP(); assert(0);
} }
if (!IsInit) if (!IsInit)
pile2->SetError(TX_NOTINIT, m_leftop->GetToken()); pile2->SetError(TX_NOTINIT, m_leftop->GetToken());
@ -2270,7 +2273,7 @@ CBotIndexExpr::~CBotIndexExpr()
bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{ {
if (pVar->GetType(1) != CBotTypArrayPointer) if (pVar->GetType(1) != CBotTypArrayPointer)
ASM_TRAP(); assert(0);
pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(0, false); // at compile time makes the element [0] pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(0, false); // at compile time makes the element [0]
if (pVar == NULL) if (pVar == NULL)
@ -2291,7 +2294,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
CBotStack* pj = pile; CBotStack* pj = pile;
if (pVar->GetType(1) != CBotTypArrayPointer) if (pVar->GetType(1) != CBotTypArrayPointer)
ASM_TRAP(); assert(0);
pile = pile->AddStack(); pile = pile->AddStack();
@ -2372,7 +2375,7 @@ void CBotFieldExpr::SetUniqNum(int num)
bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{ {
if (pVar->GetType(1) != CBotTypPointer) if (pVar->GetType(1) != CBotTypPointer)
ASM_TRAP(); assert(0);
pVar = pVar->GetItemRef(m_nIdent); pVar = pVar->GetItemRef(m_nIdent);
if (pVar == NULL) if (pVar == NULL)
@ -2395,7 +2398,7 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
if (pVar->GetType(1) != CBotTypPointer) if (pVar->GetType(1) != CBotTypPointer)
ASM_TRAP(); assert(0);
CBotVarClass* pItem = pVar->GetPointer(); CBotVarClass* pItem = pVar->GetPointer();
if (pItem == NULL) if (pItem == NULL)
@ -2648,7 +2651,7 @@ bool CBotLeftExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevT
if (pVar == NULL) if (pVar == NULL)
{ {
#ifdef _DEBUG #ifdef _DEBUG
ASM_TRAP(); assert(0);
#endif #endif
pile->SetError(2, &m_token); pile->SetError(2, &m_token);
return false; return false;
@ -3289,7 +3292,7 @@ bool CBotExprVar::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* prevToke
if (pVar == NULL) if (pVar == NULL)
{ {
#ifdef _DEBUG #ifdef _DEBUG
ASM_TRAP(); assert(0);
#endif #endif
pj->SetError(1, &m_token); pj->SetError(1, &m_token);
return false; return false;

View File

@ -32,13 +32,6 @@
#define EOX (reinterpret_cast<CBotStack*>(-1)) /// \def tag special condition #define EOX (reinterpret_cast<CBotStack*>(-1)) /// \def tag special condition
// fix for MSVC instruction __asm int 3 (setting a trap)
#if defined(__MINGW32__) || defined(__GNUC__)
#define ASM_TRAP() asm("int $3");
#else
#define ASM_TRAP() __asm int 3;
#endif
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// forward declaration // forward declaration

View File

@ -20,6 +20,9 @@
#include "CBot.h" #include "CBot.h"
#include <cassert>
// various constructors / destructors // various constructors / destructors
// \TODO translation:to liberate all according to esteblished tree // \TODO translation:to liberate all according to esteblished tree
// pour libérer tout selon l'arbre établi // pour libérer tout selon l'arbre établi
@ -1046,7 +1049,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
} }
break; break;
default: default:
ASM_TRAP(); assert(0);
} }
} }
newvar->SetUniqNum(p->m_nIdent); newvar->SetUniqNum(p->m_nIdent);

View File

@ -18,6 +18,8 @@
#include "CBot.h" #include "CBot.h"
#include <cassert>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -80,12 +82,12 @@ CBotStack* CBotStack::FirstStack()
CBotStack::CBotStack(CBotStack* ppapa) CBotStack::CBotStack(CBotStack* ppapa)
{ {
// constructor must exist or the destructor is never called! // constructor must exist or the destructor is never called!
ASM_TRAP(); assert(0);
} }
CBotStack::~CBotStack() CBotStack::~CBotStack()
{ {
ASM_TRAP(); // use Delete () instead assert(0); // use Delete () instead
} }
void CBotStack::Delete() void CBotStack::Delete()
@ -693,7 +695,7 @@ void CBotStack::AddVar(CBotVar* pVar)
*pp = pVar; // added after *pp = pVar; // added after
#ifdef _DEBUG #ifdef _DEBUG
if ( pVar->GetUniqNum() == 0 ) ASM_TRAP(); if ( pVar->GetUniqNum() == 0 ) assert(0);
#endif #endif
} }
@ -1091,7 +1093,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
} }
break; break;
default: default:
ASM_TRAP(); assert(0);
} }
if ( pPrev != NULL ) pPrev->m_next = pNew; if ( pPrev != NULL ) pPrev->m_next = pNew;
@ -1388,7 +1390,7 @@ void CBotCStack::AddVar(CBotVar* pVar)
*pp = pVar; // added after *pp = pVar; // added after
#ifdef _DEBUG #ifdef _DEBUG
if ( pVar->GetUniqNum() == 0 ) ASM_TRAP(); if ( pVar->GetUniqNum() == 0 ) assert(0);
#endif #endif
} }

View File

@ -20,6 +20,8 @@
#include "CBot.h" #include "CBot.h"
#include <cassert>
// various constructors // various constructors
CBotTwoOpExpr::CBotTwoOpExpr() CBotTwoOpExpr::CBotTwoOpExpr()
@ -466,7 +468,7 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
if ( !IsNan(left, right, &err) ) result->SL(left , right); if ( !IsNan(left, right, &err) ) result->SL(left , right);
break; break;
default: default:
ASM_TRAP(); assert(0);
} }
delete temp; delete temp;

View File

@ -21,8 +21,10 @@
// it never creates an instance of the class mother CBotVar // it never creates an instance of the class mother CBotVar
#include "CBot.h" #include "CBot.h"
#include <math.h>
#include <stdio.h> #include <cassert>
#include <cmath>
#include <cstdio>
long CBotVar::m_identcpt = 0; long CBotVar::m_identcpt = 0;
@ -124,7 +126,7 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type
!type.Eq(CBotTypIntrinsic) && // by convenience there accepts these types !type.Eq(CBotTypIntrinsic) && // by convenience there accepts these types
!type.Eq(CBotTypPointer) && !type.Eq(CBotTypPointer) &&
!type.Eq(CBotTypArrayPointer) && !type.Eq(CBotTypArrayPointer) &&
!type.Eq(CBotTypArrayBody)) ASM_TRAP(); !type.Eq(CBotTypArrayBody)) assert(0);
m_token = new CBotToken(name); m_token = new CBotToken(name);
m_next = NULL; m_next = NULL;
@ -169,7 +171,7 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type
CBotVarClass::~CBotVarClass( ) CBotVarClass::~CBotVarClass( )
{ {
if ( m_CptUse != 0 ) if ( m_CptUse != 0 )
ASM_TRAP(); assert(0);
if ( m_pParent ) delete m_pParent; if ( m_pParent ) delete m_pParent;
m_pParent = NULL; m_pParent = NULL;
@ -242,7 +244,7 @@ void CBotVar::SetUniqNum(long n)
{ {
m_ident = n; m_ident = n;
if ( n == 0 ) ASM_TRAP(); if ( n == 0 ) assert(0);
} }
long CBotVar::NextUniqNum() long CBotVar::NextUniqNum()
@ -267,7 +269,7 @@ bool CBotVar::Save1State(FILE* pf)
// this routine "virtual" must never be called, // this routine "virtual" must never be called,
// there must be a routine for each of the subclasses (CBotVarInt, CBotVarFloat, etc) // there must be a routine for each of the subclasses (CBotVarInt, CBotVarFloat, etc)
// ( see the type in m_type ) // ( see the type in m_type )
ASM_TRAP(); assert(0);
return false; return false;
} }
@ -335,7 +337,7 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
} }
} }
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
@ -406,7 +408,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
} }
} }
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
@ -519,25 +521,25 @@ CBotToken* CBotVar::GetToken()
CBotVar* CBotVar::GetItem(const char* name) CBotVar* CBotVar::GetItem(const char* name)
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
CBotVar* CBotVar::GetItemRef(int nIdent) CBotVar* CBotVar::GetItemRef(int nIdent)
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
CBotVar* CBotVar::GetItemList() CBotVar* CBotVar::GetItemList()
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
CBotVar* CBotVar::GetItem(int row, bool bGrow) CBotVar* CBotVar::GetItem(int row, bool bGrow)
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
@ -617,7 +619,7 @@ void CBotVar::SetVal(CBotVar* var)
} }
break; break;
default: default:
ASM_TRAP(); assert(0);
} }
m_binit = var->m_binit; // copie l'état nan s'il y a m_binit = var->m_binit; // copie l'état nan s'il y a
@ -651,12 +653,12 @@ int CBotVar::GetPrivate()
void CBotVar::SetPointer(CBotVar* pVarClass) void CBotVar::SetPointer(CBotVar* pVarClass)
{ {
ASM_TRAP(); assert(0);
} }
CBotVarClass* CBotVar::GetPointer() CBotVarClass* CBotVar::GetPointer()
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
@ -665,167 +667,167 @@ CBotVarClass* CBotVar::GetPointer()
int CBotVar::GetValInt() int CBotVar::GetValInt()
{ {
ASM_TRAP(); assert(0);
return 0; return 0;
} }
float CBotVar::GetValFloat() float CBotVar::GetValFloat()
{ {
ASM_TRAP(); assert(0);
return 0; return 0;
} }
void CBotVar::SetValInt(int c, const char* s) void CBotVar::SetValInt(int c, const char* s)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::SetValFloat(float c) void CBotVar::SetValFloat(float c)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Mul(CBotVar* left, CBotVar* right) void CBotVar::Mul(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Power(CBotVar* left, CBotVar* right) void CBotVar::Power(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
int CBotVar::Div(CBotVar* left, CBotVar* right) int CBotVar::Div(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return 0; return 0;
} }
int CBotVar::Modulo(CBotVar* left, CBotVar* right) int CBotVar::Modulo(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return 0; return 0;
} }
void CBotVar::Add(CBotVar* left, CBotVar* right) void CBotVar::Add(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Sub(CBotVar* left, CBotVar* right) void CBotVar::Sub(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
bool CBotVar::Lo(CBotVar* left, CBotVar* right) bool CBotVar::Lo(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
bool CBotVar::Hi(CBotVar* left, CBotVar* right) bool CBotVar::Hi(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
bool CBotVar::Ls(CBotVar* left, CBotVar* right) bool CBotVar::Ls(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
bool CBotVar::Hs(CBotVar* left, CBotVar* right) bool CBotVar::Hs(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
bool CBotVar::Eq(CBotVar* left, CBotVar* right) bool CBotVar::Eq(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
bool CBotVar::Ne(CBotVar* left, CBotVar* right) bool CBotVar::Ne(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
return false; return false;
} }
void CBotVar::And(CBotVar* left, CBotVar* right) void CBotVar::And(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Or(CBotVar* left, CBotVar* right) void CBotVar::Or(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::XOr(CBotVar* left, CBotVar* right) void CBotVar::XOr(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::ASR(CBotVar* left, CBotVar* right) void CBotVar::ASR(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::SR(CBotVar* left, CBotVar* right) void CBotVar::SR(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::SL(CBotVar* left, CBotVar* right) void CBotVar::SL(CBotVar* left, CBotVar* right)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Neg() void CBotVar::Neg()
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Not() void CBotVar::Not()
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Inc() void CBotVar::Inc()
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Dec() void CBotVar::Dec()
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::Copy(CBotVar* pSrc, bool bName) void CBotVar::Copy(CBotVar* pSrc, bool bName)
{ {
ASM_TRAP(); assert(0);
} }
void CBotVar::SetValString(const char* p) void CBotVar::SetValString(const char* p)
{ {
ASM_TRAP(); assert(0);
} }
CBotString CBotVar::GetValString() CBotString CBotVar::GetValString()
{ {
ASM_TRAP(); assert(0);
return CBotString(); return CBotString();
} }
void CBotVar::SetClass(CBotClass* pClass) void CBotVar::SetClass(CBotClass* pClass)
{ {
ASM_TRAP(); assert(0);
} }
CBotClass* CBotVar::GetClass() CBotClass* CBotVar::GetClass()
{ {
ASM_TRAP(); assert(0);
return NULL; return NULL;
} }
@ -1398,7 +1400,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName)
pSrc = pSrc->GetPointer(); // if source given by a pointer pSrc = pSrc->GetPointer(); // if source given by a pointer
if ( pSrc->GetType() != CBotTypClass ) if ( pSrc->GetType() != CBotTypClass )
ASM_TRAP(); assert(0);
CBotVarClass* p = static_cast<CBotVarClass*>(pSrc); CBotVarClass* p = static_cast<CBotVarClass*>(pSrc);
@ -1410,7 +1412,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName)
m_pClass = p->m_pClass; m_pClass = p->m_pClass;
if ( p->m_pParent ) if ( p->m_pParent )
{ {
ASM_TRAP(); // "que faire du pParent"; assert(0); // "que faire du pParent";
} }
// m_next = NULL; // m_next = NULL;
@ -1768,7 +1770,7 @@ bool CBotVarClass::Ne(CBotVar* left, CBotVar* right)
CBotVarArray::CBotVarArray(const CBotToken* name, CBotTypResult& type ) CBotVarArray::CBotVarArray(const CBotToken* name, CBotTypResult& type )
{ {
if ( !type.Eq(CBotTypArrayPointer) && if ( !type.Eq(CBotTypArrayPointer) &&
!type.Eq(CBotTypArrayBody)) ASM_TRAP(); !type.Eq(CBotTypArrayBody)) assert(0);
m_token = new CBotToken(name); m_token = new CBotToken(name);
m_next = NULL; m_next = NULL;
@ -1791,7 +1793,7 @@ CBotVarArray::~CBotVarArray()
void CBotVarArray::Copy(CBotVar* pSrc, bool bName) void CBotVarArray::Copy(CBotVar* pSrc, bool bName)
{ {
if ( pSrc->GetType() != CBotTypArrayPointer ) if ( pSrc->GetType() != CBotTypArrayPointer )
ASM_TRAP(); assert(0);
CBotVarArray* p = static_cast<CBotVarArray*>(pSrc); CBotVarArray* p = static_cast<CBotVarArray*>(pSrc);
@ -1825,7 +1827,7 @@ void CBotVarArray::SetPointer(CBotVar* pVarClass)
if ( !pVarClass->m_type.Eq(CBotTypClass) && if ( !pVarClass->m_type.Eq(CBotTypClass) &&
!pVarClass->m_type.Eq(CBotTypArrayBody)) !pVarClass->m_type.Eq(CBotTypArrayBody))
ASM_TRAP(); assert(0);
(static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // incement the reference (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // incement the reference
} }
@ -1882,7 +1884,7 @@ CBotVarPointer::CBotVarPointer(const CBotToken* name, CBotTypResult& type )
if ( !type.Eq(CBotTypPointer) && if ( !type.Eq(CBotTypPointer) &&
!type.Eq(CBotTypNullPointer) && !type.Eq(CBotTypNullPointer) &&
!type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic !type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic
!type.Eq(CBotTypIntrinsic) ) ASM_TRAP(); !type.Eq(CBotTypIntrinsic) ) assert(0);
m_token = new CBotToken(name); m_token = new CBotToken(name);
m_next = NULL; m_next = NULL;
@ -1965,7 +1967,7 @@ void CBotVarPointer::SetPointer(CBotVar* pVarClass)
// if ( pVarClass->GetType() != CBotTypClass ) // if ( pVarClass->GetType() != CBotTypClass )
if ( !pVarClass->m_type.Eq(CBotTypClass) ) if ( !pVarClass->m_type.Eq(CBotTypClass) )
ASM_TRAP(); assert(0);
(static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // increment the reference (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // increment the reference
m_pClass = (static_cast<CBotVarClass*>(pVarClass))->m_pClass; m_pClass = (static_cast<CBotVarClass*>(pVarClass))->m_pClass;
@ -2034,7 +2036,7 @@ void CBotVarPointer::Copy(CBotVar* pSrc, bool bName)
{ {
if ( pSrc->GetType() != CBotTypPointer && if ( pSrc->GetType() != CBotTypPointer &&
pSrc->GetType() != CBotTypNullPointer) pSrc->GetType() != CBotTypNullPointer)
ASM_TRAP(); assert(0);
CBotVarPointer* p = static_cast<CBotVarPointer*>(pSrc); CBotVarPointer* p = static_cast<CBotVarPointer*>(pSrc);
@ -2162,11 +2164,11 @@ int CBotTypResult::GetType(int mode) const
m_type == CBotTypClass || m_type == CBotTypClass ||
m_type == CBotTypIntrinsic ) m_type == CBotTypIntrinsic )
if ( m_pClass == NULL ) ASM_TRAP(); if ( m_pClass == NULL ) assert(0);
if ( m_type == CBotTypArrayPointer ) if ( m_type == CBotTypArrayPointer )
if ( m_pNext == NULL ) ASM_TRAP(); if ( m_pNext == NULL ) assert(0);
#endif #endif
if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer; if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer;
return m_type; return m_type;

View File

@ -56,21 +56,13 @@ if(PLATFORM_WINDOWS)
set(RES_FILES "../desktop/colobot.rc") set(RES_FILES "../desktop/colobot.rc")
endif() endif()
# Platform-dependent implementation of system.h
if(PLATFORM_WINDOWS)
set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif(PLATFORM_LINUX)
set(SYSTEM_CPP_MODULE "system_linux.cpp")
else()
set(SYSTEM_CPP_MODULE "system_other.cpp")
endif()
# Source files # Source files
set(SOURCES set(SOURCES
app/app.cpp app/app.cpp
app/main.cpp app/main.cpp
app/system.cpp app/system.cpp
app/${SYSTEM_CPP_MODULE} app/${SYSTEM_CPP_MODULE}
app/system_other.cpp
common/event.cpp common/event.cpp
common/image.cpp common/image.cpp
common/iman.cpp common/iman.cpp
@ -237,5 +229,6 @@ add_executable(colobot ${SOURCES})
target_link_libraries(colobot ${LIBS}) 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}) if(NOT CBOT_STATIC)
set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})
endif()

View File

@ -147,8 +147,8 @@ CApplication::CApplication()
m_mouseButtonsState = 0; m_mouseButtonsState = 0;
m_trackedKeys = 0; m_trackedKeys = 0;
m_dataPath = COLOBOT_DEFAULT_DATADIR; m_dataPath = GetSystemUtils()->GetDataPath();
m_langPath = COLOBOT_I18N_DIR; m_langPath = GetSystemUtils()->GetLangPath();
m_texPackPath = ""; m_texPackPath = "";
m_runSceneName = ""; m_runSceneName = "";
@ -280,7 +280,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -debug modes enable debug modes (more info printed in logs; see code for reference of modes)\n"); GetLogger()->Message(" -debug modes enable debug modes (more info printed in logs; see code for reference of modes)\n");
GetLogger()->Message(" -runscene sceneNNN run given scene on start\n"); GetLogger()->Message(" -runscene sceneNNN run given scene on start\n");
GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n"); GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n");
GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl)\n"); GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n");
GetLogger()->Message(" -datadir path set custom data directory path\n"); GetLogger()->Message(" -datadir path set custom data directory path\n");
GetLogger()->Message(" -langdir path set custom language directory path\n"); GetLogger()->Message(" -langdir path set custom language directory path\n");
GetLogger()->Message(" -texpack path set path to custom texture pack\n"); GetLogger()->Message(" -texpack path set path to custom texture pack\n");
@ -421,7 +421,10 @@ bool CApplication::Create()
return false; return false;
} }
#if !defined(PLATFORM_MACOSX)
// On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file
GetProfile().SetLocalProfileString("Resources", "Data", m_dataPath); GetProfile().SetLocalProfileString("Resources", "Data", m_dataPath);
#endif
SetLanguage(m_language); SetLanguage(m_language);
@ -435,12 +438,16 @@ bool CApplication::Create()
m_sound->Create(true); m_sound->Create(true);
#if !defined(PLATFORM_MACOSX)
// On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file
// Cache sound files // Cache sound files
if (defaultValues) if (defaultValues)
{ {
GetProfile().SetLocalProfileString("Resources", "Sound", GetDataSubdirPath(DIR_SOUND)); GetProfile().SetLocalProfileString("Resources", "Sound", GetDataSubdirPath(DIR_SOUND));
GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC)); GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC));
} }
#endif
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path)) if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path))
{ {
@ -1681,6 +1688,10 @@ char CApplication::GetLanguageChar() const
case LANGUAGE_POLISH: case LANGUAGE_POLISH:
langChar = 'P'; langChar = 'P';
break; break;
case LANGUAGE_RUSSIAN:
langChar = 'R';
break;
} }
return langChar; return langChar;
} }
@ -1707,6 +1718,11 @@ bool CApplication::ParseLanguage(const std::string& str, Language& language)
language = LANGUAGE_POLISH; language = LANGUAGE_POLISH;
return true; return true;
} }
else if (str == "ru")
{
language = LANGUAGE_RUSSIAN;
return true;
}
return false; return false;
} }
@ -1740,6 +1756,10 @@ void CApplication::SetLanguage(Language language)
case LANGUAGE_POLISH: case LANGUAGE_POLISH:
locale = "pl_PL.utf8"; locale = "pl_PL.utf8";
break; break;
case LANGUAGE_RUSSIAN:
locale = "ru_RU.utf8";
break;
} }
if (locale.empty()) if (locale.empty())
@ -1770,6 +1790,10 @@ void CApplication::SetLanguage(Language language)
{ {
m_language = LANGUAGE_POLISH; m_language = LANGUAGE_POLISH;
} }
else if (strncmp(envLang,"ru",2) == 0)
{
m_language = LANGUAGE_RUSSIAN;
}
else else
{ {
GetLogger()->Warn("Enviromnent locale ('%s') is not supported, setting default language\n", envLang); GetLogger()->Warn("Enviromnent locale ('%s') is not supported, setting default language\n", envLang);

View File

@ -25,6 +25,8 @@
#include "app/system_windows.h" #include "app/system_windows.h"
#elif defined(PLATFORM_LINUX) #elif defined(PLATFORM_LINUX)
#include "app/system_linux.h" #include "app/system_linux.h"
#elif defined(PLATFORM_MACOSX)
#include "app/system_macosx.h"
#else #else
#include "app/system_other.h" #include "app/system_other.h"
#endif #endif
@ -48,6 +50,8 @@ CSystemUtils* CSystemUtils::Create()
m_instance = new CSystemUtilsWindows(); m_instance = new CSystemUtilsWindows();
#elif defined(PLATFORM_LINUX) #elif defined(PLATFORM_LINUX)
m_instance = new CSystemUtilsLinux(); m_instance = new CSystemUtilsLinux();
#elif defined(PLATFORM_MACOSX)
m_instance = new CSystemUtilsMacOSX();
#else #else
m_instance = new CSystemUtilsOther(); m_instance = new CSystemUtilsOther();
#endif #endif
@ -188,6 +192,16 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte
return result; return result;
} }
std::string CSystemUtils::GetDataPath()
{
return COLOBOT_DEFAULT_DATADIR;
}
std::string CSystemUtils::GetLangPath()
{
return COLOBOT_I18N_DIR;
}
std::string CSystemUtils::GetProfileFileLocation() std::string CSystemUtils::GetProfileFileLocation()
{ {
return std::string("colobot.ini"); return std::string("colobot.ini");

View File

@ -130,6 +130,12 @@ public:
/** The difference is \a after - \a before. */ /** The difference is \a after - \a before. */
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
//! Returns the data path (containing textures, levels, helpfiles, etc)
virtual std::string GetDataPath();
//! Returns the translations path
virtual std::string GetLangPath();
//! Returns the profile (colobot.ini) file location //! Returns the profile (colobot.ini) file location
virtual std::string GetProfileFileLocation(); virtual std::string GetProfileFileLocation();

116
src/app/system_macosx.cpp Normal file
View File

@ -0,0 +1,116 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2013, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
#include "app/system_macosx.h"
#include "common/logger.h"
#include <stdlib.h>
// MacOS-specific headers
#include <CoreFoundation/CFBundle.h>
#include <CoreServices/CoreServices.h>
#include <boost/filesystem.hpp>
inline std::string CFStringRefToStdString(CFStringRef str) {
std::string stdstr;
char *fullPath;
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
// 1st try for English system
fullPath = const_cast<char*>(CFStringGetCStringPtr(str, encodingMethod));
if( fullPath == NULL )
{
// 2nd try for Japanese system
encodingMethod = kCFStringEncodingUTF8;
fullPath = const_cast<char*>(CFStringGetCStringPtr(str, encodingMethod));
}
// for safer operation.
if( fullPath == NULL )
{
CFIndex length = CFStringGetLength(str);
fullPath = static_cast<char *>(malloc( length + 1 ));
// TODO: Check boolean result of that conversion
CFStringGetCString(str, fullPath, length, kCFStringEncodingUTF8 );
stdstr = fullPath;
free( fullPath );
}
else
stdstr = fullPath;
return stdstr;
}
void CSystemUtilsMacOSX::Init()
{
// These functions are a deprecated way to get the 'Application Support' folder, but they do work, in plain C++
FSRef ref;
OSType folderType = kApplicationSupportFolderType;
char path[PATH_MAX];
FSFindFolder( kUserDomain, folderType, kCreateFolder, &ref );
FSRefMakePath( &ref, reinterpret_cast<UInt8*>(&path), PATH_MAX );
m_ASPath = path;
m_ASPath.append("/colobot/");
// Make sure the directory exists
boost::filesystem::create_directories(m_ASPath.c_str());
// Get the Resources bundle URL
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyBundleURL(mainBundle);
CFStringRef str = CFURLCopyFileSystemPath( resourcesURL, kCFURLPOSIXPathStyle );
CFRelease(resourcesURL);
m_dataPath = CFStringRefToStdString(str);
m_dataPath += "/Contents/Resources";
}
std::string CSystemUtilsMacOSX::GetDataPath()
{
return m_dataPath;
}
std::string CSystemUtilsMacOSX::GetLangPath()
{
return m_dataPath + "/i18n";
}
std::string CSystemUtilsMacOSX::GetProfileFileLocation()
{
std::string profileFile = m_ASPath + "/colobot.ini";
GetLogger()->Trace("Profile file is %s\n", profileFile.c_str());
return profileFile;
}
std::string CSystemUtilsMacOSX::GetSavegameDirectoryLocation()
{
std::string savegameDir = m_ASPath + "/savegame";
boost::filesystem::create_directories(savegameDir.c_str());
GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
return savegameDir;
}

39
src/app/system_macosx.h Normal file
View File

@ -0,0 +1,39 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
/**
* \file app/system_macosx.h
* \brief MacOSX-specific implementation of system functions
*/
#include "app/system.h"
#include "app/system_other.h"
class CSystemUtilsMacOSX : public CSystemUtilsOther
{
public:
virtual void Init() override;
virtual std::string GetDataPath() override;
virtual std::string GetLangPath() override;
virtual std::string GetProfileFileLocation() override;
virtual std::string GetSavegameDirectoryLocation() override;
private:
std::string m_ASPath;
std::string m_dataPath;
};

View File

@ -6,6 +6,11 @@
#cmakedefine PLATFORM_MACOSX @PLATFORM_MACOSX@ #cmakedefine PLATFORM_MACOSX @PLATFORM_MACOSX@
#cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@ #cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@
#ifdef PLATFORM_MACOSX
// Assume we have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework
#define HAVE_CFLOCALECOPYCURRENT 1
#endif
#cmakedefine GLEW_STATIC #cmakedefine GLEW_STATIC
#cmakedefine OPENAL_SOUND #cmakedefine OPENAL_SOUND

View File

@ -173,7 +173,8 @@ enum Language
LANGUAGE_ENGLISH = 0, LANGUAGE_ENGLISH = 0,
LANGUAGE_FRENCH = 1, LANGUAGE_FRENCH = 1,
LANGUAGE_GERMAN = 2, LANGUAGE_GERMAN = 2,
LANGUAGE_POLISH = 3 LANGUAGE_POLISH = 3,
LANGUAGE_RUSSIAN = 4
}; };
/** /**

View File

@ -218,15 +218,30 @@ void CImage::PadToNearestPowerOfTwo()
int w = Math::NextPowerOfTwo(m_data->surface->w); int w = Math::NextPowerOfTwo(m_data->surface->w);
int h = Math::NextPowerOfTwo(m_data->surface->h); int h = Math::NextPowerOfTwo(m_data->surface->h);
BlitToNewRGBASurface(w, h);
}
void CImage::ConvertToRGBA()
{
assert(m_data != nullptr);
int w = m_data->surface->w;
int h = m_data->surface->h;
BlitToNewRGBASurface(w, h);
}
void CImage::BlitToNewRGBASurface(int width, int height)
{
m_data->surface->flags &= (~SDL_SRCALPHA); m_data->surface->flags &= (~SDL_SRCALPHA);
SDL_Surface* resizedSurface = SDL_CreateRGBSurface(0, w, h, 32, 0x00ff0000, 0x0000ff00, SDL_Surface* convertedSurface = SDL_CreateRGBSurface(0, width, height, 32, 0x00FF0000, 0x0000FF00,
0x000000ff, 0xff000000); 0x000000FF, 0xFF000000);
assert(resizedSurface != NULL); assert(convertedSurface != nullptr);
SDL_BlitSurface(m_data->surface, NULL, resizedSurface, NULL); SDL_BlitSurface(m_data->surface, nullptr, convertedSurface, nullptr);
SDL_FreeSurface(m_data->surface); SDL_FreeSurface(m_data->surface);
m_data->surface = resizedSurface; m_data->surface = convertedSurface;
} }
/** /**
@ -376,6 +391,11 @@ bool CImage::Load(const std::string& fileName)
return false; return false;
} }
if (m_data->surface->format->palette != nullptr)
{
ConvertToRGBA();
}
return true; return true;
} }

View File

@ -97,6 +97,9 @@ public:
//! Pads the image to nearest power of 2 dimensions //! Pads the image to nearest power of 2 dimensions
void PadToNearestPowerOfTwo(); void PadToNearestPowerOfTwo();
//! Convert the image to RGBA surface
void ConvertToRGBA();
//! Loads an image from the specified file //! Loads an image from the specified file
bool Load(const std::string &fileName); bool Load(const std::string &fileName);
@ -107,6 +110,9 @@ public:
std::string GetError(); std::string GetError();
private: private:
//! Blit to new RGBA surface with given size
void BlitToNewRGBASurface(int width, int height);
//! Last encountered error //! Last encountered error
std::string m_error; std::string m_error;
//! Image data //! Image data

View File

@ -3138,9 +3138,9 @@ void CRobotMain::CreateTooltip(Math::Point pos, const char* text)
start, end); start, end);
start.x -= 0.010f; start.x -= 0.010f;
start.y -= 0.002f; start.y -= 0.006f;
end.x += 0.010f; end.x += 0.010f;
end.y += 0.004f; // ch'tite (?) margin end.y += 0.008f; // small'ish margin
pos.x = start.x; pos.x = start.x;
pos.y = start.y; pos.y = start.y;

View File

@ -57,7 +57,7 @@ CControl::~CControl()
bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{ {
char text[100]; char text[200];
std::string str_text; std::string str_text;
if ( eventType == EVENT_NULL ) if ( eventType == EVENT_NULL )

View File

@ -1191,8 +1191,8 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 ) else if ( icon == 1 )
{ {
m_engine->SetTexture("button1.png"); m_engine->SetTexture("button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // yellow tooltip uv1.x = 128.0f/256.0f; // white tooltip
uv1.y = 0.0f/256.0f; uv1.y = 0.0f/256.0f;
uv2.x = 224.0f/256.0f; uv2.x = 224.0f/256.0f;
uv2.y = 16.0f/256.0f; uv2.y = 16.0f/256.0f;

View File

@ -2,15 +2,6 @@ set(SRC_DIR ${colobot_SOURCE_DIR}/src)
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h) configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
# Platform-dependent implementation of system.h
if(PLATFORM_WINDOWS)
set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif(PLATFORM_LINUX)
set(SYSTEM_CPP_MODULE "system_linux.cpp")
else()
set(SYSTEM_CPP_MODULE "system_other.cpp")
endif()
set(TEXTURE_SOURCES set(TEXTURE_SOURCES
${SRC_DIR}/graphics/core/color.cpp ${SRC_DIR}/graphics/core/color.cpp
${SRC_DIR}/graphics/opengl/gldevice.cpp ${SRC_DIR}/graphics/opengl/gldevice.cpp
@ -28,6 +19,7 @@ ${SRC_DIR}/common/image.cpp
${SRC_DIR}/common/stringutils.cpp ${SRC_DIR}/common/stringutils.cpp
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp
model_test.cpp model_test.cpp
) )
@ -38,6 +30,7 @@ ${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/image.cpp ${SRC_DIR}/common/image.cpp
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp
transform_test.cpp transform_test.cpp
) )
@ -48,6 +41,7 @@ ${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/image.cpp ${SRC_DIR}/common/image.cpp
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp
light_test.cpp light_test.cpp
) )
@ -68,6 +62,7 @@ ${SDLIMAGE_LIBRARY}
${OPENGL_LIBRARY} ${OPENGL_LIBRARY}
${GLEW_LIBRARY} ${GLEW_LIBRARY}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${Boost_LIBRARIES}
) )
add_executable(texture_test ${TEXTURE_SOURCES}) add_executable(texture_test ${TEXTURE_SOURCES})

View File

@ -1,7 +1,7 @@
Test programs for OpenGL engine: Test programs for OpenGL engine:
- texture_test -> multitexturing test with 2 textures (included as files: ./tex1.png, ./tex2.png) - texture_test -> multitexturing test with 2 textures (included as files: ./tex1.png, ./tex2.png)
- model_test -> simple model viewer to test model loading - model_test -> simple model viewer to test model loading
usage: ./model_test {dxf|mod} model_file usage: ./model_test {old|new_txt|new_bin} model_file
second argument is the loaded format (DXF or Colobot .mod files) second argument is the loaded format (DXF or Colobot .mod files)
requires ./tex folder (or symlink) with Colobot textures requires ./tex folder (or symlink) with Colobot textures
viewer is controlled from keyboard - the bindings can be found in code viewer is controlled from keyboard - the bindings can be found in code

View File

@ -365,6 +365,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{ {
CLogger logger; CLogger logger;
CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
systemUtils->Init();
PREV_TIME = GetSystemUtils()->CreateTimeStamp(); PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp(); CURR_TIME = GetSystemUtils()->CreateTimeStamp();

View File

@ -265,6 +265,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{ {
CLogger logger; CLogger logger;
CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
systemUtils->Init();
PREV_TIME = GetSystemUtils()->CreateTimeStamp(); PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp(); CURR_TIME = GetSystemUtils()->CreateTimeStamp();
@ -273,7 +276,7 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
if (argc != 3) if (argc != 3)
{ {
std::cerr << "Usage: " << argv[0] << "{old|new_txt|new_bin} model_file" << std::endl; std::cerr << "Usage: " << argv[0] << " {old|new_txt|new_bin} model_file" << std::endl;
return 1; return 1;
} }

View File

@ -243,6 +243,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{ {
CLogger logger; CLogger logger;
CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
systemUtils->Init();
PREV_TIME = GetSystemUtils()->CreateTimeStamp(); PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp(); CURR_TIME = GetSystemUtils()->CreateTimeStamp();

View File

@ -18,20 +18,12 @@ endif()
# Configure file # Configure file
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h) configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
# Platform-dependent implementation of system.h
if(PLATFORM_WINDOWS)
set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif(PLATFORM_LINUX)
set(SYSTEM_CPP_MODULE "system_linux.cpp")
else()
set(SYSTEM_CPP_MODULE "system_other.cpp")
endif()
# Code sources # Code sources
set(COLOBOT_SOURCES set(COLOBOT_SOURCES
${SRC_DIR}/app/app.cpp ${SRC_DIR}/app/app.cpp
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp
${SRC_DIR}/common/event.cpp ${SRC_DIR}/common/event.cpp
${SRC_DIR}/common/image.cpp ${SRC_DIR}/common/image.cpp
${SRC_DIR}/common/iman.cpp ${SRC_DIR}/common/iman.cpp

View File

@ -7,10 +7,15 @@ ${GTEST_INCLUDE_DIR}
add_executable(image_test ${SRC_DIR}/common/image.cpp image_test.cpp) add_executable(image_test ${SRC_DIR}/common/image.cpp image_test.cpp)
target_link_libraries(image_test ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${PNG_LIBRARIES}) target_link_libraries(image_test ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${PNG_LIBRARIES})
add_test(NAME image_test
COMMAND ${CMAKE_BINARY_DIR}/image_test ${CMAKE_SOURCE_DIR}/test/envs/opengl/tex1.png ${CMAKE_BINARY_DIR}/tex1_test.png)
file(COPY colobot.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY colobot.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# add_executable(profile_test ${SRC_DIR}/common/profile.cpp ${SRC_DIR}/common/logger.cpp profile_test.cpp) add_executable(profile_test ${SRC_DIR}/common/profile.cpp ${SRC_DIR}/common/logger.cpp profile_test.cpp)
# target_link_libraries(profile_test gtest ${Boost_LIBRARIES}) set_target_properties(profile_test PROPERTIES COMPILE_DEFINITIONS "DEV_BUILD=1")
target_link_libraries(profile_test gtest ${Boost_LIBRARIES})
# add_test(profile_test ./profile_test) add_test(NAME profile_test
COMMAND ${CMAKE_BINARY_DIR}/profile_test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -10,21 +10,18 @@ ${CLIPBOARD_INCLUDE_DIR}
# Platform-dependent implementation of CSystemUtils # Platform-dependent implementation of CSystemUtils
if(PLATFORM_WINDOWS) if(PLATFORM_WINDOWS)
set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif(PLATFORM_LINUX) elseif(PLATFORM_LINUX)
set(SYSTEM_CPP_MODULE "system_linux.cpp")
set(ADDITIONAL_LIB "-lX11") set(ADDITIONAL_LIB "-lX11")
elseif(PLATFORM_MACOSX) elseif(PLATFORM_MACOSX)
set(SYSTEM_CPP_MODULE "system_other.cpp")
set(ADDITIONAL_LIB "${X11_X11_LIB}") set(ADDITIONAL_LIB "${X11_X11_LIB}")
else() else()
set(SYSTEM_CPP_MODULE "system_other.cpp")
set(ADDITIONAL_LIB "-lX11") set(ADDITIONAL_LIB "-lX11")
endif() endif()
add_executable(edit_test add_executable(edit_test
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp
${SRC_DIR}/common/event.cpp ${SRC_DIR}/common/event.cpp
${SRC_DIR}/common/logger.cpp ${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/misc.cpp ${SRC_DIR}/common/misc.cpp