home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added further (though rarely informative) handling of windows library error.
[plomrogue]
/
src
/
misc.c
diff --git
a/src/misc.c
b/src/misc.c
index 44e9a0871edb76caf22790fcfd71ec40103ef8ec..72568858451877a65b5cd51dcf61b5074c5d268d 100644
(file)
--- a/
src/misc.c
+++ b/
src/misc.c
@@
-115,15
+115,15
@@
extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
extern void turn_over(struct World * world, char action)
{
char * err_open = "Error recording move: "
extern void turn_over(struct World * world, char action)
{
char * err_open = "Error recording move: "
- "Unable to open 'record_tmp' for appending.";
+ "Unable to open
file
'record_tmp' for appending.";
char * err_write = "Error recording move: "
char * err_write = "Error recording move: "
- "Trouble writing to opened 'record_tmp'.";
+ "Trouble writing to opened
file
'record_tmp'.";
char * err_close = "Error recording move: "
char * err_close = "Error recording move: "
- "Unable to close opened 'record_tmp'.";
+ "Unable to close opened
file
'record_tmp'.";
char * err_unl = "Error recording move: "
char * err_unl = "Error recording move: "
- "Unable to unlink old
'record' file
.";
+ "Unable to unlink old
file 'record'
.";
char * err_move = "Error recording move: "
char * err_move = "Error recording move: "
- "Unable to rename 'record_tmp' to 'record'.";
+ "Unable to rename
file
'record_tmp' to 'record'.";
char * recordfile_tmp = "record_tmp";
char * recordfile = "record";
if (1 == world->interactive)
char * recordfile_tmp = "record_tmp";
char * recordfile = "record";
if (1 == world->interactive)
@@
-152,15
+152,15
@@
extern void turn_over(struct World * world, char action)
extern void save_game(struct World * world)
{
char * err_open = "Error saving game: "
extern void save_game(struct World * world)
{
char * err_open = "Error saving game: "
- "Unable to open 'savefile_tmp' for writing.";
+ "Unable to open
file
'savefile_tmp' for writing.";
char * err_write = "Error saving game: "
char * err_write = "Error saving game: "
- "Trouble writing to opened 'savefile_tmp'.";
+ "Trouble writing to opened
file
'savefile_tmp'.";
char * err_close = "Error saving game: "
char * err_close = "Error saving game: "
- "Unable to close opened 'savefile_tmp'.";
+ "Unable to close opened
file
'savefile_tmp'.";
char * err_unl = "Error saving game: "
char * err_unl = "Error saving game: "
- "Unable to unlink old 'savefile'.";
+ "Unable to unlink old 'savefile'
file
.";
char * err_move = "Error saving game: "
char * err_move = "Error saving game: "
- "Unable to rename 'savefile_tmp' to 'savefile'.";
+ "Unable to rename '
file
savefile_tmp' to 'savefile'.";
char * savefile_tmp = "savefile_tmp";
char * savefile = "savefile";
FILE * file = fopen(savefile_tmp, "w");
char * savefile_tmp = "savefile_tmp";
char * savefile = "savefile";
FILE * file = fopen(savefile_tmp, "w");
@@
-185,15
+185,15
@@
extern void save_game(struct World * world)
-extern
void
toggle_window(struct WinMeta * win_meta, struct Win * win)
+extern
uint8_t
toggle_window(struct WinMeta * win_meta, struct Win * win)
{
if (0 != win->frame.curses_win)
{
{
if (0 != win->frame.curses_win)
{
- suspend_win(win_meta, win);
+
return
suspend_win(win_meta, win);
}
else
{
}
else
{
- append_win(win_meta, win);
+
return
append_win(win_meta, win);
}
}
}
}
@@
-213,7
+213,7
@@
extern void scroll_pad(struct WinMeta * win_meta, char dir)
-extern
void
growshrink_active_window(struct WinMeta * win_meta, char change)
+extern
uint8_t
growshrink_active_window(struct WinMeta * win_meta, char change)
{
if (0 != win_meta->active)
{
{
if (0 != win_meta->active)
{
@@
-234,8
+234,9
@@
extern void growshrink_active_window(struct WinMeta * win_meta, char change)
{
size.x++;
}
{
size.x++;
}
- resize_active_win (win_meta, size);
+ re
turn re
size_active_win (win_meta, size);
}
}
+ return 0;
}
}
@@
-272,19
+273,19
@@
extern uint8_t meta_keys(int key, struct World * world,
}
else if (key == get_action_key(world->keybindings, "toggle keys window"))
{
}
else if (key == get_action_key(world->keybindings, "toggle keys window"))
{
-
toggle_window(win_meta, win_keys
);
+
exit_err(toggle_window(win_meta, win_keys), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "toggle map window"))
{
}
else if (key == get_action_key(world->keybindings, "toggle map window"))
{
-
toggle_window(win_meta, win_map
);
+
exit_err(toggle_window(win_meta, win_map), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "toggle info window"))
{
}
else if (key == get_action_key(world->keybindings, "toggle info window"))
{
-
toggle_window(win_meta, win_info
);
+
exit_err(toggle_window(win_meta, win_info), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "toggle log window"))
{
}
else if (key == get_action_key(world->keybindings, "toggle log window"))
{
-
toggle_window(win_meta, win_log
);
+
exit_err(toggle_window(win_meta, win_log), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "cycle forwards"))
{
}
else if (key == get_action_key(world->keybindings, "cycle forwards"))
{
@@
-296,27
+297,27
@@
extern uint8_t meta_keys(int key, struct World * world,
}
else if (key == get_action_key(world->keybindings, "shift forwards"))
{
}
else if (key == get_action_key(world->keybindings, "shift forwards"))
{
-
shift_active_win(win_meta, 'f'
);
+
exit_err(shift_active_win(win_meta, 'f'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "shift backwards"))
{
}
else if (key == get_action_key(world->keybindings, "shift backwards"))
{
-
shift_active_win(win_meta, 'b'
);
+
exit_err(shift_active_win(win_meta, 'b'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "grow horizontally"))
{
}
else if (key == get_action_key(world->keybindings, "grow horizontally"))
{
-
growshrink_active_window(win_meta, '*'
);
+
exit_err(growshrink_active_window(win_meta, '*'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "shrink horizontally"))
{
}
else if (key == get_action_key(world->keybindings, "shrink horizontally"))
{
-
growshrink_active_window(win_meta, '_'
);
+
exit_err(growshrink_active_window(win_meta, '_'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "grow vertically"))
{
}
else if (key == get_action_key(world->keybindings, "grow vertically"))
{
-
growshrink_active_window(win_meta, '+'
);
+
exit_err(growshrink_active_window(win_meta, '+'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "shrink vertically"))
{
}
else if (key == get_action_key(world->keybindings, "shrink vertically"))
{
-
growshrink_active_window(win_meta, '-'
);
+
exit_err(growshrink_active_window(win_meta, '-'), world, NULL
);
}
else if (key == get_action_key(world->keybindings, "save keys"))
{
}
else if (key == get_action_key(world->keybindings, "save keys"))
{