Skip to content

Commit

Permalink
Fix GTK developer mode build
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Nov 17, 2023
1 parent 905959d commit 5ef865b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/C4Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,10 @@ void C4Console::OnPlrJoin(GtkWidget *item, gpointer data)

void C4Console::OnPlrQuit(GtkWidget *item, gpointer data)
{
Game.Control.Input.Add(CID_EliminatePlayer, new C4ControlEliminatePlayer(GPOINTER_TO_INT(data)));
const std::int32_t playerNumber{GPOINTER_TO_INT(data)};
C4Player *const player{Game.Players.Get(playerNumber)};

Game.Control.Input.Add(CID_EliminatePlayer, new C4ControlEliminatePlayer(Game.GetSectionIndex(**player->ViewSection), GPOINTER_TO_INT(data)));
}

void C4Console::OnViewNew(GtkWidget *item, gpointer data)
Expand Down
2 changes: 1 addition & 1 deletion src/C4ObjectListDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GType c4_list_get_type(void);
static void
c4_list_init(C4List *c4_list)
{
c4_list->data = &Game.Objects;
c4_list->data = &Game.Sections.front()->Objects; // FIXME

c4_list->stamp = g_random_int(); /* Random int to check whether iters belong to this model */
}
Expand Down
8 changes: 5 additions & 3 deletions src/C4Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,11 @@ GtkWidget *C4ViewportWindow::InitGUI()
v_scrollbar = gtk_vscrollbar_new(nullptr);
table = gtk_table_new(2, 2, FALSE);

C4Section &section{cvp->GetViewSection()};

GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(h_scrollbar));
adjustment->lower = 0;
adjustment->upper = ViewSection->Landscape.Width;
adjustment->upper = section.Landscape.Width;
adjustment->step_increment = ViewportScrollSpeed;

g_signal_connect(
Expand All @@ -332,7 +334,7 @@ GtkWidget *C4ViewportWindow::InitGUI()

adjustment = gtk_range_get_adjustment(GTK_RANGE(v_scrollbar));
adjustment->lower = 0;
adjustment->upper = ViewSection->Landscape.Height;
adjustment->upper = section.Landscape.Height;
adjustment->step_increment = ViewportScrollSpeed;

g_signal_connect(
Expand Down Expand Up @@ -436,7 +438,7 @@ void C4ViewportWindow::OnDragDataReceivedStatic(GtkWidget *widget, GdkDragContex
gchar *file = g_filename_from_uri(*uri, nullptr, nullptr);
if (!file) continue;

Game.DropFile(file, window->cvp->ViewX + static_cast<int32_t>(x / scale), window->cvp->ViewY + static_cast<int32_t>(y / scale));
Game.DropFile(window->cvp->GetViewSection(), file, window->cvp->ViewX + static_cast<int32_t>(x / scale), window->cvp->ViewY + static_cast<int32_t>(y / scale));
g_free(file);
}

Expand Down

0 comments on commit 5ef865b

Please sign in to comment.