# HG changeset patch # User Wuzzy # Date 1491853373 -7200 # Node ID a6cd48b8ef61b87606f94c0ca1a4c9df8b5df62d # Parent 5b525d041fb49452e74140089c8f3e12200d0f00 Prevent frontend from starting game w/ >48 hogs This is because the engine does not support >48 hogs (another bug), but at least this commit a common crash with useless/confusing error message. diff -r 5b525d041fb4 -r a6cd48b8ef61 ChangeLog.txt --- a/ChangeLog.txt Mon Apr 10 20:56:01 2017 +0200 +++ b/ChangeLog.txt Mon Apr 10 21:42:53 2017 +0200 @@ -188,6 +188,7 @@ * Fixed mostly broken descriptions for multiplayer mission maps * Clicking on "New" in weapon scheme editor now creates empty weapon scheme instead of default * Fix language names in language list being always in English + * Prevent starting game with >48 hogs (because engine doesn't support it yet) Content Creation: + Theme objects can now have more than 1 in-land rect specified. You can specify the amount in theme.cfg by adding another number (and ,) before the first rect diff -r 5b525d041fb4 -r a6cd48b8ef61 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Mon Apr 10 20:56:01 2017 +0200 +++ b/QTfrontend/hwform.cpp Mon Apr 10 21:42:53 2017 +0200 @@ -1594,6 +1594,14 @@ 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) + { + 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); + return; + } QString ammo; ammo = ui.pageMultiplayer->gameCFG->WeaponsName->itemData( ui.pageMultiplayer->gameCFG->WeaponsName->currentIndex() diff -r 5b525d041fb4 -r a6cd48b8ef61 QTfrontend/ui/widget/teamselect.cpp --- a/QTfrontend/ui/widget/teamselect.cpp Mon Apr 10 20:56:01 2017 +0200 +++ b/QTfrontend/ui/widget/teamselect.cpp Mon Apr 10 21:42:53 2017 +0200 @@ -310,6 +310,17 @@ return m_curNotPlayingTeams; } +unsigned short TeamSelWidget::getNumHedgehogs() const +{ + unsigned short numHogs = 0; + QList::const_iterator team; + for(team = curPlayingTeams.begin(); team != curPlayingTeams.end(); ++team) + { + numHogs += (*team).numHedgehogs(); + } + return numHogs; +} + void TeamSelWidget::pre_changeTeamStatus(const HWTeam & team) { //team.setColor(framePlaying->getNextColor()); diff -r 5b525d041fb4 -r a6cd48b8ef61 QTfrontend/ui/widget/teamselect.h --- a/QTfrontend/ui/widget/teamselect.h Mon Apr 10 20:56:01 2017 +0200 +++ b/QTfrontend/ui/widget/teamselect.h Mon Apr 10 21:42:53 2017 +0200 @@ -47,6 +47,7 @@ bool isPlaying(const HWTeam &team) const; QList getPlayingTeams() const; QList getNotPlayingTeams() const; + unsigned short getNumHedgehogs() const; void setInteractivity(bool interactive); public slots: