Make element names a String (unicode support)
This won't be used by official elements, but mods or lua scripts could and do use unicode
This commit is contained in:
parent
45b391d9ea
commit
2e17b848b1
@ -104,7 +104,7 @@ void ElementSearchActivity::searchTools(String query)
|
|||||||
ui::Point viewPosition = searchField->Position + ui::Point(2+0, searchField->Size.Y+2+8);
|
ui::Point viewPosition = searchField->Position + ui::Point(2+0, searchField->Size.Y+2+8);
|
||||||
ui::Point current = ui::Point(0, 0);
|
ui::Point current = ui::Point(0, 0);
|
||||||
|
|
||||||
ByteString queryLower = query.ToUtf8().ToLower();
|
String queryLower = query.ToLower();
|
||||||
|
|
||||||
std::vector<Tool *> matches;
|
std::vector<Tool *> matches;
|
||||||
std::vector<Tool *> frontmatches;
|
std::vector<Tool *> frontmatches;
|
||||||
@ -112,7 +112,7 @@ void ElementSearchActivity::searchTools(String query)
|
|||||||
|
|
||||||
for(std::vector<Tool*>::const_iterator iter = tools.begin(), end = tools.end(); iter != end; ++iter)
|
for(std::vector<Tool*>::const_iterator iter = tools.begin(), end = tools.end(); iter != end; ++iter)
|
||||||
{
|
{
|
||||||
ByteString nameLower = (*iter)->GetName().ToLower();
|
String nameLower = (*iter)->GetName().ToLower();
|
||||||
if(nameLower == queryLower)
|
if(nameLower == queryLower)
|
||||||
exactmatches.push_back(*iter);
|
exactmatches.push_back(*iter);
|
||||||
else if(nameLower.BeginsWith(queryLower))
|
else if(nameLower.BeginsWith(queryLower))
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
return newTexture;
|
return newTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
DecorationTool(Renderer *ren_, int decoMode, ByteString name, String description, int r, int g, int b, ByteString identifier):
|
DecorationTool(Renderer *ren_, int decoMode, String name, String description, int r, int g, int b, ByteString identifier):
|
||||||
Tool(decoMode, name, description, r, g, b, identifier),
|
Tool(decoMode, name, description, r, g, b, identifier),
|
||||||
Red(0),
|
Red(0),
|
||||||
Green(0),
|
Green(0),
|
||||||
|
@ -1566,7 +1566,7 @@ void GameController::ReloadSim()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteString GameController::ElementResolve(int type, int ctype)
|
String GameController::ElementResolve(int type, int ctype)
|
||||||
{
|
{
|
||||||
if(gameModel && gameModel->GetSimulation())
|
if(gameModel && gameModel->GetSimulation())
|
||||||
{
|
{
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
bool MouseInZoom(ui::Point position);
|
bool MouseInZoom(ui::Point position);
|
||||||
ui::Point PointTranslate(ui::Point point);
|
ui::Point PointTranslate(ui::Point point);
|
||||||
ui::Point NormaliseBlockCoord(ui::Point point);
|
ui::Point NormaliseBlockCoord(ui::Point point);
|
||||||
ByteString ElementResolve(int type, int ctype);
|
String ElementResolve(int type, int ctype);
|
||||||
bool IsValidElement(int type);
|
bool IsValidElement(int type);
|
||||||
String WallName(int type);
|
String WallName(int type);
|
||||||
int Record(bool record);
|
int Record(bool record);
|
||||||
|
@ -305,7 +305,7 @@ void GameModel::BuildMenus()
|
|||||||
//Build menu for GOL types
|
//Build menu for GOL types
|
||||||
for(int i = 0; i < NGOL; i++)
|
for(int i = 0; i < NGOL; i++)
|
||||||
{
|
{
|
||||||
Tool * tempTool = new ElementTool(PT_LIFE|PMAPID(i), sim->gmenu[i].name, sim->gmenu[i].description, PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour), "DEFAULT_PT_LIFE_"+sim->gmenu[i].name);
|
Tool * tempTool = new ElementTool(PT_LIFE|PMAPID(i), sim->gmenu[i].name, sim->gmenu[i].description, PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour), "DEFAULT_PT_LIFE_"+sim->gmenu[i].name.ToAscii());
|
||||||
menuList[SC_LIFE]->AddTool(tempTool);
|
menuList[SC_LIFE]->AddTool(tempTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ void GameView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl,
|
|||||||
case SDL_SCANCODE_F5:
|
case SDL_SCANCODE_F5:
|
||||||
c->ReloadSim();
|
c->ReloadSim();
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case SDL_SCANCODE_A:
|
||||||
if ((Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator
|
if ((Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator
|
||||||
|| Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin) && ctrl)
|
|| Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin) && ctrl)
|
||||||
{
|
{
|
||||||
@ -2284,14 +2284,14 @@ void GameView::OnDraw()
|
|||||||
if (showDebug)
|
if (showDebug)
|
||||||
{
|
{
|
||||||
if (type == PT_LAVA && c->IsValidElement(ctype))
|
if (type == PT_LAVA && c->IsValidElement(ctype))
|
||||||
sampleInfo << "Molten " << c->ElementResolve(ctype, -1).FromAscii();
|
sampleInfo << "Molten " << c->ElementResolve(ctype, -1);
|
||||||
else if ((type == PT_PIPE || type == PT_PPIP) && c->IsValidElement(ctype))
|
else if ((type == PT_PIPE || type == PT_PPIP) && c->IsValidElement(ctype))
|
||||||
sampleInfo << c->ElementResolve(type, -1).FromAscii() << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]).FromAscii();
|
sampleInfo << c->ElementResolve(type, -1) << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]);
|
||||||
else if (type == PT_LIFE)
|
else if (type == PT_LIFE)
|
||||||
sampleInfo << c->ElementResolve(type, ctype).FromAscii();
|
sampleInfo << c->ElementResolve(type, ctype);
|
||||||
else if (type == PT_FILT)
|
else if (type == PT_FILT)
|
||||||
{
|
{
|
||||||
sampleInfo << c->ElementResolve(type, ctype).FromAscii();
|
sampleInfo << c->ElementResolve(type, ctype);
|
||||||
String filtModes[] = {"set colour", "AND", "OR", "subtract colour", "red shift", "blue shift", "no effect", "XOR", "NOT", "old QRTZ scattering", "variable red shift", "variable blue shift"};
|
String filtModes[] = {"set colour", "AND", "OR", "subtract colour", "red shift", "blue shift", "no effect", "XOR", "NOT", "old QRTZ scattering", "variable red shift", "variable blue shift"};
|
||||||
if (sample.particle.tmp>=0 && sample.particle.tmp<=11)
|
if (sample.particle.tmp>=0 && sample.particle.tmp<=11)
|
||||||
sampleInfo << " (" << filtModes[sample.particle.tmp] << ")";
|
sampleInfo << " (" << filtModes[sample.particle.tmp] << ")";
|
||||||
@ -2300,14 +2300,14 @@ void GameView::OnDraw()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleInfo << c->ElementResolve(type, ctype).FromAscii();
|
sampleInfo << c->ElementResolve(type, ctype);
|
||||||
if (wavelengthGfx)
|
if (wavelengthGfx)
|
||||||
sampleInfo << " (" << ctype << ")";
|
sampleInfo << " (" << ctype << ")";
|
||||||
// Some elements store extra LIFE info in upper bits of ctype, instead of tmp/tmp2
|
// Some elements store extra LIFE info in upper bits of ctype, instead of tmp/tmp2
|
||||||
else if (type == PT_CRAY || type == PT_DRAY || type == PT_CONV)
|
else if (type == PT_CRAY || type == PT_DRAY || type == PT_CONV)
|
||||||
sampleInfo << " (" << c->ElementResolve(TYP(ctype), ID(ctype)).FromAscii() << ")";
|
sampleInfo << " (" << c->ElementResolve(TYP(ctype), ID(ctype)) << ")";
|
||||||
else if (c->IsValidElement(ctype))
|
else if (c->IsValidElement(ctype))
|
||||||
sampleInfo << " (" << c->ElementResolve(ctype, -1).FromAscii() << ")";
|
sampleInfo << " (" << c->ElementResolve(ctype, -1) << ")";
|
||||||
else
|
else
|
||||||
sampleInfo << " ()";
|
sampleInfo << " ()";
|
||||||
}
|
}
|
||||||
@ -2319,7 +2319,7 @@ void GameView::OnDraw()
|
|||||||
{
|
{
|
||||||
String elemName = c->ElementResolve(
|
String elemName = c->ElementResolve(
|
||||||
TYP(sample.particle.tmp),
|
TYP(sample.particle.tmp),
|
||||||
ID(sample.particle.tmp)).FromAscii();
|
ID(sample.particle.tmp));
|
||||||
if (elemName == "")
|
if (elemName == "")
|
||||||
sampleInfo << ", Tmp: " << sample.particle.tmp;
|
sampleInfo << ", Tmp: " << sample.particle.tmp;
|
||||||
else
|
else
|
||||||
@ -2338,13 +2338,13 @@ void GameView::OnDraw()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (type == PT_LAVA && c->IsValidElement(ctype))
|
if (type == PT_LAVA && c->IsValidElement(ctype))
|
||||||
sampleInfo << "Molten " << c->ElementResolve(ctype, -1).FromAscii();
|
sampleInfo << "Molten " << c->ElementResolve(ctype, -1);
|
||||||
else if ((type == PT_PIPE || type == PT_PPIP) && c->IsValidElement(ctype))
|
else if ((type == PT_PIPE || type == PT_PPIP) && c->IsValidElement(ctype))
|
||||||
sampleInfo << c->ElementResolve(type, -1).FromAscii() << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]).FromAscii();
|
sampleInfo << c->ElementResolve(type, -1) << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]);
|
||||||
else if (type == PT_LIFE)
|
else if (type == PT_LIFE)
|
||||||
sampleInfo << c->ElementResolve(type, ctype).FromAscii();
|
sampleInfo << c->ElementResolve(type, ctype);
|
||||||
else
|
else
|
||||||
sampleInfo << c->ElementResolve(type, ctype).FromAscii();
|
sampleInfo << c->ElementResolve(type, ctype);
|
||||||
sampleInfo << ", Temp: " << sample.particle.temp - 273.15f << " C";
|
sampleInfo << ", Temp: " << sample.particle.temp - 273.15f << " C";
|
||||||
sampleInfo << ", Pressure: " << sample.AirPressure;
|
sampleInfo << ", Pressure: " << sample.AirPressure;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Tool::Tool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
Tool::Tool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
textureGen(textureGen),
|
textureGen(textureGen),
|
||||||
toolID(id),
|
toolID(id),
|
||||||
toolName(name),
|
toolName(name),
|
||||||
@ -33,7 +33,7 @@ void Tool::SetTextureGen(VideoBuffer * (*textureGen)(int, int, int))
|
|||||||
this->textureGen = textureGen;
|
this->textureGen = textureGen;
|
||||||
}
|
}
|
||||||
ByteString Tool::GetIdentifier() { return identifier; }
|
ByteString Tool::GetIdentifier() { return identifier; }
|
||||||
ByteString Tool::GetName() { return toolName; }
|
String Tool::GetName() { return toolName; }
|
||||||
String Tool::GetDescription() { return toolDescription; }
|
String Tool::GetDescription() { return toolDescription; }
|
||||||
Tool::~Tool() {}
|
Tool::~Tool() {}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ void Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Po
|
|||||||
void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {}
|
void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {}
|
||||||
|
|
||||||
|
|
||||||
ElementTool::ElementTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
ElementTool::ElementTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, identifier, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ void ElementTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WallTool::WallTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
WallTool::WallTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, identifier, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
blocky = true;
|
blocky = true;
|
||||||
@ -110,7 +110,7 @@ void WallTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
|||||||
sim->FloodWalls(position.X, position.Y, toolID, -1);
|
sim->FloodWalls(position.X, position.Y, toolID, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindTool::WindTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
WindTool::WindTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, identifier, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class Tool
|
|||||||
protected:
|
protected:
|
||||||
VideoBuffer * (*textureGen)(int, int, int);
|
VideoBuffer * (*textureGen)(int, int, int);
|
||||||
int toolID;
|
int toolID;
|
||||||
ByteString toolName;
|
String toolName;
|
||||||
String toolDescription;
|
String toolDescription;
|
||||||
float strength;
|
float strength;
|
||||||
bool blocky;
|
bool blocky;
|
||||||
@ -24,9 +24,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
int colRed, colGreen, colBlue;
|
int colRed, colGreen, colBlue;
|
||||||
|
|
||||||
Tool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
Tool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
int GetToolID() { return toolID; }
|
int GetToolID() { return toolID; }
|
||||||
ByteString GetName();
|
String GetName();
|
||||||
String GetDescription();
|
String GetDescription();
|
||||||
ByteString GetIdentifier();
|
ByteString GetIdentifier();
|
||||||
int GetBlocky() { return blocky; }
|
int GetBlocky() { return blocky; }
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
class ElementTool: public Tool
|
class ElementTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
ElementTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
virtual ~ElementTool();
|
virtual ~ElementTool();
|
||||||
void Draw(Simulation * sim, Brush * brush, ui::Point position) override;
|
void Draw(Simulation * sim, Brush * brush, ui::Point position) override;
|
||||||
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
class Element_LIGH_Tool: public ElementTool
|
class Element_LIGH_Tool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Element_LIGH_Tool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
Element_LIGH_Tool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
||||||
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{ }
|
{ }
|
||||||
virtual ~Element_LIGH_Tool() { }
|
virtual ~Element_LIGH_Tool() { }
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
class Element_TESC_Tool: public ElementTool
|
class Element_TESC_Tool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Element_TESC_Tool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
Element_TESC_Tool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
||||||
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{ }
|
{ }
|
||||||
virtual ~Element_TESC_Tool() {}
|
virtual ~Element_TESC_Tool() {}
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
class PlopTool: public ElementTool
|
class PlopTool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlopTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
PlopTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
||||||
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{ }
|
{ }
|
||||||
virtual ~PlopTool() { }
|
virtual ~PlopTool() { }
|
||||||
@ -154,7 +154,7 @@ public:
|
|||||||
class WallTool: public Tool
|
class WallTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WallTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
WallTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
virtual ~WallTool();
|
virtual ~WallTool();
|
||||||
void Draw(Simulation * sim, Brush * brush, ui::Point position) override;
|
void Draw(Simulation * sim, Brush * brush, ui::Point position) override;
|
||||||
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
||||||
@ -165,7 +165,7 @@ public:
|
|||||||
class WindTool: public Tool
|
class WindTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindTool(int id, ByteString name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
WindTool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
virtual ~WindTool() { }
|
virtual ~WindTool() { }
|
||||||
void Draw(Simulation * sim, Brush * brush, ui::Point position) override { }
|
void Draw(Simulation * sim, Brush * brush, ui::Point position) override { }
|
||||||
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) override;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include "gui/interface/Mouse.h"
|
#include "gui/interface/Mouse.h"
|
||||||
#include "Favorite.h"
|
#include "Favorite.h"
|
||||||
|
|
||||||
ToolButton::ToolButton(ui::Point position, ui::Point size, ByteString text_, ByteString toolIdentifier, String toolTip):
|
ToolButton::ToolButton(ui::Point position, ui::Point size, String text, ByteString toolIdentifier, String toolTip):
|
||||||
ui::Button(position, size, text_.FromAscii(), toolTip),
|
ui::Button(position, size, text, toolTip),
|
||||||
toolIdentifier(toolIdentifier)
|
toolIdentifier(toolIdentifier)
|
||||||
{
|
{
|
||||||
SetSelectionState(-1);
|
SetSelectionState(-1);
|
||||||
@ -72,11 +72,11 @@ void ToolButton::Draw(const ui::Point& screenPos)
|
|||||||
|
|
||||||
if (totalColour<544)
|
if (totalColour<544)
|
||||||
{
|
{
|
||||||
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText.c_str(), 255, 255, 255, 255);
|
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText, 255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText.c_str(), 0, 0, 0, 255);
|
g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText, 0, 0, 0, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class ToolButton: public ui::Button
|
|||||||
int currentSelection;
|
int currentSelection;
|
||||||
ByteString toolIdentifier;
|
ByteString toolIdentifier;
|
||||||
public:
|
public:
|
||||||
ToolButton(ui::Point position, ui::Point size, ByteString text_, ByteString toolIdentifier, String toolTip = String());
|
ToolButton(ui::Point position, ui::Point size, String text, ByteString toolIdentifier, String toolTip = String());
|
||||||
void OnMouseUnclick(int x, int y, unsigned int button) override;
|
void OnMouseUnclick(int x, int y, unsigned int button) override;
|
||||||
void OnMouseUp(int x, int y, unsigned int button) override;
|
void OnMouseUp(int x, int y, unsigned int button) override;
|
||||||
void OnMouseClick(int x, int y, unsigned int button) override;
|
void OnMouseClick(int x, int y, unsigned int button) override;
|
||||||
|
@ -276,7 +276,7 @@ int luatpt_getelement(lua_State *l)
|
|||||||
t = luaL_optint(l, 1, 1);
|
t = luaL_optint(l, 1, 1);
|
||||||
if (t<0 || t>=PT_NUM)
|
if (t<0 || t>=PT_NUM)
|
||||||
return luaL_error(l, "Unrecognised element number '%d'", t);
|
return luaL_error(l, "Unrecognised element number '%d'", t);
|
||||||
lua_pushstring(l, luacon_sim->elements[t].Name.c_str());
|
lua_pushstring(l, luacon_sim->elements[t].Name.ToUtf8().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -290,7 +290,7 @@ tpt.partsdata = nil");
|
|||||||
lua_setfield(l, currentElementMeta, "__index");
|
lua_setfield(l, currentElementMeta, "__index");
|
||||||
lua_setmetatable(l, currentElement);
|
lua_setmetatable(l, currentElement);
|
||||||
|
|
||||||
lua_setfield(l, tptElements, luacon_sim->elements[i].Name.ToLower().c_str());
|
lua_setfield(l, tptElements, luacon_sim->elements[i].Name.ToUtf8().ToLower().c_str());
|
||||||
}
|
}
|
||||||
lua_setfield(l, tptProperties, "el");
|
lua_setfield(l, tptProperties, "el");
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ tpt.partsdata = nil");
|
|||||||
lua_setfield(l, currentElementMeta, "__index");
|
lua_setfield(l, currentElementMeta, "__index");
|
||||||
lua_setmetatable(l, currentElement);
|
lua_setmetatable(l, currentElement);
|
||||||
|
|
||||||
lua_setfield(l, tptElementTransitions, luacon_sim->elements[i].Name.ToLower().c_str());
|
lua_setfield(l, tptElementTransitions, luacon_sim->elements[i].Name.ToUtf8().ToLower().c_str());
|
||||||
}
|
}
|
||||||
lua_setfield(l, tptProperties, "eltransition");
|
lua_setfield(l, tptProperties, "eltransition");
|
||||||
|
|
||||||
@ -2428,12 +2428,11 @@ void LuaScriptInterface::initElementsAPI()
|
|||||||
{
|
{
|
||||||
lua_pushinteger(l, i);
|
lua_pushinteger(l, i);
|
||||||
lua_setfield(l, -2, luacon_sim->elements[i].Identifier.c_str());
|
lua_setfield(l, -2, luacon_sim->elements[i].Identifier.c_str());
|
||||||
char realIdentifier[20];
|
ByteString realIdentifier = ByteString::Build("DEFAULT_PT_", luacon_sim->elements[i].Name.ToUtf8());
|
||||||
sprintf(realIdentifier, "DEFAULT_PT_%s", luacon_sim->elements[i].Name.c_str());
|
|
||||||
if (i != 0 && i != PT_NBHL && i != PT_NWHL && luacon_sim->elements[i].Identifier != realIdentifier)
|
if (i != 0 && i != PT_NBHL && i != PT_NWHL && luacon_sim->elements[i].Identifier != realIdentifier)
|
||||||
{
|
{
|
||||||
lua_pushinteger(l, i);
|
lua_pushinteger(l, i);
|
||||||
lua_setfield(l, -2, realIdentifier);
|
lua_setfield(l, -2, realIdentifier.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
struct gol_menu
|
struct gol_menu
|
||||||
{
|
{
|
||||||
ByteString name;
|
String name;
|
||||||
pixel colour;
|
pixel colour;
|
||||||
int goltype;
|
int goltype;
|
||||||
String description;
|
String description;
|
||||||
|
@ -4912,7 +4912,7 @@ int Simulation::GetParticleType(ByteString type)
|
|||||||
return PT_NONE;
|
return PT_NONE;
|
||||||
for (int i = 1; i < PT_NUM; i++)
|
for (int i = 1; i < PT_NUM; i++)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(txt, elements[i].Name.c_str()) && elements[i].Name.size() && elements[i].Enabled)
|
if (!strcasecmp(txt, elements[i].Name.ToUtf8().c_str()) && elements[i].Name.size() && elements[i].Enabled)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ Element::Element():
|
|||||||
std::vector<StructProperty> Element::GetProperties()
|
std::vector<StructProperty> Element::GetProperties()
|
||||||
{
|
{
|
||||||
std::vector<StructProperty> properties;
|
std::vector<StructProperty> properties;
|
||||||
properties.push_back(StructProperty("Name", StructProperty::BString, offsetof(Element, Name)));
|
properties.push_back(StructProperty("Name", StructProperty::String, offsetof(Element, Name)));
|
||||||
properties.push_back(StructProperty("Colour", StructProperty::Colour, offsetof(Element, Colour)));
|
properties.push_back(StructProperty("Colour", StructProperty::Colour, offsetof(Element, Colour)));
|
||||||
properties.push_back(StructProperty("Color", StructProperty::Colour, offsetof(Element, Colour)));
|
properties.push_back(StructProperty("Color", StructProperty::Colour, offsetof(Element, Colour)));
|
||||||
properties.push_back(StructProperty("MenuVisible", StructProperty::Integer, offsetof(Element, MenuVisible)));
|
properties.push_back(StructProperty("MenuVisible", StructProperty::Integer, offsetof(Element, MenuVisible)));
|
||||||
|
@ -14,7 +14,7 @@ class Element
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteString Identifier;
|
ByteString Identifier;
|
||||||
ByteString Name;
|
String Name;
|
||||||
pixel Colour;
|
pixel Colour;
|
||||||
int MenuVisible;
|
int MenuVisible;
|
||||||
int MenuSection;
|
int MenuSection;
|
||||||
|
@ -11,7 +11,7 @@ class SimTool
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteString Identifier;
|
ByteString Identifier;
|
||||||
ByteString Name;
|
String Name;
|
||||||
pixel Colour;
|
pixel Colour;
|
||||||
String Description;
|
String Description;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user