Fix various warnings that had piled up

This commit is contained in:
Tamás Bálint Misius
2025-06-04 21:31:39 +02:00
parent bb4251adef
commit ebb3638413
5 changed files with 26 additions and 24 deletions

View File

@@ -187,10 +187,10 @@ void ScrollPanel::XTick()
}
}
if (xScrollVel > 7.0f) xScrollVel = 7.0f;
if (xScrollVel < -7.0f) xScrollVel = -7.0f;
if (xScrollVel > -0.5f && xScrollVel < 0.5)
xScrollVel = 0;
if (xScrollVel.GetValue() > 7.0f) xScrollVel.SetValue(7.0f);
if (xScrollVel.GetValue() < -7.0f) xScrollVel.SetValue(-7.0f);
if (xScrollVel.GetValue() > -0.5f && xScrollVel.GetValue() < 0.5f)
xScrollVel.SetValue(0);
maxOffset = InnerSize-Size;
maxOffset.Y = std::max(0, maxOffset.Y);
@@ -210,8 +210,8 @@ void ScrollPanel::XTick()
if (!ui::Engine::Ref().MomentumScroll)
{
yScrollVel = 0.0f;
xScrollVel = 0.0f;
yScrollVel.SetValue(0.0f);
xScrollVel.SetValue(0.0f);
}

View File

@@ -23,8 +23,8 @@ LoginView::LoginView():
usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username.FromUtf8(), "[username]")),
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]"))
{
targetSize.SetTarget(Size.Y);
targetSize.SetValue(Size.Y);
targetSize.SetTarget(float(Size.Y));
targetSize.SetValue(float(Size.Y));
FocusComponent(usernameField);
infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
@@ -100,11 +100,11 @@ void LoginView::NotifyStatusChanged(LoginModel * sender)
passwordField->Enabled = notWorking;
if (infoLabel->Visible)
{
targetSize.SetTarget(defaultSize.Y + infoLabel->Size.Y);
targetSize.SetTarget(float(defaultSize.Y + infoLabel->Size.Y));
}
else
{
targetSize.SetTarget(defaultSize.Y);
targetSize.SetTarget(float(defaultSize.Y));
}
if (sender->GetStatus() == loginSucceeded)
{
@@ -115,7 +115,7 @@ void LoginView::NotifyStatusChanged(LoginModel * sender)
void LoginView::OnTick()
{
c->Tick();
Size.Y = targetSize.GetValue();
Size.Y = int(targetSize.GetValue());
loginButton->Position.Y = Size.Y-17;
cancelButton->Position.Y = Size.Y-17;
}

View File

@@ -636,14 +636,14 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender)
if(sender->GetCommentBoxEnabled())
{
addCommentBox = new ui::Textbox(ui::Point((XRES/2)+4, Size.Y-19), ui::Point(Size.X-(XRES/2)-48, 17), "", "Add Comment");
commentBoxPositionX.SetTarget(addCommentBox->Position.X);
commentBoxPositionX.SetValue(addCommentBox->Position.X);
commentBoxPositionY.SetTarget(addCommentBox->Position.Y);
commentBoxPositionY.SetValue(addCommentBox->Position.Y);
commentBoxSizeX.SetTarget(addCommentBox->Size.X);
commentBoxSizeX.SetValue(addCommentBox->Size.X);
commentBoxSizeY.SetTarget(addCommentBox->Size.Y);
commentBoxSizeY.SetValue(addCommentBox->Size.Y);
commentBoxPositionX.SetTarget(float(addCommentBox->Position.X));
commentBoxPositionX.SetValue(float(addCommentBox->Position.X));
commentBoxPositionY.SetTarget(float(addCommentBox->Position.Y));
commentBoxPositionY.SetValue(float(addCommentBox->Position.Y));
commentBoxSizeX.SetTarget(float(addCommentBox->Size.X));
commentBoxSizeX.SetValue(float(addCommentBox->Size.X));
commentBoxSizeY.SetTarget(float(addCommentBox->Size.Y));
commentBoxSizeY.SetValue(float(addCommentBox->Size.Y));
addCommentBox->SetActionCallback({ [this] {
CheckComment();
commentBoxAutoHeight();

View File

@@ -134,12 +134,15 @@ public:
seenRunningThisTick = false;
}
void Progress(int64_t *total, int64_t *done)
std::pair<int64_t, int64_t> Progress()
{
int64_t total = 0;
int64_t done = 0;
if (!dead)
{
std::tie(*total, *done) = request->CheckProgress();
std::tie(total, done) = request->CheckProgress();
}
return { total, done };
}
void Cancel()
@@ -220,8 +223,7 @@ static int HTTPRequest_progress(lua_State *L)
auto *rh = (LuaHttp::RequestHandle *)luaL_checkudata(L, 1, "HTTPRequest");
if (rh->GetStatus() != LuaHttp::RequestHandle::Status::dead)
{
int64_t total, done;
rh->Progress(&total, &done);
auto [ total, done ] = rh->Progress();
lua_pushinteger(L, total);
lua_pushinteger(L, done);
return 2;

View File

@@ -511,7 +511,7 @@ static int createParts(lua_State *L)
{
int c = luaL_checkint(L, 5); // note: weird: has to be specified in a sim context but not in a ui context
auto center = Vec2(x, y);
RasterizeEllipseRows(Vec2<float>(rx * rx, ry * ry), [lsi, c, center](int xLim, int dy) {
RasterizeEllipseRows(Vec2<float>(float(rx * rx), float(ry * ry)), [lsi, c, center](int xLim, int dy) {
for (auto pos : RectBetween(center + Vec2(-xLim, dy), center + Vec2(xLim, dy)))
{
lsi->sim->CreateParts(-1, pos.X, pos.Y, 0, 0, c, 0);