Merge branch 'dev' into dev-graphics-overhaul

dev
Tomasz Kapuściński 2023-04-14 23:41:28 +02:00
commit 4531dc432e
42 changed files with 296 additions and 209 deletions

View File

@ -9,7 +9,7 @@ jobs:
strategy: strategy:
matrix: matrix:
target_os: [linux] target_os: [linux]
host_os: [ubuntu-18.04, ubuntu-20.04] host_os: [ubuntu-20.04]
container: [''] container: ['']
fail-fast: false fail-fast: false
steps: steps:
@ -45,7 +45,7 @@ jobs:
with: with:
name: ${{matrix.target_os}}-debug name: ${{matrix.target_os}}-debug
path: build/install path: build/install
if: matrix.host_os == 'ubuntu-18.04' if: matrix.host_os == 'ubuntu-20.04'
- name: Create AppImage - name: Create AppImage
working-directory: build working-directory: build
run: | run: |
@ -69,7 +69,7 @@ jobs:
with: with:
name: ${{matrix.target_os}}-debug-AppImage name: ${{matrix.target_os}}-debug-AppImage
path: build/appimage path: build/appimage
if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-18.04' if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-20.04'
- name: Run tests - name: Run tests
# TODO: Maybe run Windows tests using wine as well? # TODO: Maybe run Windows tests using wine as well?
working-directory: build working-directory: build
@ -81,6 +81,42 @@ jobs:
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }}) name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
path: build/gtestresults.xml path: build/gtestresults.xml
if: matrix.target_os == 'linux' if: matrix.target_os == 'linux'
build-macos:
runs-on: ${{ matrix.host_os }}
container: ${{ matrix.container }}
strategy:
matrix:
target_os: [macos]
host_os: [macos-11, macos-12]
container: ['']
fail-fast: false
steps:
- name: Install Colobot dependencies
run: brew install cmake sdl2 sdl2_image sdl2_ttf boost glew physfs flac libsndfile libvorbis vorbis-tools gettext libicns librsvg wget xmlstarlet
if: matrix.container == ''
- uses: actions/checkout@v2
- name: Checkout the Google Test submodule
run: git submodule update --init -- lib/googletest
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake (for Mac)
working-directory: build
run: cmake -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTESTS=1 -DDESKTOP=1 -DOPENAL_LIBRARY=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenAL.framework/OpenAL.tbd ..
if: matrix.target_os == 'macos'
- name: Build
working-directory: build
run: make -j `nproc`
- 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 == 'macos'
- 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 == 'macos'
build-windows: build-windows:
runs-on: windows-2019 runs-on: windows-2019
strategy: strategy:
@ -105,11 +141,12 @@ jobs:
- name: Install Colobot dependencies - name: Install Colobot dependencies
uses: lukka/run-vcpkg@v7 uses: lukka/run-vcpkg@v7
with: with:
vcpkgGitCommitId: '6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2' setupOnly: true
vcpkgGitCommitId: '69efe9cc2df0015f0bb2d37d55acde4a75c9a25b'
vcpkgTriplet: ${{ matrix.vcpkg_triplet }} vcpkgTriplet: ${{ matrix.vcpkg_triplet }}
vcpkgArguments: 'boost-system boost-filesystem boost-regex boost-lexical-cast boost-bimap boost-algorithm boost-property-tree boost-optional boost-range sdl2 sdl2-ttf sdl2-image glew libpng libwebp tiff gettext libsndfile libvorbis libogg openal-soft physfs glm mpg123' # SHA-256 hash of the vcpkg.json file, recalculated automatically when it changes
# SHA-256 hash of the list of packages above, for caching purposes appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
appendedCacheKey: '79bfe00dc99b9da12e57ab30397ba444a8d68e7030c247cf813121111e37cabf' additionalCachedPaths: ${{ github.workspace }}/build/vcpkg_installed
- name: Install external tools - name: Install external tools
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |

3
.gitignore vendored
View File

@ -48,3 +48,6 @@ CMakeLists.txt.user.*
/CMakeSettings.json /CMakeSettings.json
/.vs /.vs
/out /out
# Ignore CMakeUserPresets.json
CMakeUserPresets.json

View File

@ -106,6 +106,8 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# Platform-dependent implementation of system.h # Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_macosx.cpp") set(SYSTEM_CPP_MODULE "system_macosx.cpp")
set(SYSTEM_H_MODULE "system_macosx.h") set(SYSTEM_H_MODULE "system_macosx.h")
# Fix compilation errors in MacOS SDK files
set(CMAKE_CXX_FLAGS "${NORMAL_CXX_FLAGS} -Wno-nullability-extension -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-four-char-constants -Wno-gnu-zero-variadic-macro-arguments -Wno-variadic-macros -Wno-zero-length-array")
# To avoid CMake warning # To avoid CMake warning
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
@ -307,21 +309,14 @@ include("${colobot_SOURCE_DIR}/cmake/colobot-lint.cmake")
## ##
find_package(OpenGL 1.4 REQUIRED) find_package(OpenGL 1.4 REQUIRED)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(PNG 1.2 REQUIRED) find_package(PNG 1.2 REQUIRED)
find_package(Gettext REQUIRED) find_package(Gettext REQUIRED)
find_package(PhysFS REQUIRED) find_package(PhysFS REQUIRED)
find_package(glm CONFIG REQUIRED) find_package(glm CONFIG REQUIRED)
if(PLATFORM_WINDOWS)
find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2_image CONFIG REQUIRED)
find_package(SDL2_ttf CONFIG REQUIRED)
else()
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
endif()
# Add target alias glm::glm for older versions of the library # Add target alias glm::glm for older versions of the library
if(NOT TARGET glm::glm) if(NOT TARGET glm::glm)
add_library(glm::glm ALIAS glm) add_library(glm::glm ALIAS glm)
@ -351,9 +346,6 @@ endif()
find_package(SndFile REQUIRED) find_package(SndFile REQUIRED)
find_package(mpg123 QUIET)
find_package(mp3lame QUIET)
if(NOT ASSERTS) if(NOT ASSERTS)
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
endif() endif()

