Skip to content

Commit

Permalink
Fix workshop getting stuck on job #182
Browse files Browse the repository at this point in the history
  • Loading branch information
Ext3h committed Aug 15, 2021
1 parent c78f3a0 commit 9a758ae
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16.0)
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo CACHE STRING INTERNAL FORCE)

# Project version, 4 numbers representation
set(DEFAULT_VERSION "0.8.9.0" CACHE STRING "Version" FORCE)
set(DEFAULT_VERSION "0.8.10.0" CACHE STRING "Version" FORCE)
# Set from CI only
set(BUILD_ID "0" CACHE INTERNAL "")
set(GIT_REPO "" CACHE INTERNAL "")
Expand Down
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.8.10]

### Fixed
- fix workshop getting stuck if job prerequisites are used elsewhere (#182)
- fix half-height walls being completely flat

## [0.8.9]

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Just looking for the game itself?
Prebuilt binaries are available in the [release section](https://github.com/rschurade/Ingnomia/releases) or on
[Steam](https://store.steampowered.com/app/709240/Ingnomia/).

The active community for this game can be found on our [Discord server](https://discord.gg/y5GygwY).

## What is this? ##

Ingnomia started out as an independent remake of the older [Gnomoria](https://store.steampowered.com/app/224500/Gnomoria/) colony simulator, from which it was permitted to borrow some of the assets.
Expand Down
24 changes: 22 additions & 2 deletions src/game/workshop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ void Workshop::onTick( quint64 tick )

if ( !m_active )
{
if( m_job )
QSharedPointer<Job> spJob = m_job.toStrongRef();
if ( spJob )
{
QSharedPointer<Job> spJob = m_job.toStrongRef();
g->jm()->deleteJob( spJob->id() );
m_currentCraftJobID = 0;
}
Expand All @@ -380,6 +380,26 @@ void Workshop::onTick( quint64 tick )
}
m_autoCraftList.clear();

// check if the emitted job is still possible
// ressources may have been consumed by 3rd party
{
QSharedPointer<Job> spJob = m_job.toStrongRef();
if ( spJob && !spJob->isWorked() )
{
for ( auto& cj : m_jobList )
{
if ( cj.id == m_currentCraftJobID )
{
if ( !checkItemsAvailable( cj ) )
{
g->jm()->deleteJob( spJob->id() );
m_currentCraftJobID = 0;
}
}
}
}
}

if ( !m_job && !m_jobList.empty() && outputTileFree() )
{
for ( auto& cj : m_jobList )
Expand Down

0 comments on commit 9a758ae

Please sign in to comment.