fix clang compile warnings, fixes #406
also, sim.ambientAirTemp takes floats now
This commit is contained in:
parent
8d492ef549
commit
cdc8f64896
@ -180,8 +180,6 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define TPT_INLINE _inline
|
#define TPT_INLINE _inline
|
||||||
#elif defined(__llvm__)
|
|
||||||
#define TPT_INLINE
|
|
||||||
#else
|
#else
|
||||||
#define TPT_INLINE inline
|
#define TPT_INLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,7 @@ ParticleDebug::ParticleDebug(unsigned int id, Simulation * sim, GameModel * mode
|
|||||||
void ParticleDebug::Debug(int mode, int x, int y)
|
void ParticleDebug::Debug(int mode, int x, int y)
|
||||||
{
|
{
|
||||||
int debug_currentParticle = sim->debug_currentParticle;
|
int debug_currentParticle = sim->debug_currentParticle;
|
||||||
int i;
|
int i = 0;
|
||||||
std::stringstream logmessage;
|
std::stringstream logmessage;
|
||||||
|
|
||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
|
@ -1507,9 +1507,9 @@ std::string GameController::ElementResolve(int type, int ctype)
|
|||||||
{
|
{
|
||||||
if(gameModel && gameModel->GetSimulation())
|
if(gameModel && gameModel->GetSimulation())
|
||||||
{
|
{
|
||||||
if (type == PT_LIFE && ctype >= 0 && ctype < NGOL && gameModel->GetSimulation()->gmenu)
|
if (type == PT_LIFE && ctype >= 0 && ctype < NGOL)
|
||||||
return gameModel->GetSimulation()->gmenu[ctype].name;
|
return gameModel->GetSimulation()->gmenu[ctype].name;
|
||||||
else if (type >= 0 && type < PT_NUM && gameModel->GetSimulation()->elements)
|
else if (type >= 0 && type < PT_NUM)
|
||||||
return std::string(gameModel->GetSimulation()->elements[type].Name);
|
return std::string(gameModel->GetSimulation()->elements[type].Name);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -1527,7 +1527,7 @@ bool GameController::IsValidElement(int type)
|
|||||||
|
|
||||||
std::string GameController::WallName(int type)
|
std::string GameController::WallName(int type)
|
||||||
{
|
{
|
||||||
if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0 && type < UI_WALLCOUNT)
|
if(gameModel && gameModel->GetSimulation() && type >= 0 && type < UI_WALLCOUNT)
|
||||||
return std::string(gameModel->GetSimulation()->wtypes[type].name);
|
return std::string(gameModel->GetSimulation()->wtypes[type].name);
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
|
@ -1861,10 +1861,9 @@ void GameView::NotifyNotificationsChanged(GameModel * sender)
|
|||||||
{
|
{
|
||||||
class NotificationButtonAction : public ui::ButtonAction
|
class NotificationButtonAction : public ui::ButtonAction
|
||||||
{
|
{
|
||||||
GameView * v;
|
|
||||||
Notification * notification;
|
Notification * notification;
|
||||||
public:
|
public:
|
||||||
NotificationButtonAction(GameView * v, Notification * notification) : v(v), notification(notification) { }
|
NotificationButtonAction(Notification * notification) : notification(notification) { }
|
||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
notification->Action();
|
notification->Action();
|
||||||
@ -1901,7 +1900,7 @@ void GameView::NotifyNotificationsChanged(GameModel * sender)
|
|||||||
{
|
{
|
||||||
int width = (Graphics::textwidth((*iter)->Message.c_str()))+8;
|
int width = (Graphics::textwidth((*iter)->Message.c_str()))+8;
|
||||||
ui::Button * tempButton = new ui::Button(ui::Point(XRES-width-22, currentY), ui::Point(width, 15), (*iter)->Message);
|
ui::Button * tempButton = new ui::Button(ui::Point(XRES-width-22, currentY), ui::Point(width, 15), (*iter)->Message);
|
||||||
tempButton->SetActionCallback(new NotificationButtonAction(this, *iter));
|
tempButton->SetActionCallback(new NotificationButtonAction(*iter));
|
||||||
tempButton->Appearance.BorderInactive = style::Colour::WarningTitle;
|
tempButton->Appearance.BorderInactive = style::Colour::WarningTitle;
|
||||||
tempButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
tempButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
||||||
tempButton->Appearance.BorderHover = ui::Colour(255, 175, 0);
|
tempButton->Appearance.BorderHover = ui::Colour(255, 175, 0);
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
ItemSelectedAction(ContextMenu * window, int itemID): window(window), item(itemID) { }
|
ItemSelectedAction(ContextMenu * window, int itemID): window(window), item(itemID) { }
|
||||||
virtual void ActionCallback(ui::Button *sender)
|
virtual void ActionCallback(ui::Button *sender)
|
||||||
{
|
{
|
||||||
window->ActionCallback(sender, item);
|
window->ActionCallbackItem(sender, item);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ void ContextMenu::Show(ui::Point position)
|
|||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextMenu::ActionCallback(ui::Button *sender, int item)
|
void ContextMenu::ActionCallbackItem(ui::Button *sender, int item)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().CloseWindow();
|
ui::Engine::Ref().CloseWindow();
|
||||||
Halt();
|
Halt();
|
||||||
|
@ -20,13 +20,12 @@ public:
|
|||||||
class ContextMenu: public ui::Window, public ButtonAction {
|
class ContextMenu: public ui::Window, public ButtonAction {
|
||||||
std::vector<Button*> buttons;
|
std::vector<Button*> buttons;
|
||||||
std::vector<ContextMenuItem> items;
|
std::vector<ContextMenuItem> items;
|
||||||
bool isMouseInside;
|
|
||||||
ui::Component * source;
|
ui::Component * source;
|
||||||
public:
|
public:
|
||||||
ui::Appearance Appearance;
|
ui::Appearance Appearance;
|
||||||
class ItemSelectedAction;
|
class ItemSelectedAction;
|
||||||
ContextMenu(Component * source);
|
ContextMenu(Component * source);
|
||||||
virtual void ActionCallback(ui::Button *sender, int item);
|
virtual void ActionCallbackItem(ui::Button *sender, int item);
|
||||||
virtual void AddItem(ContextMenuItem item);
|
virtual void AddItem(ContextMenuItem item);
|
||||||
virtual void RemoveItem(int id);
|
virtual void RemoveItem(int id);
|
||||||
virtual void SetItem(int id, std::string text);
|
virtual void SetItem(int id, std::string text);
|
||||||
|
@ -32,6 +32,7 @@ PreviewController::PreviewController(int saveID, int saveDate, bool instant, Con
|
|||||||
Client::Ref().AddListener(this);
|
Client::Ref().AddListener(this);
|
||||||
|
|
||||||
this->callback = callback;
|
this->callback = callback;
|
||||||
|
(void)saveDate; //pretend this is used
|
||||||
}
|
}
|
||||||
|
|
||||||
PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
|
PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
|
||||||
@ -55,6 +56,7 @@ PreviewController::PreviewController(int saveID, bool instant, ControllerCallbac
|
|||||||
Client::Ref().AddListener(this);
|
Client::Ref().AddListener(this);
|
||||||
|
|
||||||
this->callback = callback;
|
this->callback = callback;
|
||||||
|
(void)saveDate; //pretend this is used
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewController::Update()
|
void PreviewController::Update()
|
||||||
|
@ -76,9 +76,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
|
|||||||
{
|
{
|
||||||
class EditAvatarAction: public ui::ButtonAction
|
class EditAvatarAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
ProfileActivity * a;
|
|
||||||
public:
|
public:
|
||||||
EditAvatarAction(ProfileActivity * a) : a(a) { }
|
|
||||||
void ActionCallback(ui::Button * sender_)
|
void ActionCallback(ui::Button * sender_)
|
||||||
{
|
{
|
||||||
Platform::OpenURI("http://" SERVER "/Profile/Avatar.html");
|
Platform::OpenURI("http://" SERVER "/Profile/Avatar.html");
|
||||||
@ -112,7 +110,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
|
|||||||
if (editable)
|
if (editable)
|
||||||
{
|
{
|
||||||
ui::Button * editAvatar = new ui::Button(ui::Point(Size.X - (40 + 16 + 75), currentY), ui::Point(75, 15), "Edit Avatar");
|
ui::Button * editAvatar = new ui::Button(ui::Point(Size.X - (40 + 16 + 75), currentY), ui::Point(75, 15), "Edit Avatar");
|
||||||
editAvatar->SetActionCallback(new EditAvatarAction(this));
|
editAvatar->SetActionCallback(new EditAvatarAction());
|
||||||
scrollPanel->AddChild(editAvatar);
|
scrollPanel->AddChild(editAvatar);
|
||||||
}
|
}
|
||||||
currentY += 23;
|
currentY += 23;
|
||||||
|
@ -1849,7 +1849,7 @@ int LuaScriptInterface::simulation_ambientAirTemp(lua_State * l)
|
|||||||
lua_pushnumber(l, luacon_sim->air->ambientAirTemp);
|
lua_pushnumber(l, luacon_sim->air->ambientAirTemp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
int ambientAirTemp = luaL_optint(l, 1, 295.15f);
|
float ambientAirTemp = luaL_optnumber(l, 1, 295.15f);
|
||||||
luacon_sim->air->ambientAirTemp = ambientAirTemp;
|
luacon_sim->air->ambientAirTemp = ambientAirTemp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,9 @@ public:
|
|||||||
|
|
||||||
class InvalidConversionException: public GeneralException
|
class InvalidConversionException: public GeneralException
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
ValueType from;
|
|
||||||
ValueType to;
|
|
||||||
public:
|
public:
|
||||||
InvalidConversionException(ValueType from_, ValueType to_):
|
InvalidConversionException(ValueType from_, ValueType to_):
|
||||||
GeneralException("Invalid conversion from " + AnyType::TypeName(from_) + " to " + AnyType::TypeName(to_)), from(from_), to(to_) {
|
GeneralException("Invalid conversion from " + AnyType::TypeName(from_) + " to " + AnyType::TypeName(to_)) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ int TPTScriptInterface::Command(std::string command)
|
|||||||
lastError = "";
|
lastError = "";
|
||||||
std::deque<std::string> words;
|
std::deque<std::string> words;
|
||||||
std::deque<AnyType> commandWords;
|
std::deque<AnyType> commandWords;
|
||||||
int retCode;
|
int retCode = -1;
|
||||||
|
|
||||||
//Split command into words, put them on the stack
|
//Split command into words, put them on the stack
|
||||||
char * rawCommand;
|
char * rawCommand;
|
||||||
@ -382,7 +382,7 @@ AnyType TPTScriptInterface::tptS_set(std::deque<std::string> * words)
|
|||||||
}
|
}
|
||||||
else if(selector.GetType() == TypeString || selector.GetType() == TypeNumber)
|
else if(selector.GetType() == TypeString || selector.GetType() == TypeNumber)
|
||||||
{
|
{
|
||||||
int type;
|
int type = 0;
|
||||||
if (selector.GetType() == TypeNumber)
|
if (selector.GetType() == TypeNumber)
|
||||||
type = ((NumberType)selector).Value();
|
type = ((NumberType)selector).Value();
|
||||||
else if (selector.GetType() == TypeString)
|
else if (selector.GetType() == TypeString)
|
||||||
|
@ -339,7 +339,7 @@ static double bessel0(double x)
|
|||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Resample_Real KAISER_ALPHA = 4.0;
|
//static const Resample_Real KAISER_ALPHA = 4.0;
|
||||||
static double kaiser(double alpha, double half_width, double x)
|
static double kaiser(double alpha, double half_width, double x)
|
||||||
{
|
{
|
||||||
const double ratio = (x / half_width);
|
const double ratio = (x / half_width);
|
||||||
|
@ -1970,10 +1970,8 @@ void Simulation::clear_sim(void)
|
|||||||
pfree = 0;
|
pfree = 0;
|
||||||
parts_lastActiveIndex = 0;
|
parts_lastActiveIndex = 0;
|
||||||
memset(pmap, 0, sizeof(pmap));
|
memset(pmap, 0, sizeof(pmap));
|
||||||
if(fvx)
|
memset(fvx, 0, sizeof(fvx));
|
||||||
memset(fvx, 0, sizeof(fvx));
|
memset(fvy, 0, sizeof(fvy));
|
||||||
if(fvy)
|
|
||||||
memset(fvy, 0, sizeof(fvy));
|
|
||||||
memset(photons, 0, sizeof(photons));
|
memset(photons, 0, sizeof(photons));
|
||||||
memset(wireless, 0, sizeof(wireless));
|
memset(wireless, 0, sizeof(wireless));
|
||||||
memset(gol2, 0, sizeof(gol2));
|
memset(gol2, 0, sizeof(gol2));
|
||||||
|
Reference in New Issue
Block a user