# HG changeset patch # User Wuzzy # Date 1531657266 -7200 # Node ID 4ef83bcb850b608046aa04fdb584296fcaf6066e # Parent c85b324c4c2d94ed2988b090aaa4bfea90781f44 Clean up cMaxHHs and cMaxTeams a bit, get rid of hardcoded numbers diff -r c85b324c4c2d -r 4ef83bcb850b QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Thu Jul 12 14:46:16 2018 +0200 +++ b/QTfrontend/hwconsts.cpp.in Sun Jul 15 14:21:06 2018 +0200 @@ -16,6 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +/* + * PLEASE NOTE: hwconsts.cpp is automatically generated from hwconsts.cpp.in. + * Do not edit hwconsts.cpp manually, it will be overwritten when building. + * Edit hwconsts.cpp.in to change the code. + */ + #include #include "hwconsts.h" @@ -37,6 +43,7 @@ bool custom_data = false; int cMaxTeams = 8; +int cMaxHHs = 48; int cMinServerVersion = 3; QString * cDefaultAmmoStore = new QString( AMMOLINE_DEFAULT_QT AMMOLINE_DEFAULT_PROB diff -r c85b324c4c2d -r 4ef83bcb850b QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Thu Jul 12 14:46:16 2018 +0200 +++ b/QTfrontend/hwconsts.h Sun Jul 15 14:21:06 2018 +0200 @@ -37,6 +37,7 @@ extern bool custom_data; extern int cMaxTeams; +extern int cMaxHHs; extern int cMinServerVersion; class QStandardItemModel; diff -r c85b324c4c2d -r 4ef83bcb850b QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Thu Jul 12 14:46:16 2018 +0200 +++ b/QTfrontend/hwform.cpp Sun Jul 15 14:21:06 2018 +0200 @@ -1708,11 +1708,11 @@ void HWForm::StartMPGame() { int numHogs = ui.pageMultiplayer->teamsSelect->getNumHedgehogs(); - /* Don't allow to start game with >48 hogs. - TODO: Remove this as soon the engine supports more hogs. */ - if(numHogs > 48) + /* Don't allow to start game with more than cMaxHHs hedgehogs. + TODO: Remove this as soon the engine supports more hedgehogs. */ + if(numHogs > cMaxHHs) { - MessageDialog::ShowErrorMessage(QMessageBox::tr("Sorry, Hedgewars can't be played with more than 48 hedgehogs. Please try again with fewer hedgehogs.\n\nCurrent number of hedgehogs: %1").arg(numHogs), this); + MessageDialog::ShowErrorMessage(QMessageBox::tr("Sorry, there are too many hedgehogs! Please try again with fewer hedgehogs.\n\nMaximum number of hedgehogs: %1\nCurrent number of hedgehogs: %2").arg(cMaxHHs).arg(numHogs), this); return; } QString ammo; diff -r c85b324c4c2d -r 4ef83bcb850b QTfrontend/ui/widget/frameTeam.cpp --- a/QTfrontend/ui/widget/frameTeam.cpp Thu Jul 12 14:46:16 2018 +0200 +++ b/QTfrontend/ui/widget/frameTeam.cpp Sun Jul 15 14:21:06 2018 +0200 @@ -126,7 +126,7 @@ bool FrameTeams::isFullTeams() const { - return teamToWidget.size() >= 8; + return teamToWidget.size() >= cMaxTeams; } void FrameTeams::emitTeamColorChanged(const HWTeam& team)