From f155f3b635826fd3af282f46ea6e53dbfb3afeed Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 27 Jul 2018 00:40:31 +0200 Subject: [PATCH] Enable mine building for iron only after prospecting It fixes the bug #68. Note that is possible to restore this funny bug with --restore-bugs argument. --- src/decor.cxx | 17 +++++++++++------ src/decor.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/decor.cxx b/src/decor.cxx index e4b1fab..2cb8e0e 100644 --- a/src/decor.cxx +++ b/src/decor.cxx @@ -197,6 +197,7 @@ CDecor::Init (Sint32 channel, Sint32 icon) m_decor[x][y].rankMove = -1; m_decor[x][y].workBlupi = -1; m_decor[x][y].fire = 0; + m_decor[x][y].flagged = false; } } @@ -403,6 +404,10 @@ CDecor::PutObject (Point cel, Sint32 channel, Sint32 icon) m_decor[cel.x / 2][cel.y / 2].objectChannel = channel; m_decor[cel.x / 2][cel.y / 2].objectIcon = icon; + /* When flagged, it's possible to build a mine for iron */ + if (icon == 124) + m_decor[cel.x / 2][cel.y / 2].flagged = true; + SubDrapeau (cel); // on pourra de nouveau planter un drapeau return true; @@ -1835,13 +1840,13 @@ CDecor::CelOkForAction ( } } - if (action == EV_ACTION_BUILD4) // mine ? + GetFloor (cel, channel, icon); + if ( // mine ? + action == EV_ACTION_BUILD4 && + ((!g_restoreBugs && !m_decor[cel.x / 2][cel.y / 2].flagged) || // fixed + (g_restoreBugs && (channel != CHFLOOR || icon != 71)))) // funny bug { - GetFloor (cel, channel, icon); - if (channel != CHFLOOR || icon != 71) // terre à fer ? - { - error = Errors::GROUND; // sol pas adéquat - } + error = Errors::GROUND; // sol pas adéquat } if ( diff --git a/src/decor.h b/src/decor.h index 70ea98b..f980272 100644 --- a/src/decor.h +++ b/src/decor.h @@ -48,6 +48,7 @@ typedef struct { Sint16 rankMove; // rang dans m_move Sint16 workBlupi; // rang du blupi travaillant ici Sint16 fire; + Sint8 flagged; } Cellule; // Cette structure doit être la plus petite possible, car // il en existe un tableau de 100x100 = 10'000 cellules !