projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
df28305
)
Cleaned up unused variables
author
NHOrus
<jy6x2b32pie9@yahoo.com>
Tue, 4 Jul 2017 08:15:10 +0000
(11:15 +0300)
committer
NHOrus
<jy6x2b32pie9@yahoo.com>
Tue, 4 Jul 2017 12:18:49 +0000
(15:18 +0300)
actions.c
patch
|
blob
|
history
misc.c
patch
|
blob
|
history
diff --git
a/actions.c
b/actions.c
index 6bee7760a9e2200574803cbb43339bda470334fd..b6fbfa2200afb5985300108b53191ede1326cf3e 100644
(file)
--- a/
actions.c
+++ b/
actions.c
@@
-1038,9
+1038,7
@@
static int rub(token_t verb, token_t obj)
static int say(struct command_t *command)
/* Say. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
{
static int say(struct command_t *command)
/* Say. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
{
- long a = command->wd1;
if (command->wd2 > 0) {
if (command->wd2 > 0) {
- a = command->wd2;
command->wd1 = command->wd2;
strcpy(command->raw1, command->raw2);
}
command->wd1 = command->wd2;
strcpy(command->raw1, command->raw2);
}
diff --git
a/misc.c
b/misc.c
index 6e3656f50fd90e9144e9f27177fc9a10673391ad..5d400db7d5611e5382c7ea7b3bf532759de69714 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-23,7
+23,7
@@
static void* xmalloc(size_t size)
return (ptr);
}
return (ptr);
}
-void packed_to_token(long packed, char token[TOKLEN
+
1])
+void packed_to_token(long packed, char token[TOKLEN
+
1])
{
// The advent->ascii mapping.
const char advent_to_ascii[] = {
{
// The advent->ascii mapping.
const char advent_to_ascii[] = {
@@
-81,7
+81,7
@@
long token_to_packed(const char token[])
size_t t_len = strlen(token);
if (t_len > TOKLEN)
size_t t_len = strlen(token);
if (t_len > TOKLEN)
- t_len = TOKLEN;
+
t_len = TOKLEN;
long packed = 0;
for (size_t i = 0; i < t_len; ++i) {
char mapped = ascii_to_advent[(int) toupper(token[i])];
long packed = 0;
for (size_t i = 0; i < t_len; ++i) {
char mapped = ascii_to_advent[(int) toupper(token[i])];
@@
-95,7
+95,7
@@
void tokenize(char* raw, struct command_t *cmd)
memset(cmd, '\0', sizeof(struct command_t));
/* FIXME: put a bound prefix on the %s to prevent buffer overflow */
memset(cmd, '\0', sizeof(struct command_t));
/* FIXME: put a bound prefix on the %s to prevent buffer overflow */
-
int word_count =
sscanf(raw, "%s%s", cmd->raw1, cmd->raw2);
+ sscanf(raw, "%s%s", cmd->raw1, cmd->raw2);
// pack the substrings
cmd->wd1 = token_to_packed(cmd->raw1);
// pack the substrings
cmd->wd1 = token_to_packed(cmd->raw1);
@@
-274,16
+274,16
@@
int word_count(char* str)
int inblanks = true;
for (char *s = str; *s; s++)
int inblanks = true;
for (char *s = str; *s; s++)
- if (inblanks) {
- if (strchr(delims, *s) == 0) {
- ++count;
- inblanks = false;
- }
- } else {
- if (strchr(delims, *s) != 0) {
- inblanks = true;
- }
- }
+
if (inblanks) {
+
if (strchr(delims, *s) == 0) {
+
++count;
+
inblanks = false;
+
}
+
} else {
+
if (strchr(delims, *s) != 0) {
+
inblanks = true;
+
}
+
}
return (count);
}
return (count);
}
@@
-485,7
+485,7
@@
long get_vocab_id(const char* word)
{
/* Check for an empty string */
if (strncmp(word, "", sizeof("")) == 0)
{
/* Check for an empty string */
if (strncmp(word, "", sizeof("")) == 0)
- return (WORD_EMPTY);
+
return (WORD_EMPTY);
long ref_num;
long ref_num;
@@
-649,7
+649,7
@@
long randrange(long range)
return range * get_next_lcg_value() / game.lcg_m;
}
return range * get_next_lcg_value() / game.lcg_m;
}
-void make_zzword(char zzword[TOKLEN
+
1])
+void make_zzword(char zzword[TOKLEN
+
1])
{
for (int i = 0; i < 5; ++i) {
zzword[i] = 'A' + randrange(26);
{
for (int i = 0; i < 5; ++i) {
zzword[i] = 'A' + randrange(26);