View File

@ -4,7 +4,7 @@ To compile Colobot on MacOS X, you need to first get Developer Command Line Tool
After installing Developer Command Line Tools, you should have basic tools like clang and git installed. After that, you can grab other required packages with Homebrew. So as in instructions on [the project page](http://brew.sh/): After installing Developer Command Line Tools, you should have basic tools like clang and git installed. After that, you can grab other required packages with Homebrew. So as in instructions on [the project page](http://brew.sh/):
```bash ```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
``` ```
And then: And then:
```bash ```bash
@ -20,7 +20,7 @@ If you've installed everything correctly, the simple way of compiling Colobot wi
git clone --recursive https://github.com/colobot/colobot.git git clone --recursive https://github.com/colobot/colobot.git
mkdir colobot/build mkdir colobot/build
cd colobot/build cd colobot/build
cmake ../ cmake -DOPENAL_LIBRARY=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenAL.framework/OpenAL.tbd ../
make make
``` ```

View File

@ -186,7 +186,7 @@ endif()
# SDL-2.0 is the name used by FreeBSD ports... # SDL-2.0 is the name used by FreeBSD ports...
# don't confuse it for the version number. # don't confuse it for the version number.
find_library(SDL2_LIBRARY find_library(SDL2_LIBRARY
NAMES SDL2 SDL-2.0 NAMES SDL2 SDL-2.0 SDL2-static
HINTS HINTS
ENV SDL2DIR ENV SDL2DIR
${SDL2_NO_DEFAULT_PATH_CMD} ${SDL2_NO_DEFAULT_PATH_CMD}
@ -223,7 +223,7 @@ if(NOT SDL2_BUILDING_LIBRARY)
HINTS HINTS
ENV SDL2DIR ENV SDL2DIR
${SDL2_NO_DEFAULT_PATH_CMD} ${SDL2_NO_DEFAULT_PATH_CMD}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} PATH_SUFFIXES lib lib/manual-link ${VC_LIB_PATH_SUFFIX}
PATHS ${SDL2MAIN_LIBRARY_PATHS} PATHS ${SDL2MAIN_LIBRARY_PATHS}
DOC "Where the SDL2main library can be found" DOC "Where the SDL2main library can be found"
) )

View File

