A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
This assumes the worst case in which the team file is missing all campaign variables except Progress.
This has been successfully tested with all 10 missions and still generates a logical storyline.
By default, the game assumes:
- The cyborg's offer in mission 2 was refused
- The traitor in mission 5 was killed
As a consequence, missions 8 and 10 use the princessScene cut scene.
#include "hwmapoptimizer.h"
#include "hwconsts.h"
HWMapOptimizer::HWMapOptimizer(QObject *parent) :
TCPBase(parent)
{
}
bool HWMapOptimizer::couldBeRemoved()
{
return !m_hasStarted;
}
void HWMapOptimizer::optimizeMap(const Paths &paths)
{
m_paths = paths;
Start(true);
}
QStringList HWMapOptimizer::getArguments()
{
QStringList arguments;
arguments << "--internal";
arguments << "--port";
arguments << QString("%1").arg(ipc_port);
arguments << "--user-prefix";
arguments << cfgdir->absolutePath();
arguments << "--prefix";
arguments << datadir->absolutePath();
arguments << "--landpreview";
return arguments;
}
void HWMapOptimizer::onClientDisconnect()
{
}
void HWMapOptimizer::SendToClientFirst()
{
SendIPC("e$mapgen 4");
/*QByteArray data = m_drawMapData;
while(data.size() > 0)
{
QByteArray tmp = data;
tmp.truncate(200);
SendIPC("edraw " + tmp);
data.remove(0, 200);
}
SendIPC("!");*/
}