Remove some quits, replace with clean dialog

main
Cameron Murphy Reikes 2 years ago
parent 59b4363b45
commit 6d50ebc50a

@ -19,7 +19,7 @@
// - chipmunk
#ifdef ASSERT_DO_POPUP_AND_CRASH
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
wchar_t *
@ -64,7 +64,7 @@ FILE *log_file = NULL;
void quit_with_popup(const char *message_utf8, const char *title_utf8)
{
#ifdef WIN32
#ifdef _WIN32
size_t message_out_len = 0;
size_t title_out_len = 0;
wchar_t *message_wchar = fromUTF8(message_utf8, strlen(message_utf8), &message_out_len);
@ -581,7 +581,7 @@ cpVect box_compass_vector(Entity *box)
#include <time.h>
void fill_time_string(char *to_fill, size_t max_length)
{
#ifdef WIN32
#ifdef _WIN32
time_t rawtime;
struct tm timeinfo = {0};

@ -253,7 +253,6 @@ static enum BoxType currently_building()
return toolbar[cur_toolbar_slot];
}
struct BoxInfo boxinfo(enum BoxType type)
{
for (int i = 0; i < ARRLEN(boxes); i++)
@ -519,29 +518,30 @@ static void init(void)
result = ma_device_init(NULL, &microphone_config, &microphone_device);
if (result != MA_SUCCESS)
{
Log("Failed to initialize capture device.\n");
exit(-1);
quit_with_popup("Failed to initialize microphone\n", "Failed to initialize audio");
Log("Cap device fail\n");
return;
}
result = ma_device_init(NULL, &speaker_config, &speaker_device);
if (result != MA_SUCCESS)
{
ma_device_uninit(&microphone_device);
quit_with_popup("Failed to initialize speaker/headphones\n", "Failed to initialize audio");
Log("Failed to init speaker\n");
exit(-1);
return;
}
if (ma_mutex_init(&send_packets_mutex) != MA_SUCCESS)
Log("Failed to init send mutex\n");
if (ma_mutex_init(&play_packets_mutex) != MA_SUCCESS)
Log("Failed to init play mutex\n");
flight_assert(ma_mutex_init(&send_packets_mutex) == MA_SUCCESS);
flight_assert(ma_mutex_init(&play_packets_mutex) == MA_SUCCESS);
result = ma_device_start(&microphone_device);
if (result != MA_SUCCESS)
{
ma_device_uninit(&microphone_device);
Log("Failed to start device.\n");
exit(-1);
Log("Failed to start mic.\n");
quit_with_popup("Failed to start microphone device\n", "Failed to start audio");
return;
}
result = ma_device_start(&speaker_device);
@ -550,7 +550,8 @@ static void init(void)
ma_device_uninit(&microphone_device);
ma_device_uninit(&speaker_device);
Log("Failed to start speaker\n");
exit(-1);
quit_with_popup("Failed to start speaker device\n", "Failed to start audio");
return;
}
Log("Initialized audio\n");
@ -580,10 +581,7 @@ static void init(void)
exit(-1);
}
// shaders
{
// initialize shader
{
// initialize shaders
{
sgp_pipeline_desc pip_desc = {
.shader = *hueshift_program_shader_desc(sg_query_backend()),
@ -595,7 +593,6 @@ static void init(void)
fprintf(stderr, "failed to make hueshift pipeline\n");
exit(-1);
}
}
{
sgp_pipeline_desc pip_desc = {
@ -610,6 +607,7 @@ static void init(void)
exit(-1);
}
}
}
// images loading
{
@ -688,10 +686,9 @@ static void init(void)
/* received. Reset the peer in the event the 5 seconds */
/* had run out without any significant event. */
enet_peer_reset(peer);
fprintf(stderr, "Connection to server failed.");
exit(-1);
}
}
Log("Failed to connecvt to server\n");
quit_with_popup("Failed to connect to server. Is your wifi down? It took too long.", "Connection Failure");
Log("Connection to server failed.\n");
}
}
}

@ -436,6 +436,8 @@ uint64_t tick(struct GameState *gs);
double elapsed_time(GameState *gs);
double sun_dist_no_gravity(Entity *sun);
void quit_with_popup(const char *message_utf8, const char *title_utf8);
// all of these return if successful or not
bool server_to_client_serialize(struct ServerToClient *msg, unsigned char *bytes, size_t *out_len, size_t max_len, Entity *for_this_player, bool to_disk);
bool server_to_client_deserialize(struct ServerToClient *msg, unsigned char *bytes, size_t max_len, bool from_disk);

Loading…
Cancel
Save