Fix for invisible batteries (code by melex750) (#1520)

* Fix for invisible batteries (code by melex750)

* Updated vcpkg

* A workaround for sprintf define

* Added mpg123 to dependencies due to newer version of SndFile

* Removed CONFIG

* Another fix for dependencies

* Made additional dependencies optional
fix-squashed-planets
Tomasz Kapuściński 2022-04-29 00:02:04 +02:00 committed by GitHub
parent 07541d0bbb
commit b6f2a9e544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 15 deletions

View File

@ -14,7 +14,7 @@ jobs:
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
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 libmpg123-dev
if: matrix.container == ''
- uses: actions/checkout@v2
- name: Checkout the Google Test submodule
@ -98,11 +98,11 @@ jobs:
- name: Install Colobot dependencies
uses: lukka/run-vcpkg@v7
with:
vcpkgGitCommitId: '210240b399fbc2f1363f4103b6a93629c207d7e3'
vcpkgGitCommitId: 'e809a42f87565e803b2178a0c11263f462d1800a'
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'
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 mpg123'
# SHA-256 hash of the list of packages above, for caching purposes
appendedCacheKey: '35754367e6e6b4fb1b1ec24fa631e5234548fa1f9a59e4f2d80d2174a3a4e1b5'
appendedCacheKey: '84402d9834b06a1b571e0fda32a791915777d47a394a1469d4773322bd71614b'
- name: Install external tools
working-directory: ${{ github.workspace }}
run: |
@ -158,7 +158,7 @@ jobs:
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
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 libmpg123-dev
- uses: actions/checkout@v2
- name: Create build directory
run: cmake -E make_directory build

View File

@ -327,8 +327,11 @@ find_package(GLEW REQUIRED)
if (OPENAL_SOUND)
find_package(OpenAL REQUIRED)
endif()
find_package(SndFile REQUIRED)
find_package(mpg123 QUIET)
find_package(mp3lame QUIET)
if(NOT ASSERTS)
add_definitions(-DNDEBUG)

View File

@ -493,6 +493,20 @@ target_link_libraries(colobotbase PUBLIC
SndFile::sndfile
)
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
if(OPENAL_SOUND)
target_sources(colobotbase PRIVATE

View File

@ -56,11 +56,12 @@
#include <SDL_image.h>
#include <stdlib.h>
#include <libintl.h>
#include <getopt.h>
#include <localename.h>
#include <thread>
#include <libintl.h>
using TimeUtils::TimeStamp;
using TimeUtils::TimeUnit;

View File

@ -31,10 +31,11 @@
#include "object/object_type.h"
#include <libintl.h>
#include <SDL_keyboard.h>
#include <boost/regex.hpp>
#include <libintl.h>
const char* stringsText[RT_MAX] = { nullptr };
const char* stringsEvent[EVENT_STD_MAX] = { nullptr };
const char* stringsObject[OBJECT_MAX] = { nullptr };

View File

@ -4930,6 +4930,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
assert(slotNum >= 0);
assert(slots.find(slotNum) == slots.end());
asSlotted->SetSlotContainedObject(slotNum, power);
dynamic_cast<CTransportableObject&>(*power).SetTransporter(obj);
}
for (std::pair<const int, CObject*>& slot : slots)
@ -4949,14 +4950,6 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
assert(cargo == nullptr);
}
if (power != nullptr)
{
dynamic_cast<CSlottedObject&>(*obj).SetSlotContainedObjectReq(CSlottedObject::Pseudoslot::POWER, power);
dynamic_cast<CTransportableObject&>(*power).SetTransporter(obj);
}
cargo = nullptr;
power = nullptr;
objCounter++;
}
}