@ -166,7 +166,7 @@ endif()
# Search for the SDL2_image library # Search for the SDL2_image library
find_library(SDL2_IMAGE_LIBRARY find_library(SDL2_IMAGE_LIBRARY
NAMES SDL2_image NAMES SDL2_image SDL2_image-static
HINTS HINTS
ENV SDL2IMAGEDIR ENV SDL2IMAGEDIR
ENV SDL2DIR ENV SDL2DIR

View File

@ -86,7 +86,7 @@ msgid "Access to solution\\Shows the solution (detailed instructions for mission
msgstr "Dostęp do rozwiązania\\Pokazuje rozwiązanie (szczegółowe instrukcje dotyczące misji)" msgstr "Dostęp do rozwiązania\\Pokazuje rozwiązanie (szczegółowe instrukcje dotyczące misji)"
msgid "Access to solutions\\Show program \"4: Solution\" in the exercises" msgid "Access to solutions\\Show program \"4: Solution\" in the exercises"
msgstr "Accčs aux solutions\\Programme \"4: Solution\" dans les exercices" msgstr "Dostęp do rozwiązań\\Pokaż program \"4: Rozwiązanie\" w ćwiczeniach"
msgid "Add new program" msgid "Add new program"
msgstr "Dodaj nowy program" msgstr "Dodaj nowy program"

View File

@ -19,6 +19,7 @@
#pragma once #pragma once
#include <cstdint>
#include <iostream> #include <iostream>
#include <string> #include <string>

View File

@ -21,6 +21,8 @@
#include "CBot/CBotInstr/CBotInstr.h" #include "CBot/CBotInstr/CBotInstr.h"
#include <cstdint>
namespace CBot namespace CBot
{ {

View File

@ -23,6 +23,8 @@
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
#include <cmath>
namespace CBot namespace CBot
{ {
@ -41,9 +43,9 @@ bool CBotExprLitNan::Execute(CBotStack* &pj)
CBotStack* pile = pj->AddStack(this); CBotStack* pile = pj->AddStack(this);
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create("", CBotTypInt); CBotVar* var = CBotVar::Create("", CBotTypFloat);
var->SetInit(CBotVar::InitType::IS_NAN); // nan var->SetValFloat(nanf(""));
pile->SetVar(var); // put on the stack pile->SetVar(var); // put on the stack
return pj->Return(pile); // forward below return pj->Return(pile); // forward below
} }

View File

@ -206,12 +206,6 @@ bool CBotExpression::Execute(CBotStack* &pj)
if (m_token.GetType() != ID_ASS) if (m_token.GetType() != ID_ASS)
{ {
pVar = pile1->GetVar(); // recovers if interrupted pVar = pile1->GetVar(); // recovers if interrupted
initKind = pVar->GetInit();
if (initKind == CBotVar::InitType::IS_NAN)
{
pile2->SetError(CBotErrNan, m_leftop->GetToken());
return pj->Return(pile2);
}
result = CBotVar::Create("", pVar->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC)); result = CBotVar::Create("", pVar->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC));
} }

View File

@ -38,6 +38,8 @@
#include "CBot/CBotCStack.h" #include "CBot/CBotCStack.h"
#include <cmath>
namespace CBot namespace CBot
{ {
@ -217,8 +219,8 @@ CBotInstr* CBotParExpr::CompileLitExpr(CBotToken* &p, CBotCStack* pStack)
{ {
CBotInstr* inst = new CBotExprLitNan(); CBotInstr* inst = new CBotExprLitNan();
inst->SetToken(pp); inst->SetToken(pp);
CBotVar* var = CBotVar::Create("", CBotTypInt); CBotVar* var = CBotVar::Create("", CBotTypFloat);
var->SetInit(CBotVar::InitType::IS_NAN); var->SetValFloat(nanf(""));
pStk->SetVar(var); pStk->SetVar(var);
return pStack->Return(inst, pStk); return pStack->Return(inst, pStk);
} }

View File

@ -56,11 +56,6 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj)
CBotStack* pile3 = pile2->AddStack(this); CBotStack* pile3 = pile2->AddStack(this);
if (pile3->IfStep()) return false; if (pile3->IfStep()) return false;
if (var1->IsNAN())
{
pile1->SetError(CBotErrNan, &m_token);
}
if (!var1->IsDefined()) if (!var1->IsDefined())
{ {
pile1->SetError(CBotErrNotInit, &m_token); pile1->SetError(CBotErrNotInit, &m_token);

View File

@ -55,12 +55,6 @@ bool CBotPreIncExpr::Execute(CBotStack* &pj)
// pile2 is modified on return // pile2 is modified on return
if (!(static_cast<CBotExprVar*>(m_instr))->ExecuteVar(var1, pile2, nullptr, true)) return false; if (!(static_cast<CBotExprVar*>(m_instr))->ExecuteVar(var1, pile2, nullptr, true)) return false;
if (var1->IsNAN())
{
pile->SetError(CBotErrNan, &m_token);
return pj->Return(pile); // operation performed
}
if (!var1->IsDefined()) if (!var1->IsDefined())
{ {
pile->SetError(CBotErrNotInit, &m_token); pile->SetError(CBotErrNotInit, &m_token);

View File

@ -31,6 +31,7 @@
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
#include <cassert> #include <cassert>
#include <cmath>
#include <algorithm> #include <algorithm>
namespace CBot namespace CBot
@ -305,7 +306,13 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
static bool VarIsNAN(const CBotVar* var) static bool VarIsNAN(const CBotVar* var)
{ {
return var->GetInit() > CBotVar::InitType::DEF; if (var->GetType() == CBotTypFloat)
return std::isnan(var->GetValFloat());
if (var->GetType() == CBotTypDouble)
return std::isnan(var->GetValDouble());
return false;
} }
static bool IsNan(CBotVar* left, CBotVar* right, CBotError* err = nullptr) static bool IsNan(CBotVar* left, CBotVar* right, CBotError* err = nullptr)
@ -475,13 +482,13 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
break; break;
case ID_EQ: case ID_EQ:
if ( IsNan(left, right) ) if ( IsNan(left, right) )
result->SetValInt(left->GetInit() == right->GetInit()) ; result->SetValInt(VarIsNAN(left) == VarIsNAN(right));
else else
result->SetValInt(temp->Eq(left , right)); // equal result->SetValInt(temp->Eq(left , right)); // equal
break; break;
case ID_NE: case ID_NE:
if ( IsNan(left, right) ) if ( IsNan(left, right) )
result->SetValInt(left ->GetInit() != right->GetInit()) ; result->SetValInt(VarIsNAN(left) != VarIsNAN(right));
else else
result->SetValInt(temp->Ne(left , right)); // different result->SetValInt(temp->Ne(left , right)); // different
break; break;

View File

@ -30,6 +30,7 @@
#include "CBot/CBotExternalCall.h" #include "CBot/CBotExternalCall.h"
#include <cassert> #include <cassert>
#include <cstdint>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>

View File

@ -355,7 +355,7 @@ CBotTypResult CBotVar::GetTypResult(GetTypeMode mode)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CBotType CBotVar::GetType(GetTypeMode mode) CBotType CBotVar::GetType(GetTypeMode mode) const
{ {
if ( mode == GetTypeMode::CLASS_AS_POINTER && m_type.Eq(CBotTypClass) ) if ( mode == GetTypeMode::CLASS_AS_POINTER && m_type.Eq(CBotTypClass) )
return CBotTypPointer; return CBotTypPointer;
@ -584,43 +584,43 @@ CBotVarClass* CBotVar::GetPointer()
// All these functions must be defined in the subclasses // All these functions must be defined in the subclasses
// derived from class CBotVar // derived from class CBotVar
signed char CBotVar::GetValByte() signed char CBotVar::GetValByte() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
short CBotVar::GetValShort() short CBotVar::GetValShort() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
uint32_t CBotVar::GetValChar() uint32_t CBotVar::GetValChar() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
int CBotVar::GetValInt() int CBotVar::GetValInt() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
long CBotVar::GetValLong() long CBotVar::GetValLong() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
float CBotVar::GetValFloat() float CBotVar::GetValFloat() const
{ {
assert(0); assert(0);
return 0; return 0;
} }
double CBotVar::GetValDouble() double CBotVar::GetValDouble() const
{ {
assert(0); assert(0);
return 0; return 0;
@ -822,7 +822,7 @@ void CBotVar::SetValString(const std::string& val)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string CBotVar::GetValString() std::string CBotVar::GetValString() const
{ {
assert(0); assert(0);
return std::string(); return std::string();

View File

@ -24,6 +24,7 @@
#include "CBot/CBotEnums.h" #include "CBot/CBotEnums.h"
#include "CBot/CBotUtils.h" #include "CBot/CBotUtils.h"
#include <cstdint>
#include <string> #include <string>
namespace CBot namespace CBot
@ -199,7 +200,7 @@ public:
* \brief GetType Returns the base type of the variable (::CBotType) * \brief GetType Returns the base type of the variable (::CBotType)
* \param mode Mode, see GetTypeMode enum * \param mode Mode, see GetTypeMode enum
*/ */
CBotType GetType(GetTypeMode mode = GetTypeMode::NORMAL); CBotType GetType(GetTypeMode mode = GetTypeMode::NORMAL) const;
/** /**
* \brief Returns the complete type of the variable (CBotTypResult) * \brief Returns the complete type of the variable (CBotTypResult)
@ -243,7 +244,6 @@ public:
UNDEF = 0, //!< the variable value is currently not defined UNDEF = 0, //!< the variable value is currently not defined
DEF = 1, //!< the variable value is defined DEF = 1, //!< the variable value is defined
IS_POINTER = 2, //!< the variable value is as a pointer IS_POINTER = 2, //!< the variable value is as a pointer
IS_NAN = 999 //!< the variable value is NAN
}; };
/** /**
@ -269,12 +269,6 @@ public:
*/ */
bool IsDefined() const { return GetInit() == InitType::DEF; } bool IsDefined() const { return GetInit() == InitType::DEF; }
/**
* \brief Checks if the variable is currently NAN
* \return InitType::NAN
*/
bool IsNAN() const { return GetInit() == InitType::IS_NAN; }
//@} //@}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -508,27 +502,27 @@ public:
*/ */
virtual void SetValString(const std::string& val); virtual void SetValString(const std::string& val);
virtual signed char GetValByte(); virtual signed char GetValByte() const;
virtual short GetValShort(); virtual short GetValShort() const;
virtual uint32_t GetValChar(); virtual uint32_t GetValChar() const;
/** /**
* \brief Get value as integer * \brief Get value as integer
* \return Current value * \return Current value
*/ */
virtual int GetValInt(); virtual int GetValInt() const;
virtual long GetValLong(); virtual long GetValLong() const;
/** /**
* \brief Get value as float * \brief Get value as float
* \return Current value * \return Current value
*/ */
virtual float GetValFloat(); virtual float GetValFloat() const;
virtual double GetValDouble(); virtual double GetValDouble() const;
/** /**
* \brief Get value as string * \brief Get value as string
@ -539,7 +533,7 @@ public:
* *
* \return Current value * \return Current value
*/ */
virtual std::string GetValString(); virtual std::string GetValString() const;
/** /**
* \brief Set value for pointer types * \brief Set value for pointer types

View File

@ -129,7 +129,7 @@ CBotVar* CBotVarArray::GetItemList()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string CBotVarArray::GetValString() std::string CBotVarArray::GetValString() const
{ {
if ( m_pInstance == nullptr ) return ( std::string( "Null pointer" ) ) ; if ( m_pInstance == nullptr ) return ( std::string( "Null pointer" ) ) ;
return m_pInstance->GetValString(); return m_pInstance->GetValString();

View File

@ -49,7 +49,7 @@ public:
CBotVar* GetItem(int n, bool grow = false) override; CBotVar* GetItem(int n, bool grow = false) override;
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
std::string GetValString() override; std::string GetValString() const override;
bool Save1State(std::ostream &ostr) override; bool Save1State(std::ostream &ostr) override;

View File

@ -32,12 +32,10 @@ class CBotVarChar : public CBotVarInteger<uint32_t, CBotTypChar>
public: public:
CBotVarChar(const CBotToken &name) : CBotVarInteger(name) {} CBotVarChar(const CBotToken &name) : CBotVarInteger(name) {}
std::string GetValString() override std::string GetValString() const override
{ {
if (m_binit == CBotVar::InitType::UNDEF) if (m_binit == CBotVar::InitType::UNDEF)
return LoadString(TX_UNDEF); return LoadString(TX_UNDEF);
if (m_binit == CBotVar::InitType::IS_NAN)
return LoadString(TX_NAN);
if (0x10FFFF < m_val || (0xD7FF < m_val && m_val < 0xE000)) if (0x10FFFF < m_val || (0xD7FF < m_val && m_val < 0xE000))
return "\xEF\xBF\xBD"; // replacement character U+FFFD return "\xEF\xBF\xBD"; // replacement character U+FFFD

View File

@ -291,7 +291,7 @@ CBotVar* CBotVarClass::GetItemList()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string CBotVarClass::GetValString() std::string CBotVarClass::GetValString() const
{ {
std::string res; std::string res;

View File

@ -52,7 +52,7 @@ public:
CBotVar* GetItemRef(int nIdent) override; CBotVar* GetItemRef(int nIdent) override;
CBotVar* GetItem(int n, bool bExtend) override; CBotVar* GetItem(int n, bool bExtend) override;
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
std::string GetValString() override; std::string GetValString() const override;
bool Save1State(std::ostream &ostr) override; bool Save1State(std::ostream &ostr) override;

View File

@ -35,7 +35,7 @@ void CBotVarInt::SetValInt(int val, const std::string& defnum)
m_defnum = defnum; m_defnum = defnum;
} }
std::string CBotVarInt::GetValString() std::string CBotVarInt::GetValString() const
{ {
if (!m_defnum.empty()) return m_defnum; if (!m_defnum.empty()) return m_defnum;
return CBotVarValue::GetValString(); return CBotVarValue::GetValString();

View File

@ -33,7 +33,7 @@ public:
CBotVarInt(const CBotToken &name) : CBotVarInteger(name) {} CBotVarInt(const CBotToken &name) : CBotVarInteger(name) {}
void SetValInt(int val, const std::string& s = "") override; void SetValInt(int val, const std::string& s = "") override;
std::string GetValString() override; std::string GetValString() const override;
void Copy(CBotVar* pSrc, bool bName = true) override; void Copy(CBotVar* pSrc, bool bName = true) override;

View File

@ -90,7 +90,7 @@ CBotVar* CBotVarPointer::GetItemList()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string CBotVarPointer::GetValString() std::string CBotVarPointer::GetValString() const
{ {
std::string s = "Pointer to "; std::string s = "Pointer to ";
if ( m_pVarClass == nullptr ) s = "Null pointer" ; if ( m_pVarClass == nullptr ) s = "Null pointer" ;

View File

@ -47,7 +47,7 @@ public:
CBotVar* GetItem(const std::string& name) override; CBotVar* GetItem(const std::string& name) override;
CBotVar* GetItemRef(int nIdent) override; CBotVar* GetItemRef(int nIdent) override;
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
std::string GetValString() override; std::string GetValString() const override;
void SetPointer(CBotVar* p) override; void SetPointer(CBotVar* p) override;
CBotVarClass* GetPointer() override; CBotVarClass* GetPointer() override;

View File

@ -48,12 +48,12 @@ public:
SetValString(ToString(val)); SetValString(ToString(val));
} }
int GetValInt() override int GetValInt() const override
{ {
return FromString<int>(GetValString()); return FromString<int>(GetValString());
} }
float GetValFloat() override float GetValFloat() const override
{ {
return FromString<float>(GetValString()); return FromString<float>(GetValString());
} }

View File

@ -62,15 +62,13 @@ public:
m_binit = CBotVar::InitType::DEF; m_binit = CBotVar::InitType::DEF;
} }
std::string GetValString() override std::string GetValString() const override
{ {
if (m_binit == CBotVar::InitType::UNDEF) if (m_binit == CBotVar::InitType::UNDEF)
return LoadString(TX_UNDEF); return LoadString(TX_UNDEF);
if (m_binit == CBotVar::InitType::IS_NAN)
return LoadString(TX_NAN);
std::ostringstream s; std::ostringstream s;
s << m_val; s << std::boolalpha << m_val;
return s.str(); return s.str();
} }
@ -133,37 +131,37 @@ public:
this->SetValue(static_cast<T>(val)); this->SetValue(static_cast<T>(val));
} }
signed char GetValByte() override signed char GetValByte() const override
{ {
return static_cast<signed char>(this->m_val); return static_cast<signed char>(this->m_val);
} }
short GetValShort() override short GetValShort() const override
{ {
return static_cast<short>(this->m_val); return static_cast<short>(this->m_val);
} }
uint32_t GetValChar() override uint32_t GetValChar() const override
{ {
return static_cast<uint32_t>(this->m_val); return static_cast<uint32_t>(this->m_val);
} }
int GetValInt() override int GetValInt() const override
{ {
return static_cast<int>(this->m_val); return static_cast<int>(this->m_val);
} }
long GetValLong() override long GetValLong() const override
{ {
return static_cast<long>(this->m_val); return static_cast<long>(this->m_val);
} }
float GetValFloat() override float GetValFloat() const override
{ {
return static_cast<float>(this->m_val); return static_cast<float>(this->m_val);
} }
double GetValDouble() override double GetValDouble() const override
{ {
return static_cast<double>(this->m_val); return static_cast<double>(this->m_val);
} }

View File

@ -133,7 +133,7 @@ bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception
if (!pVar->IsDefined()) return true; // file not opened if (!pVar->IsDefined()) return true; // file not opened
g_files.erase(pVar->GetValInt()); g_files.erase(pVar->GetValInt());
pVar->SetInit(CBotVar::InitType::IS_NAN); pVar->SetInit(CBotVar::InitType::UNDEF);
return true; return true;
} }
@ -203,7 +203,7 @@ bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception, v
g_files.erase(handleIter); g_files.erase(handleIter);
pVar->SetInit(CBotVar::InitType::IS_NAN); pVar->SetInit(CBotVar::InitType::UNDEF);
return true; return true;
} }

View File

@ -218,6 +218,37 @@ bool rTrunc(CBotVar* var, CBotVar* result, int& exception, void* user)
return true; return true;
} }
// Instruction "isnan()"
CBotTypResult cIsNAN(CBotVar*& var, void* user)
{
if (var == nullptr) return CBotTypResult(CBotErrLowParam);
if (var->GetType() > CBotTypDouble) return CBotTypResult(CBotErrBadNum);
var = var->GetNext();
if (var != nullptr) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypBoolean);
}
bool rIsNAN(CBotVar* var, CBotVar* result, int& exception, void* user)
{
bool isnan = false;
if (var->GetType() == CBotTypFloat)
{
if (std::isnan(var->GetValFloat())) isnan = true;
}
else if (var->GetType() == CBotTypDouble)
{
if (std::isnan(var->GetValDouble())) isnan = true;
}
result->SetValInt(isnan);
return true;
}
} // namespace } // namespace
void InitMathFunctions() void InitMathFunctions()
@ -237,6 +268,7 @@ void InitMathFunctions()
CBotProgram::AddFunction("ceil", rCeil, cOneFloat); CBotProgram::AddFunction("ceil", rCeil, cOneFloat);
CBotProgram::AddFunction("round", rRound, cOneFloat); CBotProgram::AddFunction("round", rRound, cOneFloat);
CBotProgram::AddFunction("trunc", rTrunc, cOneFloat); CBotProgram::AddFunction("trunc", rTrunc, cOneFloat);
CBotProgram::AddFunction("isnan", rIsNAN, cIsNAN);
} }
} // namespace CBot } // namespace CBot

View File

@ -233,7 +233,7 @@ bool rStrFind( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
} }
else else
{ {
pResult->SetInit(CBotVar::InitType::IS_NAN); pResult->SetValInt(-1);
} }
return true; return true;
} }

View File

@ -1,5 +1,5 @@
# Compile flags as defined in global CMakeLists # Compile flags as defined in global CMakeLists
set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS}") set(CMAKE_CXX_FLAGS ${COLOBOT_CXX_FLAGS})
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
@ -487,6 +487,9 @@ target_include_directories(colobotbase PUBLIC
target_link_libraries(colobotbase PUBLIC target_link_libraries(colobotbase PUBLIC
CBot CBot
localename localename
SDL2::Core
SDL2::Image
SDL2::TTF
OpenGL::GL OpenGL::GL
PNG::PNG PNG::PNG
GLEW::GLEW GLEW::GLEW
@ -499,34 +502,6 @@ target_link_libraries(colobotbase PUBLIC
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
) )
if(PLATFORM_WINDOWS)
target_link_libraries(colobotbase PUBLIC
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
)
elseif()
target_link_libraries(colobotbase PUBLIC
SDL2::Core
SDL2::Image
SDL2::TTF
)
endif()
if(mpg123_FOUND)
target_link_libraries(colobotbase PUBLIC
MPG123::libmpg123
MPG123::libout123
MPG123::libsyn123
)
endif()
if(mp3lame_FOUND)
target_link_libraries(colobotbase PUBLIC
mp3lame::mp3lame
)
endif()
# Optional libraries # Optional libraries
if(OPENAL_SOUND) if(OPENAL_SOUND)
target_sources(colobotbase PRIVATE target_sources(colobotbase PRIVATE
@ -556,9 +531,6 @@ if(PLATFORM_WINDOWS)
find_package(Intl REQUIRED) find_package(Intl REQUIRED)
find_library(BZ2_LIBRARY NAMES bz2) find_library(BZ2_LIBRARY NAMES bz2)
find_library(JPEG_LIBRARY NAMES jpeg)
find_library(TIFF_LIBRARY NAMES tiff)
find_library(LZMA_LIBRARY NAMES lzma)
find_library(FREETYPE_LIBRARY NAMES freetype) find_library(FREETYPE_LIBRARY NAMES freetype)
find_library(ICONV_LIBRARY NAMES iconv) find_library(ICONV_LIBRARY NAMES iconv)
find_library(CHARSET_LIBRARY NAMES charset) find_library(CHARSET_LIBRARY NAMES charset)
@ -568,10 +540,7 @@ if(PLATFORM_WINDOWS)
target_link_libraries(colobotbase PUBLIC target_link_libraries(colobotbase PUBLIC
Gettext::Intl Gettext::Intl
${JPEG_LIBRARY}
${TIFF_LIBRARY}
${BZ2_LIBRARY} ${BZ2_LIBRARY}
${LZMA_LIBRARY}
${FREETYPE_LIBRARY} ${FREETYPE_LIBRARY}
${ICONV_LIBRARY} ${ICONV_LIBRARY}
${CHARSET_LIBRARY} ${CHARSET_LIBRARY}
@ -622,11 +591,7 @@ if(PLATFORM_WINDOWS)
target_sources(colobot PRIVATE ../desktop/colobot.rc) target_sources(colobot PRIVATE ../desktop/colobot.rc)
endif() endif()
if(PLATFORM_WINDOWS)
target_link_libraries(colobot colobotbase SDL2::SDL2main)
elseif()
target_link_libraries(colobot colobotbase SDL2::Main) target_link_libraries(colobot colobotbase SDL2::Main)
endif()
# Install # Install
install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR}) install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})

View File

@ -3242,7 +3242,8 @@ void CEngine::Capture3DScene()
// create SDL surface and final texture // create SDL surface and final texture
ImageData image; ImageData image;
image.surface = SDL_CreateRGBSurfaceFrom(blured.get(), newWidth, newHeight, 32, 0, 0, 0, 0, 0xFF000000); image.surface = SDL_CreateRGBSurfaceFrom(blured.get(), newWidth, newHeight,
32, 4 * newWidth, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
TextureCreateParams params; TextureCreateParams params;
params.filter = TextureFilter::BILINEAR; params.filter = TextureFilter::BILINEAR;

View File

@ -112,6 +112,8 @@ private:
if (variant < other.variant) if (variant < other.variant)
return true; return true;
if (variant > other.variant)
return false;
return !mirrored && mirrored != other.mirrored; return !mirrored && mirrored != other.mirrored;
} }

View File

@ -113,6 +113,7 @@
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
#include <stdexcept> #include <stdexcept>
#include <cmath>
#include <ctime> #include <ctime>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -4136,13 +4137,33 @@ float SearchNearestObject(CObjectManager* objMan, glm::vec3 center, CObject* exc
} }
return min; return min;
} }
bool BlockedByObject(CObjectManager* objMan, const glm::vec3& center, float space, CObject* exclu)
{
for (CObject* obj : objMan->GetAllObjects())
{
if (!obj->GetDetectable()) continue; // inactive?
if (IsObjectBeingTransported(obj)) continue;
if (obj == exclu) continue;
for (const auto &crashSphere : obj->GetAllCrashSpheres())
{
const glm::vec3 oPos = crashSphere.sphere.pos;
const float oRadius = crashSphere.sphere.radius;
const float minDist = oRadius + space;
if (glm::distance(center, oPos) < minDist)
return true;
}
}
return false;
}
} }
//! Calculates a free space //! Calculates a free space
bool CRobotMain::FreeSpace(glm::vec3 &center, float minRadius, float maxRadius, bool CRobotMain::FreeSpace(glm::vec3 &center, float minRadius, float maxRadius,
float space, CObject *exclu) float space, CObject *exclu)
{
if (minRadius < maxRadius) // from internal to external?
{ {
for (float radius = minRadius; radius <= maxRadius; radius += space) for (float radius = minRadius; radius <= maxRadius; radius += space)
{ {
@ -4152,17 +4173,18 @@ bool CRobotMain::FreeSpace(glm::vec3 &center, float minRadius, float maxRadius,
glm::vec2 p; glm::vec2 p;
p.x = center.x+radius; p.x = center.x+radius;
p.y = center.z; p.y = center.z;
p = Math::RotatePoint({ center.x, center.z }, angle, p); p = Math::RotatePoint(glm::vec2(center.x, center.z), angle, p);
glm::vec3 pos; glm::vec3 pos;
pos.x = p.x; pos.x = p.x;
pos.z = p.y; pos.z = p.y;
pos.y = 0.0f; pos.y = 0.0f;
m_terrain->AdjustToFloor(pos, true); pos.y = m_terrain->GetFloorLevel(pos);
float dist = SearchNearestObject(m_objMan.get(), pos, exclu);
if (dist >= space) if (!BlockedByObject(m_objMan.get(), pos, space, exclu))
{ {
float flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f); float flat = m_terrain->GetFlatZoneRadius(pos, space);
if (flat >= dist/2.0f) if (flat >= space)
{ {
center = pos; center = pos;
return true; return true;
@ -4170,36 +4192,11 @@ bool CRobotMain::FreeSpace(glm::vec3 &center, float minRadius, float maxRadius,
} }
} }
} }
}
else // from external to internal? float nan = nanf("");
{
for (float radius=maxRadius; radius >= minRadius; radius -= space) center = glm::vec3{ nan, nan, nan };
{
float ia = space/radius;
for (float angle=0.0f ; angle<Math::PI*2.0f ; angle+=ia )
{
glm::vec2 p;
p.x = center.x+radius;
p.y = center.z;
p = Math::RotatePoint({ center.x, center.z }, angle, p);
glm::vec3 pos;
pos.x = p.x;
pos.z = p.y;
pos.y = 0.0f;
m_terrain->AdjustToFloor(pos, true);
float dist = SearchNearestObject(m_objMan.get(), pos, exclu);
if (dist >= space)
{
float flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f);
if (flat >= dist/2.0f)
{
center = pos;
return true;
}
}
}
}
}
return false; return false;
} }

View File

@ -33,6 +33,8 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <string>
class CLevelParserLine; class CLevelParserLine;
class CObject; class CObject;

View File

@ -100,7 +100,7 @@ float HaltToFloat(uint16_t value)
// NaN // NaN
else if ((exponent == 31) && (mantissa != 0)) else if ((exponent == 31) && (mantissa != 0))
{ {
result = std::nanf(""); result = nanf("");
} }
// Normal number // Normal number
else else

View File

@ -24,6 +24,7 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <array> #include <array>
#include <cstdint>
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -301,6 +301,7 @@ std::string GetHelpFilename(const char *token)
if ( strcmp(token, "ceil" ) == 0 ) helpfile = "cbot/ceil"; if ( strcmp(token, "ceil" ) == 0 ) helpfile = "cbot/ceil";
if ( strcmp(token, "round" ) == 0 ) helpfile = "cbot/round"; if ( strcmp(token, "round" ) == 0 ) helpfile = "cbot/round";
if ( strcmp(token, "trunc" ) == 0 ) helpfile = "cbot/trunc"; if ( strcmp(token, "trunc" ) == 0 ) helpfile = "cbot/trunc";
if ( strcmp(token, "isnan" ) == 0 ) helpfile = "cbot/isnan";
if ( strcmp(token, "retobject" ) == 0 ) helpfile = "cbot/retobj"; if ( strcmp(token, "retobject" ) == 0 ) helpfile = "cbot/retobj";
if ( strcmp(token, "errmode" ) == 0 ) helpfile = "cbot/errmode"; if ( strcmp(token, "errmode" ) == 0 ) helpfile = "cbot/errmode";
if ( strcmp(token, "isbusy" ) == 0 ) helpfile = "cbot/isbusy"; if ( strcmp(token, "isbusy" ) == 0 ) helpfile = "cbot/isbusy";
@ -463,6 +464,7 @@ bool IsFunction(const char *token)
if ( strcmp(token, "ceil" ) == 0 ) return true; if ( strcmp(token, "ceil" ) == 0 ) return true;
if ( strcmp(token, "round" ) == 0 ) return true; if ( strcmp(token, "round" ) == 0 ) return true;
if ( strcmp(token, "trunc" ) == 0 ) return true; if ( strcmp(token, "trunc" ) == 0 ) return true;
if ( strcmp(token, "isnan" ) == 0 ) return true;
if ( strcmp(token, "retobjectbyid") == 0 ) return true; if ( strcmp(token, "retobjectbyid") == 0 ) return true;
if ( strcmp(token, "retobject" ) == 0 ) return true; if ( strcmp(token, "retobject" ) == 0 ) return true;
if ( strcmp(token, "isbusy" ) == 0 ) return true; if ( strcmp(token, "isbusy" ) == 0 ) return true;
@ -571,6 +573,7 @@ const char* GetHelpText(const char *token)
if ( strcmp(token, "ceil" ) == 0 ) return "ceil ( value );"; if ( strcmp(token, "ceil" ) == 0 ) return "ceil ( value );";
if ( strcmp(token, "round" ) == 0 ) return "round ( value );"; if ( strcmp(token, "round" ) == 0 ) return "round ( value );";
if ( strcmp(token, "trunc" ) == 0 ) return "trunc ( value );"; if ( strcmp(token, "trunc" ) == 0 ) return "trunc ( value );";
if ( strcmp(token, "isnan" ) == 0 ) return "isnan ( value );";
if ( strcmp(token, "retobject" ) == 0 ) return "retobject ( rank );"; if ( strcmp(token, "retobject" ) == 0 ) return "retobject ( rank );";
if ( strcmp(token, "retobjectbyid") == 0 ) return "retobjectbyid ( rank );"; if ( strcmp(token, "retobjectbyid") == 0 ) return "retobjectbyid ( rank );";
if ( strcmp(token, "progfunc" ) == 0 ) return "progfunc ( funcname );"; if ( strcmp(token, "progfunc" ) == 0 ) return "progfunc ( funcname );";

View File

@ -67,6 +67,8 @@
#include "ui/displaytext.h" #include "ui/displaytext.h"
#include <cmath>
using namespace CBot; using namespace CBot;
CBotTypResult CScriptFunctions::cClassNull(CBotVar* thisclass, CBotVar* &var) CBotTypResult CScriptFunctions::cClassNull(CBotVar* thisclass, CBotVar* &var)
@ -1836,12 +1838,15 @@ bool CScriptFunctions::rSpace(CBotVar* var, CBotVar* result, int& exception, voi
} }
} }
} }
script->m_main->FreeSpace(center, rMin, rMax, dist, pThis);
bool success = script->m_main->FreeSpace(center, rMin, rMax, dist, pThis);
if ( result != nullptr ) if ( result != nullptr )
{ {
pSub = result->GetItemList(); pSub = result->GetItemList();
if ( pSub != nullptr ) if ( pSub != nullptr )
{
if (success)
{ {
pSub->SetValFloat(center.x / g_unit); pSub->SetValFloat(center.x / g_unit);
pSub = pSub->GetNext(); // "y" pSub = pSub->GetNext(); // "y"
@ -1849,6 +1854,15 @@ bool CScriptFunctions::rSpace(CBotVar* var, CBotVar* result, int& exception, voi
pSub = pSub->GetNext(); // "z" pSub = pSub->GetNext(); // "z"
pSub->SetValFloat(center.y / g_unit); pSub->SetValFloat(center.y / g_unit);
} }
else
{
pSub->SetValFloat(center.x);
pSub = pSub->GetNext(); // "y"
pSub->SetValFloat(center.y);
pSub = pSub->GetNext(); // "z"
pSub->SetValFloat(center.z);
}
}
} }
return true; return true;
} }
@ -2313,7 +2327,7 @@ bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, v
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
script->m_taskExecutor->StopForegroundTask(); script->m_taskExecutor->StopForegroundTask();
result->SetInit(CBotVar::InitType::IS_NAN); result->SetValFloat(nanf(""));
return true; return true;
} }
@ -2324,7 +2338,7 @@ bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, v
if ( script->m_returnValue == boost::none ) if ( script->m_returnValue == boost::none )
{ {
result->SetInit(CBotVar::InitType::IS_NAN); result->SetValFloat(nanf(""));
} }
else else
{ {
@ -2859,6 +2873,7 @@ CBotTypResult CScriptFunctions::cMessage(CBotVar* &var, void* user)
{ {
if ( var == nullptr ) return CBotTypResult(CBotErrLowParam); if ( var == nullptr ) return CBotTypResult(CBotErrLowParam);
if ( var->GetType() != CBotTypString && if ( var->GetType() != CBotTypString &&
var->GetType() != CBotTypBoolean &&
var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
var = var->GetNext(); var = var->GetNext();
@ -3644,11 +3659,11 @@ void CScriptFunctions::uObject(CBotVar* botThis, void* user)
if (IsObjectBeingTransported(object)) if (IsObjectBeingTransported(object))
{ {
pSub = pVar->GetItemList(); // "x" pSub = pVar->GetItemList(); // "x"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
pSub = pSub->GetNext(); // "y" pSub = pSub->GetNext(); // "y"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
pSub = pSub->GetNext(); // "z" pSub = pSub->GetNext(); // "z"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
} }
else else
{ {
@ -3749,11 +3764,11 @@ void CScriptFunctions::uObject(CBotVar* botThis, void* user)
if (IsObjectBeingTransported(object) || physics == nullptr) if (IsObjectBeingTransported(object) || physics == nullptr)
{ {
pSub = pVar->GetItemList(); // "x" pSub = pVar->GetItemList(); // "x"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
pSub = pSub->GetNext(); // "y" pSub = pSub->GetNext(); // "y"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
pSub = pSub->GetNext(); // "z" pSub = pSub->GetNext(); // "z"
pSub->SetInit(CBotVar::InitType::IS_NAN); pSub->SetValFloat(nanf(""));
} }
else else
{ {

49
vcpkg.json Normal file
View File

@ -0,0 +1,49 @@
{
"name": "colobot",
"version-string": "0.1.0",
"builtin-baseline": "e809a42f87565e803b2178a0c11263f462d1800a",
"dependencies": [
"boost-algorithm",
"boost-bimap",
"boost-filesystem",
"boost-lexical-cast",
"boost-optional",
"boost-property-tree",
"boost-range",
"boost-regex",
"boost-system",
{
"name": "freetype",
"default-features": false
},
"glew",
"glm",
"gettext",
"libogg",
"libpng",
{
"name": "libsndfile",
"default-features": false,
"features": [ "external-libs" ]
},
"libvorbis",
"openal-soft",
"opus",
"physfs",
"sdl2",
{
"name": "sdl2-image",
"default-features": false
},
{
"name": "sdl2-ttf",
"default-features": false
},
"zlib"
],
"overrides": [
{
"name": "zlib", "version": "1.2.13"
}
]
}