projects
/
vrlugburz
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
631df34
)
load levels
author
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 31 Aug 2021 00:31:32 +0000
(
03:31
+0300)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 31 Aug 2021 00:31:32 +0000
(
03:31
+0300)
tools/dunger/src/main.c
patch
|
blob
|
history
diff --git
a/tools/dunger/src/main.c
b/tools/dunger/src/main.c
index
22932ec
..
5a23d71
100644
(file)
--- a/
tools/dunger/src/main.c
+++ b/
tools/dunger/src/main.c
@@
-343,10
+343,22
@@
static void cb_open(utk_event *ev, void *data)
static void cb_open_ok(utk_event *ev, void *data)
{
static void cb_open_ok(utk_event *ev, void *data)
{
+ char *errmsg = 0;
+ const char *path;
+
utk_widget *dlg = utk_event_widget(ev);
utk_widget *dlg = utk_event_widget(ev);
- printf("selected: %s\n", utk_file_dialog_file(dlg));
+ path = utk_file_dialog_path(dlg);
+ printf("selected: %s\n", path);
+ if(load_level(&lvl, path) == -1) {
+ errmsg = alloca(strlen(path) + 32);
+ sprintf(errmsg, "Failed to load level: %s", path);
+ }
utk_destroy_window(dlg);
if(uigrab == dlg) uigrab = 0;
utk_destroy_window(dlg);
if(uigrab == dlg) uigrab = 0;
+
+ if(errmsg) {
+ uigrab = utk_message_dialog(errmsg, UTK_MSG_TYPE_ERROR, UTK_MSG_BN_OK, cb_cancel, 0);
+ }
}
static void cb_save(utk_event *ev, void *data)
}
static void cb_save(utk_event *ev, void *data)