Release 0.2.0-alpha: Merge branch 'dev'

fix-squashed-planets
Mateusz Przybył 2021-08-21 22:57:33 +02:00
commit d9c966a95b
667 changed files with 12760 additions and 3816 deletions

104
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,104 @@
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.host_os }}
container: ${{ matrix.container }}
strategy:
matrix:
target_os: [linux]
host_os: [ubuntu-18.04, ubuntu-20.04]
container: ['']
include:
- target_os: windows
host_os: ubuntu-latest
container: krzysh/colobot-build:latest
fail-fast: false
steps:
- name: Install Colobot dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet
if: matrix.container == ''
- uses: actions/checkout@v2
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake (for Windows using MXE)
working-directory: build
# FIXME: without -lsetupapi linking sdl2 fails
run: /opt/mxe/usr/bin/i686-w64-mingw32.static-cmake -DCMAKE_CXX_STANDARD_LIBRARIES="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lsetupapi" -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 -DMXE_USE_CCACHE=0 ..
if: matrix.target_os == 'windows'
- name: Run CMake (for Linux)
working-directory: build
run: cmake -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 ..
if: matrix.target_os == 'linux'
- name: Build
working-directory: build
run: make -j `nproc`
- name: Install
working-directory: build
run: DESTDIR=. make install
- name: Patch library path
working-directory: build
run: patchelf --set-rpath '.' install/colobot
if: matrix.target_os == 'linux'
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: ${{matrix.target_os}}-debug
path: build/install
if: matrix.target_os == 'windows' || matrix.host_os == 'ubuntu-18.04'
- name: Create AppImage
working-directory: build
run: |
# Download app image tool
wget -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appimage-extract
# Create AppImage
NO_STRIP=1 ./squashfs-root/AppRun -e colobot --output appimage --appdir colobot.AppDir -d desktop/colobot.desktop -i ../desktop/colobot.svg
chmod +x Colobot-*-x86_64.AppImage
# Prepare folder for zip
mkdir -p appimage
cp -rp install/data appimage/data
cp -rp install/lang appimage/lang
cp -p Colobot-*-x86_64.AppImage appimage/colobot
if: matrix.target_os == 'linux'
- name: Upload AppImage
uses: actions/upload-artifact@v2
with:
name: ${{matrix.target_os}}-debug-AppImage
path: build/appimage
if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-18.04'
- name: Run tests
# TODO: Maybe run Windows tests using wine as well?
working-directory: build
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
if: matrix.target_os == 'linux'
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
path: build/gtestresults.xml
if: matrix.target_os == 'linux'
doc:
runs-on: ubuntu-latest
steps:
- name: Install Colobot dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet doxygen graphviz
- uses: actions/checkout@v2
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake
working-directory: build
run: cmake ..
- name: Build docs
working-directory: build
run: make doc
- name: Upload docs
uses: actions/upload-artifact@v2
with:
name: doc
path: build/doc

