home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactorisation and comment improvements in misc library.
[plomrogue]
/
src
/
misc.c
diff --git
a/src/misc.c
b/src/misc.c
index 97c9fa69a96d0a2445eb54965c2fa6b5fdab3b47..122f404e8e2eace4181a1fb9d42e14048d7b67bb 100644
(file)
--- a/
src/misc.c
+++ b/
src/misc.c
@@
-27,8
+27,7
@@
extern uint16_t rrand()
extern uint16_t rrand()
-{
- /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
+{ /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
world.seed = ((world.seed * 1103515245) + 12345) % 4294967296;
return (world.seed >> 16); /* Ignore less random least significant bits. */
}
world.seed = ((world.seed * 1103515245) + 12345) % 4294967296;
return (world.seed >> 16); /* Ignore less random least significant bits. */
}
@@
-169,17
+168,17
@@
extern void update_log(char * text)
-extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
+extern uint16_t center_offset(uint16_t pos
ition
, uint16_t mapsize,
uint16_t framesize)
{
uint16_t offset = 0;
if (mapsize > framesize)
{
uint16_t framesize)
{
uint16_t offset = 0;
if (mapsize > framesize)
{
- if (pos > framesize / 2)
+ if (pos
ition
> framesize / 2)
{
{
- if (pos < mapsize - (framesize / 2))
+ if (pos
ition
< mapsize - (framesize / 2))
{
{
- offset = pos - (framesize / 2);
+ offset = pos
ition
- (framesize / 2);
}
else
{
}
else
{
@@
-213,7
+212,7
@@
extern void turn_over(char action)
if ( is_command_id_shortdsc(action, "drop")
|| is_command_id_shortdsc(action, "use"))
{
if ( is_command_id_shortdsc(action, "drop")
|| is_command_id_shortdsc(action, "use"))
{
- try_fputc(world.inventory_sel
ect
, file_new, f_name);
+ try_fputc(world.inventory_sel, file_new, f_name);
}
try_fclose_unlink_rename(file_new, recordfile_tmp, recordfile, f_name);
}
}
try_fclose_unlink_rename(file_new, recordfile_tmp, recordfile, f_name);
}
@@
-316,10
+315,7
@@
extern void nav_inventory(char dir)
{
if ('u' == dir)
{
{
if ('u' == dir)
{
- if (world.inventory_select > 0)
- {
- world.inventory_select--;
- }
+ world.inventory_sel = world.inventory_sel - (world.inventory_sel > 0);
return;
}
struct MapObj * player = get_player();
return;
}
struct MapObj * player = get_player();
@@
-330,8
+326,5
@@
extern void nav_inventory(char dir)
}
uint8_t n_owned = 0;
for (; NULL != owned->next; owned = owned->next, n_owned++);
}
uint8_t n_owned = 0;
for (; NULL != owned->next; owned = owned->next, n_owned++);
- if (world.inventory_select < n_owned)
- {
- world.inventory_select++;
- }
+ world.inventory_sel = world.inventory_sel + (world.inventory_sel < n_owned);
}
}