main window and many fixes
This commit is contained in:
1 parent
80c329a697
commit
69700f8b65
18 files changed
+3280
-95
No files matched your search
@@ -13,6 +13,7 @@
|
||||
#include "Cevo/CevoTexture.h"
|
||||
#include "Global.h"
|
||||
#include "Messg.h"
|
||||
#include "Sound.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
@@ -141,7 +142,7 @@ void MainScreen::initTurn(int newPlayer)
|
||||
MainTexture->setAge(-1);
|
||||
m_eot->setButtonIndex(clientMode == cMovieTurn ? eotCancel : eotBlinkOn);
|
||||
}
|
||||
// TODO: InitCityMark(MainTexture) - the city mark sprite is not ported.
|
||||
initCityMark(*MainTexture);
|
||||
if (m_cityDlg)
|
||||
m_cityDlg->checkAge();
|
||||
if (m_natStatDlg)
|
||||
@@ -624,8 +625,63 @@ void MainScreen::initTurn(int newPlayer)
|
||||
else
|
||||
un.Status |= usWaiting;
|
||||
checkToldNoReturn(uix);
|
||||
// TODO: continuing multi-turn goto (GetMoveAdvice + MoveUnit) and terrain enhancement
|
||||
// (ProcessEnhancement) needs MoveUnit, which is not ported yet.
|
||||
if ((un.Status & IsoEngine::usGoto) != 0) { // continue multi-turn goto
|
||||
setUnFocus(uix);
|
||||
setTroopLoc(un.Loc);
|
||||
focusOnLoc(m_troopLoc, flRepaintPanel | flImmUpdate);
|
||||
TMoveAdviceData moveAdviceData;
|
||||
int moveResult;
|
||||
if ((un.Status >> 16) == 0x7FFF)
|
||||
moveResult = ClientTools::getMoveAdvice(IsoEngine::unFocus, maNextCity, moveAdviceData);
|
||||
else
|
||||
moveResult = ClientTools::getMoveAdvice(IsoEngine::unFocus, un.Status >> 16, moveAdviceData);
|
||||
bool stop;
|
||||
if (moveResult >= rExecuted) { // !!! Shinkansen
|
||||
moveResult = eOK;
|
||||
bool ok = true;
|
||||
for (int i = 0; i < moveAdviceData.nStep; ++i) {
|
||||
const int loc1 = ClientTools::dLoc(un.Loc, moveAdviceData.dx[i], moveAdviceData.dy[i]);
|
||||
if ((ClientTools::myMap[loc1] & (fCity | fOwned)) == static_cast<std::uint32_t>(fCity)
|
||||
// don't capture cities during auto move
|
||||
|| (ClientTools::myMap[loc1] & (fUnit | fOwned)) == static_cast<std::uint32_t>(fUnit)) {
|
||||
// don't attack during auto move
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
const int moveOptions = loc1 == moveAdviceData.ToLoc
|
||||
|| (moveAdviceData.ToLoc == maNextCity
|
||||
&& (ClientTools::myMap[loc1] & fCity) != 0)
|
||||
? muAutoNoWait
|
||||
: 0;
|
||||
moveResult = moveUnit(moveAdviceData.dx[i], moveAdviceData.dy[i], moveOptions);
|
||||
if (moveResult < rExecuted || moveResult == eEnemySpotted) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
stop = !ok || un.Loc == moveAdviceData.ToLoc
|
||||
|| (moveAdviceData.ToLoc == maNextCity && (ClientTools::myMap[un.Loc] & fCity) != 0);
|
||||
} else {
|
||||
moveResult = eOK;
|
||||
stop = true;
|
||||
}
|
||||
if (moveResult != eDied) {
|
||||
if (stop)
|
||||
un.Status &= 0xFFFF - IsoEngine::usGoto;
|
||||
else
|
||||
un.Status &= ~usWaiting;
|
||||
}
|
||||
}
|
||||
if ((un.Status & (IsoEngine::usEnhance | IsoEngine::usGoto)) == IsoEngine::usEnhance) {
|
||||
// continue terrain enhancement
|
||||
const int moveResult = ClientTools::processEnhancement(uix, myData->enhancementJobs);
|
||||
if (moveResult != eDied) {
|
||||
if (moveResult == eJobDone)
|
||||
un.Status &= ~IsoEngine::usEnhance;
|
||||
else
|
||||
un.Status &= ~usWaiting;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -701,7 +757,8 @@ void MainScreen::nextUnit(int nearLoc, bool autoTurn)
|
||||
setTroopLoc(-1);
|
||||
QTimer::singleShot(0, this, [this] { endTurn(); });
|
||||
} else {
|
||||
// TODO: Play('TURNEND') when the turn becomes complete (sound is not ported).
|
||||
if (!m_turnComplete && m_eot->isVisible())
|
||||
Sound::play(QStringLiteral("TURNEND"));
|
||||
m_turnComplete = true;
|
||||
setUnFocus(-1);
|
||||
setTroopLoc(-1);
|
||||
|
||||
Reference in new issue
Block a user