21
.github/workflows/verify-pr-target.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Verify pull request target
on: [pull_request_target]
jobs:
check_pr_target:
runs-on: ubuntu-latest
steps:
- name: Send comment if wrong pull request target
if: github.base_ref == 'master'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
Hey! This pull request targets the `master` branch. You should probably target `dev` instead. Make sure to read the [contributing guidelines](https://github.com/colobot/colobot/blob/master/CONTRIBUTING.md#submitting-pull-requests) and [edit the target branch if necessary](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request).
- name: Wrong pull request target
if: github.base_ref == 'master'
run: echo "This pull request targets the master branch. Please edit the pull request to target dev." && exit 1
- name: Correct pull request target
if: github.base_ref != 'master'
run: echo "This pull request targets the correct branch." && exit 0

6
.gitignore vendored
View File

@ -23,7 +23,7 @@ Makefile
/saves
# Standard build directory
/build
/build*
# Ignore KDevelop files
.kdev4
@ -39,6 +39,10 @@ CMakeLists.txt.user.*
# Ignore Visual Studio Code files
/.vscode
# Ignore CLion files
/.idea
# Ignore Visual Studio files
/CMakeSettings.json
/.vs
/out

View File

@ -16,9 +16,9 @@ set(COLOBOT_VERSION_MINOR 1)
set(COLOBOT_VERSION_REVISION 12)
# Used on official releases
set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
#set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
# Used on unreleased, development builds
#set(COLOBOT_VERSION_UNRELEASED "+alpha")
set(COLOBOT_VERSION_UNRELEASED "+alpha")
# Append git characteristics to version
if(DEFINED COLOBOT_VERSION_UNRELEASED)
@ -60,6 +60,7 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(PLATFORM_GNU 0)
set(PLATFORM_LINUX 0)
set(PLATFORM_MACOSX 0)
set(PLATFORM_FREEBSD 0)
set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
@ -71,6 +72,7 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(PLATFORM_LINUX 1)
set(PLATFORM_GNU 1)
set(PLATFORM_MACOSX 0)
set(PLATFORM_FREEBSD 0)
set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
@ -82,6 +84,7 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "kFreeBSD" OR "${CMAKE_SYSTEM_NAME}" STREQ
set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 1)
set(PLATFORM_MACOSX 0)
set(PLATFORM_FREEBSD 0)
set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
@ -94,18 +97,35 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(PLATFORM_GNU 0)
set(PLATFORM_MACOSX 1)
set(PLATFORM_OTHER 0)
set(PLATFORM_FREEBSD 0)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_macosx.cpp")
set(SYSTEM_H_MODULE "system_macosx.h")
# To avoid CMake warning
set(CMAKE_MACOSX_RPATH 1)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
message(STATUS "Build for FreeBSD system")
set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 0)
set(PLATFORM_MACOSX 0)
set(PLATFORM_FREEBSD 1)
set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
# On FreeBSD we can use *_other
set(SYSTEM_CPP_MODULE "system_other.cpp")
set(SYSTEM_H_MODULE "system_other.h")
# To avoid CMake warning
set(CMAKE_MACOSX_RPATH 1)
else()
message(STATUS "Build for other system")
set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 0)
set(PLATFORM_MACOSX 0)
set(PLATFORM_FREEBSD 0)
set(PLATFORM_OTHER 1)
# Platform-dependent implementation of system.h
@ -153,6 +173,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Detected Clang version 3.1+")
if (${PLATFORM_FREEBSD})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=bfd")
endif()
set(NORMAL_CXX_FLAGS "-std=c++11 -Wall -Werror -Wold-style-cast -pedantic-errors -Wmissing-prototypes")
set(NORMAL_CXX_FLAGS "${NORMAL_CXX_FLAGS} -Wno-error=deprecated-declarations") # updated version of physfs is not available on some platforms so we keep using deprecated functions, see #958
set(RELEASE_CXX_FLAGS "-O2")
@ -165,16 +189,16 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(NORMAL_CXX_FLAGS "/wd\"4244\" /wd\"4309\" /wd\"4800\" /wd\"4996\" /wd\"4351\" /EHsc") # disable some useless warnings
if(MSVC_STATIC)
set(RELEASE_CXX_FLAGS "/MT /Ox")
set(DEBUG_CXX_FLAGS "/MTd /ZI")
set(DEBUG_CXX_FLAGS "/MTd /Od /ZI")
else(MSVC_STATIC)
set(RELEASE_CXX_FLAGS "/MD /Ox")
set(DEBUG_CXX_FLAGS "/MDd /ZI")
set(DEBUG_CXX_FLAGS "/MDd /Od /ZI")
endif()
set(TEST_CXX_FLAGS "")
set(TEST_CXX_FLAGS "${DEBUG_CXX_FLAGS}")
add_definitions(-DNOEXCEPT= -DHAS_MSVC_EXCEPTION_BUG)
# Needed for Debug information (it's set to "No" by default for some reason)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /NODEFAULTLIB:MSVCRTD /NODEFAULTLIB:LIBCMT")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
else()
message(FATAL_ERROR "Your C++ compiler doesn't seem to be supported.")
@ -206,7 +230,10 @@ option(DEV_BUILD "Enable development build (enables some debugging tools, local
# PLEASE DO NOT USE ON UNOFFICIAL BUILDS. Thanks.
option(OFFICIAL_COLOBOT_BUILD "Official build (changes crash screen text)" OFF)
# Portable build - load all data from current directory
# Hardcode relative paths instead of absolute paths
option(USE_RELATIVE_PATHS "Generate relative paths from absolute paths" OFF)
# Portable build - load all data from the base directory
option(PORTABLE "Portable build" OFF)
# Portable saves - suitable for e.g. putting the whole game on external storage and moving your saves with it
@ -367,12 +394,12 @@ endif()
# Installation paths defined before compiling sources
if(PORTABLE OR (PLATFORM_WINDOWS AND MXE))
# We need to use STRING because PATH doesn't accept relative paths
set(COLOBOT_INSTALL_BIN_DIR ./ CACHE STRING "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ./ CACHE STRING "Colobot libraries directory")
set(COLOBOT_INSTALL_DATA_DIR ./data CACHE STRING "Colobot shared data directory")
set(COLOBOT_INSTALL_I18N_DIR ./lang CACHE STRING "Colobot translations directory")
set(COLOBOT_INSTALL_DOC_DIR ./doc CACHE STRING "Colobot documentation directory")
set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot libraries directory")
set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data CACHE PATH "Colobot shared data 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(USE_RELATIVE_PATHS ON)
elseif(PLATFORM_WINDOWS)
set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot libraries directory")
@ -393,6 +420,18 @@ else()
set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/colobot CACHE PATH "Colobot documentation directory")
endif()
# Generate relative paths from absolute paths
if(USE_RELATIVE_PATHS)
message(STATUS "Generating relative paths")
file(RELATIVE_PATH COLOBOT_DATA_DIR ${COLOBOT_INSTALL_BIN_DIR} ${COLOBOT_INSTALL_DATA_DIR})
file(RELATIVE_PATH COLOBOT_I18N_DIR ${COLOBOT_INSTALL_BIN_DIR} ${COLOBOT_INSTALL_I18N_DIR})
add_definitions(-DUSE_RELATIVE_PATHS)
else()
set(COLOBOT_DATA_DIR ${COLOBOT_INSTALL_DATA_DIR})
set(COLOBOT_I18N_DIR ${COLOBOT_INSTALL_I18N_DIR})
endif()
# Subdirectory with sources
add_subdirectory(src)

View File

@ -110,7 +110,7 @@ Easy, isn't it?
If you are lazy, you can just use this one-line command, although there is no guarantee it will work or install everything (might be out of date):
```sh
pacman -S mingw-w64-i686-boost mingw-w64-i686-glew mingw-w64-i686-libpng gettext mingw-w64-i686-gettext mingw-w64-i686-libpng mingw-w64-i686-libsndfile mingw-w64-i686-libvorbis mingw-w64-i686-libogg mingw-w64-i686-openal mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_image mingw-w64-i686-SDL2_ttf
pacman -S mingw-w64-i686-boost mingw-w64-i686-glew mingw-w64-i686-libpng gettext mingw-w64-i686-gettext mingw-w64-i686-libpng mingw-w64-i686-libsndfile mingw-w64-i686-libvorbis mingw-w64-i686-libogg mingw-w64-i686-openal mingw-w64_i686-physfs mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_image mingw-w64-i686-SDL2_ttf
```
You should now have everything set up and working. You can close all instances of MSYS2 and autorebase to ensure everything installed properly.

View File

@ -71,7 +71,7 @@ You will need:
On Ubuntu (and probably any other Debian-based system), you can use the following command to install all required packages:
```
$ apt-get install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng12-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools
$ apt-get install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools
```
Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements,

6
Jenkinsfile vendored
View File

@ -27,10 +27,11 @@ pipeline {
dir('build/windows') {
sh '''
# FIXME: without -lsetupapi linking sdl2 fails
rm -rf *
/opt/mxe/usr/bin/i686-w64-mingw32.static-cmake \
-DCMAKE_CXX_STANDARD_LIBRARIES="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lsetupapi" \
-DCMAKE_INSTALL_PREFIX=/install \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 ../..
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 -DMXE_USE_CCACHE=0 ../..
make
rm -rf install
DESTDIR=. make install
@ -53,6 +54,7 @@ pipeline {
sh 'mkdir -p build/linux'
dir('build/linux') {
sh '''
rm -rf *
cmake \
-DCMAKE_INSTALL_PREFIX=/install -DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 ../..
@ -81,6 +83,8 @@ pipeline {
# Create AppImage
NO_STRIP=1 ./squashfs-root/AppRun -e colobot --output appimage --appdir colobot.AppDir -d desktop/colobot.desktop -i ../../desktop/colobot.svg
#rename AppImage file to avoid "No such file or directory" errors
find . -maxdepth 1 -type f -name '*AppImage' -name 'Colobot*' -exec sh -c 'x="{}"; mv "$x" "Colobot-x86_64.AppImage"' \\;
chmod +x Colobot-x86_64.AppImage
# Prepare folder for zip

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -30,6 +30,8 @@ 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
* openSUSE: http://software.opensuse.org/download.html?project=games&package=colobot
* Fedora: https://src.fedoraproject.org/rpms/colobot
* Guix https://guix.gnu.org/en/packages/colobot-0.1.12-alpha/
## Compiling and running the game
@ -42,9 +44,4 @@ If you want to contribute to the project, see [CONTRIBUTING.md](CONTRIBUTING.md)
## Contact
If you want to help in the project, please contact us on our IRC channels or [our forum](http://colobot.info/forum/).
### IRC channels
* [#colobot on Freenode](irc://freenode.net#colobot) - main development channel (English);
* [#colobot on pirc.pl](irc://pirc.pl#colobot) - Polish community channel;
If you want to help in the project, please contact us on our [Discord server](https://discord.gg/56Fm9kb).

2
data

@ -1 +1 @@
Subproject commit c467bd994e60fb54cf977fbe8583f92957330695
Subproject commit 74c762b47fcac7c073a0afb5c82cf046e7ea42f3

View File

@ -82,20 +82,6 @@ if(PLATFORM_GNU)
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
)
# Translate translatable material
find_program(PO4A po4a)
if(NOT PO4A)
message(WARNING "po4a not found; desktop and manpage files will not be translated")
endif()
if(PO4A)
add_custom_target(desktop_po4a
COMMAND ${PO4A} po4a.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_dependencies(desktopfile desktop_po4a)
endif()
# Create manpage from pod-formatted file
find_program(POD2MAN pod2man)
if(NOT POD2MAN)
@ -133,11 +119,30 @@ if(PLATFORM_GNU)
# Create the english manpage
podman(PODFILE colobot.pod)
# Translate translatable material
find_program(PO4A po4a)
if(NOT PO4A)
message(WARNING "po4a not found; desktop and manpage files will not be translated")
endif()
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})
set(PO4A_OUTPUTS)
foreach(LOCALE ${LINGUAS})
list(APPEND PO4A_OUTPUTS ${CMAKE_CURRENT_SOURCE_DIR}/lang/${LOCALE}/colobot.pod)
endforeach()
add_custom_command(
OUTPUT ${PO4A_OUTPUTS}
COMMAND ${PO4A} po4a.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(desktop_po4a DEPENDS ${PO4A_OUTPUTS})
add_dependencies(man desktop_po4a)
add_dependencies(desktopfile desktop_po4a)
foreach(LOCALE ${LINGUAS})
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
add_dependencies(man${PM_LOCALE} desktop_po4a)

View File

@ -1,4 +1,4 @@
Name="Colobot"
GenericName="Game to learn programming"
Comment="Colonize with bots"
Keywords="robots;3d;space;astronaut;java;c++"
Keywords="robots;3d;space;astronaut;java;c++;"

View File

@ -37,7 +37,7 @@ msgstr ""
#. type: Keywords=
#: colobot.ini:4
#, no-wrap
msgid "robots;3d;space;astronaut;java;c++"
msgid "robots;3d;space;astronaut;java;c++;"
msgstr ""
#. type: =head1

View File

@ -3,18 +3,20 @@
# This file is distributed under the same license as the Colobot package.
#
# Didier Raboud <odyx@debian.org>, 2012, 2016.
# B-CE <.>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: colobot 0.1.7\n"
"Project-Id-Version: colobot 0.1.12\n"
"POT-Creation-Date: 2016-03-30 13:45+0200\n"
"PO-Revision-Date: 2016-03-30 13:49+0100\n"
"Last-Translator: Didier Raboud <odyx@debian.org>\n"
"PO-Revision-Date: 2019-06-01 09:43+0200\n"
"Last-Translator: BCE <.>\n"
"Language-Team: French <kde-i18n-doc@kde.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Lokalize 2.0\n"
"X-Generator: Lokalize 18.12.3\n"
#. type: Name=
#: colobot.ini:1
@ -32,13 +34,13 @@ msgstr "Apprentissage de la programmation par le jeu"
#: colobot.ini:3
#, no-wrap
msgid "Colonize with bots"
msgstr "Colonise avec des roBots"
msgstr "COlonise avec des roBOTs"
#. type: Keywords=
#: colobot.ini:4
#, no-wrap
msgid "robots;3d;space;astronaut;java;c++"
msgstr "robots;3d;espace;astronaute;cosmonaute;java;c++"
msgid "robots;3d;space;astronaut;java;c++;"
msgstr "robots;3d;espace;astronaute;cosmonaute;java;c++;programmation;jeux"
#. type: =head1
#: colobot.pod:3
@ -74,12 +76,12 @@ msgid ""
"real-time graphics and a C++ and Java-like, object-oriented language, CBOT, "
"which can be used to program the robots available in the game."
msgstr ""
"Colobot (Colonise avec des roBots) est un jeu éducatif visant à "
"l'enseignement de la programmation par le jeu. Vous jouez un astronaute en "
"Colobot (Colonise avec des roBots) est un jeu éducatif visant "
"à l'enseignement de la programmation par le jeu. Vous jouez un astronaute en "
"voyage avec des robots à la recherche d'une planète à coloniser. Son "
"interface est en trois-dimensions et en temps réel; le language utilisé "
"(CBOT) ressemble au C++ et à Java et peut être utilisé pour programmer les "
"robots disponibles dans le jeu."
"interface est en trois-dimensions et en temps réel. Le langage utilisé "
"(CBOT), orienté objet , ressemble au C++ et à Java. Il peut être utilisé "
"pour programmer les robots disponibles dans le jeu."
#. type: =head1
#: colobot.pod:19
@ -208,9 +210,9 @@ msgid ""
"Enable debug mode (more info printed in logs). Possible values are as "
"follows, as well as any comma-separated combination"
msgstr ""
"Active le mode de I<debug> (plus d'informations dans les logs). Les valeurs"
" possibles sont les suivantes, ainsi que toute combinaison séparée par des"
" virgules"
"Active le mode de I<debug> (plus d'informations dans les logs). "
"Les valeurs possibles sont les suivantes, "
"ainsi que toute combinaison séparée par des virgules"
#. type: =item
#: colobot.pod:81
@ -260,7 +262,7 @@ msgstr "models"
#. type: textblock
#: colobot.pod:99
msgid "Models-related debugging"
msgstr "Debug pour les modèles"
msgstr "Débug pour les modèles"
#. type: =item
#: colobot.pod:101
@ -270,7 +272,7 @@ msgstr "all"
#. type: textblock
#: colobot.pod:103
msgid "All above debugging statements"
msgstr "Tout les messages de debug ci-dessus"
msgstr "Tous les messages de debug ci-dessus"
#. type: =item
#: colobot.pod:107
@ -280,9 +282,7 @@ msgstr "B<-headless>"
#. type: textblock
#: colobot.pod:109
msgid "Run in headless mode - disables graphics, sound and user interaction"
msgstr ""
"Lance en mode I<headless> - désactive les graphiques, sons et interactions"
" utilisateurs"
msgstr "Lance en mode I<headless> - désactive les graphiques, sons et interactions utilisateurs"
#. type: =item
#: colobot.pod:111
@ -292,7 +292,7 @@ msgstr "B<-runscene> I<scenecodename>"
#. type: textblock
#: colobot.pod:113
msgid "Run given scene on start (skip menus)"
msgstr "Lance une scène donnée au lancement (saute les menus)"
msgstr "Démarre directement une scène (saute les menus)"
#. type: =item
#: colobot.pod:115
@ -317,7 +317,7 @@ msgstr "LC_MESSAGES"
#. type: textblock
#: colobot.pod:127
msgid "Used to determine the runtime language."
msgstr "Utilisé pour déterminer la langue au lancement"
msgstr "Utilisé pour déterminer la langue au lancement."
#. type: =head1
#: colobot.pod:131

View File

@ -12,7 +12,7 @@ add_custom_command(OUTPUT ${_potFile}
COMMAND ${XGETTEXT_CMD} ${colobot_SOURCE_DIR}/src/app/app.cpp --output=${_potFile} --no-wrap
COMMAND ${XGETTEXT_CMD} ${colobot_SOURCE_DIR}/src/common/restext.cpp --output=${_potFile} --no-wrap --join-existing --no-location --keyword=TR
COMMAND ${XGETTEXT_CMD} ${colobot_SOURCE_DIR}/src/script/script.cpp --output=${_potFile} --no-wrap --join-existing --no-location
COMMAND sed -i -e "s|^\\(\"POT-Creation-Date:\\).*$|\\1 DATE\\\\n\"|" ${_potFile}
COMMAND sed -bi -e "s/^\\(\"POT-Creation-Date:\\).*$/\\1 DATE\\\\n\"/" ${_potFile}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Extract translatable messages to ${_potFile}"

View File

@ -84,6 +84,12 @@ msgstr ""
msgid "Load a saved mission"
msgstr ""
msgid "Missions+"
msgstr ""
msgid "Mods"
msgstr ""
msgid "Chapters:"
msgstr ""
@ -166,6 +172,23 @@ msgstr ""
msgid "This menu is for userlevels from mods, but you didn't install any"
msgstr ""
msgid "Could not open the file explorer!"
msgstr ""
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "Keyword help(\\key cbot;)"
msgstr ""
@ -206,6 +229,12 @@ msgstr ""
msgid "Public\\Common folder"
msgstr ""
msgid "Overwrite existing file?"
msgstr ""
msgid "Select Folder"
msgstr ""
msgid "Original game developed by:"
msgstr ""
@ -274,6 +303,42 @@ msgstr ""
msgid "%s: %d pts"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Information:"
msgstr ""
msgid "Description:"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Unknown author"
msgstr ""
msgid "by"
msgstr ""
msgid "Version"
msgstr ""
msgid "Website"
msgstr ""
msgid "Changes"
msgstr ""
msgid "No description."
msgstr ""
msgid "No changes."
msgstr ""
msgid "Code battle"
msgstr ""
@ -286,6 +351,9 @@ msgstr ""
msgid "Previous"
msgstr ""
msgid "New Folder"
msgstr ""
msgid "Exercises\\Programming exercises"
msgstr ""
@ -307,6 +375,9 @@ msgstr ""
msgid "SatCom"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Change player\\Change player"
msgstr ""
@ -331,9 +402,30 @@ msgstr ""
msgid "<< Back \\Back to the previous screen"
msgstr ""
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "Play\\Start mission!"
msgstr ""
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Device\\Driver and resolution settings"
msgstr ""
@ -406,6 +498,9 @@ msgstr ""
msgid "Pause in background\\Pause the game when the window is unfocused"
msgstr ""
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Automatic indent\\When program editing"
msgstr ""
@ -571,6 +666,15 @@ msgstr ""
msgid "Invert\\Invert values on this axis"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "\\New player name"
msgstr ""
@ -742,7 +846,7 @@ msgstr ""
msgid "Build a exchange post"
msgstr ""
msgid "Build a destroyer"
msgid "Build a vault"
msgstr ""
msgid "Show if the ground is flat"
@ -817,6 +921,18 @@ msgstr ""
msgid "Build a legged sniffer"
msgstr ""
msgid "Build a winged builder"
msgstr ""
msgid "Build a tracked builder"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a legged builder"
msgstr ""
msgid "Build a thumper"
msgstr ""
@ -832,6 +948,9 @@ msgstr ""
msgid "Build a subber"
msgstr ""
msgid "Build a target bot"
msgstr ""
msgid "Run research program for tracked bots"
msgstr ""
@ -862,6 +981,12 @@ msgstr ""
msgid "Run research program for orga shooter"
msgstr ""
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for target bot"
msgstr ""
msgid "Return to start"
msgstr ""
@ -877,6 +1002,9 @@ msgstr ""
msgid "Explode (\\key action;)"
msgstr ""
msgid "Build (\\key action;)"
msgstr ""
msgid "Recycle (\\key action;)"
msgstr ""
@ -1255,6 +1383,18 @@ msgstr ""
msgid "Legged grabber"
msgstr ""
msgid "Winged builder"
msgstr ""
msgid "Tracked builder"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Legged builder"
msgstr ""
msgid "Winged shooter"
msgstr ""
@ -1471,7 +1611,7 @@ msgstr ""
msgid "Nothing to analyze"
msgstr ""
msgid "Analyzes only organic matter"
msgid "Inappropriate sample"
msgstr ""
msgid "Analysis already performed"
@ -1570,6 +1710,9 @@ msgstr ""
msgid "Plans for nuclear power plant available"
msgstr ""
msgid "Plans for builder available"
msgstr ""
msgid "New bot available"
msgstr ""
@ -1795,6 +1938,12 @@ msgstr ""
msgid "Invalid universal character name"
msgstr ""
msgid "Empty character constant"
msgstr ""
msgid "Duplicate label in switch"
msgstr ""
msgid "Dividing by zero"
msgstr ""

164
po/cs.po
View File

@ -32,6 +32,9 @@ msgstr "Chybí \"]\""
msgid "%s: %d pts"
msgstr "%s: %d bodů"
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "..behind"
msgstr "...za sebou"
@ -110,9 +113,6 @@ msgstr "Analýza již byla dokončena"
msgid "Analysis performed"
msgstr "Analýza dokončena"
msgid "Analyzes only organic matter"
msgstr "Analyzuje pouze organickou hmotu"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Úroveň anizotropie\\Úroveň anizotropie"
@ -128,6 +128,9 @@ msgstr "Vzhled\\Upravte svůj vzhled"
msgid "Apply changes\\Activates the changed settings"
msgstr "Uložit změny\\Aktivovat změny nastavení"
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Appropriate constructor missing"
msgstr "Chybí vhodný konstruktor"
@ -185,6 +188,9 @@ msgstr "Robot zničen"
msgid "Bot factory"
msgstr "Továrna na roboty"
msgid "Build (\\key action;)"
msgstr ""
msgid "Build a bot factory"
msgstr "Postavit továrnu na roboty"
@ -197,12 +203,12 @@ msgstr "Postavit obrannou věž"
msgid "Build a derrick"
msgstr "Postavit vrtnou věž"
msgid "Build a destroyer"
msgstr "Postavit drtič"
msgid "Build a exchange post"
msgstr "Postavit komunikační stanici"
msgid "Build a legged builder"
msgstr ""
msgid "Build a legged grabber"
msgstr "Vyrobit chodící rameno"
@ -248,9 +254,15 @@ msgstr "Vyrobit mobilní štít"
msgid "Build a subber"
msgstr "Vyrobit ponorku"
msgid "Build a target bot"
msgstr ""
msgid "Build a thumper"
msgstr "Vyrobit buchar"
msgid "Build a tracked builder"
msgstr ""
msgid "Build a tracked grabber"
msgstr "Vyrobit pásové rameno"
@ -263,6 +275,12 @@ msgstr "Vyrobit pásový kanón"
msgid "Build a tracked sniffer"
msgstr "Vyrobit pásový detektor"
msgid "Build a vault"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a wheeled grabber"
msgstr "Vyrobit pojízdné rameno"
@ -275,6 +293,9 @@ msgstr "Vyrobit pojízdný kanón"
msgid "Build a wheeled sniffer"
msgstr "Vyrobit pojízdný detektor"
msgid "Build a winged builder"
msgstr ""
msgid "Build a winged grabber"
msgstr "Vyrobit létající rameno"
@ -356,6 +377,9 @@ msgstr "Změnit kameru\\Přepíná mezi kamerou na robotu a za robotem"
msgid "Change player\\Change player"
msgstr "Změnit hráče\\Změnit hráče"
msgid "Changes"
msgstr ""
msgid "Chapters:"
msgstr "Kapitoly:"
@ -425,6 +449,12 @@ msgstr "Kopírovat"
msgid "Copy (Ctrl+C)"
msgstr "Kopírovat (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
msgid "Current mission saved"
msgstr "Současná mise uložena"
@ -458,6 +488,9 @@ msgstr "Vrtná věž"
msgid "Descend\\Reduces the power of the jet"
msgstr "Klesat\\Snížit tah tryskového motoru"
msgid "Description:"
msgstr ""
msgid "Destroy"
msgstr "Zbourat"
@ -470,6 +503,9 @@ msgstr "Drtič"
msgid "Device\\Driver and resolution settings"
msgstr "Obrazovka\\Nastavení grafické karty a rozlišení"
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Dividing by zero"
msgstr "Dělení nulou"
@ -486,9 +522,15 @@ msgstr "Dveře blokuje robot nebo jiný objekt"
msgid "Down (\\key gdown;)"
msgstr "Dolů (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Drawer bot"
msgstr "Tužkobot"
msgid "Duplicate label in switch"
msgstr ""
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Prach\\Prach a špína na robotech a budovách"
@ -507,6 +549,12 @@ msgstr "Upravit vybraný program"
msgid "Egg"
msgstr "Vejce"
msgid "Empty character constant"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "End of block missing"
msgstr "Chybí konec bloku"
@ -721,6 +769,9 @@ msgstr "Nevhodný typ baterie"
msgid "Inappropriate object"
msgstr "Nevhodný objekt"
msgid "Inappropriate sample"
msgstr ""
msgid "Incorrect index type"
msgstr "Špatný datový typ indexu"
@ -730,6 +781,9 @@ msgstr "Infikováno virem; dočasně mimo provoz"
msgid "Information exchange post"
msgstr "Komunikační stanice"
msgid "Information:"
msgstr ""
msgid "Instruction \"break\" outside a loop"
msgstr "Příkaz \"break\" mimo cyklus"
@ -790,6 +844,9 @@ msgstr "Nápověda ke klíčovému slovu (\\key cbot;)"
msgid "LOADING"
msgstr "NAČÍTÁNÍ"
msgid "Legged builder"
msgstr ""
msgid "Legged grabber"
msgstr "Chodící rameno"
@ -874,9 +931,21 @@ msgstr "Mise"
msgid "Missions on this planet:"
msgstr "Mise na této planetě:"
msgid "Missions+"
msgstr "Mise+"
msgid "Missions\\Select mission"
msgstr "Mise\\Vyberte misi"
msgid "Mods"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Vodorovné převrácení posunu\\Při vodorovném posunu kamery myší pousouvat opačným směrem"
@ -889,6 +958,9 @@ msgstr "Posunout vybraný program níže"
msgid "Move selected program up"
msgstr "Posunout vybraný program výše"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Mute\\No sound"
msgstr "Ticho\\Bez zvuku"
@ -907,6 +979,9 @@ msgstr "Nový"
msgid "New ..."
msgstr "Nový..."
msgid "New Folder"
msgstr ""
msgid "New bot available"
msgstr "Robot vyroben"
@ -919,6 +994,12 @@ msgstr "Další objekt\\Vybere následující objekt"
msgid "No"
msgstr "Ne"
msgid "No changes."
msgstr ""
msgid "No description."
msgstr ""
msgid "No energy in the subsoil"
msgstr "Pod povrchem není zdroj energie"
@ -1039,6 +1120,9 @@ msgstr "Otevřít"
msgid "Open (Ctrl+O)"
msgstr "Otevřít (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Opening brace missing"
msgstr "Chybí levá složená závorka"
@ -1063,6 +1147,9 @@ msgstr "Zdroj poslední zprávy\\Zobrazí objekt, který poslal poslední zpráv
msgid "Original game developed by:"
msgstr "Vývojáři původní hry:"
msgid "Overwrite existing file?"
msgstr ""
msgid "Parameters missing"
msgstr "Některé parametry nejsou vyplněné"
@ -1096,6 +1183,9 @@ msgstr "Místo je obsazeno"
msgid "Planets:"
msgstr "Planety:"
msgid "Plans for builder available"
msgstr ""
msgid "Plans for defense tower available"
msgstr "Plány pro obrannou věž jsou k dispozici"
@ -1243,6 +1333,9 @@ msgstr "Červená vlajka"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Odlesky na tlačítkách\\Blyštivá tlačítka"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Remains of Apollo mission"
msgstr "Pozůstatky mise Apollo"
@ -1300,6 +1393,9 @@ msgstr "Robbie"
msgid "Ruin"
msgstr "Trosky"
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for defense tower"
msgstr "Spustit výzkum obranných věží"
@ -1321,6 +1417,9 @@ msgstr "Spustit výzkum mobilního štítu"
msgid "Run research program for shooter"
msgstr "Spustit výzkum kanónů"
msgid "Run research program for target bot"
msgstr ""
msgid "Run research program for thumper"
msgstr "Spustit výzkum bucharu"
@ -1351,6 +1450,9 @@ msgstr "Uložit\\Uložit současnou misi"
msgid "Save\\Saves the current mission"
msgstr "Uložit\\Uloží současnou misi"
msgid "Select Folder"
msgstr ""
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Vybrat kosmonauta\\Vybere kosmonauta"
@ -1417,6 +1519,15 @@ msgstr "Zvukové efekty:\\Hlasitost motorů, hlasů, střelby, atd."
msgid "Sound\\Music and game sound volume"
msgstr "Zvuk\\Hlasitost hudby a zvukových efektů"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Spaceship"
msgstr "Raketa"
@ -1495,6 +1606,10 @@ msgstr "Filtrování textur\\Filtrování textur"
msgid "Textures"
msgstr "Textury"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "The battle has ended"
msgstr "Souboj skončil"
@ -1507,9 +1622,16 @@ msgstr "Funkce nevrátila žádnou hodnotu"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "Mise ještě nebyla splněna (pro podrobnosti stiskněte \\key help;)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "The types of the two operands are incompatible"
msgstr "Operaci nelze provést s operandy těchto dvou typů"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "This class already exists"
msgstr "Tato třída již existuje"
@ -1583,6 +1705,9 @@ msgstr "Příliš mnoho vlajek této barvy (maximálně 5)"
msgid "Too many parameters"
msgstr "Příliš mnoho parametrů"
msgid "Tracked builder"
msgstr ""
msgid "Tracked grabber"
msgstr "Pásové rameno"
@ -1631,6 +1756,9 @@ msgstr "Jednotka"
msgid "Unknown Object"
msgstr "Neznámý objekt"
msgid "Unknown author"
msgstr ""
msgid "Unknown command"
msgstr "Neznámý příkaz"
@ -1643,6 +1771,9 @@ msgstr "Neznámá funkce"
msgid "Up (\\key gup;)"
msgstr "Vzhůru (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Uranium deposit (site for derrick)"
msgstr "Uranové ložisko (místo pro vrtnou věž)"
@ -1664,6 +1795,9 @@ msgstr "Proměnná nebyla nastavena"
msgid "Vault"
msgstr "Trezor"
msgid "Version"
msgstr ""
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr ""
@ -1682,6 +1816,12 @@ msgstr "Vosa byla smrtelně raněna"
msgid "Waste"
msgstr "Odpad"
msgid "Website"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Wheeled grabber"
msgstr "Pojízdné rameno"
@ -1694,6 +1834,9 @@ msgstr "Pojízdný kanón"
msgid "Wheeled sniffer"
msgstr "Pojízdný detektor"
msgid "Winged builder"
msgstr ""
msgid "Winged grabber"
msgstr "Létající rameno"
@ -1709,6 +1852,9 @@ msgstr "Létající detektor"
msgid "Withdraw shield (\\key action;)"
msgstr "Vypnout štít (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Worm"
msgstr "Červ"
@ -1859,8 +2005,14 @@ msgstr "\\Fialové vlajky"
msgid "\\Yellow flags"
msgstr "\\Žluté vlajky"
msgid "by"
msgstr ""
msgid "colobot.info"
msgstr "colobot.info"
msgid "epsitec.com"
msgstr "epsitec.com"
#~ msgid "Build a destroyer"
#~ msgstr "Postavit drtič"

164
po/de.po
View File

@ -33,6 +33,9 @@ msgstr "Es fehlt eine geschlossene eckige Klammer \" ] \""
msgid "%s: %d pts"
msgstr ""
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "..behind"
msgstr "..hinten"
@ -111,9 +114,6 @@ msgstr "Analyse schon durchgeführt"
msgid "Analysis performed"
msgstr "Analyse vollendet"
msgid "Analyzes only organic matter"
msgstr "Analysiert nur Orgastoff"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Anisotropie-Level\\Anisotropie-Level"
@ -129,6 +129,9 @@ msgstr "Aussehen\\Erscheinungsbild des Astronauten einstellen"
msgid "Apply changes\\Activates the changed settings"
msgstr "Änderungen anwenden\\Getätigte Einstellungen anwenden"
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Appropriate constructor missing"
msgstr "Es gibt keinen geeigneten Konstruktor"
@ -186,6 +189,9 @@ msgstr "Roboter zerstört"
msgid "Bot factory"
msgstr "Roboterfabrik"
msgid "Build (\\key action;)"
msgstr ""
msgid "Build a bot factory"
msgstr "Baut eine Roboterfabrik"
@ -198,12 +204,12 @@ msgstr "Baut einen Geschützturm"
msgid "Build a derrick"
msgstr "Baut einen Bohrturm"
msgid "Build a destroyer"
msgstr "Baue einen Zerstörer"
msgid "Build a exchange post"
msgstr "Baut einen Infoserver"
msgid "Build a legged builder"
msgstr ""
msgid "Build a legged grabber"
msgstr "Baut einen Krabbeltransporter"
@ -249,9 +255,15 @@ msgstr "Baut einen Schutzschild"
msgid "Build a subber"
msgstr "Baut einen Kettentaucher"
msgid "Build a target bot"
msgstr ""
msgid "Build a thumper"
msgstr "Baut einen Stampfer"
msgid "Build a tracked builder"
msgstr ""
msgid "Build a tracked grabber"
msgstr "Baut einen Kettentransporter"
@ -264,6 +276,12 @@ msgstr "Baut einen Kettenshooter"
msgid "Build a tracked sniffer"
msgstr "Baut einen Kettenschnüffler"
msgid "Build a vault"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a wheeled grabber"
msgstr "Baut einen Radtransporter"
@ -276,6 +294,9 @@ msgstr "Baut einen Radshooter"
msgid "Build a wheeled sniffer"
msgstr "Baut einen Radschnüffler"
msgid "Build a winged builder"
msgstr ""
msgid "Build a winged grabber"
msgstr "Baut einen Jettransporter"
@ -357,6 +378,9 @@ msgstr "Andere Kamera\\Sichtpunkt einstellen"
msgid "Change player\\Change player"
msgstr "Anderer Spieler\\Spielername ändern"
msgid "Changes"
msgstr ""
msgid "Chapters:"
msgstr "Liste der Kapitel:"
@ -426,6 +450,12 @@ msgstr "Kopieren"
msgid "Copy (Ctrl+C)"
msgstr "Kopieren (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
msgid "Current mission saved"
msgstr "Mission gespeichert"
@ -459,6 +489,9 @@ msgstr "Bohrturm"
msgid "Descend\\Reduces the power of the jet"
msgstr "Sinken\\Leistung des Triebwerks drosseln"
msgid "Description:"
msgstr ""
msgid "Destroy"
msgstr "Zerstören"
@ -471,6 +504,9 @@ msgstr "Einstampfer"
msgid "Device\\Driver and resolution settings"
msgstr "Bildschirm\\Driver und Bildschirmauflösung"
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Dividing by zero"
msgstr "Division durch Null"
@ -487,9 +523,15 @@ msgstr "Die Türen werden von einem Gegenstand blockiert"
msgid "Down (\\key gdown;)"
msgstr "Sinkt (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Drawer bot"
msgstr "Zeichner"
msgid "Duplicate label in switch"
msgstr ""
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Schmutz\\Schmutz auf Robotern und Bauten"
@ -508,6 +550,12 @@ msgstr "Gewähltes Programm bearbeiten"
msgid "Egg"
msgstr "Ei"
msgid "Empty character constant"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "End of block missing"
msgstr "Es fehlt eine geschlossene geschweifte Klammer \"}\" (Ende des Blocks)"
@ -723,6 +771,9 @@ msgstr "Falscher Batterietyp"
msgid "Inappropriate object"
msgstr "Objekt ungeeignet"
msgid "Inappropriate sample"
msgstr ""
msgid "Incorrect index type"
msgstr "Falscher Typ für einen Index"
@ -732,6 +783,9 @@ msgstr "Von Virus infiziert, zeitweise außer Betrieb"
msgid "Information exchange post"
msgstr "Infoserver"
msgid "Information:"
msgstr ""
msgid "Instruction \"break\" outside a loop"
msgstr "Anweisung \"break\" außerhalb einer Schleife"
@ -792,6 +846,9 @@ msgstr "Hilfe über den Begriff (\\key cbot;)"
msgid "LOADING"
msgstr "LADEN"
msgid "Legged builder"
msgstr ""
msgid "Legged grabber"
msgstr "Transporter"
@ -890,9 +947,21 @@ msgstr "Missionen"
msgid "Missions on this planet:"
msgstr "Liste der Missionen des Planeten:"
msgid "Missions+"
msgstr "Missionen+"
msgid "Missions\\Select mission"
msgstr "Missionen\\Aufbruch ins Weltall"
msgid "Mods"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Umkehr X\\Umkehr der Kameradrehung X-Achse"
@ -905,6 +974,9 @@ msgstr "Gewähltes Programm nach unten"
msgid "Move selected program up"
msgstr "Gewähltes Programm nach oben"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Mute\\No sound"
msgstr "Kein Ton\\Keine Geräusche und Geräuschkulisse"
@ -923,6 +995,9 @@ msgstr "Neu"
msgid "New ..."
msgstr "Neu ..."
msgid "New Folder"
msgstr ""
msgid "New bot available"
msgstr "Neuer Roboter verfügbar"
@ -935,6 +1010,12 @@ msgstr "Nächstes auswählen\\Nächstes Objekt auswählen"
msgid "No"
msgstr "Nein"
msgid "No changes."
msgstr ""
msgid "No description."
msgstr ""
msgid "No energy in the subsoil"
msgstr "Kein unterirdisches Energievorkommen"
@ -1055,6 +1136,9 @@ msgstr "Öffnen"
msgid "Open (Ctrl+O)"
msgstr "Öffnen (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Opening brace missing"
msgstr "Es fehlt eine offene geschweifte Klammer\"{\""
@ -1079,6 +1163,9 @@ msgstr "Ort der Meldung\\Zeigt den Ort, von dem die letzte Meldung stammt"
msgid "Original game developed by:"
msgstr "Ursprünglichen Spiel entwickelt von:"
msgid "Overwrite existing file?"
msgstr ""
msgid "Parameters missing"
msgstr "Nicht genug Parameter"
@ -1112,6 +1199,9 @@ msgstr "Stelle schon besetzt"
msgid "Planets:"
msgstr "Liste der Planeten:"
msgid "Plans for builder available"
msgstr ""
msgid "Plans for defense tower available"
msgstr "Errichtung eines Geschützturms möglich"
@ -1260,6 +1350,9 @@ msgstr "Rote Fahne"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Glänzende Tasten\\Glänzende Tasten in den Menüs"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Remains of Apollo mission"
msgstr "Überreste einer Apollo-Mission"
@ -1317,6 +1410,9 @@ msgstr "Robby"
msgid "Ruin"
msgstr "Gebäuderuine"
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for defense tower"
msgstr "Forschungsprogramm Geschützturm"
@ -1338,6 +1434,9 @@ msgstr "Forschungsprogramm Schutzschild"
msgid "Run research program for shooter"
msgstr "Forschungsprogramm Shooterkanone"
msgid "Run research program for target bot"
msgstr ""
msgid "Run research program for thumper"
msgstr "Forschungsprogramm Stampfer"
@ -1368,6 +1467,9 @@ msgstr "Speichern\\Aktuelle Mission speichern"
msgid "Save\\Saves the current mission"
msgstr "Speichern\\Speichert die Mission"
msgid "Select Folder"
msgstr ""
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Astronauten auswählen\\Astronauten auswählen"
@ -1434,6 +1536,15 @@ msgstr "Geräusche:\\Lautstärke Motoren, Stimmen, usw."
msgid "Sound\\Music and game sound volume"
msgstr "Geräusche\\Lautstärke Geräusche und Musik"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Spaceship"
msgstr "Raumschiff"
@ -1512,6 +1623,10 @@ msgstr "Texturfilterung\\Texturfilterung"
msgid "Textures"
msgstr "Texturen"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "The battle has ended"
msgstr ""
@ -1524,9 +1639,16 @@ msgstr "Die Funktion hat kein Ergebnis zurückgegeben"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "Mission noch nicht beendet (Drücken Sie auf \\key help; für weitere Informationen)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "The types of the two operands are incompatible"
msgstr "Die zwei Operanden sind nicht kompatibel"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "This class already exists"
msgstr "Diese Klasse gibt es schon"
@ -1600,6 +1722,9 @@ msgstr "Zu viele Fahnen dieser Farbe (Maximum 5)"
msgid "Too many parameters"
msgstr "Zu viele Parameter"
msgid "Tracked builder"
msgstr ""
msgid "Tracked grabber"
msgstr "Transporter"
@ -1648,6 +1773,9 @@ msgstr "Einheit"
msgid "Unknown Object"
msgstr "Das Objekt existiert nicht"
msgid "Unknown author"
msgstr ""
msgid "Unknown command"
msgstr "Befehl unbekannt"
@ -1660,6 +1788,9 @@ msgstr "Unbekannte Funktion"
msgid "Up (\\key gup;)"
msgstr "Steigt (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Uranium deposit (site for derrick)"
msgstr "Markierung für unterirdisches Platinvorkommen"
@ -1681,6 +1812,9 @@ msgstr "Der Wert dieser Variable wurde nicht definiert"
msgid "Vault"
msgstr "Bunker"
msgid "Version"
msgstr ""
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr ""
@ -1699,6 +1833,12 @@ msgstr "Wespe tödlich verwundet"
msgid "Waste"
msgstr "Abfall"
msgid "Website"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Wheeled grabber"
msgstr "Transporter"
@ -1711,6 +1851,9 @@ msgstr "Shooter"
msgid "Wheeled sniffer"
msgstr "Schnüffler"
msgid "Winged builder"
msgstr ""
msgid "Winged grabber"
msgstr "Transporter"
@ -1726,6 +1869,9 @@ msgstr "Schnüffler"
msgid "Withdraw shield (\\key action;)"
msgstr "Schutzschild einholen (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Worm"
msgstr "Wurm"
@ -1874,6 +2020,9 @@ msgstr "\\Violette Fahne"
msgid "\\Yellow flags"
msgstr "\\Gelbe Fahne"
msgid "by"
msgstr ""
msgid "colobot.info"
msgstr "colobot.info"
@ -1895,6 +2044,9 @@ msgstr "epsitec.com"
#~ msgid "3D sound\\3D positioning of the sound"
#~ msgstr "3D-Geräusche\\Orten der Geräusche im Raum"
#~ msgid "Build a destroyer"
#~ msgstr "Baue einen Zerstörer"
#~ msgid "Building too close"
#~ msgstr "Gebäude zu nahe"

299
po/fr.po
View File

@ -1,21 +1,21 @@
# Didier Raboud <odyx@debian.org>, 2012, 2015, 2016.
# Martin Quinson <mquinson@debian.org>, 2016
# B-CE, 2018
# Pascal Audoux <pascal.audoux@gmail.com>, 2018
# Martin Quinson <mquinson@debian.org>, 2016.
# B-CE <.>, 2018, 2019.
# Pascal Audoux <pascal.audoux@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Colobot 0.1.11\n"
"Project-Id-Version: Colobot 0.1.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: DATE\n"
"PO-Revision-Date: 2019-01-09 23:07+0100\n"
"Last-Translator: B-CE\n"
"Language-Team: \n"
"PO-Revision-Date: 2019-06-13 01:31+0200\n"
"Last-Translator: BCE <.>\n"
"Language-Team: French <>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 2.0.6\n"
"X-Generator: Lokalize 18.12.3\n"
"X-Language: fr_FR\n"
"X-Source-Language: en_US\n"
@ -32,6 +32,9 @@ msgstr "\" ] \" manquant"
msgid "%s: %d pts"
msgstr "%s: %d points"
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "..behind"
msgstr "..derrière"
@ -39,7 +42,7 @@ msgid "..in front"
msgstr "..devant"
msgid "..power cell"
msgstr "..pile"
msgstr "..batterie"
msgid "1) First click on the key you want to redefine."
msgstr "1) Cliquez d'abord sur la touche à redéfinir."
@ -110,9 +113,6 @@ msgstr "Analyse déjà effectuée"
msgid "Analysis performed"
msgstr "Analyse terminée"
msgid "Analyzes only organic matter"
msgstr "N'analyse que la matière organique"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Niveau d'anisotropie\\Niveau d'anisotropie"
@ -128,6 +128,9 @@ msgstr "Aspect\\Choisir votre aspect"
msgid "Apply changes\\Activates the changed settings"
msgstr "Appliquer les changements\\Active les changements effectués"
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Appropriate constructor missing"
msgstr "Constructeur approprié manquant"
@ -141,10 +144,10 @@ msgid "Automatic indent\\When program editing"
msgstr "Indentation automatique\\Pendant l'édition d'un programme"
msgid "Autosave interval\\How often your game will autosave"
msgstr "Interval d'auto-sauvegarde\\À quels intervals les parties vont-t-elles êtres sauvegardées automatiquement"
msgstr "Interval auto-sauvegarde\\À quels intervals les parties vont-t-elles êtres sauvegardées automatiquement"
msgid "Autosave slots\\How many autosave slots you'll have"
msgstr "Nombre d'auto-sauvegardes\\Combien d'auto-sauvegarde seront conservées"
msgstr "Nb auto-sauvegardes\\Combien d'auto-sauvegarde seront conservées"
msgid "Autosave\\Enables autosave"
msgstr "Auto-sauvegarde\\Activer l'auto-sauvegarde"
@ -186,13 +189,16 @@ msgid "Bot destroyed"
msgstr "Robot détruit"
msgid "Bot factory"
msgstr "Fabrique de robots"
msgstr "Usine de robots"
msgid "Build (\\key action;)"
msgstr ""
msgid "Build a bot factory"
msgstr "Construire une fabrique de robots"
msgstr "Construire une usine de robots"
msgid "Build a converter"
msgstr "Construire un convertisseur"
msgstr "Construire une raffinerie"
msgid "Build a defense tower"
msgstr "Construire une tour"
@ -200,14 +206,14 @@ msgstr "Construire une tour"
msgid "Build a derrick"
msgstr "Construire un derrick"
msgid "Build a destroyer"
msgstr "Construire un destructeur"
msgid "Build a exchange post"
msgstr "Construire une borne d'information"
msgstr "Construire une station relais"
msgid "Build a legged builder"
msgstr ""
msgid "Build a legged grabber"
msgstr "Fabriquer un déménageur à pattes"
msgstr "Fabriquer un préhenseur à pattes"
msgid "Build a legged orga shooter"
msgstr "Fabriquer un tireur organique à pattes"
@ -225,10 +231,10 @@ msgid "Build a nuclear power plant"
msgstr "Construire une centrale nucléaire"
msgid "Build a phazer shooter"
msgstr "Fabriquer un robot canon à phases"
msgstr "Fabriquer un robot canon hachoir"
msgid "Build a power cell factory"
msgstr "Construire une fabrique de piles"
msgstr "Construire une fabrique de batteries"
msgid "Build a power station"
msgstr "Construire une station de recharge"
@ -251,11 +257,17 @@ msgstr "Fabriquer un robot bouclier"
msgid "Build a subber"
msgstr "Fabriquer un robot sous-marin"
msgid "Build a target bot"
msgstr ""
msgid "Build a thumper"
msgstr "Fabriquer un robot secoueur"
msgid "Build a tracked builder"
msgstr ""
msgid "Build a tracked grabber"
msgstr "Fabriquer un déménageur à chenilles"
msgstr "Fabriquer un préhenseur à chenilles"
msgid "Build a tracked orga shooter"
msgstr "Fabriquer un tireur organique à chenilles"
@ -266,8 +278,14 @@ msgstr "Fabriquer un tireur à chenilles"
msgid "Build a tracked sniffer"
msgstr "Fabriquer un renifleur à chenilles"
msgid "Build a vault"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a wheeled grabber"
msgstr "Fabriquer un déménageur à roues"
msgstr "Fabriquer un préhenseur à roues"
msgid "Build a wheeled orga shooter"
msgstr "Fabriquer un tireur organique à roues"
@ -278,8 +296,11 @@ msgstr "Fabriquer un tireur à roues"
msgid "Build a wheeled sniffer"
msgstr "Fabriquer un renifleur à roues"
msgid "Build a winged builder"
msgstr ""
msgid "Build a winged grabber"
msgstr "Fabriquer un déménageur volant"
msgstr "Fabriquer un préhenseur volant"
msgid "Build a winged orga shooter"
msgstr "Fabriquer un tireur organique volant"
@ -315,19 +336,19 @@ msgid "Camera border scrolling\\Scrolling when the mouse touches right or left b
msgstr "Défilement dans les bords\\Défilement lorsque la souris touche les bords gauche ou droite"
msgid "Camera closer\\Moves the camera forward"
msgstr "Caméra plus proche\\Avance la caméra"
msgstr "Plus proche\\Avance la caméra"
msgid "Camera down\\Turns the camera down"
msgstr "Baisser caméra\\Baisse la caméra"
msgstr "Plus bas\\Tourne la caméra vers le bas"
msgid "Camera left\\Turns the camera left"
msgstr "Caméra à gauche\\Tourne la caméra vers la gauche"
msgstr "À gauche\\Tourne la caméra vers la gauche"
msgid "Camera right\\Turns the camera right"
msgstr "Caméra à droite\\Tourne la caméra vers la droite"
msgstr "À droite\\Tourne la caméra vers la droite"
msgid "Camera up\\Turns the camera up"
msgstr "Lever caméra\\Monte la caméra"
msgstr "Plus haut\\Tourne la caméra vers le haut"
msgid "Can not produce not researched object"
msgstr "Impossible de créer un objet n'ayant pas été recherché"
@ -359,6 +380,9 @@ msgstr "Changement de caméra\\Autre de point de vue"
msgid "Change player\\Change player"
msgstr "Autre joueur\\Choix du nom du joueur"
msgid "Changes"
msgstr ""
msgid "Chapters:"
msgstr "Liste des chapitres :"
@ -366,7 +390,7 @@ msgid "Cheat console\\Show cheat console"
msgstr "Console de triche\\Montre la console de triche"
msgid "Checkpoint"
msgstr "Indicateur"
msgstr "Point de passage"
msgid "Class name expected"
msgstr "Nom de classe attendu"
@ -420,7 +444,7 @@ msgid "Controls\\Keyboard, joystick and mouse settings"
msgstr "Commandes\\Touches du clavier"
msgid "Converts ore to titanium"
msgstr "Conversion de minerai en titane"
msgstr "Raffinage de minerai en titane"
msgid "Copy"
msgstr "Copier"
@ -428,6 +452,12 @@ msgstr "Copier"
msgid "Copy (Ctrl+C)"
msgstr "Copier (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
msgid "Current mission saved"
msgstr "Enregistrement effectué"
@ -461,6 +491,9 @@ msgstr "Derrick"
msgid "Descend\\Reduces the power of the jet"
msgstr "Descendre\\Diminuer la puissance du réacteur"
msgid "Description:"
msgstr ""
msgid "Destroy"
msgstr "Détruire"
@ -473,6 +506,9 @@ msgstr "Destructeur"
msgid "Device\\Driver and resolution settings"
msgstr "Affichage\\Pilote et résolution d'affichage"
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Dividing by zero"
msgstr "Division par zéro"
@ -489,9 +525,15 @@ msgstr "Portes bloquées par un robot ou un objet"
msgid "Down (\\key gdown;)"
msgstr "Descend (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Drawer bot"
msgstr "Robot dessinateur"
msgid "Duplicate label in switch"
msgstr ""
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Salissures\\Salissures des robots et bâtiments"
@ -510,11 +552,17 @@ msgstr "Éditer le programme sélectionné"
msgid "Egg"
msgstr "Oeuf"
msgid "Empty character constant"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "End of block missing"
msgstr "Il manque la fin du bloc"
msgid "Energy deposit (site for power station)"
msgstr "Emplacement pour une station de recharge ou une fabrique de pile"
msgstr "Sous sol énergétique (Emplacement pour une station de recharge ou une fabrique de batteries)"
msgid "Energy level"
msgstr "Niveau d'énergie"
@ -569,7 +617,7 @@ msgstr "But/Objectif"
# OBJECT_END : GoalArea
msgid "Fixed mine"
msgstr "Mine fixe"
msgstr "Mine anti-personnel"
msgid "Flat ground not large enough"
msgstr "Sol plat pas assez grand"
@ -600,7 +648,7 @@ msgid "Found a site for a derrick"
msgstr "Emplacement pour un derrick trouvé"
msgid "Found a site for power station"
msgstr "Emplacement pour station de recharge ou fabrique de pile trouvé"
msgstr "Emplacement pour station de recharge ou fabrique de batteries trouvé"
msgid "Found key A (site for derrick)"
msgstr "Emplacement pour un derrick (clé A)"
@ -720,11 +768,14 @@ msgid "Inappropriate bot"
msgstr "Robot inadapté"
msgid "Inappropriate cell type"
msgstr "Pas le bon type de pile"
msgstr "Source d'énergie non adapté"
msgid "Inappropriate object"
msgstr "Pas le bon objet"
msgid "Inappropriate sample"
msgstr ""
msgid "Incorrect index type"
msgstr "Mauvais type d'index"
@ -732,7 +783,10 @@ msgid "Infected by a virus; temporarily out of order"
msgstr "Infecté par un virus; ne fonctionne plus temporairement"
msgid "Information exchange post"
msgstr "Borne d'information"
msgstr "Station relais"
msgid "Information:"
msgstr ""
msgid "Instruction \"break\" outside a loop"
msgstr "Instruction \"break\" en dehors d'une boucle"
@ -794,8 +848,11 @@ msgstr "Aide sur le mot-clé (\\key cbot;)"
msgid "LOADING"
msgstr "CHARGEMENT"
msgid "Legged builder"
msgstr ""
msgid "Legged grabber"
msgstr "Robot déménageur à pattes"
msgstr "Robot préhenseur à pattes"
msgid "Legged orga shooter"
msgstr "Robot tireur organique à pattes"
@ -866,7 +923,7 @@ msgid "Lunar Roving Vehicle"
msgstr "Véhicule d'exploration lunaire"
msgid "MSAA\\Multisample anti-aliasing"
msgstr "ACME\\Anticrénelage multiéchantillon"
msgstr "ACME\\Anticrénelage multiéchantillon (MSAA: Multisample anti-aliasing)"
msgid "Maximize"
msgstr "Taille maximale"
@ -892,9 +949,21 @@ msgstr "Missions"
msgid "Missions on this planet:"
msgstr "Liste des missions du chapitre :"
msgid "Missions+"
msgstr "Missions+"
msgid "Missions\\Select mission"
msgstr "Missions\\La grande aventure"
msgid "Mods"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Inversion souris X\\Inversion de la rotation lorsque la souris touche un bord"
@ -907,6 +976,9 @@ msgstr "Déplace le programme sélectionné vers le bas"
msgid "Move selected program up"
msgstr "Déplace le programme sélectionné vers le haut"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Mute\\No sound"
msgstr "Silencieux\\Totalement silencieux"
@ -925,6 +997,9 @@ msgstr "Nouveau"
msgid "New ..."
msgstr "Nouveau ..."
msgid "New Folder"
msgstr ""
msgid "New bot available"
msgstr "Nouveau robot disponible"
@ -937,6 +1012,12 @@ msgstr "Sélectionner l'objet suivant\\Sélectionner l'objet suivant"
msgid "No"
msgstr "Non"
msgid "No changes."
msgstr ""
msgid "No description."
msgstr ""
msgid "No energy in the subsoil"
msgstr "Pas d'énergie en sous-sol"
@ -953,7 +1034,7 @@ msgid "No function with this name accepts this number of parameters"
msgstr "Aucune fonction de ce nom n'accepte ce nombre de paramètres"
msgid "No information exchange post within range"
msgstr "Pas de borne d'information accessible"
msgstr "Pas de station relais accessible"
msgid "No more energy"
msgstr "Plus d'énergie"
@ -962,7 +1043,7 @@ msgid "No ore in the subsoil"
msgstr "Pas de minerai en sous-sol"
msgid "No power cell"
msgstr "Pas de pile"
msgstr "Pas de source d'énergie"
msgid "No titanium"
msgstr "Pas de titane"
@ -971,7 +1052,7 @@ msgid "No titanium around"
msgstr "Pas de titane accessible"
msgid "No titanium ore to convert"
msgstr "Pas de minerai de titane à convertir"
msgstr "Pas de minerai de titane à raffiner"
msgid "No titanium to transform"
msgstr "Pas de titane à transformer"
@ -1016,10 +1097,10 @@ msgid "Nothing to recycle"
msgstr "Rien à recycler"
msgid "Nuclear power cell"
msgstr "Pile nucléaire"
msgstr "Pile atomique"
msgid "Nuclear power cell available"
msgstr "Pile nucléaire disponible"
msgstr "Pile atomique disponible"
msgid "Nuclear power station"
msgstr "Centrale nucléaire"
@ -1040,7 +1121,7 @@ msgid "OK\\Choose the selected player"
msgstr "D'accord\\Choisir le joueur"
msgid "OK\\Close program editor and return to game"
msgstr "D'accord\\Compiler le programme"
msgstr "D'accord\\Compiler le programme et fermer la fenêtre d'édition"
msgid "Object too close"
msgstr "Objet trop proche"
@ -1057,6 +1138,9 @@ msgstr "Ouvrir"
msgid "Open (Ctrl+O)"
msgstr "Ouvrir (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Opening brace missing"
msgstr "Début d'un bloc attendu"
@ -1081,6 +1165,9 @@ msgstr "Montrer le lieu d'un message\\Montrer le lieu du dernier message"
msgid "Original game developed by:"
msgstr "Jeu original développé par :"
msgid "Overwrite existing file?"
msgstr ""
msgid "Parameters missing"
msgstr "Pas assez de paramètres"
@ -1103,7 +1190,7 @@ msgid "Pause\\Pause the game without opening menu"
msgstr "Pause\\Mettre le jeu en pause sans ouvrir le menu"
msgid "Phazer shooter"
msgstr "Robot canon à phases"
msgstr "Robot canon hachoir"
msgid "Photography"
msgstr "Vue de la mission"
@ -1114,6 +1201,9 @@ msgstr "Emplacement occupé"
msgid "Planets:"
msgstr "Liste des planètes :"
msgid "Plans for builder available"
msgstr ""
msgid "Plans for defense tower available"
msgstr "Construction d'une tour de défense possible"
@ -1121,7 +1211,7 @@ msgid "Plans for nuclear power plant available"
msgstr "Construction d'une centrale nucléaire possible"
msgid "Plans for phazer shooter available"
msgstr "Fabrication des robots canon à phases possible"
msgstr "Fabrication des robots canon hachoir possible"
msgid "Plans for shielder available"
msgstr "Fabrication d'un robot bouclier possible"
@ -1151,13 +1241,13 @@ msgid "Player's name"
msgstr "Nom du joueur"
msgid "Power cell"
msgstr "Pile normale"
msgstr "Batterie standard"
msgid "Power cell available"
msgstr "Pile disponible"
msgstr "Batterie disponible"
msgid "Power cell factory"
msgstr "Fabrique de piles"
msgstr "Fabrique de batteries"
msgid "Power station"
msgstr "Station de recharge"
@ -1235,7 +1325,7 @@ msgid "Quit\\Quit Colobot: Gold Edition"
msgstr "Quitter\\Quitter Colobot : Édition Gold"
msgid "Quit\\Quit the current mission or exercise"
msgstr "Quitter la mission en cours\\Terminer un exercice ou une mssion"
msgstr "Quitter la mission en cours\\Terminer un exercice ou une mission"
msgid "Radar station"
msgstr "Radar"
@ -1262,6 +1352,9 @@ msgstr "Drapeau rouge"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Reflets sur les boutons\\Boutons brillants"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Remains of Apollo mission"
msgstr "Vestige d'une mission Apollo"
@ -1319,35 +1412,41 @@ msgstr "Robbie"
msgid "Ruin"
msgstr "Bâtiment en ruine"
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for defense tower"
msgstr "Recherche la tour de défense"
msgstr "Lancer la recherche de la tour de défense"
msgid "Run research program for legged bots"
msgstr "Recherche du fonctionnement des pattes"
msgstr "Lancer la recherche du fonctionnement des pattes"
msgid "Run research program for nuclear power"
msgstr "Recherche du programme nucléaire"
msgstr "Lancer la recherche du programme nucléaire"
msgid "Run research program for orga shooter"
msgstr "Recherche le canon organique"
msgstr "Lancer la recherche du canon organique"
msgid "Run research program for phazer shooter"
msgstr "Recherche le canon à phases"
msgstr "Lancer la recherche du canon hachoir"
msgid "Run research program for shielder"
msgstr "Recherche le bouclier"
msgstr "Lancer la recherche du bouclier"
msgid "Run research program for shooter"
msgstr "Recherche le canon de tir"
msgstr "Lancer la recherche du canon de tir"
msgid "Run research program for target bot"
msgstr ""
msgid "Run research program for thumper"
msgstr "Recherche le secoueur"
msgstr "Lancer la recherche du secoueur"
msgid "Run research program for tracked bots"
msgstr "Recherche du fonctionnement des chenilles"
msgstr "Lancer la recherche du fonctionnement des chenilles"
msgid "Run research program for winged bots"
msgstr "Recherche du fonctionnement du jet"
msgstr "Lancer la recherche du fonctionnement du jet"
msgid "SatCom"
msgstr "SatCom"
@ -1370,6 +1469,9 @@ msgstr "Enregistrer\\Enregistrer la mission en cours"
msgid "Save\\Saves the current mission"
msgstr "Enregistrer\\Enregistrer la mission en cours"
msgid "Select Folder"
msgstr ""
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Sélectionner le cosmonaute\\Sélectionner le cosmonaute"
@ -1436,11 +1538,20 @@ msgstr "Sons :\\Volume des moteurs, voix, etc."
msgid "Sound\\Music and game sound volume"
msgstr "Son\\Volumes des sons & musiques"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Spaceship"
msgstr "Vaisseau spatial"
msgid "Spaceship ruin"
msgstr "Epave de vaisseau spatial"
msgstr "Épave de vaisseau spatial"
msgid "Spider"
msgstr "Araignée"
@ -1497,7 +1608,7 @@ msgid "Switch bots <-> buildings"
msgstr "Permute robots <-> bâtiments"
msgid "Take off to finish the mission"
msgstr "Décolle pour terminer la mission"
msgstr "Décollage pour terminer la mission"
msgid "Target"
msgstr "Cible"
@ -1514,6 +1625,10 @@ msgstr "Filtrage de textures\\Filtrage de textures"
msgid "Textures"
msgstr "Textures"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "The battle has ended"
msgstr "La bataille est terminée"
@ -1526,9 +1641,16 @@ msgstr "La fonction n'a pas retourné de résultat"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "La mission n'est pas terminée (appuyez sur \\key help; pour plus de détails)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "The types of the two operands are incompatible"
msgstr "Les deux opérandes ne sont pas de types compatibles"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "This class already exists"
msgstr "Cette classe existe déjà"
@ -1560,7 +1682,7 @@ msgid "This program is read-only, clone it to edit"
msgstr "Ce programme est en lecture-seule, le dupliquer pour pouvoir le modifier"
msgid "Thump (\\key action;)"
msgstr "Secoue (\\key action;)"
msgstr "Secouer (\\key action;)"
msgid "Thumper"
msgstr "Robot secoueur"
@ -1602,8 +1724,11 @@ msgstr "Trop de drapeaux de cette couleur (maximum 5)"
msgid "Too many parameters"
msgstr "Trop de paramètres"
msgid "Tracked builder"
msgstr ""
msgid "Tracked grabber"
msgstr "Robot déménageur à chenilles"
msgstr "Robot préhenseur à chenilles"
msgid "Tracked orga shooter"
msgstr "Robot tireur organique à chenilles"
@ -1650,6 +1775,9 @@ msgstr "Unité"
msgid "Unknown Object"
msgstr "Objet inconnu"
msgid "Unknown author"
msgstr ""
msgid "Unknown command"
msgstr "Commande inconnue"
@ -1662,6 +1790,9 @@ msgstr "Routine inconnue"
msgid "Up (\\key gup;)"
msgstr "Monte (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Uranium deposit (site for derrick)"
msgstr "Emplacement pour un derrick (minerai d'uranium)"
@ -1683,9 +1814,12 @@ msgstr "Variable non initialisée"
msgid "Vault"
msgstr "Coffre-fort"
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgid "Version"
msgstr ""
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr "Synchronisation verticale :\\Réduit la fréquence d'images par seconde à afficher."
msgid "Violet flag"
msgstr "Drapeau violet"
@ -1701,8 +1835,14 @@ msgstr "Guêpe mortellement touchée"
msgid "Waste"
msgstr "Déchet"
msgid "Website"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Wheeled grabber"
msgstr "Robot déménageur à roues"
msgstr "Robot préhenseur à roues"
msgid "Wheeled orga shooter"
msgstr "Robot tireur organique à roues"
@ -1713,8 +1853,11 @@ msgstr "Robot tireur à roues"
msgid "Wheeled sniffer"
msgstr "Robot renifleur à roues"
msgid "Winged builder"
msgstr ""
msgid "Winged grabber"
msgstr "Robot déménageur volant"
msgstr "Robot préhenseur volant"
msgid "Winged orga shooter"
msgstr "Robot tireur organique volant"
@ -1728,6 +1871,9 @@ msgstr "Robot renifleur volant"
msgid "Withdraw shield (\\key action;)"
msgstr "Refermer le bouclier (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Worm"
msgstr "Ver"
@ -1735,7 +1881,7 @@ msgid "Worm fatally wounded"
msgstr "Ver mortellement touché"
msgid "Wreckage"
msgstr "Epave de robot"
msgstr "Épave de robot"
msgid "Write error"
msgstr "Erreur lors de l'écriture"
@ -1820,7 +1966,7 @@ msgid "\\New player name"
msgstr "\\Nom du joueur à créer"
msgid "\\No eyeglasses"
msgstr "\\Pas de lunettes"
msgstr "\\Pas de lunette"
msgid "\\Raise the pencil"
msgstr "\\Relève le crayon"
@ -1876,15 +2022,15 @@ msgstr "\\Drapeaux violets"
msgid "\\Yellow flags"
msgstr "\\Drapeaux jaunes"
msgid "by"
msgstr ""
msgid "colobot.info"
msgstr "colobot.info"
msgid "epsitec.com"
msgstr "epsitec.com"
#~ msgid " "
#~ msgstr " "
#~ msgid " Drivers:"
#~ msgstr " Pilotes :"
@ -1897,6 +2043,9 @@ msgstr "epsitec.com"
#~ msgid "3D sound\\3D positioning of the sound"
#~ msgstr "Bruitages 3D\\Positionnement sonore dans l'espace"
#~ msgid "Build a destroyer"
#~ msgstr "Construire un destructeur"
#~ msgid "Building too close"
#~ msgstr "Bâtiment trop proche"

186
po/pl.po
View File

@ -31,6 +31,9 @@ msgstr "Brak \" ] \""
msgid "%s: %d pts"
msgstr "%s: %d pkt"
msgid "+\\Missions with bonus content and optional challenges"
msgstr "+\\Misje z dodatkową zawartością i opcjonalnymi wyzwaniami"
msgid "..behind"
msgstr "..za"
@ -109,9 +112,6 @@ msgstr "Analiza została już wykonana"
msgid "Analysis performed"
msgstr "Analiza wykonana"
msgid "Analyzes only organic matter"
msgstr "Analizuje jedynie materię organiczną"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Filtrowanie anizotropowe\\Poziom filtrowania anizotropowego"
@ -127,6 +127,9 @@ msgstr "Wygląd\\Wybierz swoją postać"
msgid "Apply changes\\Activates the changed settings"
msgstr "Zastosuj zmiany\\Aktywuje zmienione ustawienia"
msgid "Apply\\Apply the current mod configuration"
msgstr "Zastosuj\\Zastosuj obecną konfigurację modów"
msgid "Appropriate constructor missing"
msgstr "Brak odpowiedniego konstruktora"
@ -184,6 +187,9 @@ msgstr "Robot zniszczony"
msgid "Bot factory"
msgstr "Fabryka robotów"
msgid "Build (\\key action;)"
msgstr "Buduj (\\key action;)"
msgid "Build a bot factory"
msgstr "Zbuduj fabrykę robotów"
@ -196,12 +202,12 @@ msgstr "Zbuduj wieżę obronną"
msgid "Build a derrick"
msgstr "Zbuduj kopalnię"
msgid "Build a destroyer"
msgstr "Zbuduj niszczarkę"
msgid "Build a exchange post"
msgstr "Zbuduj stację przekaźnikową"
msgid "Build a legged builder"
msgstr "Zbuduj budowniczego na nogach"
msgid "Build a legged grabber"
msgstr "Zbuduj transporter na nogach"
@ -247,9 +253,15 @@ msgstr "Zbuduj robota osłaniacza"
msgid "Build a subber"
msgstr "Zbuduj robota nurka"
msgid "Build a target bot"
msgstr "Zbuduj robota-cel"
msgid "Build a thumper"
msgstr "Zbuduj robota uderzacza"
msgid "Build a tracked builder"
msgstr "Zbuduj budowniczego na gąsienicach"
msgid "Build a tracked grabber"
msgstr "Zbuduj transporter na gąsienicach"
@ -262,6 +274,12 @@ msgstr "Zbuduj działo na gąsienicach"
msgid "Build a tracked sniffer"
msgstr "Zbuduj szperacz na gąsienicach"
msgid "Build a vault"
msgstr "Zbuduj skrytkę"
msgid "Build a wheeled builder"
msgstr "Zbuduj budowniczego na kołach"
msgid "Build a wheeled grabber"
msgstr "Zbuduj transporter na kołach"
@ -274,6 +292,9 @@ msgstr "Zbuduj działo na kołach"
msgid "Build a wheeled sniffer"
msgstr "Zbuduj szperacz na kołach"
msgid "Build a winged builder"
msgstr "Zbuduj latającego budowniczego"
msgid "Build a winged grabber"
msgstr "Zbuduj transporter latający"
@ -355,6 +376,9 @@ msgstr "Zmień kamerę\\Przełącza pomiędzy kamerą pokładową i śledzącą"
msgid "Change player\\Change player"
msgstr "Zmień gracza\\Zmień gracza"
msgid "Changes"
msgstr "Zmiany"
msgid "Chapters:"
msgstr "Rozdziały:"
@ -365,7 +389,7 @@ msgid "Checkpoint"
msgstr "Punkt kontrolny"
msgid "Class name expected"
msgstr ""
msgstr "Oczekiwano nazwy klasy"
msgid "Climb\\Increases the power of the jet"
msgstr "W górę\\Zwiększa moc silnika"
@ -424,6 +448,12 @@ msgstr "Kopiuj"
msgid "Copy (Ctrl+C)"
msgstr "Kopiuj (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr "Nie udało się otworzyć przeglądarki plików!"
msgid "Could not open the web browser!"
msgstr "Nie udało się otworzyć przeglądarki internetowej!"
msgid "Current mission saved"
msgstr "Bieżąca misja zapisana"
@ -457,6 +487,9 @@ msgstr "Kopalnia"
msgid "Descend\\Reduces the power of the jet"
msgstr "W dół\\Zmniejsza moc silnika"
msgid "Description:"
msgstr "Opis:"
msgid "Destroy"
msgstr "Zniszcz"
@ -469,6 +502,9 @@ msgstr "Destroyer"
msgid "Device\\Driver and resolution settings"
msgstr "Urządzenie\\Ustawienia sterownika i rozdzielczości"
msgid "Disable\\Disable the selected mod"
msgstr "Wyłącz\\Wyłącza zaznaczonego moda"
msgid "Dividing by zero"
msgstr "Dzielenie przez zero"
@ -485,9 +521,15 @@ msgstr "Drzwi zablokowane przez robota lub inny obiekt"
msgid "Down (\\key gdown;)"
msgstr "Dół (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr "W dół\\Przenieś zaznaczonego moda w dół, aby był załadowany później (mody mogą nadpisywać pliki modów wyżej)"
msgid "Drawer bot"
msgstr "Robot rysownik"
msgid "Duplicate label in switch"
msgstr "Zduplikowana wartość w instrukcji switch"
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Kurz\\Kurz i bród na robotach i budynkach"
@ -506,6 +548,12 @@ msgstr "Edytuj zaznaczony program"
msgid "Egg"
msgstr "Jajo"
msgid "Empty character constant"
msgstr "Stała będąca pustym znakiem"
msgid "Enable\\Enable the selected mod"
msgstr "Włącz\\Włącza zaznaczonego moda"
msgid "End of block missing"
msgstr "Brak końca bloku"
@ -628,7 +676,7 @@ msgid "Function name missing"
msgstr "Brakująca nazwa funkcji"
msgid "Function needs return type \"void\""
msgstr ""
msgstr "Funkcja potrzebuje typu zwracanego \"void\""
msgid "Game speed"
msgstr "Prędkość gry"
@ -679,7 +727,7 @@ msgid "Help balloons\\Explain the function of the buttons"
msgstr "Dymki pomocy\\Wyjaśnia funkcje przycisków"
msgid "Hex value out of range"
msgstr ""
msgstr "Wartość heksadecymalna poza zakresem"
msgid "Higher speed\\Doubles speed"
msgstr "Zwiększ prędkość\\Podwaja prędkość"
@ -720,6 +768,9 @@ msgstr "Nieodpowiedni rodzaj ogniw"
msgid "Inappropriate object"
msgstr "Nieodpowiedni obiekt"
msgid "Inappropriate sample"
msgstr "Nieprawidłowa próbka"
msgid "Incorrect index type"
msgstr "Nieprawidłowy typ indeksu"
@ -729,6 +780,9 @@ msgstr "Zainfekowane wirusem, chwilowo niesprawne"
msgid "Information exchange post"
msgstr "Stacja przekaźnikowa informacji"
msgid "Information:"
msgstr "Informacje:"
msgid "Instruction \"break\" outside a loop"
msgstr "Polecenie \"break\" na zewnątrz pętli"
@ -760,7 +814,7 @@ msgid "Internal error - tell the developers"
msgstr "Błąd wewnętrzny - powiadom twórców gry"
msgid "Invalid universal character name"
msgstr ""
msgstr "Nieprawidłowy znak Unicode"
msgid "Invert\\Invert values on this axis"
msgstr "Odwróć\\Odwróć wartości na tej osi"
@ -789,6 +843,9 @@ msgstr "Skróty klawiszowe (\\key cbot;)"
msgid "LOADING"
msgstr "WCZYTYWANIE"
msgid "Legged builder"
msgstr "Budowniczy na nogach"
msgid "Legged grabber"
msgstr "Transporter na nogach"
@ -859,10 +916,10 @@ msgid "Mipmap level\\Mipmap level"
msgstr "Poziom mipmap\\Poziom mipmap"
msgid "Missing end quote"
msgstr ""
msgstr "Brak cudzysłowu zamykającego"
msgid "Missing hex digits after escape sequence"
msgstr ""
msgstr "Brak cyfr heksadecymalnych po znaku ucieczki"
msgid "Mission name"
msgstr "Nazwa misji"
@ -873,9 +930,21 @@ msgstr "Misje"
msgid "Missions on this planet:"
msgstr "Misje na tej planecie:"
msgid "Missions+"
msgstr "Misje+"
msgid "Missions\\Select mission"
msgstr "Misje\\Wybierz misję"
msgid "Mods"
msgstr "Mody"
msgid "Mods:"
msgstr "Mody:"
msgid "Mods\\Mod manager"
msgstr "Mody\\Zarządzanie modami"
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Odwrócenie myszy X\\Odwrócenie kierunków przewijania w poziomie"
@ -888,6 +957,9 @@ msgstr "Przenieś zaznaczony program w dół"
msgid "Move selected program up"
msgstr "Przenieś zaznaczony program w górę"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr "Cisza, gdy okno jest w tle\\Wycisza wszystkie dźwięki, gdy okno gry stanie się nieaktywne"
msgid "Mute\\No sound"
msgstr "Cisza\\Brak dźwięków"
@ -906,6 +978,9 @@ msgstr "Nowy"
msgid "New ..."
msgstr "Nowy ..."
msgid "New Folder"
msgstr "Nowy folder"
msgid "New bot available"
msgstr "Dostępny nowy robot"
@ -918,6 +993,12 @@ msgstr "Następny obiekt\\Zaznacza następny obiekt"
msgid "No"
msgstr "Nie"
msgid "No changes."
msgstr "Brak zmian."
msgid "No description."
msgstr "Brak opisu."
msgid "No energy in the subsoil"
msgstr "Brak energii w ziemi"
@ -964,7 +1045,7 @@ msgid "No userlevels installed!"
msgstr "Brak zainstalowanych poziomów użytkownika!"
msgid "Non-void function needs \"return;\""
msgstr ""
msgstr "Funkcja zwracająca typ inny, niż \"void\", wymaga \"return;\""
msgid "Normal size"
msgstr "Normalna wielkość"
@ -1027,7 +1108,7 @@ msgid "Object too close"
msgstr "Obiekt za blisko"
msgid "Octal value out of range"
msgstr ""
msgstr "Wartość ósemkowa poza zakresem"
msgid "One step"
msgstr "Jeden krok"
@ -1038,6 +1119,9 @@ msgstr "Otwórz"
msgid "Open (Ctrl+O)"
msgstr "Otwórz (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr "Otwórz katalog\\Otwórz katalog z modami"
msgid "Opening brace missing"
msgstr "Brak klamry otwierającej"
@ -1062,6 +1146,9 @@ msgstr "Miejsce nadania wiadomości\\Pokazuje skąd została wysłana ostatnia w
msgid "Original game developed by:"
msgstr "Twórcy oryginalnej gry:"
msgid "Overwrite existing file?"
msgstr "Nadpisać istniejący plik?"
msgid "Parameters missing"
msgstr "Brak wymaganego parametru"
@ -1072,7 +1159,7 @@ msgid "Paste (Ctrl+V)"
msgstr "Wklej (Ctrl+V)"
msgid "Pause blur\\Blur the background on the pause screen"
msgstr ""
msgstr "Rozmyta pauza\\Rozmyj tło na ekranie pauzy"
msgid "Pause in background\\Pause the game when the window is unfocused"
msgstr "Wstrzymaj w tle\\Wstrzymaj grę gdy okno stanie się nieaktywne"
@ -1095,6 +1182,9 @@ msgstr "Miejsce zajęte"
msgid "Planets:"
msgstr "Planety:"
msgid "Plans for builder available"
msgstr "Dostępne plany robota budowniczego"
msgid "Plans for defense tower available"
msgstr "Dostępne plany wieży obronnej"
@ -1242,6 +1332,9 @@ msgstr "Czerwona flaga"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Odbicia na przyciskach \\Świecące przyciski"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr "Odśwież\\Odśwież listę obecnie zainstalowanych modów"
msgid "Remains of Apollo mission"
msgstr "Pozostałości z misji Apollo"
@ -1299,6 +1392,9 @@ msgstr "Robbie"
msgid "Ruin"
msgstr "Ruiny"
msgid "Run research program for builder"
msgstr "Rozpocznij prace badawcze nad robotem budowniczym"
msgid "Run research program for defense tower"
msgstr "Rozpocznij prace badawcze nad wieżą obronną"
@ -1320,6 +1416,9 @@ msgstr "Rozpocznij prace badawcze nad robotem osłaniaczem"
msgid "Run research program for shooter"
msgstr "Rozpocznij prace badawcze nad działem"
msgid "Run research program for target bot"
msgstr "Rozpocznij prace badawcze nad robotem-celem"
msgid "Run research program for thumper"
msgstr "Rozpocznij prace badawcze nad robotem uderzaczem"
@ -1350,6 +1449,9 @@ msgstr "Zapisz\\Zapisuje bieżącą misję"
msgid "Save\\Saves the current mission"
msgstr "Zapisz\\Zapisuje bieżącą misję"
msgid "Select Folder"
msgstr "Wybierz folder"
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Zaznacz astronautę\\Zaznacza astronautę"
@ -1416,6 +1518,15 @@ msgstr "Efekty dźwiękowe:\\Głośność silników, głosów, strzałów, itp."
msgid "Sound\\Music and game sound volume"
msgstr "Dźwięk\\Głośność muzyki i dźwięków gry"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr "Kosmiczny odkrywca\\Wyłącza umiejętności astronauty"
msgid "Space Programmer\\Disables radio-control"
msgstr "Kosmiczny koder\\Wyłącza zdalną kontrolę"
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr "Kosmiczny badacz\\Blokuje dostęp do poprzednio wynalezionych technologii"
msgid "Spaceship"
msgstr "Statek kosmiczny"
@ -1494,6 +1605,10 @@ msgstr "Filtrowanie tekstur\\Filtrowanie tekstur"
msgid "Textures"
msgstr "Tekstury"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr "Nie udało się otworzyć adresu %s w przeglądarce internetowej."
msgid "The battle has ended"
msgstr "Bitwa zakończyła się"
@ -1506,9 +1621,16 @@ msgstr "Funkcja nie zwróciła żadnej wartości"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "Misja nie jest wypełniona (naciśnij \\key help; aby uzyskać szczegóły)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr "Nie udało się otworzyć ścieżki %s w przeglądarce plików."
msgid "The types of the two operands are incompatible"
msgstr "Niezgodne typy operatorów"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr "Są niezapisane zmiany. Czy chcesz je zapisać przed wyjściem?"
msgid "This class already exists"
msgstr "Taka klasa już istnieje"
@ -1534,7 +1656,7 @@ msgid "This object is not a member of a class"
msgstr "Ten obiekt nie jest członkiem klasy"
msgid "This parameter needs a default value"
msgstr ""
msgstr "Ten parametr wymaga podania domyślnej wartości"
msgid "This program is read-only, clone it to edit"
msgstr "Ten program jest tylko do odczytu, skopiuj go, aby edytować"
@ -1582,6 +1704,9 @@ msgstr "Za dużo flag w tym kolorze (maksymalnie 5)"
msgid "Too many parameters"
msgstr "Za dużo parametrów"
msgid "Tracked builder"
msgstr "Budowniczy na gąsienicach"
msgid "Tracked grabber"
msgstr "Transporter na gąsienicach"
@ -1630,11 +1755,14 @@ msgstr "Jednostka"
msgid "Unknown Object"
msgstr "Obiekt nieznany"
msgid "Unknown author"
msgstr "Nieznany autor"
msgid "Unknown command"
msgstr "Nieznane polecenie"
msgid "Unknown escape sequence"
msgstr ""
msgstr "Nieznany znak ucieczki"
msgid "Unknown function"
msgstr "Funkcja nieznana"
@ -1642,6 +1770,9 @@ msgstr "Funkcja nieznana"
msgid "Up (\\key gup;)"
msgstr "Góra (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr "W górę\\Przenieś zaznaczonego moda w górę, aby był załadowany wcześniej (mody mogą nadpisywać pliki modów wyżej)"
msgid "Uranium deposit (site for derrick)"
msgstr "Złoże uranu (miejsce na kopalnię)"
@ -1663,6 +1794,9 @@ msgstr "Zmienna nie została zainicjalizowana"
msgid "Vault"
msgstr "Skrytka"
msgid "Version"
msgstr "Wersja"
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr "Synchronizacja pionowa\\Ogranicza ilość klatek na sekundę do wartości odświeżania ekranu"
@ -1681,6 +1815,12 @@ msgstr "Osa śmiertelnie raniona"
msgid "Waste"
msgstr "Odpady"
msgid "Website"
msgstr "Strona internetowa"
msgid "Wheeled builder"
msgstr "Budowniczy na kołach"
msgid "Wheeled grabber"
msgstr "Transporter na kołach"
@ -1693,6 +1833,9 @@ msgstr "Działo na kołach"
msgid "Wheeled sniffer"
msgstr "Szperacz na kołach"
msgid "Winged builder"
msgstr "Budowniczy latający"
msgid "Winged grabber"
msgstr "Transporter latający"
@ -1708,6 +1851,9 @@ msgstr "Szperacz latający"
msgid "Withdraw shield (\\key action;)"
msgstr "Wyłącz osłonę (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr "Warsztat\\Otwórz warsztat, aby poszukać modów"
msgid "Worm"
msgstr "Robal"
@ -1858,6 +2004,9 @@ msgstr "\\Fioletowe flagi"
msgid "\\Yellow flags"
msgstr "\\Żółte flagi"
msgid "by"
msgstr "autorstwa"
msgid "colobot.info"
msgstr "colobot.info"
@ -1873,6 +2022,9 @@ msgstr "epsitec.com"
#~ msgid "3D sound\\3D positioning of the sound"
#~ msgstr "Dźwięk 3D\\Przestrzenne pozycjonowanie dźwięków"
#~ msgid "Build a destroyer"
#~ msgstr "Zbuduj niszczarkę"
#~ msgid "Building too close"
#~ msgstr "Budynek za blisko"

164
po/pt.po
View File

@ -29,6 +29,9 @@ msgstr "\" ] \" faltando"
msgid "%s: %d pts"
msgstr ""
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "..behind"
msgstr "..atrás"
@ -107,9 +110,6 @@ msgstr "Análise já realizada"
msgid "Analysis performed"
msgstr "Análise realizada"
msgid "Analyzes only organic matter"
msgstr "Analisa apenas matéria orgânica"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Nível de anisotropia\\Nível de anisotropia"
@ -125,6 +125,9 @@ msgstr "Aparência\\Escolha sua aparência"
msgid "Apply changes\\Activates the changed settings"
msgstr "Aplicar mudanças\\Ativa as configurações alteradas"
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Appropriate constructor missing"
msgstr "Construtor apropriado faltando"
@ -182,6 +185,9 @@ msgstr "Robo destruido"
msgid "Bot factory"
msgstr "Fábrica de robos"
msgid "Build (\\key action;)"
msgstr ""
msgid "Build a bot factory"
msgstr "Construir uma fábrica de robos"
@ -194,12 +200,12 @@ msgstr "Construir uma torre de defesa"
msgid "Build a derrick"
msgstr "Construir um extrator"
msgid "Build a destroyer"
msgstr "Construir um destruidor"
msgid "Build a exchange post"
msgstr "Construir um posto de troca"
msgid "Build a legged builder"
msgstr ""
msgid "Build a legged grabber"
msgstr "Construir um agarrador com pernas"
@ -245,9 +251,15 @@ msgstr "Construir um defensor"
msgid "Build a subber"
msgstr "Construir um mergulhador"
msgid "Build a target bot"
msgstr ""
msgid "Build a thumper"
msgstr "Construir um batedor"
msgid "Build a tracked builder"
msgstr ""
msgid "Build a tracked grabber"
msgstr "Construir um agarrador com esteiras"
@ -260,6 +272,12 @@ msgstr "Construir um atirador com esteiras"
msgid "Build a tracked sniffer"
msgstr "Construir um farejador com esteiras"
msgid "Build a vault"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a wheeled grabber"
msgstr "Construir um agarrador com rodas"
@ -272,6 +290,9 @@ msgstr "Construir um atirador com rodas"
msgid "Build a wheeled sniffer"
msgstr "Construir um farejador com rodas"
msgid "Build a winged builder"
msgstr ""
msgid "Build a winged grabber"
msgstr "Construir um agarrador alado"
@ -353,6 +374,9 @@ msgstr "Mudar câmera\\Alterna entre câmera incorporada e câmera seguidora"
msgid "Change player\\Change player"
msgstr "Mudar jogador\\Mudar jogador"
msgid "Changes"
msgstr ""
msgid "Chapters:"
msgstr "Capítulos:"
@ -423,6 +447,12 @@ msgstr "Copiar"
msgid "Copy (Ctrl+C)"
msgstr "Copiar (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
msgid "Current mission saved"
msgstr "Missão atual salva"
@ -456,6 +486,9 @@ msgstr "Extrator"
msgid "Descend\\Reduces the power of the jet"
msgstr "Descer\\Diminui o poder do jato"
msgid "Description:"
msgstr ""
msgid "Destroy"
msgstr "Destruir"
@ -468,6 +501,9 @@ msgstr "Destruidor"
msgid "Device\\Driver and resolution settings"
msgstr "Dispositivo\\Configurações de driver e resolução"
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Dividing by zero"
msgstr "Dividindo por zero"
@ -484,9 +520,15 @@ msgstr "Portas bloqueadas por um robô ou outro objeto"
msgid "Down (\\key gdown;)"
msgstr "Baixo (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Drawer bot"
msgstr "Robô cartoonista"
msgid "Duplicate label in switch"
msgstr ""
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Poeira\\Poeira e sujeira nos robôs e prédios"
@ -505,6 +547,12 @@ msgstr "Alterar o programa selecionado"
msgid "Egg"
msgstr "Ovo"
msgid "Empty character constant"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "End of block missing"
msgstr "Fim do bloco ausente"
@ -720,6 +768,9 @@ msgstr "Tipo de célula inapropriada"
msgid "Inappropriate object"
msgstr "Objeto inapropiado"
msgid "Inappropriate sample"
msgstr ""
msgid "Incorrect index type"
msgstr "Tipo de índice inválido"
@ -729,6 +780,9 @@ msgstr "Infectado por vírus; temporariamento fora de serviço"
msgid "Information exchange post"
msgstr "Posto de troca de informação"
msgid "Information:"
msgstr ""
msgid "Instruction \"break\" outside a loop"
msgstr "Intrução \"break\" fora de um laço"
@ -789,6 +843,9 @@ msgstr "Palavra-chave ajuda (\\key cbot;)"
msgid "LOADING"
msgstr "CARREGANDO"
msgid "Legged builder"
msgstr ""
msgid "Legged grabber"
msgstr "Agarrador com pernas"
@ -887,9 +944,21 @@ msgstr "Missões"
msgid "Missions on this planet:"
msgstr "Lista de missões neste planeta:"
msgid "Missions+"
msgstr "Missões+"
msgid "Missions\\Select mission"
msgstr "Missões\\Selecione uma missão"
msgid "Mods"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Inversão de mouse X\\Inverte a direção da rolagem no eixo X"
@ -902,6 +971,9 @@ msgstr "Move o programa selecionado para baixo"
msgid "Move selected program up"
msgstr "Move o programa selecionado para cima"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Mute\\No sound"
msgstr "Mudo\\Sem som"
@ -920,6 +992,9 @@ msgstr "Novo"
msgid "New ..."
msgstr "Novo ..."
msgid "New Folder"
msgstr ""
msgid "New bot available"
msgstr "Novo robô disponível"
@ -932,6 +1007,12 @@ msgstr "Próximo objeto\\Selecionar o próximo objeto"
msgid "No"
msgstr "Não"
msgid "No changes."
msgstr ""
msgid "No description."
msgstr ""
msgid "No energy in the subsoil"
msgstr "Nenhuma energia no subsolo"
@ -1052,6 +1133,9 @@ msgstr "Abrir"
msgid "Open (Ctrl+O)"
msgstr "Abrir (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Opening brace missing"
msgstr "Chave de abertura ausente"
@ -1076,6 +1160,9 @@ msgstr "Origem da última mensagem\\Mostra de onde a última mensagem foi enviad
msgid "Original game developed by:"
msgstr "Jogo original desenvolvido por:"
msgid "Overwrite existing file?"
msgstr ""
msgid "Parameters missing"
msgstr "Parâmetros ausentes"
@ -1109,6 +1196,9 @@ msgstr "Local ocupado"
msgid "Planets:"
msgstr "Planetas:"
msgid "Plans for builder available"
msgstr ""
msgid "Plans for defense tower available"
msgstr "Planos para a torre de defesa disponíveis"
@ -1257,6 +1347,9 @@ msgstr "Bandeira vermelha"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Reflexões nos botões\\Botões brilhantes"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Remains of Apollo mission"
msgstr "Restos da missão Apollo"
@ -1314,6 +1407,9 @@ msgstr "Robbie"
msgid "Ruin"
msgstr "Ruína"
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for defense tower"
msgstr "Executar programa de pesquisa para torre de defesa"
@ -1335,6 +1431,9 @@ msgstr "Executar programa de pesquisa para defensor"
msgid "Run research program for shooter"
msgstr "Executar programa de pesquisa para atirador"
msgid "Run research program for target bot"
msgstr ""
msgid "Run research program for thumper"
msgstr "Executar programa de pesquisa para batedor"
@ -1365,6 +1464,9 @@ msgstr "Salvar\\Salve a missão atual"
msgid "Save\\Saves the current mission"
msgstr "Salvar\\Salva a missão atual"
msgid "Select Folder"
msgstr ""
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Selecione o astronauta\\Seleciona o astronauta"
@ -1431,6 +1533,15 @@ msgstr "Efeitos sonoros:\\Volume dos motores, voz, tiros, etc."
msgid "Sound\\Music and game sound volume"
msgstr "Som\\Volume do som das músicas e do jogo"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Spaceship"
msgstr "Nave espacial"
@ -1509,6 +1620,10 @@ msgstr "Filtragem de textura\\Filtragem de textura"
msgid "Textures"
msgstr "Texturas"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "The battle has ended"
msgstr "A batalha acabou"
@ -1521,9 +1636,16 @@ msgstr "A função não retornou nenhum valor"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "A missão não foi completada ainda (pressione \\key help; para mais detalhes)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "The types of the two operands are incompatible"
msgstr "Os tipos dos dois operandos são incompativeis"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "This class already exists"
msgstr "Esta classe já existe"
@ -1597,6 +1719,9 @@ msgstr "Muitas bandeiras dessa cor (máximo 5)"
msgid "Too many parameters"
msgstr "Muitos parâmetros"
msgid "Tracked builder"
msgstr ""
msgid "Tracked grabber"
msgstr "Pegador com esteiras"
@ -1645,6 +1770,9 @@ msgstr "Unidade"
msgid "Unknown Object"
msgstr "Objeto desconhecido"
msgid "Unknown author"
msgstr ""
msgid "Unknown command"
msgstr "Comando desconhecido"
@ -1657,6 +1785,9 @@ msgstr "Função desconhecida"
msgid "Up (\\key gup;)"
msgstr "Cima (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Uranium deposit (site for derrick)"
msgstr "Depósito de urânio (local para extrator)"
@ -1678,6 +1809,9 @@ msgstr "Variável não inicializada"
msgid "Vault"
msgstr "Cofre"
msgid "Version"
msgstr ""
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr ""
@ -1696,6 +1830,12 @@ msgstr "Vespa fatalmente ferida"
msgid "Waste"
msgstr "Desperdício"
msgid "Website"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Wheeled grabber"
msgstr "Agarrador com rodas"
@ -1708,6 +1848,9 @@ msgstr "Atirador com rodas"
msgid "Wheeled sniffer"
msgstr "Farejador com rodas"
msgid "Winged builder"
msgstr ""
msgid "Winged grabber"
msgstr "Agarrador alado"
@ -1723,6 +1866,9 @@ msgstr "Farejador alado"
msgid "Withdraw shield (\\key action;)"
msgstr "Retirar escudo (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Worm"
msgstr "Verme"
@ -1871,6 +2017,9 @@ msgstr "\\Bandeiras violetas"
msgid "\\Yellow flags"
msgstr "\\Bandeiras amarelas"
msgid "by"
msgstr ""
msgid "colobot.info"
msgstr "colobot.info"
@ -1892,6 +2041,9 @@ msgstr "epsitec.com"
#~ msgid "3D sound\\3D positioning of the sound"
#~ msgstr "Bruitages 3D\\Positionnement sonore dans l'espace"
#~ msgid "Build a destroyer"
#~ msgstr "Construir um destruidor"
#~ msgid "Building too close"
#~ msgstr "Bâtiment trop proche"

164
po/ru.po
View File

@ -31,6 +31,9 @@ msgstr "Отсутствует \"]\" "
msgid "%s: %d pts"
msgstr ""
msgid "+\\Missions with bonus content and optional challenges"
msgstr ""
msgid "..behind"
msgstr "Сзади"
@ -109,9 +112,6 @@ msgstr "Анализ уже выполнен"
msgid "Analysis performed"
msgstr "Анализ выполнен"
msgid "Analyzes only organic matter"
msgstr "Анализирую только органические вещества"
msgid "Anisotropy level\\Anisotropy level"
msgstr "Уровень анизотр. фильтр.\\Уровень анизотропной фильтрации"
@ -127,6 +127,9 @@ msgstr "Внешность\\Настройка внешности"
msgid "Apply changes\\Activates the changed settings"
msgstr "Принять\\Принять изменения настроек"
msgid "Apply\\Apply the current mod configuration"
msgstr ""
msgid "Appropriate constructor missing"
msgstr "Соответствующий конструктор отсутствует"
@ -185,6 +188,9 @@ msgstr "Бот уничтожен"
msgid "Bot factory"
msgstr "Завод ботов"
msgid "Build (\\key action;)"
msgstr ""
msgid "Build a bot factory"
msgstr "Построить завод ботов"
@ -197,12 +203,12 @@ msgstr "Построить защитную башню"
msgid "Build a derrick"
msgstr "Построить буровую вышку"
msgid "Build a destroyer"
msgstr "Построить уничтожитель"
msgid "Build a exchange post"
msgstr "Построить пост по обмену сообщениями"
msgid "Build a legged builder"
msgstr ""
msgid "Build a legged grabber"
msgstr "Собрать шагающего сборщика"
@ -248,9 +254,15 @@ msgstr "Собрать передвижной щит"
msgid "Build a subber"
msgstr "Собрать саббера"
msgid "Build a target bot"
msgstr ""
msgid "Build a thumper"
msgstr "Собрать ударника"
msgid "Build a tracked builder"
msgstr ""
msgid "Build a tracked grabber"
msgstr "Собрать гусеничного сборщика"
@ -263,6 +275,12 @@ msgstr "Собрать гусеничного стрелка"
msgid "Build a tracked sniffer"
msgstr "Собрать гусеничного искателя"
msgid "Build a vault"
msgstr ""
msgid "Build a wheeled builder"
msgstr ""
msgid "Build a wheeled grabber"
msgstr "Собрать колесного сборщика"
@ -275,6 +293,9 @@ msgstr "Собрать колесного стрелка"
msgid "Build a wheeled sniffer"
msgstr "Собрать колесного искателя"
msgid "Build a winged builder"
msgstr ""
msgid "Build a winged grabber"
msgstr "Собрать летающего сборщика"
@ -360,6 +381,9 @@ msgstr "Изменить вид\\Переключение между борто
msgid "Change player\\Change player"
msgstr "Новый игрок\\Выберите имя для игрока"
msgid "Changes"
msgstr ""
msgid "Chapters:"
msgstr "Разделы:"
@ -431,6 +455,12 @@ msgstr "Копировать"
msgid "Copy (Ctrl+C)"
msgstr "Копировать (Ctrl+C)"
msgid "Could not open the file explorer!"
msgstr ""
msgid "Could not open the web browser!"
msgstr ""
msgid "Current mission saved"
msgstr "Текущая миссия сохранена"
@ -465,6 +495,9 @@ msgstr "Космический корабль"
msgid "Descend\\Reduces the power of the jet"
msgstr "Снижение и посадка\\Понижение мощности реактивного двигателя"
msgid "Description:"
msgstr ""
msgid "Destroy"
msgstr "Уничтожить"
@ -477,6 +510,9 @@ msgstr "Уничтожитель"
msgid "Device\\Driver and resolution settings"
msgstr "Устройство\\Драйвер и настройки разрешения"
msgid "Disable\\Disable the selected mod"
msgstr ""
msgid "Dividing by zero"
msgstr "Деление на ноль (запрещено!)"
@ -493,9 +529,15 @@ msgstr "Двери заблокированы роботом или другим
msgid "Down (\\key gdown;)"
msgstr "Вниз (\\key gdown;)"
msgid "Down\\Move the selected mod down so it's loaded later (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Drawer bot"
msgstr "Рисовальщик"
msgid "Duplicate label in switch"
msgstr ""
msgid "Dust\\Dust and dirt on bots and buildings"
msgstr "Пыль\\Пыль и грязь на ботах и зданиях"
@ -514,6 +556,12 @@ msgstr "Изменить выбранную программу"
msgid "Egg"
msgstr "Яйцо"
msgid "Empty character constant"
msgstr ""
msgid "Enable\\Enable the selected mod"
msgstr ""
msgid "End of block missing"
msgstr "Отсутствует конец блока"
@ -729,6 +777,9 @@ msgstr "Батарея не подходит"
msgid "Inappropriate object"
msgstr "Неподходящий объект"
msgid "Inappropriate sample"
msgstr ""
msgid "Incorrect index type"
msgstr "Неверный тип индекса"
@ -738,6 +789,9 @@ msgstr "Заражено вирусом. Временно вышел из стр
msgid "Information exchange post"
msgstr "Пост обмена информацией"
msgid "Information:"
msgstr ""
msgid "Instruction \"break\" outside a loop"
msgstr "Инструкция \"break\" вне цикла"
@ -798,6 +852,9 @@ msgstr "Помощь(\\key cbot;)"
msgid "LOADING"
msgstr "ЗАГРУЗКА"
msgid "Legged builder"
msgstr ""
msgid "Legged grabber"
msgstr "Шагающий сборщик"
@ -896,9 +953,21 @@ msgstr "Миссии"
msgid "Missions on this planet:"
msgstr "Миссии на этой планете:"
msgid "Missions+"
msgstr "Миссии+"
msgid "Missions\\Select mission"
msgstr "Миссии\\Выбор миссии"
msgid "Mods"
msgstr ""
msgid "Mods:"
msgstr ""
msgid "Mods\\Mod manager"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr "Инверсия мыши по оси X\\Инверсия прокрутки по оси Х"
@ -913,6 +982,9 @@ msgstr "Изменить выбранную программу"
msgid "Move selected program up"
msgstr "Изменить выбранную программу"
msgid "Mute sounds in background\\Mute all game sounds when the window is unfocused"
msgstr ""
msgid "Mute\\No sound"
msgstr "Без звука\\Без звука"
@ -931,6 +1003,9 @@ msgstr "Новый"
msgid "New ..."
msgstr "Новый ..."
msgid "New Folder"
msgstr ""
msgid "New bot available"
msgstr "Доступен новый бот"
@ -943,6 +1018,12 @@ msgstr "Следующий объект\\Выбор следующего объ
msgid "No"
msgstr "Нет"
msgid "No changes."
msgstr ""
msgid "No description."
msgstr ""
msgid "No energy in the subsoil"
msgstr "Под землей нет запасов энергии"
@ -1063,6 +1144,9 @@ msgstr "Открыть"
msgid "Open (Ctrl+O)"
msgstr "Открыть (Ctrl+O)"
msgid "Open Directory\\Open the mods directory"
msgstr ""
msgid "Opening brace missing"
msgstr "Открывающая скобка отсутствует"
@ -1087,6 +1171,9 @@ msgstr "Источник сообщения\\Показывает место, о
msgid "Original game developed by:"
msgstr "Оригинальная игра была разработана:"
msgid "Overwrite existing file?"
msgstr ""
msgid "Parameters missing"
msgstr "Отсутствуют параметры"
@ -1120,6 +1207,9 @@ msgstr "Место занято"
msgid "Planets:"
msgstr "Планеты:"
msgid "Plans for builder available"
msgstr ""
msgid "Plans for defense tower available"
msgstr "Доступны схемы защитной башни"
@ -1269,6 +1359,9 @@ msgstr "Красный флаг"
msgid "Reflections on the buttons \\Shiny buttons"
msgstr "Отражения на кнопках \\Блестящие кнопки"
msgid "Refresh\\Refresh the list of currently installed mods"
msgstr ""
msgid "Remains of Apollo mission"
msgstr "Остатки миссии Аполлон"
@ -1328,6 +1421,9 @@ msgstr "Робби"
msgid "Ruin"
msgstr "Руины"
msgid "Run research program for builder"
msgstr ""
msgid "Run research program for defense tower"
msgstr "Начать исследование программы для защитной башни"
@ -1349,6 +1445,9 @@ msgstr "Начать исследование программы для пере
msgid "Run research program for shooter"
msgstr "Начать исследование программы для стрелка"
msgid "Run research program for target bot"
msgstr ""
msgid "Run research program for thumper"
msgstr "Начать исследование программы для ударника"
@ -1379,6 +1478,9 @@ msgstr "Сохранить\\Сохранить текущую миссию"
msgid "Save\\Saves the current mission"
msgstr "Сохранить\\Сохранить текущую миссию"
msgid "Select Folder"
msgstr ""
msgid "Select the astronaut\\Selects the astronaut"
msgstr "Выбор астронавта\\Выбор астронавта"
@ -1446,6 +1548,15 @@ msgstr "Общий звук:\\Гормкость двигателя, голос
msgid "Sound\\Music and game sound volume"
msgstr "Звук\\Громкость музыки и звуков"
msgid "Space Explorer\\Disables astronaut abilities"
msgstr ""
msgid "Space Programmer\\Disables radio-control"
msgstr ""
msgid "Space Researcher\\Disables using all previously researched technologies"
msgstr ""
msgid "Spaceship"
msgstr "Космический корабль"
@ -1525,6 +1636,10 @@ msgstr "Фильтрация текстур\\Фильтрация текстур
msgid "Textures"
msgstr "Текстуры"
#, c-format
msgid "The address %s could not be opened in a web browser."
msgstr ""
msgid "The battle has ended"
msgstr ""
@ -1537,9 +1652,16 @@ msgstr "Функция не возвратила значения"
msgid "The mission is not accomplished yet (press \\key help; for more details)"
msgstr "Миссия еще не выполнена (нажмите \\key help; для более подробной информации)"
#, c-format
msgid "The path %s could not be opened in a file explorer."
msgstr ""
msgid "The types of the two operands are incompatible"
msgstr "Типы операндов несовместимы"
msgid "There are unsaved changes. Do you want to save them before leaving?"
msgstr ""
msgid "This class already exists"
msgstr "Этот класс уже существует"
@ -1613,6 +1735,9 @@ msgstr "Слишком много флагов этого цвета (макси
msgid "Too many parameters"
msgstr "Слишком много параметров"
msgid "Tracked builder"
msgstr ""
msgid "Tracked grabber"
msgstr "Гусеничный сборщик"
@ -1661,6 +1786,9 @@ msgstr "Юнит"
msgid "Unknown Object"
msgstr "Неизвестный объект"
msgid "Unknown author"
msgstr ""
msgid "Unknown command"
msgstr "Неизвестная команда"
@ -1673,6 +1801,9 @@ msgstr "Неизвестная функция"
msgid "Up (\\key gup;)"
msgstr "Вверх (\\key gup;)"
msgid "Up\\Move the selected mod up so it's loaded sooner (mods may overwrite files from the mods above them)"
msgstr ""
msgid "Uranium deposit (site for derrick)"
msgstr "Запасы урана (место для буровой вышки)"
@ -1694,6 +1825,9 @@ msgstr "Переменная не инициализирована"
msgid "Vault"
msgstr "Хранилище"
msgid "Version"
msgstr ""
msgid "Vertical Synchronization\\Limits the number of frames per second to display frequency"
msgstr ""
@ -1712,6 +1846,12 @@ msgstr "Оса смертельно ранена"
msgid "Waste"
msgstr "Мусор"
msgid "Website"
msgstr ""
msgid "Wheeled builder"
msgstr ""
msgid "Wheeled grabber"
msgstr "Колесный сборщик"
@ -1724,6 +1864,9 @@ msgstr "Колесный стрелок"
msgid "Wheeled sniffer"
msgstr "Колесный искатель"
msgid "Winged builder"
msgstr ""
msgid "Winged grabber"
msgstr "Летающий сборщик"
@ -1739,6 +1882,9 @@ msgstr "Летающий искатель"
msgid "Withdraw shield (\\key action;)"
msgstr "Снять щит (\\key action;)"
msgid "Workshop\\Open the workshop to search for mods"
msgstr ""
msgid "Worm"
msgstr "Червь"
@ -1887,6 +2033,9 @@ msgstr "\\Фиолетовый флаг"
msgid "\\Yellow flags"
msgstr "\\Желтый флаг"
msgid "by"
msgstr ""
msgid "colobot.info"
msgstr "colobot.info"
@ -1908,6 +2057,9 @@ msgstr "epsitec.com"
#~ msgid "3D sound\\3D positioning of the sound"
#~ msgstr "3D-звук\\Стерео звук"
#~ msgid "Build a destroyer"
#~ msgstr "Построить уничтожитель"
#~ msgid "Building too close"
#~ msgstr "Здание слишком близко"

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -20,6 +20,7 @@
#include "CBot/CBotCStack.h"
#include "CBot/CBotClass.h"
#include "CBot/CBotToken.h"
#include "CBot/CBotExternalCall.h"
@ -30,107 +31,100 @@
namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotProgram* CBotCStack::m_prog = nullptr; // init the static variable
CBotError CBotCStack::m_error = CBotNoErr;
int CBotCStack::m_end = 0;
CBotTypResult CBotCStack::m_retTyp = CBotTypResult(0);
struct CBotCStack::Data
{
//! The program currently being compiled
CBotProgram* prog = nullptr;
//! The current error state of the compile stack
CBotError error = CBotNoErr;
int errEnd = 0;
//! The return type of the function currently being compiled
CBotTypResult retTyp = CBotTypResult(CBotTypVoid);
};
////////////////////////////////////////////////////////////////////////////////
CBotCStack::CBotCStack(CBotCStack* ppapa)
{
m_next = nullptr;
m_prev = ppapa;
if (ppapa == nullptr)
{
m_error = CBotNoErr;
m_start = 0;
m_end = 0;
m_data = new CBotCStack::Data;
m_errStart = 0;
m_bBlock = true;
}
else
{
m_start = ppapa->m_start;
m_data = ppapa->m_data;
m_errStart = ppapa->m_errStart;
m_bBlock = false;
}
m_listVar = nullptr;
m_var = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotCStack::~CBotCStack()
{
if (m_next != nullptr) delete m_next;
if (m_prev != nullptr) m_prev->m_next = nullptr; // removes chain
delete m_var;
delete m_listVar;
if (m_prev == nullptr) delete m_data;
}
////////////////////////////////////////////////////////////////////////////////
CBotCStack* CBotCStack::TokenStack(CBotToken* pToken, bool bBlock)
{
if (m_next != nullptr) return m_next; // include on an existing stack
if (m_next) return m_next.get(); // include on an existing stack
CBotCStack* p = new CBotCStack(this);
m_next = p; // channel element
p->m_bBlock = bBlock;
m_next.reset(new CBotCStack(this));
m_next->m_bBlock = bBlock;
if (pToken != nullptr) p->SetStartError(pToken->GetStart());
if (pToken != nullptr) m_next->SetStartError(pToken->GetStart());
return p;
return m_next.get();
}
void CBotCStack::DeleteNext()
{
m_next.reset();
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotCStack::Return(CBotInstr* inst, CBotCStack* pfils)
{
if ( pfils == this ) return inst;
if (m_var != nullptr) delete m_var; // value replaced?
m_var = pfils->m_var; // result transmitted
pfils->m_var = nullptr; // not to destroy the variable
m_var = std::move(pfils->m_var); // result transmitted
if (m_error)
if (m_data->error != CBotNoErr)
{
m_start = pfils->m_start; // retrieves the position of the error
m_end = pfils->m_end;
m_errStart = pfils->m_errStart; // retrieves the position of the error
}
delete pfils;
m_next.reset();
return inst;
}
////////////////////////////////////////////////////////////////////////////////
CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils)
{
if (m_var != nullptr) delete m_var; // value replaced?
m_var = pfils->m_var; // result transmitted
pfils->m_var = nullptr; // not to destroy the variable
m_var = std::move(pfils->m_var); // result transmitted
if (m_error)
if (m_data->error != CBotNoErr)
{
m_start = pfils->m_start; // retrieves the position of the error
m_end = pfils->m_end;
m_errStart = pfils->m_errStart; // retrieves the position of the error
}
delete pfils;
m_next.reset();
return inst;
}
////////////////////////////////////////////////////////////////////////////////
CBotError CBotCStack::GetError(int& start, int& end)
{
start = m_start;
end = m_end;
return m_error;
start = m_errStart;
end = m_data->errEnd;
return m_data->error;
}
////////////////////////////////////////////////////////////////////////////////
CBotError CBotCStack::GetError()
{
return m_error;
return m_data->error;
}
////////////////////////////////////////////////////////////////////////////////
@ -170,18 +164,13 @@ void CBotCStack::SetType(CBotTypResult& type)
CBotVar* CBotCStack::FindVar(CBotToken* &pToken)
{
CBotCStack* p = this;
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
while (p != nullptr)
{
CBotVar* pp = p->m_listVar;
while ( pp != nullptr)
if (p->m_bBlock) for (auto& var : p->m_listVar)
{
if (name == pp->GetName())
{
return pp;
}
pp = pp->m_next;
if (name == var->GetName()) return var.get();
}
p = p->m_prev;
}
@ -210,39 +199,39 @@ CBotVar* CBotCStack::CopyVar(CBotToken& Token)
////////////////////////////////////////////////////////////////////////////////
bool CBotCStack::IsOk()
{
return (m_error == 0);
return (m_data->error == CBotNoErr);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetStartError( int pos )
{
if ( m_error != 0) return; // does not change existing error
m_start = pos;
if (m_data->error != CBotNoErr) return; // does not change existing error
m_errStart = pos;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetError(CBotError n, int pos)
{
if ( n!= 0 && m_error != 0) return; // does not change existing error
m_error = n;
m_end = pos;
if (n != CBotNoErr && m_data->error != CBotNoErr) return; // does not change existing error
m_data->error = n;
m_data->errEnd = pos;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetError(CBotError n, CBotToken* p)
{
if (m_error) return; // does not change existing error
m_error = n;
m_start = p->GetStart();
m_end = p->GetEnd();
if (m_data->error != CBotNoErr) return; // does not change existing error
m_data->error = n;
m_errStart = p->GetStart();
m_data->errEnd = p->GetEnd();
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::ResetError(CBotError n, int start, int end)
{
m_error = n;
m_start = start;
m_end = end;
m_data->error = n;
m_errStart = start;
m_data->errEnd = end;
}
////////////////////////////////////////////////////////////////////////////////
@ -260,48 +249,47 @@ bool CBotCStack::NextToken(CBotToken* &p)
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetProgram(CBotProgram* p)
{
m_prog = p;
m_data->prog = p;
}
////////////////////////////////////////////////////////////////////////////////
CBotProgram* CBotCStack::GetProgram()
{
return m_prog;
return m_data->prog;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetRetType(CBotTypResult& type)
{
m_retTyp = type;
m_data->retTyp = type;
}
////////////////////////////////////////////////////////////////////////////////
CBotTypResult CBotCStack::GetRetType()
{
return m_retTyp;
return m_data->retTyp;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetVar( CBotVar* var )
{
if (m_var) delete m_var; // replacement of a variable
m_var = var;
m_var.reset(var);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetCopyVar( CBotVar* var )
{
if (m_var) delete m_var; // replacement of a variable
m_var.reset();
if ( var == nullptr ) return;
m_var = CBotVar::Create("", var->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC));
m_var.reset(CBotVar::Create("", var->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC)));
m_var->Copy( var );
}
////////////////////////////////////////////////////////////////////////////////
CBotVar* CBotCStack::GetVar()
{
return m_var;
return m_var.get();
}
////////////////////////////////////////////////////////////////////////////////
@ -309,34 +297,70 @@ void CBotCStack::AddVar(CBotVar* pVar)
{
CBotCStack* p = this;
// returns to the father element
// find the level of the current block
while (p != nullptr && p->m_bBlock == 0) p = p->m_prev;
if ( p == nullptr ) return;
if (p == nullptr || pVar == nullptr) return;
CBotVar** pp = &p->m_listVar;
while ( *pp != nullptr ) pp = &(*pp)->m_next;
p->m_listVar.emplace_back(pVar);
}
*pp = pVar; // added after
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::CreateVarThis(CBotClass* pClass)
{
if ( pClass == nullptr ) return;
CBotVar* pThis = CBotVar::Create("this", CBotTypResult(CBotTypClass, pClass));
pThis->SetUniqNum(-2); // special ID for "this"
AddVar(pThis);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::CreateVarSuper(CBotClass* pClass)
{
if ( pClass == nullptr ) return;
CBotVar* pSuper = CBotVar::Create("super", CBotTypResult(CBotTypClass, pClass));
pSuper->SetUniqNum(-3); // special ID for "super"
AddVar(pSuper);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::CreateMemberVars(CBotClass* pClass, bool setDefined)
{
while (pClass != nullptr)
{
CBotVar* pv = pClass->GetVar();
while (pv != nullptr)
{
CBotVar* pcopy = CBotVar::Create(pv);
CBotVar::InitType initType = CBotVar::InitType::UNDEF;
if (setDefined || pv->IsStatic())
initType = CBotVar::InitType::DEF;
pcopy->SetInit(initType);
pcopy->SetUniqNum(pv->GetUniqNum());
pcopy->SetPrivate(pv->GetPrivate());
AddVar(pcopy);
pv = pv->GetNext();
}
pClass = pClass->GetParent();
}
}
////////////////////////////////////////////////////////////////////////////////
bool CBotCStack::CheckVarLocal(CBotToken* &pToken)
{
CBotCStack* p = this;
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
while (p != nullptr)
// find the level of the current block
while (p != nullptr && p->m_bBlock == 0) p = p->m_prev;
if (p != nullptr) for (auto& var : p->m_listVar)
{
CBotVar* pp = p->m_listVar;
while ( pp != nullptr)
{
if (name == pp->GetName())
return true;
pp = pp->m_next;
}
if ( p->m_bBlock ) return false;
p = p->m_prev;
if (name == var->GetName()) return true;
}
return false;
}
@ -347,10 +371,10 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId
nIdent = 0;
CBotTypResult val(-1);
val = m_prog->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
val = GetProgram()->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
if (val.GetType() < 0)
{
val = CBotFunction::CompileCall(m_prog->GetFunctions(), p->GetString(), ppVars, nIdent);
val = CBotFunction::CompileCall(p->GetString(), ppVars, nIdent, GetProgram());
if ( val.GetType() < 0 )
{
// pVar = nullptr; // the error is not on a particular parameter
@ -363,16 +387,19 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId
}
////////////////////////////////////////////////////////////////////////////////
bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam)
bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::string& className)
{
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
if ( m_prog->GetExternalCalls()->CheckCall(name) ) return true;
if ( GetProgram()->GetExternalCalls()->CheckCall(name) ) return true;
for (CBotFunction* pp : m_prog->GetFunctions())
for (CBotFunction* pp : GetProgram()->GetFunctions())
{
if ( pToken->GetString() == pp->GetName() )
if ( name == pp->GetName() )
{
// ignore methods for a different class
if ( className != pp->GetClassName() )
continue;
// are parameters exactly the same?
if ( pp->CheckParam( pParam ) )
return true;
@ -381,8 +408,11 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam)
for (CBotFunction* pp : CBotFunction::m_publicFunctions)
{
if ( pToken->GetString() == pp->GetName() )
if ( name == pp->GetName() )
{
// ignore methods for a different class
if ( className != pp->GetClassName() )
continue;
// are parameters exactly the same?
if ( pp->CheckParam( pParam ) )
return true;
@ -392,4 +422,4 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam)
return false;
}
}
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -22,6 +22,9 @@
#include "CBot/CBotVar/CBotVar.h"
#include "CBot/CBotProgram.h"
#include <list>
#include <memory>
namespace CBot
{
@ -100,6 +103,25 @@ public:
*/
void AddVar(CBotVar* p);
/*!
* \brief Create 'this' as a local variable.
* \param pClass The current class referred to by 'this'
*/
void CreateVarThis(CBotClass* pClass);
/*!
* \brief Create 'super' as a local variable.
* \param pClass The parent class referred to by 'super'
*/
void CreateVarSuper(CBotClass* pClass);
/*!
* \brief Create member variables of the current class as local variables.
* \param pClass The current class.
* \param setDefined Whether to mark the variables as initialized.
*/
void CreateMemberVars(CBotClass* pClass, bool setDefined);
/*!
* \brief FindVar Finds a variable. Seeks a variable on the stack the token
* may be a result of TokenTypVar (object of a class) or a pointer in the
@ -138,6 +160,11 @@ public:
*/
CBotCStack* TokenStack(CBotToken* pToken = nullptr, bool bBlock = false);
/*!
* \brief Deletes all subsequent stack frames created by TokenStack.
*/
void DeleteNext();
/*!
* \brief Return Transmits the result upper.
* \param p
@ -235,11 +262,12 @@ public:
/*!
* \brief CheckCall Test if a procedure name is already defined somewhere.
* \param pToken
* \param pParam
* \param pToken Token representing the name of a function.
* \param pParam List of parameters.
* \param className Name of a class when checking for methods.
* \return
*/
bool CheckCall(CBotToken* &pToken, CBotDefParam* pParam);
bool CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::string& className);
/*!
* \brief NextToken
@ -249,21 +277,20 @@ public:
bool NextToken(CBotToken* &p);
private:
CBotCStack* m_next;
std::unique_ptr<CBotCStack> m_next;
CBotCStack* m_prev;
static CBotError m_error;
static int m_end;
int m_start;
int m_errStart = 0;
struct Data;
CBotCStack::Data* m_data;
//! Result of the operations.
CBotVar* m_var;
std::unique_ptr<CBotVar> m_var;
//! Is part of a block (variables are local to this block).
bool m_bBlock;
CBotVar* m_listVar;
//! List of compiled functions.
static CBotProgram* m_prog;
static CBotTypResult m_retTyp;
std::list<std::unique_ptr<CBotVar>> m_listVar;
};
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -36,7 +36,6 @@
#include "CBot/CBotCStack.h"
#include "CBot/CBotDefParam.h"
#include "CBot/CBotUtils.h"
#include "CBot/CBotFileUtils.h"
#include <algorithm>
@ -316,7 +315,7 @@ CBotTypResult CBotClass::CompileMethode(CBotToken* name,
// find the methods declared by user
r = CBotFunction::CompileCall(m_pMethod, name->GetString(), ppParams, nIdent);
r = CBotFunction::CompileMethodCall(name->GetString(), ppParams, nIdent, pStack, this);
if ( r.Eq(CBotErrUndefCall) && m_parent != nullptr )
return m_parent->CompileMethode(name, pThis, ppParams, pStack, nIdent);
return r;
@ -333,7 +332,7 @@ bool CBotClass::ExecuteMethode(long& nIdent,
int ret = m_externalMethods->DoCall(pToken, pThis, ppParams, pStack, pResultType);
if (ret >= 0) return ret;
ret = CBotFunction::DoCall(m_pMethod, nIdent, pToken->GetString(), pThis, ppParams, pStack, pToken, this);
ret = CBotFunction::DoCall(nIdent, pToken->GetString(), pThis, ppParams, pStack, pToken, this);
if (ret >= 0) return ret;
if (m_parent != nullptr)
@ -356,7 +355,7 @@ void CBotClass::RestoreMethode(long& nIdent,
CBotClass* pClass = this;
while (pClass != nullptr)
{
bool ok = CBotFunction::RestoreCall(pClass->m_pMethod, nIdent, name->GetString(), pThis, ppParams, pStack, pClass);
bool ok = CBotFunction::RestoreCall(nIdent, name->GetString(), pThis, ppParams, pStack, pClass);
if (ok) return;
pClass = pClass->m_parent;
}
@ -364,69 +363,70 @@ void CBotClass::RestoreMethode(long& nIdent,
}
////////////////////////////////////////////////////////////////////////////////
bool CBotClass::SaveStaticState(FILE* pf)
bool CBotClass::SaveStaticState(std::ostream &ostr)
{
if (!WriteWord( pf, CBOTVERSION*2)) return false;
if (!WriteLong(ostr, CBOTVERSION*2)) return false;
// saves the state of static variables in classes
for (CBotClass* p : m_publicClasses)
{
if (!WriteWord( pf, 1 )) return false;
if (!WriteWord(ostr, 1)) return false;
// save the name of the class
if (!WriteString( pf, p->GetName() )) return false;
if (!WriteString(ostr, p->GetName())) return false;
CBotVar* pv = p->GetVar();
while( pv != nullptr )
{
if ( pv->IsStatic() )
{
if (!WriteWord( pf, 1 )) return false;
if (!WriteString( pf, pv->GetName() )) return false;
if (!WriteWord(ostr, 1)) return false;
if (!WriteString(ostr, pv->GetName())) return false;
if ( !pv->Save0State(pf) ) return false; // common header
if ( !pv->Save1State(pf) ) return false; // saves as the child class
if ( !WriteWord( pf, 0 ) ) return false;
if (!pv->Save0State(ostr)) return false; // common header
if (!pv->Save1State(ostr)) return false; // saves as the child class
if (!WriteWord(ostr, 0)) return false;
}
pv = pv->GetNext();
}
if (!WriteWord( pf, 0 )) return false;
if (!WriteWord(ostr, 0)) return false;
}
if (!WriteWord( pf, 0 )) return false;
if (!WriteWord(ostr, 0)) return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotClass::RestoreStaticState(FILE* pf)
bool CBotClass::RestoreStaticState(std::istream &istr)
{
std::string ClassName, VarName;
CBotClass* pClass;
unsigned short w;
if (!ReadWord( pf, w )) return false;
if ( w != CBOTVERSION*2 ) return false;
long version;
if (!ReadLong(istr, version)) return false;
if (version != CBOTVERSION*2) return false;
while (true)
{
if (!ReadWord( pf, w )) return false;
if (!ReadWord(istr, w)) return false;
if ( w == 0 ) return true;
if (!ReadString( pf, ClassName )) return false;
if (!ReadString(istr, ClassName)) return false;
pClass = Find(ClassName);
while (true)
{
if (!ReadWord( pf, w )) return false;
if (!ReadWord(istr, w)) return false;
if ( w == 0 ) break;
CBotVar* pVar = nullptr;
CBotVar* pv = nullptr;
if (!ReadString( pf, VarName )) return false;
if (!ReadString(istr, VarName)) return false;
if ( pClass != nullptr ) pVar = pClass->GetItem(VarName);
if (!CBotVar::RestoreState(pf, pv)) return false; // the temp variable
if (!CBotVar::RestoreState(istr, pv)) return false; // the temp variable
if ( pVar != nullptr ) pVar->Copy(pv);
delete pv;
@ -542,6 +542,11 @@ void CBotClass::DefineClasses(std::list<CBotClass*> pClassList, CBotCStack* pSta
}
}
const std::list<CBotFunction*>& CBotClass::GetFunctions() const
{
return m_pMethod;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
{
@ -600,8 +605,8 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
// return a method precompiled in pass 1
CBotCStack* pStk = pStack->TokenStack(nullptr, true);
CBotDefParam* params = CBotDefParam::Compile(p, pStk );
delete pStk;
std::list<CBotFunction*>::iterator pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, &params](CBotFunction* x)
pStack->DeleteNext();
auto pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, &params](CBotFunction* x)
{
return x->GetName() == pp && x->CheckParam( params );
});
@ -609,45 +614,8 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
CBotFunction* pf = *pfIter;
delete params;
bool bConstructor = (pp == GetName());
CBotCStack* pile = pStack->TokenStack(nullptr, true);
// make "this" known
CBotToken TokenThis(std::string("this"), std::string());
CBotVar* pThis = CBotVar::Create(TokenThis, CBotTypResult( CBotTypClass, this ) );
pThis->SetUniqNum(-2);
pile->AddVar(pThis);
if (m_parent)
{
// makes "super" known
CBotToken TokenSuper(std::string("super"), std::string());
CBotVar* pThis = CBotVar::Create(TokenSuper, CBotTypResult(CBotTypClass, m_parent) );
pThis->SetUniqNum(-3);
pile->AddVar(pThis);
}
// int num = 1;
CBotClass* my = this;
while (my != nullptr)
{
// places a copy of variables of a class (this) on a stack
CBotVar* pv = my->m_pVar;
while (pv != nullptr)
{
CBotVar* pcopy = CBotVar::Create(pv);
CBotVar::InitType initType = CBotVar::InitType::UNDEF;
if (!bConstructor || pv->IsStatic())
initType = CBotVar::InitType::DEF;
pcopy->SetInit(initType);
pcopy->SetUniqNum(pv->GetUniqNum());
pcopy->SetPrivate(pv->GetPrivate());
pile->AddVar(pcopy);
pv = pv->GetNext();
}
my = my->m_parent;
}
// compiles a method
p = pBase;
CBotFunction* f =
@ -658,7 +626,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
f->m_pProg = pStack->GetProgram();
f->m_bSynchro = bSynchro;
}
pStack->Return(nullptr, pile);
pStack->DeleteNext();
}
return pStack->IsOk();

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -303,6 +303,12 @@ public:
*/
static void DefineClasses(std::list<CBotClass*> pClassList, CBotCStack* pStack);
/*!
* \brief Get the list of user-defined methods in this class.
* \return List of methods, can be empty.
*/
const std::list<CBotFunction*>& GetFunctions() const;
/*!
* \brief CompileDefItem
* \param p
@ -331,18 +337,18 @@ public:
static void ClearPublic();
/*!
* \brief SaveStaticState
* \param pf
* \return
* \brief Save all static variables from each public class
* \param ostr Output stream
* \return true on success
*/
static bool SaveStaticState(FILE* pf);
static bool SaveStaticState(std::ostream &ostr);
/*!
* \brief RestoreStaticState
* \param pf
* \return
* \brief Restore all static variables in each public class
* \param istr Input stream
* \return true on success
*/
static bool RestoreStaticState(FILE* pf);
static bool RestoreStaticState(std::istream &istr);
/**
* \brief Request a lock on this class (for "synchronized" keyword)

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -64,10 +64,8 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
if (list == nullptr) list = param;
else list->AddNext(param); // added to the list
// CBotClass* pClass = nullptr;//= CBotClass::Find(p);
param->m_typename = p->GetString();
CBotTypResult type = param->m_type = TypeParam(p, pStack);
// if ( type == CBotTypPointer ) type = CBotTypClass; // we must create a new object
if (param->m_type.GetType() > 0)
{
@ -96,7 +94,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
prevHasDefault = true;
}
else pStack->SetError(CBotErrNoExpression, p);
delete pStk;
pStack->DeleteNext();
}
else
if (prevHasDefault) pStack->SetError(CBotErrDefaultValue, p->GetPrev());
@ -105,7 +103,6 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
if ( type.Eq(CBotTypArrayPointer) ) type.SetType(CBotTypArrayBody);
CBotVar* var = CBotVar::Create(pp->GetString(), type); // creates the variable
// if ( pClass ) var->SetClass(pClass);
var->SetInit(CBotVar::InitType::IS_POINTER); // mark initialized
param->m_nIdent = CBotVar::NextUniqNum();
var->SetUniqNum(param->m_nIdent);
@ -140,6 +137,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
while ( p != nullptr )
{
pile = pile->AddStack();
if (pile->StackOver()) return pj->Return(pile);
if (pile->GetState() == 1) // already done?
{
if (ppVars != nullptr && ppVars[i] != nullptr) ++i;
@ -151,13 +149,12 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
if (useDefault || (ppVars == nullptr || ppVars[i] == nullptr))
{
assert(p->m_expr != nullptr);
useDefault = true;
if (!p->m_expr->Execute(pile)) return false; // interupt here
pVar = pile->GetVar();
useDefault = true; // end of arguments found
if (p->m_expr != nullptr) // has default expression ?
{
if (!p->m_expr->Execute(pile)) return false; // interupt here
pVar = pile->GetVar();
}
}
else
pVar = ppVars[i];
@ -173,14 +170,34 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
{
switch (p->m_type.GetType())
{
case CBotTypByte:
newvar->SetValByte(pVar->GetValByte());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypShort:
newvar->SetValShort(pVar->GetValShort());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypChar:
newvar->SetValChar(pVar->GetValChar());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypInt:
newvar->SetValInt(pVar->GetValInt());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypLong:
newvar->SetValLong(pVar->GetValLong());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypFloat:
newvar->SetValFloat(pVar->GetValFloat());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypDouble:
newvar->SetValDouble(pVar->GetValDouble());
newvar->SetInit(pVar->GetInit()); // copy nan
break;
case CBotTypString:
newvar->SetValString(pVar->GetValString());
break;

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -35,13 +35,13 @@ namespace CBot
enum CBotType
{
CBotTypVoid = 0, //!< void
CBotTypByte = 1, //!< byte (NOT IMPLEMENTED)
CBotTypShort = 2, //!< short (NOT IMPLEMENTED)
CBotTypChar = 3, //!< char (NOT IMPLEMENTED)
CBotTypByte = 1, //!< byte
CBotTypShort = 2, //!< short
CBotTypChar = 3, //!< char
CBotTypInt = 4, //!< int
CBotTypLong = 5, //!< long (NOT IMPLEMENTED)
CBotTypLong = 5, //!< long
CBotTypFloat = 6, //!< float
CBotTypDouble = 7, //!< double (NOT IMPLEMENTED)
CBotTypDouble = 7, //!< double
CBotTypBoolean = 8, //!< bool
CBotTypString = 9, //!< string
@ -100,12 +100,18 @@ enum TokenId
ID_STATIC,
ID_PROTECTED,
ID_PRIVATE,
ID_REPEAT,
ID_INT,
ID_FLOAT,
ID_BOOLEAN,
ID_STRING,
ID_VOID,
ID_BOOL,
ID_BYTE,
ID_SHORT,
ID_CHAR,
ID_LONG,
ID_DOUBLE,
TokenKeyVal = 2200, //!< keywords that represent values (true, false, null, nan)
ID_TRUE = 2200,
@ -177,7 +183,8 @@ enum TokenType
TokenTypNum = 2, //!< number
TokenTypString = 3, //!< string
TokenTypVar = 4, //!< a variable name
TokenTypDef = 5 //!< value according DefineNum
TokenTypDef = 5, //!< value according DefineNum
TokenTypChar = 6, //!< character literal
};
/**
@ -247,6 +254,8 @@ enum CBotError : int
CBotErrHexDigits = 5052, //!< missing hex digits after escape sequence
CBotErrHexRange = 5053, //!< hex value out of range
CBotErrUnicodeName = 5054, //!< invalid universal character name
CBotErrCharEmpty = 5055, //!< empty character constant
CBotErrRedefCase = 5056, //!< duplicate label in switch
// Runtime errors
CBotErrZeroDiv = 6000, //!< division by zero

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -82,19 +82,23 @@ int CBotExternalCallList::DoCall(CBotToken* token, CBotVar* thisVar, CBotVar** p
CBotExternalCall* pt = m_list[token->GetString()].get();
if (pStack->IsCallFinished()) return true;
CBotStack* pile = pStack->AddStackExternalCall(pt);
if (thisVar == nullptr && pStack->IsCallFinished()) return true; // only for non-method external call
// lists the parameters depending on the contents of the stack (pStackVar)
CBotVar* pVar = MakeListVars(ppVar, true);
// if this is a method call we need to use AddStack()
CBotStack* pile = (thisVar != nullptr) ? pStack->AddStack() : pStack->AddStackExternalCall(pt);
// creates a variable to the result
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
if (pile->GetState() == 0) // the first time?
{
// lists the parameters depending on the contents of the stack
CBotVar* pVar = MakeListVars(ppVar, true);
pile->SetVar(pVar);
pile->SetVar(pVar);
CBotStack* pile2 = pile->AddStack();
pile2->SetVar(pResult);
CBotStack* pile2 = pile->AddStack();
// creates a variable to the result
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
pile2->SetVar(pResult);
pile->IncState(); // increment state to mark this step done
}
pile->SetError(CBotNoErr, token); // save token for the position in case of error
return pt->Run(thisVar, pStack);
@ -107,7 +111,8 @@ bool CBotExternalCallList::RestoreCall(CBotToken* token, CBotVar* thisVar, CBotV
CBotExternalCall* pt = m_list[token->GetString()].get();
CBotStack* pile = pStack->RestoreStackEOX(pt);
// if this is a method call we need to use RestoreStack()
CBotStack* pile = (thisVar != nullptr) ? pStack->RestoreStack() : pStack->RestoreStackEOX(pt);
if (pile == nullptr) return true;
pile->RestoreStack();
@ -163,8 +168,7 @@ bool CBotExternalCallDefault::Run(CBotVar* thisVar, CBotStack* pStack)
return false;
}
if (result != nullptr) pStack->SetCopyVar(result);
pStack->Return(pile2); // return 'result' and clear extra stack
return true;
}
@ -187,8 +191,8 @@ CBotTypResult CBotExternalCallClass::Compile(CBotVar* thisVar, CBotVar* args, vo
bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
{
if (pStack->IsCallFinished()) return true;
CBotStack* pile = pStack->AddStackExternalCall(this);
assert(thisVar != nullptr);
CBotStack* pile = pStack->AddStack();
CBotVar* args = pile->GetVar();
CBotStack* pile2 = pile->AddStack();
@ -207,9 +211,8 @@ bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
return false;
}
if (result != nullptr) pStack->SetCopyVar(result);
pStack->Return(pile2); // return 'result' and clear extra stack
return true;
}
}
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -21,129 +21,285 @@
#include "CBot/CBotClass.h"
#include "CBot/CBotEnums.h"
#include "CBot/CBotUtils.h"
namespace CBot
{
// file management
// necessary because it is not possible to do the fopen in the main program
// fwrite and fread in a dll or using the FILE * returned.
////////////////////////////////////////////////////////////////////////////////
FILE* fOpen(const char* name, const char* mode)
template<typename T>
static bool WriteBinary(std::ostream &ostr, T value, unsigned padTo = 0)
{
return fopen(name, mode);
}
////////////////////////////////////////////////////////////////////////////////
int fClose(FILE* filehandle)
{
return fclose(filehandle);
}
////////////////////////////////////////////////////////////////////////////////
std::size_t fWrite(const void *buffer,
std::size_t elemsize,
std::size_t length,
FILE* filehandle)
{
return fwrite(buffer, elemsize, length, filehandle);
}
////////////////////////////////////////////////////////////////////////////////
std::size_t fRead(void *buffer,
std::size_t elemsize,
std::size_t length,
FILE* filehandle)
{
return fread(buffer, elemsize, length, filehandle);
}
////////////////////////////////////////////////////////////////////////////////
bool ReadWord(FILE* pf, unsigned short& w)
{
size_t lg;
lg = fread(&w, sizeof( unsigned short ), 1, pf );
return (lg == 1);
}
////////////////////////////////////////////////////////////////////////////////
bool ReadFloat(FILE* pf, float& w)
{
size_t lg;
lg = fread(&w, sizeof( float ), 1, pf );
return (lg == 1);
}
////////////////////////////////////////////////////////////////////////////////
bool WriteLong(FILE* pf, long w)
{
size_t lg;
lg = fwrite(&w, sizeof( long ), 1, pf );
return (lg == 1);
}
////////////////////////////////////////////////////////////////////////////////
bool ReadLong(FILE* pf, long& w)
{
size_t lg;
lg = fread(&w, sizeof( long ), 1, pf );
return (lg == 1);
}
////////////////////////////////////////////////////////////////////////////////
bool ReadString(FILE* pf, std::string& s)
{
unsigned short w;
char buf[1000];
size_t lg1, lg2;
if (!ReadWord(pf, w)) return false;
lg1 = w;
lg2 = fread(buf, 1, lg1, pf );
buf[lg2] = 0;
s = buf;
return (lg1 == lg2);
}
////////////////////////////////////////////////////////////////////////////////
bool WriteType(FILE* pf, const CBotTypResult &type)
{
int typ = type.GetType();
if ( typ == CBotTypIntrinsic ) typ = CBotTypClass;
if ( !WriteWord(pf, typ) ) return false;
if ( typ == CBotTypClass )
unsigned char chr;
unsigned count = 1;
while (value > 127) // unsigned LEB128
{
CBotClass* p = type.GetClass();
if ( !WriteString(pf, p->GetName()) ) return false;
++count;
chr = (value & 0x7F) | 0x80;
if (!ostr.write(reinterpret_cast<char*>(&chr), 1)) return false;
value >>= 7;
}
if ( type.Eq( CBotTypArrayBody ) ||
type.Eq( CBotTypArrayPointer ) )
chr = value & 0x7F;
if (count < padTo) chr |= 0x80;
if (!ostr.write(reinterpret_cast<char*>(&chr), 1)) return false;
if (count < padTo)
{
if ( !WriteWord(pf, type.GetLimite()) ) return false;
if ( !WriteType(pf, type.GetTypElem()) ) return false;
while (++count < padTo)
if (!(ostr << '\x80')) return false;
if (!(ostr << '\x00')) return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool ReadType(FILE* pf, CBotTypResult &type)
template<typename T>
static bool ReadBinary(std::istream &istr, T &value)
{
value = 0;
unsigned char chr;
unsigned shift = 0;
while (true) // unsigned LEB128
{
if (!istr.read(reinterpret_cast<char*>(&chr), 1)) return false;
if (shift < sizeof(T) * 8 - 1)
value |= static_cast<T>(chr & 0x7F) << shift;
shift += 7;
if ((chr & 0x80) == 0) break;
}
return true;
}
template<typename T>
static bool WriteSignedBinary(std::ostream &ostr, T value, unsigned padTo = 0)
{
signed char sign = value >> (8 * sizeof(T) - 1);
unsigned count = 0;
while (true) // signed LEB128
{
++count;
unsigned char chr = value & 0x7F;
value >>= 7;
if (!(value != sign || ((chr ^ sign) & 0x40) != 0))
{
if (count < padTo) chr |= 0x80;
if (!ostr.write(reinterpret_cast<char*>(&chr), 1)) return false;
break;
}
chr |= 0x80;
if (!ostr.put(chr)) return false;
}
if (count < padTo)
{
char chr = (sign < 0) ? 0x7F : 0x00;
while (++count < padTo)
if (!ostr.put(chr | 0x80)) return false;
if (!ostr.put(chr)) return false;
}
return true;
}
template<typename T>
static bool ReadSignedBinary(std::istream &istr, T &value)
{
value = 0;
unsigned char chr;
unsigned shift = 0;
while (true) // signed LEB128
{
if (!istr.read(reinterpret_cast<char*>(&chr), 1)) return false;
if (shift < sizeof(T) * 8 - 1)
value |= (static_cast<T>(chr & 0x7F) << shift);
shift += 7;
if ((chr & 0x80) == 0) break;
}
if (shift >= 8 * sizeof(T) - 1) shift = 8 * sizeof(T) - 1;
if ((chr & 0x40) != 0)
value |= static_cast<T>(-1) << shift;
return true;
}
bool WriteWord(std::ostream &ostr, unsigned short w)
{
return WriteBinary<unsigned short>(ostr, w);
}
bool ReadWord(std::istream &istr, unsigned short &w)
{
return ReadBinary<unsigned short>(istr, w);
}
bool WriteByte(std::ostream &ostr, char c)
{
if (!ostr.put(c)) return false;
return true;
}
bool ReadByte(std::istream &istr, char& c)
{
if (!istr.get(c)) return false;
return true;
}
bool WriteShort(std::ostream &ostr, short s)
{
return WriteSignedBinary<short>(ostr, s);
}
bool ReadShort(std::istream &istr, short &s)
{
return ReadSignedBinary<short>(istr, s);
}
bool WriteUInt32(std::ostream &ostr, uint32_t i)
{
return WriteBinary<uint32_t>(ostr, i);
}
bool ReadUInt32(std::istream &istr, uint32_t &i)
{
return ReadBinary<uint32_t>(istr, i);
}
bool WriteInt(std::ostream &ostr, int i)
{
return WriteSignedBinary<int>(ostr, i);
}
bool ReadInt(std::istream &istr, int &i)
{
return ReadSignedBinary<int>(istr, i);
}
bool WriteLong(std::ostream &ostr, long l, unsigned padTo)
{
return WriteSignedBinary<long>(ostr, l, padTo);
}
bool ReadLong(std::istream &istr, long &l)
{
return ReadSignedBinary<long>(istr, l);
}
bool WriteFloat(std::ostream &ostr, float f)
{
union TypeConverter
{
float fValue;
unsigned int iValue;
};
TypeConverter u;
u.fValue = 0.0f;
u.iValue = 0;
u.fValue = f;
return WriteBinary<unsigned int>(ostr, u.iValue);
}
bool ReadFloat(std::istream &istr, float &f)
{
union TypeConverter
{
float fValue;
unsigned int iValue;
};
TypeConverter u;
u.fValue = 0.0f;
u.iValue = 0;
if (!ReadBinary<unsigned int>(istr, u.iValue)) return false;
f = u.fValue;
return true;
}
bool WriteDouble(std::ostream &ostr, double d)
{
union TypeConverter
{
double dValue;
unsigned long iValue;
};
TypeConverter u;
u.dValue = 0.0;
u.iValue = 0;
u.dValue = d;
return WriteBinary<unsigned long>(ostr, u.iValue);
}
bool ReadDouble(std::istream &istr, double &d)
{
union TypeConverter
{
double dValue;
unsigned long iValue;
};
TypeConverter u;
u.dValue = 0.0;
u.iValue = 0;
if (!ReadBinary<unsigned long>(istr, u.iValue)) return false;
d = u.dValue;
return true;
}
bool WriteString(std::ostream &ostr, const std::string &s)
{
if (!WriteBinary<size_t>(ostr, s.size())) return false;
if (!ostr.write(&(s[0]), s.size())) return false;
return true;
}
bool ReadString(std::istream &istr, std::string &s)
{
size_t length = 0;
if (!ReadBinary<size_t>(istr, length)) return false;
s.resize(length);
if (length != 0)
{
if (!istr.read(&(s[0]), length)) return false;
}
return true;
}
bool WriteType(std::ostream &ostr, const CBotTypResult &type)
{
int typ = type.GetType();
if ( typ == CBotTypIntrinsic ) typ = CBotTypClass;
if ( !WriteWord(ostr, typ) ) return false;
if ( typ == CBotTypClass )
{
CBotClass* p = type.GetClass();
if (!WriteString(ostr, p->GetName())) return false;
}
if ( type.Eq( CBotTypArrayBody ) ||
type.Eq( CBotTypArrayPointer ) )
{
if (!WriteWord(ostr, type.GetLimite())) return false;
if (!WriteType(ostr, type.GetTypElem())) return false;
}
if ( type.Eq(CBotTypPointer) )
{
if (type.GetClass() != nullptr)
{
if (!WriteString(ostr, type.GetClass()->GetName())) return false;
}
else if (!WriteString(ostr, "")) return false;
}
return true;
}
bool ReadType(std::istream &istr, CBotTypResult &type)
{
unsigned short w, ww;
if ( !ReadWord(pf, w) ) return false;
if (!ReadWord(istr, w)) return false;
type.SetType(w);
if ( type.Eq( CBotTypIntrinsic ) )
@ -154,7 +310,7 @@ bool ReadType(FILE* pf, CBotTypResult &type)
if ( type.Eq( CBotTypClass ) )
{
std::string s;
if ( !ReadString(pf, s) ) return false;
if (!ReadString(istr, s)) return false;
type = CBotTypResult( w, s );
}
@ -162,11 +318,45 @@ bool ReadType(FILE* pf, CBotTypResult &type)
type.Eq( CBotTypArrayBody ) )
{
CBotTypResult r;
if ( !ReadWord(pf, ww) ) return false;
if ( !ReadType(pf, r) ) return false;
if (!ReadWord(istr, ww)) return false;
if (!ReadType(istr, r)) return false;
type = CBotTypResult( w, r );
type.SetLimite(static_cast<short>(ww));
}
if ( type.Eq(CBotTypPointer) )
{
std::string className;
if (!ReadString(istr, className)) return false;
type = CBotTypResult(w, className);
}
return true;
}
bool WriteStream(std::ostream &ostr, std::istream& istr)
{
if (!istr.seekg(0, istr.end)) return false;
auto size = istr.tellg();
if (size == 0) return WriteLong(ostr, 0);
if (!WriteLong(ostr, size)) return false;
if (!istr.seekg(0, istr.beg)) return false;
if (!(ostr << istr.rdbuf())) return false;
return true;
}
bool ReadStream(std::istream& istr, std::ostream &ostr)
{
long length;
if (!ReadLong(istr, length)) return false;
if (length == 0) return true;
while (length-- > 0)
{
if (!(ostr << istr.get())) return false;
}
return true;
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -19,7 +19,7 @@
#pragma once
#include <cstdio>
#include <iostream>
#include <string>
namespace CBot
@ -28,128 +28,189 @@ namespace CBot
class CBotVar;
class CBotTypResult;
///////////////////////////////////////////////////////////////////////////////
// routines for file management (* FILE)
/*!
* \brief fOpen
* \param name
* \param mode
* \return
* \brief Save a linked list if variables
* \param ostr Output stream
* \param pVar First variable in the list
* \return true on success
*/
FILE* fOpen(const char* name, const char* mode);
/*!
* \brief fClose
* \param filehandle
* \return
*/
int fClose(FILE* filehandle);
/*!
* \brief fWrite
* \param buffer
* \param elemsize
* \param length
* \param filehandle
* \return
*/
std::size_t fWrite(const void *buffer,
std::size_t elemsize,
std::size_t length,
FILE* filehandle);
/*!
* \brief fRead
* \param buffer
* \param elemsize
* \param length
* \param filehandle
* \return
*/
std::size_t fRead(void *buffer,
std::size_t elemsize,
std::size_t length,
FILE* filehandle);
/*!
* \brief SaveVars
* \param pf
* \param pVar
* \return
*/
bool SaveVars(FILE* pf, CBotVar* pVar);
bool SaveVars(std::ostream &ostr, CBotVar* pVar);
/*!
* \brief WriteWord
* \param pf
* \param ostr Output stream
* \param w
* \return
* \return true on success
*/
bool WriteWord(FILE* pf, unsigned short w);
bool WriteWord(std::ostream &ostr, unsigned short w);
/*!
* \brief ReadWord
* \param pf
* \param w
* \return
* \param istr Input stream
* \param[out] w
* \return true on success
*/
bool ReadWord(FILE* pf, unsigned short& w);
bool ReadWord(std::istream &istr, unsigned short &w);
/*!
* \brief ReadLong
* \param pf
* \param w
* \return
* \brief WriteByte
* \param ostr Output stream
* \param c
* \return true on success
*/
bool ReadLong(FILE* pf, long& w);
bool WriteByte(std::ostream &ostr, char c);
/*!
* \brief WriteFloat
* \param pf
* \param w
* \return
* \brief ReadByte
* \param istr Input stream
* \param[out] c
* \return true on success
*/
bool WriteFloat(FILE* pf, float w);
bool ReadByte(std::istream &istr, char& c);
/*!
* \brief WriteShort
* \param ostr Output stream
* \param s
* \return true on success
*/
bool WriteShort(std::ostream &ostr, short s);
/*!
* \brief ReadShort
* \param istr Input stream
* \param[out] s
* \return true on success
*/
bool ReadShort(std::istream &istr, short &s);
/*!
* \brief WriteUInt32
* \param ostr Output stream
* \param i
* \return true on success
*/
bool WriteUInt32(std::ostream &ostr, uint32_t i);
/*!
* \brief ReadUInt32
* \param istr Input stream
* \param[out] i
* \return true on success
*/
bool ReadUInt32(std::istream &istr, uint32_t &i);
/*!
* \brief WriteInt
* \param ostr Output stream
* \param i
* \return true on success
*/
bool WriteInt(std::ostream &ostr, int i);
/*!
* \brief ReadInt
* \param istr Input stream
* \param[out] i
* \return true on success
*/
bool ReadInt(std::istream &istr, int &i);
/*!
* \brief WriteLong
* \param pf
* \param w
* \return
* \param ostr Output stream
* \param l
* \param padTo minimum number of bytes to write
* \return true on success
*/
bool WriteLong(FILE* pf, long w);
bool WriteLong(std::ostream &ostr, long l, unsigned padTo = 0);
/*!
* \brief ReadLong
* \param istr Input stream
* \param[out] l
* \return true on success
*/
bool ReadLong(std::istream &istr, long &l);
/*!
* \brief WriteFloat
* \param ostr Output stream
* \param f
* \return true on success
*/
bool WriteFloat(std::ostream &ostr, float f);
/*!
* \brief ReadFloat
* \param pf
* \param w
* \return
* \param istr Input stream
* \param[out] f
* \return true on success
*/
bool ReadFloat(FILE* pf, float& w);
bool ReadFloat(std::istream &istr, float &f);
/*!
* \brief WriteDouble
* \param ostr Output stream
* \param d
* \return true on success
*/
bool WriteDouble(std::ostream &ostr, double d);
/*!
* \brief ReadDouble
* \param istr Input stream
* \param[out] d
* \return true on success
*/
bool ReadDouble(std::istream &istr, double &d);
/*!
* \brief WriteString
* \param ostr Output stream
* \param s
* \return true on success
*/
bool WriteString(std::ostream &ostr, const std::string &s);
/*!
* \brief ReadString
* \param pf
* \param s
* \return
* \param istr Input stream
* \param[out] s
* \return true on success
*/
bool ReadString(FILE* pf, std::string& s);
bool ReadString(std::istream &istr, std::string &s);
/*!
* \brief WriteType
* \param pf
* \param ostr Output stream
* \param type
* \return
* \return true on success
*/
bool WriteType(FILE* pf, const CBotTypResult &type);
bool WriteType(std::ostream &ostr, const CBotTypResult &type);
/*!
* \brief ReadType
* \param pf
* \param type
* \return
* \param istr Input stream
* \param[out] type
* \return true on success
*/
bool ReadType(FILE* pf, CBotTypResult &type);
bool ReadType(std::istream &istr, CBotTypResult &type);
/*!
* \brief WriteStream
* \param ostr Output stream
* \param istr Input stream
* \return true on success
*/
bool WriteStream(std::ostream &ostr, std::istream& istr);
/*!
* \brief ReadStream
* \param istr Input stream
* \param ostr Output stream
* \return true on success
*/
bool ReadStream(std::istream& istr, std::ostream &ostr);
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -19,7 +19,7 @@
#include "CBot/CBotInstr/CBotCase.h"
#include "CBot/CBotInstr/CBotExprLitNum.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -30,69 +30,107 @@ namespace CBot
////////////////////////////////////////////////////////////////////////////////
CBotCase::CBotCase()
{
m_value = nullptr;
m_instr = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotCase::~CBotCase()
{
delete m_value;
delete m_instr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack)
CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack, std::unordered_map<long, CBotInstr*>& labels)
{
CBotCase* inst = new CBotCase(); // creates the object
CBotToken* pp = p; // preserves at the ^ token (starting position)
inst->SetToken(p);
if (!IsOfType(p, ID_CASE, ID_DEFAULT)) return nullptr; // should never happen
pStack->SetStartError(pp->GetStart());
if ( pp->GetType() == ID_CASE )
long labelValue = 0;
if (pp->GetType() == ID_CASE)
{
pp = p;
inst->m_value = CBotExprLitNum::Compile(p, pStack);
if (inst->m_value == nullptr )
CBotInstr* i = nullptr;
if (nullptr != (i = CBotTwoOpExpr::Compile(p, pStack, nullptr, true)))
{
pStack->SetError( CBotErrBadNum, pp );
delete inst;
return nullptr;
if (pStack->GetType() <= CBotTypLong)
{
CBotStack* pile = CBotStack::AllocateStack();
while ( !i->Execute(pile) );
labelValue = pile->GetVar()->GetValLong();
pile->Delete();
if (labels.count(labelValue) > 0)
{
pStack->SetError(CBotErrRedefCase, p->GetStart());
}
}
else
pStack->SetError(CBotErrBadNum, p->GetStart());
delete i;
}
}
if ( !IsOfType( p, ID_DOTS ))
{
pStack->SetError( CBotErrNoDoubleDots, p->GetStart() );
delete inst;
return nullptr;
else
pStack->SetError(CBotErrBadNum, p->GetStart());
}
return inst;
if (pStack->IsOk() && IsOfType(p, ID_DOTS))
{
CBotCase* newCase = new CBotCase();
newCase->SetToken(pp);
if (pp->GetType() == ID_CASE)
labels[labelValue] = newCase;
return newCase;
}
pStack->SetError(CBotErrNoDoubleDots, p->GetStart());
return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotCase::Execute(CBotStack* &pj)
{
return true; // the "case" statement does nothing!
if (m_instr == nullptr) return true;
CBotStack* pile = pj->AddStack(this, CBotStack::BlockVisibilityType::BLOCK);
int state = pile->GetState();
CBotInstr* p = m_instr;
while (state-- > 0) p = p->GetNext();
while (p != nullptr)
{
if (!p->Execute(pile)) return false;
pile->IncState();
p = p->GetNext();
}
pile->Delete();
return pj->IsOk();
}
////////////////////////////////////////////////////////////////////////////////
void CBotCase::RestoreState(CBotStack* &pj, bool bMain)
{
}
if (!bMain) return;
////////////////////////////////////////////////////////////////////////////////
bool CBotCase::CompCase(CBotStack* &pile, int val)
{
if (m_value == nullptr ) return true; // "default" case
CBotStack* pile = pj->RestoreStack(this);
if (pile == nullptr) return;
while (!m_value->Execute(pile)); // puts the value on the correspondent stack (without interruption)
return (pile->GetVal() == val); // compared with the given value
CBotInstr* p = m_instr;
int state = pile->GetState();
while (p != nullptr && state-- > 0)
{
p->RestoreState(pile, bMain);
p = p->GetNext();
}
if (p != nullptr) p->RestoreState(pile, bMain);
}
std::map<std::string, CBotInstr*> CBotCase::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_value"] = m_value;
links["m_instr"] = m_instr;
return links;
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -21,6 +21,8 @@
#include "CBot/CBotInstr/CBotInstr.h"
#include <unordered_map>
namespace CBot
{
@ -42,7 +44,7 @@ public:
* \param pStack
* \return
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack);
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, std::unordered_map<long, CBotInstr*>& labels);
/*!
* \brief Execute Execution of instruction "case".
@ -58,22 +60,15 @@ public:
*/
void RestoreState(CBotStack* &pj, bool bMain) override;
/*!
* \brief CompCase Routine to find the entry point of "case" corresponding
* to the value seen.
* \param pj
* \param val
* \return
*/
bool CompCase(CBotStack* &pj, int val) override;
protected:
virtual const std::string GetDebugName() override { return "CBotCase"; }
virtual std::map<std::string, CBotInstr*> GetDebugLinks() override;
private:
//! Value to compare.
CBotInstr* m_value;
//! List of instructions after case label
CBotInstr* m_instr;
friend class CBotSwitch;
};
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -135,12 +135,12 @@ CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* p
// the constructor is there?
// std::string noname;
CBotTypResult r = pClass->CompileMethode(&token, var, ppVars, pStk, inst->m_nMethodeIdent);
delete pStk->TokenStack(); // releases the supplement stack
pStk->DeleteNext(); // releases the supplement stack
int typ = r.GetType();
if (typ == CBotErrUndefCall)
{
// si le constructeur n'existe pas
// if the ctor don't exist
if (inst->m_parameters != nullptr) // with parameters
{
pStk->SetError(CBotErrNoConstruct, vartoken);
@ -160,7 +160,7 @@ CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* p
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStk, true)))
{
inst->m_exprRetVar->SetToken(vartoken);
delete pStk->TokenStack();
pStk->DeleteNext();
}
pStk->SetVar(nullptr);
@ -360,6 +360,7 @@ bool CBotDefClass::Execute(CBotStack* &pj)
if ( p != nullptr) while ( true )
{
pile2 = pile2->AddStack(); // place on the stack for the results
if (pile2->StackOver()) return pj->Return(pile2);
if ( pile2->GetState() == 0 )
{
if (!p->Execute(pile2)) return false; // interrupted here?

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -46,13 +46,22 @@ CBotDefFloat::~CBotDefFloat()
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip, CBotTypResult vartype)
{
CBotToken* pp = cont ? nullptr : p;
if (!cont && !IsOfType(p, ID_FLOAT)) return nullptr;
if (!cont)
{
switch (p->GetType())
{
case ID_FLOAT: vartype.SetType(CBotTypFloat ); break;
case ID_DOUBLE: vartype.SetType(CBotTypDouble); break;
default: return nullptr;
}
p = p->GetNext();
}
CBotDefFloat* inst = static_cast<CBotDefFloat*>(CompileArray(p, pStack, CBotTypFloat));
CBotDefFloat* inst = static_cast<CBotDefFloat*>(CompileArray(p, pStack, vartype));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
@ -67,7 +76,7 @@ CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, b
if (nullptr != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypFloat;
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = vartype;
if (pStk->CheckVarLocal(vartoken)) // redefinition of a variable
{
pStk->SetStartError(vartoken->GetStart());
@ -79,7 +88,7 @@ CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, b
{
delete inst;
p = vartoken;
inst = static_cast<CBotDefFloat*>(CBotDefArray::Compile(p, pStk, CBotTypFloat));
inst = static_cast<CBotDefFloat*>(CBotDefArray::Compile(p, pStk, vartype));
goto suite; // no assignment, variable already created
}
@ -103,7 +112,7 @@ CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, b
}
}
var = CBotVar::Create(*vartoken, CBotTypFloat);
var = CBotVar::Create(*vartoken, vartype);
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF);
var->SetUniqNum(
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
@ -111,7 +120,7 @@ CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, b
suite:
if (pStk->IsOk() && IsOfType(p, ID_COMMA))
{
if (nullptr != ( inst->m_next2b = CBotDefFloat::Compile(p, pStk, true, noskip)))
if (nullptr != ( inst->m_next2b = CBotDefFloat::Compile(p, pStk, true, noskip, vartype)))
{
return pStack->Return(inst, pStk);
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -41,7 +41,7 @@ public:
* \param noskip
* \return
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool cont = false, bool noskip=false);
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool cont = false, bool noskip=false, CBotTypResult vartype = CBotTypFloat);
/*!
* \brief Execute Executes the definition of a real variable.

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -47,13 +47,25 @@ CBotDefInt::~CBotDefInt()
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip, CBotTypResult vartype)
{
CBotToken* pp = cont ? nullptr : p; // no repetition of the token "int"
if (!cont && !IsOfType(p, ID_INT)) return nullptr;
if (!cont)
{
switch (p->GetType())
{
case ID_BYTE: vartype.SetType(CBotTypByte ); break;
case ID_SHORT: vartype.SetType(CBotTypShort); break;
case ID_CHAR: vartype.SetType(CBotTypChar ); break;
case ID_INT: vartype.SetType(CBotTypInt ); break;
case ID_LONG: vartype.SetType(CBotTypLong ); break;
default: return nullptr;
}
p = p->GetNext();
}
CBotDefInt* inst = static_cast<CBotDefInt*>(CompileArray(p, pStack, CBotTypInt));
CBotDefInt* inst = static_cast<CBotDefInt*>(CompileArray(p, pStack, vartype));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
@ -68,7 +80,7 @@ CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, boo
// determines the expression is valid for the item on the left side
if (nullptr != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypInt;
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = vartype;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{
pStk->SetError(CBotErrRedefVar, vartoken);
@ -82,7 +94,7 @@ CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, boo
// compiles an array declaration
CBotInstr* inst2 = CBotDefArray::Compile(p, pStk, CBotTypInt);
CBotInstr* inst2 = CBotDefArray::Compile(p, pStk, vartype);
inst = static_cast<CBotDefInt*>(inst2);
goto suite; // no assignment, variable already created
@ -108,7 +120,7 @@ CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, boo
}
{
CBotVar* var = CBotVar::Create(*vartoken, CBotTypInt);// create the variable (evaluated after the assignment)
CBotVar* var = CBotVar::Create(*vartoken, vartype); // create the variable (evaluated after the assignment)
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF); // if initialized with assignment
var->SetUniqNum( //set it with a unique number
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
@ -117,7 +129,7 @@ CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, boo
suite:
if (pStk->IsOk() && IsOfType(p, ID_COMMA)) // chained several definitions
{
if (nullptr != ( inst->m_next2b = CBotDefInt::Compile(p, pStk, true, noskip))) // compile next one
if (nullptr != ( inst->m_next2b = CBotDefInt::Compile(p, pStk, true, noskip, vartype))) // compile next one
{
return pStack->Return(inst, pStk);
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -41,7 +41,7 @@ public:
* \param noskip
* \return
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool cont = false, bool noskip = false);
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool cont = false, bool noskip = false, CBotTypResult vartype = CBotTypInt);
/*!
* \brief Execute Execute the definition of the integer variable.

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -57,7 +57,7 @@ CBotInstr* CBotDo::Compile(CBotToken* &p, CBotCStack* pStack)
inst->SetToken(p);
if (!IsOfType(p, ID_DO)) return nullptr; // should never happen
CBotCStack* pStk = pStack->TokenStack(pp); // un petit bout de pile svp
CBotCStack* pStk = pStack->TokenStack(pp); // some space for a stack, plz
// looking for a statement block after the do

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,151 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotExprLitChar.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotVar/CBotVar.h"
namespace CBot
{
CBotExprLitChar::CBotExprLitChar()
{
}
CBotExprLitChar::~CBotExprLitChar()
{
}
CBotInstr* CBotExprLitChar::Compile(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
const auto& s = p->GetString();
auto it = s.cbegin();
if (++it != s.cend())
{
if (*it != '\'') // not empty quotes ?
{
uint32_t valchar = 0;
int pos = p->GetStart() + 1;
if (*it != '\\') valchar = *(it++); // not escape sequence ?
else if (++it != s.cend())
{
pStk->SetStartError(pos++);
unsigned char c = *(it++);
if (c == '\"' || c == '\'' || c == '\\') valchar = c;
else if (c == 'a') valchar = '\a'; // alert bell
else if (c == 'b') valchar = '\b'; // backspace
else if (c == 'f') valchar = '\f'; // form feed
else if (c == 'n') valchar = '\n'; // new line
else if (c == 'r') valchar = '\r'; // carriage return
else if (c == 't') valchar = '\t'; // horizontal tab
else if (c == 'v') valchar = '\v'; // vertical tab
else if (c == 'u' || c == 'U') // unicode escape
{
if (it != s.cend())
{
std::string hex = "";
size_t maxlen = (c == 'u') ? 4 : 8;
for (size_t i = 0; i < maxlen; i++)
{
if (!CharInList(*it, "0123456789ABCDEFabcdef")) break;
++pos;
hex += *it;
if (++it == s.cend()) break;
}
if (maxlen == hex.length()) // unicode character
{
try
{
valchar = std::stoi(hex, nullptr, 16);
if (0x10FFFF < valchar || (0xD7FF < valchar && valchar < 0xE000))
pStk->SetError(CBotErrUnicodeName, pos + 1);
}
catch (const std::out_of_range& e)
{
pStk->SetError(CBotErrHexRange, pos + 1);
}
}
else
pStk->SetError(CBotErrHexDigits, pos + 1);
}
else
pStk->SetError(CBotErrHexDigits, pos + 1);
}
else
pStk->SetError(CBotErrBadEscape, pos + 1);
}
if (it == s.cend() || *it != '\'')
pStk->SetError(CBotErrEndQuote, p);
if (pStk->IsOk())
{
CBotExprLitChar* inst = new CBotExprLitChar();
inst->m_valchar = valchar;
inst->SetToken(p);
p = p->GetNext();
CBotVar* var = CBotVar::Create("", CBotTypChar);
pStk->SetVar(var);
return pStack->Return(inst, pStk);
}
}
pStk->SetError(CBotErrCharEmpty, p);
}
pStk->SetError(CBotErrEndQuote, p);
return pStack->Return(nullptr, pStk);
}
bool CBotExprLitChar::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create("", CBotTypChar);
var->SetValChar(m_valchar);
pile->SetVar(var);
return pj->Return(pile);
}
void CBotExprLitChar::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}
std::string CBotExprLitChar::GetDebugData()
{
return m_token.GetString();
}
} // namespace CBot

View File

@ -0,0 +1,60 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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://gnu.org/licenses
*/
#pragma once
#include "CBot/CBotInstr/CBotInstr.h"
namespace CBot
{
/**
* \brief A character literal
* \verbatim 'a', '\n', '\t', '\uFFFD', '\U0000FFFD', etc. \endverbatim
*/
class CBotExprLitChar : public CBotInstr
{
public:
CBotExprLitChar();
~CBotExprLitChar();
/*!
* \brief Compile a character literal
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack);
/*!
* \brief Execute, returns the corresponding char.
*/
bool Execute(CBotStack* &pj) override;
/*!
* \brief RestoreState
*/
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() override { return "CBotExprLitChar"; }
virtual std::string GetDebugData() override;
private:
uint32_t m_valchar = 0;
};
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -25,52 +25,85 @@
#include "CBot/CBotUtils.h"
#include <limits>
#include <sstream>
namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprLitNum::CBotExprLitNum()
template <>
CBotExprLitNum<int>::CBotExprLitNum(int val) : m_numtype(CBotTypInt), m_value(val)
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprLitNum::~CBotExprLitNum()
template <>
CBotExprLitNum<long>::CBotExprLitNum(long val) : m_numtype(CBotTypLong), m_value(val)
{
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotExprLitNum::Compile(CBotToken* &p, CBotCStack* pStack)
template <>
CBotExprLitNum<float>::CBotExprLitNum(float val) : m_numtype(CBotTypFloat), m_value(val)
{
}
template <>
CBotExprLitNum<double>::CBotExprLitNum(double val) : m_numtype(CBotTypDouble), m_value(val)
{
}
template <typename T>
CBotExprLitNum<T>::~CBotExprLitNum()
{
}
CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
CBotExprLitNum* inst = new CBotExprLitNum();
const auto& s = p->GetString();
inst->SetToken(p);
std::string s = p->GetString();
CBotInstr* inst = nullptr;
CBotType numtype = CBotTypInt;
inst->m_numtype = CBotTypInt;
if (p->GetType() == TokenTypDef)
{
inst->m_valint = p->GetKeywordId();
inst = new CBotExprLitNum<int>(static_cast<int>(p->GetKeywordId()));
}
else
{
if (s.find('.') != std::string::npos || ( s.find('x') == std::string::npos && ( s.find_first_of("eE") != std::string::npos ) ))
{
inst->m_numtype = CBotTypFloat;
inst->m_valfloat = GetNumFloat(s);
double val = GetNumFloat(s);
if (val > static_cast<double>(std::numeric_limits<float>::max()))
{
numtype = CBotTypDouble;
inst = new CBotExprLitNum<double>(val);
}
else
{
numtype = CBotTypFloat;
inst = new CBotExprLitNum<float>(static_cast<float>(val));
}
}
else
{
inst->m_valint = GetNumInt(s);
long val = GetNumInt(s);
if (val > std::numeric_limits<int>::max())
{
numtype = CBotTypLong;
inst = new CBotExprLitNum<long>(val);
}
else
{
inst = new CBotExprLitNum<int>(static_cast<int>(val));
}
}
}
inst->SetToken(p);
if (pStk->NextToken(p))
{
CBotVar* var = CBotVar::Create("", inst->m_numtype);
CBotVar* var = CBotVar::Create("", numtype);
pStk->SetVar(var);
return pStack->Return(inst, pStk);
@ -79,8 +112,48 @@ CBotInstr* CBotExprLitNum::Compile(CBotToken* &p, CBotCStack* pStack)
return pStack->Return(nullptr, pStk);
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprLitNum::Execute(CBotStack* &pj)
CBotInstr* CompileSizeOf(CBotToken* &p, CBotCStack* pStack)
{
CBotToken* pp = p;
if (!IsOfType(p, TokenTypVar)) return nullptr;
if (pp->GetString() == "sizeof" && IsOfType(p, ID_OPENPAR))
{
CBotCStack* pStk = pStack->TokenStack();
int value;
if (IsOfType(p, ID_BYTE)) value = sizeof(signed char);
else if (IsOfType(p, ID_SHORT)) value = sizeof(short);
else if (IsOfType(p, ID_CHAR)) value = sizeof(uint32_t);
else if (IsOfType(p, ID_INT)) value = sizeof(int);
else if (IsOfType(p, ID_LONG)) value = sizeof(long);
else if (IsOfType(p, ID_FLOAT)) value = sizeof(float);
else if (IsOfType(p, ID_DOUBLE)) value = sizeof(double);
else
{
p = pp;
return pStack->Return(nullptr, pStk);
}
if (IsOfType(p, ID_CLOSEPAR))
{
auto inst = new CBotExprLitNum<int>(value);
inst->SetToken(pp);
CBotVar* var = CBotVar::Create("", CBotTypInt);
pStk->SetVar(var);
return pStack->Return(inst, pStk);
}
pStk->SetError(CBotErrClosePar, p->GetStart());
return pStack->Return(nullptr, pStk);
}
p = pp;
return nullptr;
}
template <typename T>
bool CBotExprLitNum<T>::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -88,39 +161,38 @@ bool CBotExprLitNum::Execute(CBotStack* &pj)
CBotVar* var = CBotVar::Create("", m_numtype);
std::string nombre ;
if (m_token.GetType() == TokenTypDef)
{
nombre = m_token.GetString();
var->SetValInt(m_value, m_token.GetString());
}
switch (m_numtype)
else
{
case CBotTypShort:
case CBotTypInt:
var->SetValInt(m_valint, nombre);
break;
case CBotTypFloat:
var->SetValFloat(m_valfloat);
break;
default:
assert(false);
*var = m_value;
}
pile->SetVar(var); // place on the stack
return pj->Return(pile); // it's ok
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprLitNum::RestoreState(CBotStack* &pj, bool bMain)
template <typename T>
void CBotExprLitNum<T>::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}
std::string CBotExprLitNum::GetDebugData()
template <typename T>
std::string CBotExprLitNum<T>::GetDebugData()
{
std::stringstream ss;
ss << "(" << (m_numtype == CBotTypFloat ? "float" : "int") << ") " << (m_numtype == CBotTypFloat ? m_valfloat : m_valint);
switch (m_numtype)
{
case CBotTypInt : ss << "(int) "; break;
case CBotTypLong : ss << "(long) "; break;
case CBotTypFloat : ss << "(float) "; break;
case CBotTypDouble: ss << "(double) "; break;
default: assert(false);
}
ss << m_value;
return ss.str();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -24,25 +24,24 @@
namespace CBot
{
CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack);
CBotInstr* CompileSizeOf(CBotToken* &p, CBotCStack* pStack);
/**
* \brief A number literal - 5, 1, 2.5, 3.75, etc. or a predefined numerical constant (see CBotToken::DefineNum())
*
* Can be of type ::CBotTypInt or ::CBotTypFloat
* Can be of type ::CBotTypInt, ::CBotTypLong, ::CBotTypFloat, or ::CBotTypDouble
*/
template <typename T>
class CBotExprLitNum : public CBotInstr
{
public:
CBotExprLitNum();
~CBotExprLitNum();
// To keep linter happy, instead of = delete (see https://stackoverflow.com/a/37593094)
CBotExprLitNum(T val) { static_assert(sizeof(T) == 0, "Only specializations of CBotExprLitNum can be used"); };
/*!
* \brief Compile
* \param p
* \param pStack
* \return
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack);
~CBotExprLitNum();
/*!
* \brief Execute Execute, returns the corresponding number.
@ -65,10 +64,8 @@ protected:
private:
//! The type of number.
CBotType m_numtype;
//! Value for an int.
long m_valint;
//! Value for a float.
float m_valfloat;
//! Value
T m_value;
};

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -24,6 +24,8 @@
#include "CBot/CBotVar/CBotVar.h"
#include <stdexcept>
namespace CBot
{
@ -42,7 +44,7 @@ CBotInstr* CBotExprLitString::Compile(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
std::string s = p->GetString();
const auto& s = p->GetString();
auto it = s.cbegin();
if (++it != s.cend())
@ -51,7 +53,7 @@ CBotInstr* CBotExprLitString::Compile(CBotToken* &p, CBotCStack* pStack)
std::string valstring = "";
while (it != s.cend() && *it != '\"')
{
pStk->SetStartError(++pos);
++pos;
if (*it != '\\') // not escape sequence ?
{
valstring += *(it++);
@ -59,6 +61,7 @@ CBotInstr* CBotExprLitString::Compile(CBotToken* &p, CBotCStack* pStack)
}
if (++it == s.cend()) break;
pStk->SetStartError(pos);
if (CharInList(*it, "01234567")) // octal
{

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -40,8 +40,7 @@ CBotExprUnaire::~CBotExprUnaire()
delete m_expr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack, bool bLiteral)
CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack, bool bLiteral, bool bConstExpr)
{
int op = p->GetType();
CBotToken* pp = p;
@ -52,8 +51,10 @@ CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack, bool bLite
CBotExprUnaire* inst = new CBotExprUnaire();
inst->SetToken(pp);
if (!bLiteral) inst->m_expr = CBotParExpr::Compile(p, pStk);
else inst->m_expr = CBotParExpr::CompileLitExpr(p, pStk);
if (bConstExpr || !bLiteral)
inst->m_expr = CBotParExpr::Compile(p, pStk, bConstExpr);
else
inst->m_expr = CBotParExpr::CompileLitExpr(p, pStk);
if (inst->m_expr != nullptr)
{

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -40,7 +40,7 @@ public:
* \param bLiteral If true, compiles only literal expressions Ex: ~11, -4.0, !false, not true
* \return The compiled instruction or nullptr
*/
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool bLiteral = false);
static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack, bool bLiteral = false, bool bConstExpr = false);
/*!
* \brief Execute

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -67,7 +67,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack)
return nullptr;
}
CBotCStack* pStk = pStack->TokenStack(pp, true); // un petit bout de pile svp
CBotCStack* pStk = pStack->TokenStack(pp, true); // some size for a stack, plz
// compiles instructions for initialization
inst->m_init = CBotListExpression::Compile(p, pStk );

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -76,6 +76,18 @@ bool CBotFunction::IsPublic()
return m_bPublic;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotFunction::IsProtected() const
{
return m_bProtect;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotFunction::IsPrivate() const
{
return m_bPrivate;
}
////////////////////////////////////////////////////////////////////////////////
bool CBotFunction::IsExtern()
{
@ -129,21 +141,17 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
{
CBotToken* pp;
CBotFunction* func = finput;
if ( func == nullptr ) func = new CBotFunction();
assert(func != nullptr); // a pre-compiled function is required
CBotCStack* pStk = pStack->TokenStack(p, bLocal);
// func->m_nFuncIdent = CBotVar::NextUniqNum();
while (true)
{
if ( IsOfType(p, ID_PUBLIC) )
{
func->m_bPublic = true;
continue;
}
if (IsOfType(p, ID_PRIVATE)) break;
if (IsOfType(p, ID_PROTECTED)) break;
if (IsOfType(p, ID_PUBLIC)) continue;
pp = p;
if ( IsOfType(p, ID_EXTERN) )
if (IsOfType(p, ID_EXTERN))
{
func->m_extern = *pp; // for the position of the word "extern"
func->m_bExtern = true;
@ -169,7 +177,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
func->m_token = d;
}
// un nom de fonction est-il là ?
// is there a function name here ?
if (IsOfType(p, TokenTypVar))
{
if ( IsOfType( p, ID_DBLDOTS ) ) // method for a class
@ -183,10 +191,23 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
goto bad;
}
// pp = p;
pp = p;
func->m_token = *p;
if (!IsOfType(p, TokenTypVar)) goto bad;
// check if the class has a method like this
if (pClass->CheckCall(pStack->GetProgram(), func->m_param, pp))
{
pStk->SetStartError(func->m_classToken.GetStart());
pStk->SetError(CBotErrRedefFunc, pp->GetEnd());
goto bad;
}
// check if a constructor has return type void
if (func->GetName() == pClass->GetName() && !func->m_retTyp.Eq(CBotTypVoid))
{
pp = &(func->m_retToken);
pStk->SetError(CBotErrFuncNotVoid, pp);
goto bad;
}
}
func->m_openpar = *p;
delete func->m_param;
@ -198,28 +219,13 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
if (!func->m_MasterClass.empty())
{
// return "this" known
CBotVar* pThis = CBotVar::Create("this", CBotTypResult( CBotTypClass, func->m_MasterClass ));
pThis->SetInit(CBotVar::InitType::IS_POINTER);
// pThis->SetUniqNum(func->m_nThisIdent = -2); //CBotVar::NextUniqNum() will not
pThis->SetUniqNum(-2);
pStk->AddVar(pThis);
CBotClass* pClass = CBotClass::Find(func->m_MasterClass);
// initialize variables acording to This
// only saves the pointer to the first,
// the rest is chained
CBotVar* pv = pThis->GetItemList();
// int num = 1;
while (pv != nullptr)
{
CBotVar* pcopy = CBotVar::Create(pv);
// pcopy->SetInit(2);
pcopy->Copy(pv);
pcopy->SetPrivate(pv->GetPrivate());
// pcopy->SetUniqNum(pv->GetUniqNum()); //num++);
pStk->AddVar(pcopy);
pv = pv->GetNext();
}
pStk->CreateVarThis(pClass);
pStk->CreateVarSuper(pClass->GetParent());
bool bConstructor = (func->GetName() == func->m_MasterClass);
pStk->CreateMemberVars(pClass, !bConstructor);
}
// and compiles the following instruction block
@ -242,7 +248,6 @@ bad:
pStk->SetError(CBotErrNoFunc, p);
}
pStk->SetError(CBotErrNoType, p);
if ( finput == nullptr ) delete func;
return pStack->ReturnFunc(nullptr, pStk);
}
@ -254,14 +259,30 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
CBotCStack* pStk = pStack->TokenStack(p, true);
CBotToken* pPriv = p;
while (true)
{
if ( IsOfType(p, ID_PUBLIC) )
if (!func->m_bPublic) // don't repeat 'public'
{
// func->m_bPublic = true; // will be done in two passes
continue;
pPriv = p;
if (IsOfType(p, ID_PRIVATE))
{
func->m_bPrivate = true;
break;
}
if (IsOfType(p, ID_PROTECTED))
{
func->m_bProtect = true;
break;
}
if (IsOfType(p, ID_PUBLIC))
{
func->m_bPublic = true;
continue;
}
}
if ( IsOfType(p, ID_EXTERN) )
if (!func->m_bExtern && IsOfType(p, ID_EXTERN))
{
func->m_bExtern = true;
continue;
@ -284,7 +305,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
func->m_token = d;
}
// un nom de fonction est-il là ?
// is there a function name here ?
if (IsOfType(p, TokenTypVar))
{
if ( IsOfType( p, ID_DBLDOTS ) ) // method for a class
@ -297,12 +318,21 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
if (!IsOfType(p, TokenTypVar)) goto bad;
}
else if (pClass == nullptr) // not method in a class ?
{
if (func->m_bPrivate || func->m_bProtect) // not allowed for regular functions
{
pStk->SetError(CBotErrNoType, pPriv);
goto bad;
}
}
CBotToken* openPar = p;
func->m_param = CBotDefParam::Compile(p, pStk); // compile parameters
if (pStk->IsOk() && pClass != nullptr) // method in a class
{
func->m_MasterClass = pClass->GetName();
// check if a constructor has return type void
if (func->GetName() == pClass->GetName() && !func->m_retTyp.Eq(CBotTypVoid))
{
@ -331,7 +361,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
{
// looks if the function exists elsewhere
pp = &(func->m_token);
if (( pClass != nullptr || !pStack->CheckCall(pp, func->m_param)) &&
if (( pClass != nullptr || !pStack->CheckCall(pp, func->m_param, func->m_MasterClass)) &&
( pClass == nullptr || !pClass->CheckCall(pStack->GetProgram(), func->m_param, pp)) )
{
if (IsOfType(p, ID_OPBLK))
@ -415,7 +445,7 @@ bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance)
pile->IncState();
}
if ( !m_block->Execute(pile) )
if (!pile->GetRetVar(m_block->Execute(pile)))
{
if ( pile->GetError() < 0 )
pile->SetError( CBotNoErr );
@ -472,10 +502,10 @@ void CBotFunction::RestoreState(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInst
}
////////////////////////////////////////////////////////////////////////////////
CBotTypResult CBotFunction::CompileCall(const std::list<CBotFunction*>& localFunctionList, const std::string &name, CBotVar** ppVars, long &nIdent)
CBotTypResult CBotFunction::CompileCall(const std::string &name, CBotVar** ppVars, long &nIdent, CBotProgram* program)
{
CBotTypResult type;
if (!FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type))
if (!FindLocalOrPublic(program->GetFunctions(), nIdent, name, ppVars, type, program))
{
// Reset the identifier to "not found" value
nIdent = 0;
@ -485,7 +515,7 @@ CBotTypResult CBotFunction::CompileCall(const std::list<CBotFunction*>& localFun
////////////////////////////////////////////////////////////////////////////////
CBotFunction* CBotFunction::FindLocalOrPublic(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name,
CBotVar** ppVars, CBotTypResult &TypeOrError, bool bPublic)
CBotVar** ppVars, CBotTypResult &TypeOrError, CBotProgram* baseProg)
{
TypeOrError.SetType(CBotErrUndefCall); // no routine of the name
@ -515,10 +545,39 @@ CBotFunction* CBotFunction::FindLocalOrPublic(const std::list<CBotFunction*>& lo
std::map<CBotFunction*, int> funcMap;
for (CBotFunction* pt : localFunctionList)
CBotFunction::SearchList(localFunctionList, name, ppVars, TypeOrError, funcMap);
CBotFunction::SearchPublic(name, ppVars, TypeOrError, funcMap);
if (baseProg != nullptr && baseProg->m_thisVar != nullptr)
{
// find object:: functions
CBotClass* pClass = baseProg->m_thisVar->GetClass();
CBotFunction::SearchList(localFunctionList, name, ppVars, TypeOrError, funcMap, pClass);
CBotFunction::SearchPublic(name, ppVars, TypeOrError, funcMap, pClass);
}
return CBotFunction::BestFunction(funcMap, nIdent, TypeOrError);
}
////////////////////////////////////////////////////////////////////////////////
void CBotFunction::SearchList(const std::list<CBotFunction*>& functionList,
const std::string& name, CBotVar** ppVars, CBotTypResult& TypeOrError,
std::map<CBotFunction*, int>& funcMap, CBotClass* pClass)
{
for (CBotFunction* pt : functionList)
{
if ( pt->m_token.GetString() == name )
{
if (pClass != nullptr) // looking for a method ?
{
if (pt->m_MasterClass != pClass->GetName()) continue;
}
else // looking for a function
{
if (!pt->m_MasterClass.empty()) continue;
}
int i = 0;
int alpha = 0; // signature of parameters
// parameters are compatible?
@ -575,16 +634,29 @@ CBotFunction* CBotFunction::FindLocalOrPublic(const std::list<CBotFunction*>& lo
funcMap.insert( std::pair<CBotFunction*, int>(pt, alpha) );
}
}
}
if ( bPublic )
////////////////////////////////////////////////////////////////////////////////
void CBotFunction::SearchPublic(const std::string& name, CBotVar** ppVars, CBotTypResult& TypeOrError,
std::map<CBotFunction*, int>& funcMap, CBotClass* pClass)
{
{
for (CBotFunction* pt : m_publicFunctions)
{
if ( pt->m_token.GetString() == name )
{
if (pClass != nullptr) // looking for a method ?
{
if (pt->m_MasterClass != pClass->GetName()) continue;
}
else // looking for a function
{
if (!pt->m_MasterClass.empty()) continue;
}
int i = 0;
int alpha = 0; // signature of parameters
// parameters sont-ils compatibles ?
// are parameters compatible ?
CBotDefParam* pv = pt->m_param; // list of expected parameters
CBotVar* pw = ppVars[i++]; // list of provided parameters
while ( pv != nullptr && (pw != nullptr || pv->HasDefault()) )
@ -639,7 +711,12 @@ CBotFunction* CBotFunction::FindLocalOrPublic(const std::list<CBotFunction*>& lo
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
CBotFunction* CBotFunction::BestFunction(std::map<CBotFunction*, int>& funcMap,
long& nIdent, CBotTypResult& TypeOrError)
{
if ( !funcMap.empty() )
{
auto it = funcMap.begin();
@ -675,7 +752,7 @@ int CBotFunction::DoCall(CBotProgram* program, const std::list<CBotFunction*>& l
CBotFunction* pt = nullptr;
CBotProgram* baseProg = pStack->GetProgram(true);
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type, baseProg);
if ( pt != nullptr )
{
@ -766,7 +843,7 @@ void CBotFunction::RestoreCall(const std::list<CBotFunction*>& localFunctionList
CBotStack* pStk3;
CBotProgram* baseProg = pStack->GetProgram(true);
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type, baseProg);
if ( pt != nullptr )
{
@ -824,13 +901,121 @@ void CBotFunction::RestoreCall(const std::list<CBotFunction*>& localFunctionList
}
////////////////////////////////////////////////////////////////////////////////
int CBotFunction::DoCall(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name, CBotVar* pThis,
CBotTypResult CBotFunction::CompileMethodCall(const std::string& name, CBotVar** ppVars,
long& nIdent, CBotCStack* pStack, CBotClass* pClass)
{
nIdent = 0;
CBotTypResult type;
CBotFunction* pt = FindMethod(nIdent, name, ppVars, type, pClass, pStack->GetProgram());
if (pt != nullptr)
{
CBotToken token("this");
CBotVar* pThis = pStack->FindVar(token); // for 'this' context
if (pThis == nullptr || pThis->GetType() != CBotTypPointer) // called from inside a function
{
if (pt->IsPrivate() || pt->IsProtected())
type.SetType(CBotErrPrivate);
}
else // called from inside a method
{
CBotClass* thisClass = pThis->GetClass(); // current class
CBotClass* funcClass = CBotClass::Find(pt->m_MasterClass); // class of the method
if (pt->IsPrivate() && thisClass != funcClass)
type.SetType(CBotErrPrivate);
if (pt->IsProtected() && !thisClass->IsChildOf(funcClass))
type.SetType(CBotErrPrivate);
}
}
return type;
}
////////////////////////////////////////////////////////////////////////////////
CBotFunction* CBotFunction::FindMethod(long& nIdent, const std::string& name,
CBotVar** ppVars, CBotTypResult& TypeOrError,
CBotClass* pClass, CBotProgram* program)
{
TypeOrError.SetType(CBotErrUndefCall); // no routine of the name
auto methods = pClass->GetFunctions();
if ( nIdent )
{
// search methods in the class
for (CBotFunction* pt : methods)
{
if ( pt->m_nFuncIdent == nIdent )
{
TypeOrError = pt->m_retTyp;
return pt;
}
}
bool skipPublic = false;
if (program != nullptr)
{
// search the current program
for (CBotFunction* pt : program->GetFunctions())
{
if ( pt->m_nFuncIdent == nIdent )
{
// check if the method is inherited
if ( pt->GetClassName() != pClass->GetName() )
{
skipPublic = true;
break; // break in case there is an override
}
TypeOrError = pt->m_retTyp;
return pt;
}
}
}
// search the list of public functions
if (!skipPublic)
{
for (CBotFunction* pt : m_publicFunctions)
{
if (pt->m_nFuncIdent == nIdent)
{
// check if the method is inherited, break in case there is an override
if ( pt->GetClassName() != pClass->GetName() ) break;
TypeOrError = pt->m_retTyp;
return pt;
}
}
}
}
if ( name.empty() ) return nullptr;
std::map<CBotFunction*, int> funcMap;
// search methods in the class
CBotFunction::SearchList(methods, name, ppVars, TypeOrError, funcMap, pClass);
// search the current program for methods
if (program != nullptr)
CBotFunction::SearchList(program->GetFunctions(), name, ppVars, TypeOrError, funcMap, pClass);
CBotFunction::SearchPublic(name, ppVars, TypeOrError, funcMap, pClass);
return CBotFunction::BestFunction(funcMap, nIdent, TypeOrError);
}
////////////////////////////////////////////////////////////////////////////////
int CBotFunction::DoCall(long &nIdent, const std::string &name, CBotVar* pThis,
CBotVar** ppVars, CBotStack* pStack, CBotToken* pToken, CBotClass* pClass)
{
CBotTypResult type;
CBotProgram* pProgCurrent = pStack->GetProgram();
CBotFunction* pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type, false);
CBotFunction* pt = FindMethod(nIdent, name, ppVars, type, pClass, pProgCurrent);
if ( pt != nullptr )
{
@ -925,11 +1110,11 @@ int CBotFunction::DoCall(const std::list<CBotFunction*>& localFunctionList, long
}
////////////////////////////////////////////////////////////////////////////////
bool CBotFunction::RestoreCall(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name, CBotVar* pThis,
bool CBotFunction::RestoreCall(long &nIdent, const std::string &name, CBotVar* pThis,
CBotVar** ppVars, CBotStack* pStack, CBotClass* pClass)
{
CBotTypResult type;
CBotFunction* pt = FindLocalOrPublic(localFunctionList, nIdent, name, ppVars, type);
CBotFunction* pt = FindMethod(nIdent, name, ppVars, type, pClass, pStack->GetProgram());
if ( pt != nullptr )
{
@ -1020,6 +1205,12 @@ std::string CBotFunction::GetParams()
return params;
}
////////////////////////////////////////////////////////////////////////////////
const std::string& CBotFunction::GetClassName() const
{
return m_MasterClass;
}
////////////////////////////////////////////////////////////////////////////////
void CBotFunction::AddPublic(CBotFunction* func)
{

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -105,21 +105,19 @@ public:
*
* See FindLocalOrPublic for more detailed explanation
*
* \param localFunctionList Linked list of local functions to search in, can be null
* \param name Name of the function
* \param ppVars List of function arguments
* \param nIdent[in, out] Unique identifier of the function
* \param program The current program, to search for functions.
* \return Type returned by the function or error code
* \see FindLocalOrPublic
*/
static CBotTypResult CompileCall(const std::list<CBotFunction*>& localFunctionList,
const std::string &name, CBotVar** ppVars, long &nIdent);
static CBotTypResult CompileCall(const std::string &name, CBotVar** ppVars,
long &nIdent, CBotProgram* program);
/*!
* \brief Finds a local or public function
*
* <p>Finds a local or (if bPublic is true) public function to call
*
* <p>First, it looks for a function according to its unique identifier.<br>
* If the identifier is not found, looks by name and parameters.
*
@ -128,11 +126,46 @@ public:
* \param name Name of the function
* \param ppVars List of function arguments
* \param TypeOrError Type returned by the function or error code
* \param bPublic Whether to look in public functions or not
* \param baseProg Initial program, for context of the object/bot
* \return Pointer to found CBotFunction instance, or nullptr in case of no match or ambiguity (see TypeOrError for error code)
*/
static CBotFunction* FindLocalOrPublic(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name,
CBotVar** ppVars, CBotTypResult &TypeOrError, bool bPublic = true);
CBotVar** ppVars, CBotTypResult &TypeOrError, CBotProgram* baseProg);
/*!
* \brief Find all functions that match the name and arguments.
* \param functionList List of functions to search, can be empty.
* \param name Name of the function to find.
* \param ppVars Arguments to compare with parameters.
* \param TypeOrError Contains a CBotError when no useable function has been found.
* \param funcMap Container for suitable functions and their signature values.
* \param pClass Pointer to class when searching for methods.
*/
static void SearchList(const std::list<CBotFunction*>& functionList,
const std::string& name, CBotVar** ppVars, CBotTypResult& TypeOrError,
std::map<CBotFunction*, int>& funcMap, CBotClass* pClass = nullptr);
/*!
* \brief Find all public functions that match the name and arguments.
* \param name Name of the function to find.
* \param ppVars Arguments to compare with parameters.
* \param TypeOrError Contains a CBotError when no useable function has been found.
* \param funcMap Container for suitable functions and their signature values.
* \param pClass Pointer to class when searching for methods.
*/
static void SearchPublic(const std::string& name, CBotVar** ppVars, CBotTypResult& TypeOrError,
std::map<CBotFunction*, int>& funcMap, CBotClass* pClass = nullptr);
/*!
* \brief Find the function with the lowest signature value. If there is more
* than one of the same signature value, TypeOrError is set to CBotErrAmbiguousCall.
* \param funcMap List of functions and their signature values, can be empty.
* \param[out] nIdent Unique identifier of the function.
* \param TypeOrError Type returned by the function or error code.
* \return Pointer to the function with the lowest signature or nullptr.
*/
static CBotFunction* BestFunction(std::map<CBotFunction*, int>& funcMap,
long& nIdent, CBotTypResult& TypeOrError);
/*!
* \brief DoCall Fait un appel à une fonction.
@ -160,10 +193,34 @@ public:
static void RestoreCall(const std::list<CBotFunction*>& localFunctionList,
long &nIdent, const std::string &name, CBotVar** ppVars, CBotStack* pStack);
/*!
* \brief Find a method matching the name and arguments.
* \param name Name of the method to find.
* \param ppVars Arguments to compare with parameters.
* \param[out] nIdent Unique identifier of the method.
* \param pStack Current compilation stack frame.
* \param pClass Pointer to the class.
* \return The return type for the method or a CBotError.
*/
static CBotTypResult CompileMethodCall(const std::string& name, CBotVar** ppVars,
long& nIdent, CBotCStack* pStack, CBotClass* pClass);
/*!
* \brief Find a method by its unique identifier or by name and parameters.
* \param[in,out] nIdent Unique identifier of the method.
* \param name Name of the method to find.
* \param ppVars Arguments to compare with parameters.
* \param TypeOrError The return type for the method or a CBotError.
* \param pClass Pointer to the class.
* \param program The current program, to search for out-of-class methods.
* \return Pointer to the method that best matches the given arguments or nullptr.
*/
static CBotFunction* FindMethod(long& nIdent, const std::string& name,
CBotVar** ppVars, CBotTypResult& TypeOrError,
CBotClass* pClass, CBotProgram* program);
/*!
* \brief DoCall Makes call of a method
* note: this is already on the stack, the pointer pThis is just to simplify.
* \param localFunctionList
* \param nIdent
* \param name
* \param pThis
@ -173,12 +230,11 @@ public:
* \param pClass
* \return
*/
static int DoCall(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name, CBotVar* pThis,
static int DoCall(long &nIdent, const std::string &name, CBotVar* pThis,
CBotVar** ppVars, CBotStack* pStack, CBotToken* pToken, CBotClass* pClass);
/*!
* \brief RestoreCall
* \param localFunctionList
* \param nIdent
* \param name
* \param pThis
@ -187,7 +243,7 @@ public:
* \param pClass
* \return Returns true if the method call was restored.
*/
static bool RestoreCall(const std::list<CBotFunction*>& localFunctionList, long &nIdent, const std::string &name, CBotVar* pThis,
static bool RestoreCall(long &nIdent, const std::string &name, CBotVar* pThis,
CBotVar** ppVars, CBotStack* pStack, CBotClass* pClass);
/*!
@ -215,12 +271,30 @@ public:
*/
std::string GetParams();
/*!
* \brief Get the name of the class for a method.
* \return The name of a class or empty string if it's not a method.
*/
const std::string& GetClassName() const;
/*!
* \brief IsPublic
* \return
*/
bool IsPublic();
/*!
* \brief Check if a method is protected.
* \return true if a method was compiled with "protected" keyword.
*/
bool IsProtected() const;
/*!
* \brief Check if a method is private.
* \return true if a method was compiled with "private" keyword.
*/
bool IsPrivate() const;
/*!
* \brief IsExtern
* \return
@ -266,6 +340,10 @@ private:
CBotTypResult m_retTyp;
//! Public function.
bool m_bPublic;
//! Protected method.
bool m_bProtect = false;
//! Private method.
bool m_bPrivate = false;
//! Extern function.
bool m_bExtern;
//! Name of the class we are part of

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -30,6 +30,7 @@
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotFor.h"
#include "CBot/CBotInstr/CBotIf.h"
#include "CBot/CBotInstr/CBotRepeat.h"
#include "CBot/CBotInstr/CBotReturn.h"
#include "CBot/CBotInstr/CBotSwitch.h"
#include "CBot/CBotInstr/CBotThrow.h"
@ -176,7 +177,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
{
type = pp->GetType();
// Allow only instructions that accept a label
if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, 0))
if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, ID_REPEAT, 0))
{
pStack->SetError(CBotErrLabel, pp->GetStart());
return nullptr;
@ -195,6 +196,9 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
case ID_DO:
return CBotDo::Compile(p, pStack);
case ID_REPEAT:
return CBotRepeat::Compile(p, pStack);
case ID_BREAK:
case ID_CONTINUE:
return CBotBreak::Compile(p, pStack);
@ -208,10 +212,15 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
case ID_THROW:
return CBotThrow::Compile(p, pStack);
case ID_BYTE:
case ID_SHORT:
case ID_CHAR:
case ID_INT:
case ID_LONG:
return CBotDefInt::Compile(p, pStack);
case ID_FLOAT:
case ID_DOUBLE:
return CBotDefFloat::Compile(p, pStack);
case ID_STRING:
@ -312,13 +321,6 @@ void CBotInstr::RestoreStateVar(CBotStack* &pile, bool bMain)
assert(0); // dad do not know, see the girls
}
////////////////////////////////////////////////////////////////////////////////
bool CBotInstr::CompCase(CBotStack* &pj, int val)
{
return false;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypResult type, bool first)
{
if (IsOfType(p, ID_OPBRK))

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -191,17 +191,6 @@ public:
virtual void RestoreStateVar(CBotStack* &pile,
bool bMain);
/**
* \brief CompCase This routine is defined only for the subclass CBotCase
* this allows to make the call on all instructions CompCase to see if it's
* a case to the desired value..
* \param pj
* \param val
* \return
*/
virtual bool CompCase(CBotStack* &pj,
int val);
/**
* \brief SetToken Set the token corresponding to the instruction.
* \param p

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -78,12 +78,12 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
{
// if (pVar2!=nullptr) pp = pVar2->RetToken();
pStack->SetError( static_cast<CBotError>(inst->m_typRes.GetType()), pp );
delete pStack->TokenStack();
pStack->DeleteNext();
delete inst;
return nullptr;
}
delete pStack->TokenStack();
pStack->DeleteNext();
if ( inst->m_typRes.GetType() > 0 )
{
CBotVar* pRes = CBotVar::Create("", inst->m_typRes);
@ -94,7 +94,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack)))
{
inst->m_exprRetVar->SetToken(&inst->m_token);
delete pStack->TokenStack();
pStack->DeleteNext();
}
if ( !pStack->IsOk() )
{
@ -105,7 +105,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
return inst;
}
p = pp;
delete pStack->TokenStack();
pStack->DeleteNext();
return nullptr;
}
@ -138,6 +138,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj)
if ( p != nullptr) while ( true )
{
pile = pile->AddStack(); // place on the stack for the results
if (pile->StackOver()) return pj->Return(pile);
if ( pile->GetState() == 0 )
{
if (!p->Execute(pile)) return false; // interrupted here?

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2018, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -70,7 +70,7 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
CBotClass* pClass = var->GetClass(); // pointer to the class
inst->m_className = pClass->GetName(); // name of the class
CBotTypResult r = pClass->CompileMethode(pp, var, ppVars, pStack, inst->m_MethodeIdent);
delete pStack->TokenStack(); // release parameters on the stack
pStack->DeleteNext(); // release parameters on the stack
inst->m_typRes = r;
if (inst->m_typRes.GetType() > 20)
@ -95,7 +95,7 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack, bMethodChain)))
{
inst->m_exprRetVar->SetToken(pp);
delete pStack->TokenStack();
pStack->DeleteNext();
}
if ( pStack->IsOk() )
@ -164,6 +164,7 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre
}
ppVars[i++] = pile2->GetVar(); // construct the list of pointers
pile2 = pile2->AddStack(); // space on the stack for the result
if (pile2->StackOver()) return pj->Return(pile2);
p = p->GetNext();
if ( p == nullptr) break;
}

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