Stupid git
This commit is contained in:
parent
7128188048
commit
724c99102e
@ -474,15 +474,17 @@ void Renderer::DrawWalls()
|
|||||||
|
|
||||||
void Renderer::get_sign_pos(int i, int *x0, int *y0, int *w, int *h)
|
void Renderer::get_sign_pos(int i, int *x0, int *y0, int *w, int *h)
|
||||||
{
|
{
|
||||||
sign *signs = sim->signs;
|
std::vector<sign> signs = sim->signs;
|
||||||
//Changing width if sign have special content
|
//Changing width if sign have special content
|
||||||
if (strcmp(signs[i].text, "{p}")==0)
|
if (signs[i].text == "{p}")
|
||||||
|
{
|
||||||
*w = Graphics::textwidth("Pressure: -000.00");
|
*w = Graphics::textwidth("Pressure: -000.00");
|
||||||
|
}
|
||||||
if (strcmp(signs[i].text, "{t}")==0)
|
else if (signs[i].text == "{t}")
|
||||||
|
{
|
||||||
*w = Graphics::textwidth("Temp: 0000.00");
|
*w = Graphics::textwidth("Temp: 0000.00");
|
||||||
|
}
|
||||||
if (sregexp(signs[i].text, "^{c:[0-9]*|.*}$")==0)
|
else if (sregexp(signs[i].text.c_str(), "^{c:[0-9]*|.*}$")==0)
|
||||||
{
|
{
|
||||||
int sldr, startm;
|
int sldr, startm;
|
||||||
char buff[256];
|
char buff[256];
|
||||||
@ -498,10 +500,10 @@ void Renderer::get_sign_pos(int i, int *x0, int *y0, int *w, int *h)
|
|||||||
}
|
}
|
||||||
*w = Graphics::textwidth(buff) + 5;
|
*w = Graphics::textwidth(buff) + 5;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Ususal width
|
{
|
||||||
if (strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
|
*w = Graphics::textwidth(signs[i].text.c_str()) + 5;
|
||||||
*w = Graphics::textwidth(signs[i].text) + 5;
|
}
|
||||||
*h = 14;
|
*h = 14;
|
||||||
*x0 = (signs[i].ju == 2) ? signs[i].x - *w :
|
*x0 = (signs[i].ju == 2) ? signs[i].x - *w :
|
||||||
(signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x;
|
(signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x;
|
||||||
@ -511,13 +513,13 @@ void Renderer::get_sign_pos(int i, int *x0, int *y0, int *w, int *h)
|
|||||||
void Renderer::DrawSigns()
|
void Renderer::DrawSigns()
|
||||||
{
|
{
|
||||||
int i, j, x, y, w, h, dx, dy,mx,my,b=1,bq;
|
int i, j, x, y, w, h, dx, dy,mx,my,b=1,bq;
|
||||||
sign *signs = sim->signs;
|
std::vector<sign> signs = sim->signs;
|
||||||
#ifdef OGLR
|
#ifdef OGLR
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, partsFbo);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, partsFbo);
|
||||||
glTranslated(0, MENUSIZE, 0);
|
glTranslated(0, MENUSIZE, 0);
|
||||||
#endif
|
#endif
|
||||||
for (i=0; i<MAXSIGNS; i++)
|
for (i=0; i < signs.size(); i++)
|
||||||
if (signs[i].text[0])
|
if (signs[i].text.length())
|
||||||
{
|
{
|
||||||
char buff[256]; //Buffer
|
char buff[256]; //Buffer
|
||||||
get_sign_pos(i, &x, &y, &w, &h);
|
get_sign_pos(i, &x, &y, &w, &h);
|
||||||
@ -525,7 +527,7 @@ void Renderer::DrawSigns()
|
|||||||
g->drawrect(x, y, w, h, 192, 192, 192, 255);
|
g->drawrect(x, y, w, h, 192, 192, 192, 255);
|
||||||
|
|
||||||
//Displaying special information
|
//Displaying special information
|
||||||
if (strcmp(signs[i].text, "{p}")==0)
|
if (signs[i].text == "{p}")
|
||||||
{
|
{
|
||||||
float pressure = 0.0f;
|
float pressure = 0.0f;
|
||||||
if (signs[i].x>=0 && signs[i].x<XRES && signs[i].y>=0 && signs[i].y<YRES)
|
if (signs[i].x>=0 && signs[i].x<XRES && signs[i].y>=0 && signs[i].y<YRES)
|
||||||
@ -533,7 +535,7 @@ void Renderer::DrawSigns()
|
|||||||
sprintf(buff, "Pressure: %3.2f", pressure); //...pressure
|
sprintf(buff, "Pressure: %3.2f", pressure); //...pressure
|
||||||
g->drawtext(x+3, y+3, buff, 255, 255, 255, 255);
|
g->drawtext(x+3, y+3, buff, 255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
if (strcmp(signs[i].text, "{t}")==0)
|
else if (signs[i].text == "{t}")
|
||||||
{
|
{
|
||||||
if (signs[i].x>=0 && signs[i].x<XRES && signs[i].y>=0 && signs[i].y<YRES && sim->pmap[signs[i].y][signs[i].x])
|
if (signs[i].x>=0 && signs[i].x<XRES && signs[i].y>=0 && signs[i].y<YRES && sim->pmap[signs[i].y][signs[i].x])
|
||||||
sprintf(buff, "Temp: %4.2f", sim->parts[sim->pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...temperature
|
sprintf(buff, "Temp: %4.2f", sim->parts[sim->pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...temperature
|
||||||
@ -541,8 +543,7 @@ void Renderer::DrawSigns()
|
|||||||
sprintf(buff, "Temp: 0.00"); //...temperature
|
sprintf(buff, "Temp: 0.00"); //...temperature
|
||||||
g->drawtext(x+3, y+3, buff, 255, 255, 255, 255);
|
g->drawtext(x+3, y+3, buff, 255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
else if (sregexp(signs[i].text.c_str(), "^{c:[0-9]*|.*}$")==0)
|
||||||
if (sregexp(signs[i].text, "^{c:[0-9]*|.*}$")==0)
|
|
||||||
{
|
{
|
||||||
int sldr, startm;
|
int sldr, startm;
|
||||||
memset(buff, 0, sizeof(buff));
|
memset(buff, 0, sizeof(buff));
|
||||||
@ -556,10 +557,10 @@ void Renderer::DrawSigns()
|
|||||||
}
|
}
|
||||||
g->drawtext(x+3, y+3, buff, 0, 191, 255, 255);
|
g->drawtext(x+3, y+3, buff, 0, 191, 255, 255);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Usual text
|
{
|
||||||
if (strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
|
|
||||||
g->drawtext(x+3, y+3, signs[i].text, 255, 255, 255, 255);
|
g->drawtext(x+3, y+3, signs[i].text, 255, 255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
x = signs[i].x;
|
x = signs[i].x;
|
||||||
y = signs[i].y;
|
y = signs[i].y;
|
||||||
|
@ -18,7 +18,8 @@ public:
|
|||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().CloseWindow();
|
ui::Engine::Ref().CloseWindow();
|
||||||
prompt->callback->TextCallback(result, prompt->textField->GetText());
|
if(prompt->callback)
|
||||||
|
prompt->callback->TextCallback(result, prompt->textField->GetText());
|
||||||
prompt->SelfDestruct(); //TODO: Fix component disposal
|
prompt->SelfDestruct(); //TODO: Fix component disposal
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -93,6 +93,10 @@ GameModel::GameModel():
|
|||||||
//sim->wtypes[i]
|
//sim->wtypes[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Add special sign and prop tools
|
||||||
|
menuList[SC_TOOL]->AddTool(new SignTool());
|
||||||
|
menuList[SC_TOOL]->AddTool(new PropertyTool());
|
||||||
|
|
||||||
//Build menu for simtools
|
//Build menu for simtools
|
||||||
for(int i = 0; i < sim->tools.size(); i++)
|
for(int i = 0; i < sim->tools.size(); i++)
|
||||||
{
|
{
|
||||||
@ -109,8 +113,8 @@ GameModel::GameModel():
|
|||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", 0, 0, 0));
|
||||||
|
|
||||||
//Set default brush palette
|
//Set default brush palette
|
||||||
brushList.push_back(new Brush(ui::Point(4, 4)));
|
|
||||||
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
||||||
|
brushList.push_back(new Brush(ui::Point(4, 4)));
|
||||||
|
|
||||||
//Set default tools
|
//Set default tools
|
||||||
activeTools[0] = menuList[SC_POWDERS]->GetToolList()[0];
|
activeTools[0] = menuList[SC_POWDERS]->GetToolList()[0];
|
||||||
|
@ -1,9 +1,81 @@
|
|||||||
//
|
|
||||||
// SignTool.cpp
|
|
||||||
// PowderToypp
|
|
||||||
//
|
|
||||||
// Created by Simon Robertshaw on 12/05/2012.
|
|
||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
#include "Tool.h"
|
||||||
|
#include "interface/Window.h"
|
||||||
|
#include "interface/Button.h"
|
||||||
|
#include "interface/Label.h"
|
||||||
|
#include "interface/Textbox.h"
|
||||||
|
|
||||||
|
class SignWindow: public ui::Window
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ui::Textbox * textField;
|
||||||
|
SignTool * tool;
|
||||||
|
Simulation * sim;
|
||||||
|
int signID;
|
||||||
|
ui::Point signPosition;
|
||||||
|
SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_);
|
||||||
|
virtual void OnDraw();
|
||||||
|
virtual ~SignWindow() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OkayAction: public ui::ButtonAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SignWindow * prompt;
|
||||||
|
OkayAction(SignWindow * prompt_) { prompt = prompt_; }
|
||||||
|
void ActionCallback(ui::Button * sender)
|
||||||
|
{
|
||||||
|
ui::Engine::Ref().CloseWindow();
|
||||||
|
prompt->SelfDestruct();
|
||||||
|
|
||||||
|
if(prompt->signID==-1 && prompt->textField->GetText().length())
|
||||||
|
{
|
||||||
|
prompt->sim->signs.push_back(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, sign::Left));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prompt->sim->signs[prompt->signID] = sign(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, sign::Left));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_):
|
||||||
|
ui::Window(ui::Point(-1, -1), ui::Point(200, 75)),
|
||||||
|
tool(tool_),
|
||||||
|
signID(signID_),
|
||||||
|
sim(sim_),
|
||||||
|
signPosition(position_)
|
||||||
|
{
|
||||||
|
ui::Label * messageLabel = new ui::Label(ui::Point(4, 18), ui::Point(Size.X-8, 60), "New sign");
|
||||||
|
messageLabel->SetAlignment(AlignLeft, AlignTop);
|
||||||
|
AddComponent(messageLabel);
|
||||||
|
|
||||||
|
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
||||||
|
okayButton->SetAlignment(AlignLeft, AlignBottom);
|
||||||
|
okayButton->SetBorderColour(ui::Colour(200, 200, 200));
|
||||||
|
okayButton->SetActionCallback(new OkayAction(this));
|
||||||
|
AddComponent(okayButton);
|
||||||
|
|
||||||
|
textField = new ui::Textbox(ui::Point(4, 32), ui::Point(Size.X-8, 16), "");
|
||||||
|
textField->SetAlignment(AlignLeft, AlignBottom);
|
||||||
|
AddComponent(textField);
|
||||||
|
|
||||||
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
|
}
|
||||||
|
void SignWindow::OnDraw()
|
||||||
|
{
|
||||||
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
|
||||||
|
g->clearrect(Position.X-2, Position.Y-2, Size.X+4, Size.Y+4);
|
||||||
|
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
|
||||||
|
{
|
||||||
|
if(!opened) //Ensure the dialogue can only be shown one at a time.
|
||||||
|
{
|
||||||
|
opened = true;
|
||||||
|
new SignWindow(this, sim, -1, position);
|
||||||
|
}
|
||||||
|
}
|
@ -19,11 +19,11 @@ protected:
|
|||||||
string toolName;
|
string toolName;
|
||||||
public:
|
public:
|
||||||
Tool(int id, string name, int r, int g, int b):
|
Tool(int id, string name, int r, int g, int b):
|
||||||
toolID(id),
|
toolID(id),
|
||||||
toolName(name),
|
toolName(name),
|
||||||
colRed(r),
|
colRed(r),
|
||||||
colGreen(g),
|
colGreen(g),
|
||||||
colBlue(b)
|
colBlue(b)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
string GetName() { return toolName; }
|
string GetName() { return toolName; }
|
||||||
@ -41,6 +41,38 @@ public:
|
|||||||
int colRed, colBlue, colGreen;
|
int colRed, colBlue, colGreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SignTool: public Tool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SignTool():
|
||||||
|
Tool(0, "SIGN", 0, 0, 0),
|
||||||
|
opened(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~SignTool() {}
|
||||||
|
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
|
||||||
|
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
|
||||||
|
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
|
||||||
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
|
||||||
|
void SetClosed() { opened = false; }
|
||||||
|
protected:
|
||||||
|
bool opened;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PropertyTool: public Tool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PropertyTool():
|
||||||
|
Tool(0, "PROP", 0, 0, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~PropertyTool() {}
|
||||||
|
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {};
|
||||||
|
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
|
||||||
|
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
|
||||||
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
|
||||||
|
};
|
||||||
|
|
||||||
class ElementTool: public Tool
|
class ElementTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -87,6 +87,10 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim,
|
|||||||
Particle *parts = sim->parts;
|
Particle *parts = sim->parts;
|
||||||
int *fp = (int *)malloc(NPART*sizeof(int));
|
int *fp = (int *)malloc(NPART*sizeof(int));
|
||||||
|
|
||||||
|
std::vector<sign> tempSigns;
|
||||||
|
char tempSignText[255];
|
||||||
|
sign tempSign("", 0, 0, sign::Left);
|
||||||
|
|
||||||
//New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
|
//New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
|
||||||
//This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
|
//This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
|
||||||
|
|
||||||
@ -665,32 +669,33 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim,
|
|||||||
{
|
{
|
||||||
if (p+6 > dataLength)
|
if (p+6 > dataLength)
|
||||||
goto corrupt;
|
goto corrupt;
|
||||||
for (k=0; k<MAXSIGNS; k++)
|
|
||||||
if (!sim->signs[k].text[0])
|
|
||||||
break;
|
|
||||||
x = d[p++];
|
x = d[p++];
|
||||||
x |= ((unsigned)d[p++])<<8;
|
x |= ((unsigned)d[p++])<<8;
|
||||||
if (k<MAXSIGNS)
|
tempSign.x = x+x0;
|
||||||
sim->signs[k].x = x+x0;
|
|
||||||
x = d[p++];
|
x = d[p++];
|
||||||
x |= ((unsigned)d[p++])<<8;
|
x |= ((unsigned)d[p++])<<8;
|
||||||
if (k<MAXSIGNS)
|
tempSign.y = x+y0;
|
||||||
sim->signs[k].y = x+y0;
|
|
||||||
x = d[p++];
|
x = d[p++];
|
||||||
if (k<MAXSIGNS)
|
tempSign.ju = (sign::Justification)x;
|
||||||
sim->signs[k].ju = x;
|
|
||||||
x = d[p++];
|
x = d[p++];
|
||||||
if (p+x > dataLength)
|
if (p+x > dataLength)
|
||||||
goto corrupt;
|
goto corrupt;
|
||||||
if (k<MAXSIGNS)
|
if(x>254)
|
||||||
{
|
x = 254;
|
||||||
memcpy(sim->signs[k].text, d+p, x);
|
memcpy(tempSignText, d+p, x);
|
||||||
sim->signs[k].text[x] = 0;
|
tempSignText[x] = 0;
|
||||||
//clean_text(signs[k].text, 158-14 /* Current max sign length */); //TODO: Text cleanup for signs
|
tempSign.text = tempSignText;
|
||||||
}
|
tempSigns.push_back(tempSign);
|
||||||
p += x;
|
p += x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < tempSigns.size(); i++)
|
||||||
|
{
|
||||||
|
if(i == MAXSIGNS)
|
||||||
|
break;
|
||||||
|
sim->signs.push_back(tempSigns[i]);
|
||||||
|
}
|
||||||
|
|
||||||
version1:
|
version1:
|
||||||
if (m) free(m);
|
if (m) free(m);
|
||||||
if (d) free(d);
|
if (d) free(d);
|
||||||
@ -868,14 +873,14 @@ unsigned char * SaveLoader::PSVBuild(int & dataLength, Simulation * sim, int ori
|
|||||||
}
|
}
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i=0; i<MAXSIGNS; i++)
|
for (i=0; i<sim->signs.size(); i++)
|
||||||
if (sim->signs[i].text[0] &&
|
if (sim->signs[i].text.length() &&
|
||||||
sim->signs[i].x>=x0 && sim->signs[i].x<x0+w &&
|
sim->signs[i].x>=x0 && sim->signs[i].x<x0+w &&
|
||||||
sim->signs[i].y>=y0 && sim->signs[i].y<y0+h)
|
sim->signs[i].y>=y0 && sim->signs[i].y<y0+h)
|
||||||
j++;
|
j++;
|
||||||
d[p++] = j;
|
d[p++] = j;
|
||||||
for (i=0; i<MAXSIGNS; i++)
|
for (i=0; i<sim->signs.size(); i++)
|
||||||
if (sim->signs[i].text[0] &&
|
if (sim->signs[i].text.length() &&
|
||||||
sim->signs[i].x>=x0 && sim->signs[i].x<x0+w &&
|
sim->signs[i].x>=x0 && sim->signs[i].x<x0+w &&
|
||||||
sim->signs[i].y>=y0 && sim->signs[i].y<y0+h)
|
sim->signs[i].y>=y0 && sim->signs[i].y<y0+h)
|
||||||
{
|
{
|
||||||
@ -884,9 +889,9 @@ unsigned char * SaveLoader::PSVBuild(int & dataLength, Simulation * sim, int ori
|
|||||||
d[p++] = (sim->signs[i].y-y0);
|
d[p++] = (sim->signs[i].y-y0);
|
||||||
d[p++] = (sim->signs[i].y-y0)>>8;
|
d[p++] = (sim->signs[i].y-y0)>>8;
|
||||||
d[p++] = sim->signs[i].ju;
|
d[p++] = sim->signs[i].ju;
|
||||||
x = strlen(sim->signs[i].text);
|
x = sim->signs[i].text.length();
|
||||||
d[p++] = x;
|
d[p++] = x;
|
||||||
memcpy(d+p, sim->signs[i].text, x);
|
memcpy(d+p, sim->signs[i].text.c_str(), x);
|
||||||
p+=x;
|
p+=x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,8 +1347,7 @@ void Simulation::create_arc(int sx, int sy, int dx, int dy, int midpoints, int v
|
|||||||
void Simulation::clear_sim(void)
|
void Simulation::clear_sim(void)
|
||||||
{
|
{
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
if(signs)
|
signs.clear();
|
||||||
memset(signs, 0, sizeof(sign)*MAXSIGNS);
|
|
||||||
memset(bmap, 0, sizeof(bmap));
|
memset(bmap, 0, sizeof(bmap));
|
||||||
memset(emap, 0, sizeof(emap));
|
memset(emap, 0, sizeof(emap));
|
||||||
memset(parts, 0, sizeof(Particle)*NPART);
|
memset(parts, 0, sizeof(Particle)*NPART);
|
||||||
@ -3806,7 +3805,6 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
|
|||||||
|
|
||||||
Simulation::~Simulation()
|
Simulation::~Simulation()
|
||||||
{
|
{
|
||||||
free(signs);
|
|
||||||
delete grav;
|
delete grav;
|
||||||
delete air;
|
delete air;
|
||||||
}
|
}
|
||||||
@ -3844,9 +3842,6 @@ Simulation::Simulation():
|
|||||||
pv = air->pv;
|
pv = air->pv;
|
||||||
hv = air->hv;
|
hv = air->hv;
|
||||||
|
|
||||||
//Clear signs
|
|
||||||
signs = (sign*)calloc(MAXSIGNS, sizeof(sign));
|
|
||||||
|
|
||||||
int menuCount;
|
int menuCount;
|
||||||
menu_section * msectionsT = LoadMenus(menuCount);
|
menu_section * msectionsT = LoadMenus(menuCount);
|
||||||
memcpy(msections, msectionsT, menuCount * sizeof(menu_section));
|
memcpy(msections, msectionsT, menuCount * sizeof(menu_section));
|
||||||
|
@ -113,8 +113,17 @@ typedef struct menu_section menu_section;
|
|||||||
|
|
||||||
struct sign
|
struct sign
|
||||||
{
|
{
|
||||||
int x,y,ju;
|
public:
|
||||||
char text[256];
|
enum Justification { Left = 0, Centre = 1, Right = 2 };
|
||||||
|
sign(std::string text_, int x_, int y_, Justification justification_):
|
||||||
|
text(text_),
|
||||||
|
x(x_),
|
||||||
|
y(y_),
|
||||||
|
ju(justification_)
|
||||||
|
{}
|
||||||
|
int x, y;
|
||||||
|
Justification ju;
|
||||||
|
std::string text;
|
||||||
};
|
};
|
||||||
typedef struct sign sign;
|
typedef struct sign sign;
|
||||||
|
|
||||||
@ -139,6 +148,7 @@ public:
|
|||||||
Gravity * grav;
|
Gravity * grav;
|
||||||
Air * air;
|
Air * air;
|
||||||
|
|
||||||
|
vector<sign> signs;
|
||||||
Element * elements;
|
Element * elements;
|
||||||
vector<SimTool*> tools;
|
vector<SimTool*> tools;
|
||||||
unsigned int * platent;
|
unsigned int * platent;
|
||||||
@ -165,7 +175,6 @@ public:
|
|||||||
int NUM_PARTS;
|
int NUM_PARTS;
|
||||||
int elementCount[PT_NUM];
|
int elementCount[PT_NUM];
|
||||||
int ISWIRE;
|
int ISWIRE;
|
||||||
sign * signs;
|
|
||||||
//Gol sim
|
//Gol sim
|
||||||
int CGOL;
|
int CGOL;
|
||||||
int ISGOL;
|
int ISGOL;
|
||||||
|
Reference in New Issue
Block a user