Disable lobby entry buttons with mismatching versions

This commit is contained in:
Agent X 2024-07-16 16:00:29 -04:00
parent fdaf425e84
commit 73ffdf6e98
4 changed files with 8 additions and 5 deletions

View File

@ -10,8 +10,9 @@
struct FirstPersonCamera {
bool enabled;
bool forceRoll;
bool forcePitch;
bool forceYaw;
bool forceRoll;
bool centerL;
s16 pitch;
s16 yaw;

View File

@ -46,7 +46,7 @@ static void djui_lobby_entry_destroy(struct DjuiBase* base) {
free(lobbyEntry);
}
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) {
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) {
struct DjuiLobbyEntry* lobbyEntry = calloc(1, sizeof(struct DjuiLobbyEntry));
struct DjuiBase* base = &lobbyEntry->base;
@ -59,6 +59,7 @@ struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* ho
djui_base_set_border_color(&lobbyEntry->base, 128, 128, 128, 255);
djui_base_set_border_width(&lobbyEntry->base, 2);
djui_base_set_border_width_type(&lobbyEntry->base, DJUI_SVT_ABSOLUTE);
djui_base_set_enabled(&lobbyEntry->base, !disabled);
djui_interactable_create(base, djui_lobby_entry_update_style);
djui_interactable_hook_click(base, on_click);
djui_interactable_hook_hover(base, on_hover, on_hover_end);

View File

@ -6,4 +6,4 @@ struct DjuiLobbyEntry {
const char* description;
};
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*));
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*));

View File

@ -89,12 +89,13 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t
char version[MAX_VERSION_LENGTH] = { 0 };
snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online());
if (strcmp(version, aVersion) != 0) {
bool disabled = strcmp(version, aVersion) != 0;
if (disabled) {
snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion);
}
struct DjuiBase* layoutBase = &sLobbyLayout->base;
struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end);
struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, disabled, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end);
entry->base.tag = (s64)aLobbyId;
djui_paginated_update_page_buttons(sLobbyPaginated);
}