Disallow CGOL with duplicate rulestrings or names > 7 chars
This commit is contained in:
parent
f2d92bc3d7
commit
31f1b62a4c
@ -1,18 +1,18 @@
|
|||||||
#include "Tool.h"
|
#include "Tool.h"
|
||||||
|
|
||||||
#include "simulation/GOLString.h"
|
|
||||||
|
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "common/tpt-rand.h"
|
#include "common/tpt-rand.h"
|
||||||
|
#include "simulation/GOLString.h"
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/game/GameModel.h"
|
|
||||||
#include "gui/interface/Window.h"
|
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/Textbox.h"
|
#include "gui/interface/Textbox.h"
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/colourpicker/ColourPickerActivity.h"
|
#include "gui/colourpicker/ColourPickerActivity.h"
|
||||||
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
|
#include "gui/game/GameModel.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ toolSelection(toolSelection)
|
|||||||
nameField = new ui::Textbox(ui::Point(8, 25), ui::Point(Size.X-16, 16), "", "[name]");
|
nameField = new ui::Textbox(ui::Point(8, 25), ui::Point(Size.X-16, 16), "", "[name]");
|
||||||
nameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
nameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
nameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
nameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
nameField->SetLimit(7);
|
||||||
AddComponent(nameField);
|
AddComponent(nameField);
|
||||||
FocusComponent(nameField);
|
FocusComponent(nameField);
|
||||||
|
|
||||||
@ -145,6 +146,11 @@ void GOLWindow::Validate()
|
|||||||
new ErrorMessage("Could not add GOL type", "Invalid rule provided");
|
new ErrorMessage("Could not add GOL type", "Invalid rule provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (sim->GetCustomGOLByRule(rule))
|
||||||
|
{
|
||||||
|
new ErrorMessage("Could not add GOL type", "This Custom GoL rule already exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ruleString = SerialiseGOLRule(rule); // * Make it canonical.
|
ruleString = SerialiseGOLRule(rule); // * Make it canonical.
|
||||||
|
|
||||||
Client::Ref().SetPrefUnicode("CustomGOL.Name", nameString);
|
Client::Ref().SetPrefUnicode("CustomGOL.Name", nameString);
|
||||||
|
Loading…
Reference in New Issue
Block a user