summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-26 09:14:06 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-26 09:17:57 +0200
commit30ba18d4fd9901f7d7fdbde83b41de5e0ef7e8c1 (patch)
tree8087c872864a2344deb1c1f44df673693db88bdc
parentae6bee5100bb9ec4e7a3d5fa8538ca3eae38dc58 (diff)
messages: Remove message__type; it's not really used.
-rw-r--r--src/birth.c28
-rw-r--r--src/loadsave.c9
-rw-r--r--src/melee2.c4
-rw-r--r--src/messages.c32
-rw-r--r--src/messages.h5
-rw-r--r--src/q_hobbit.c5
-rw-r--r--src/q_poison.c2
-rw-r--r--src/q_shroom.c5
-rw-r--r--src/q_thrain.c5
-rw-r--r--src/util.c7
10 files changed, 45 insertions, 57 deletions
diff --git a/src/birth.c b/src/birth.c
index 851e1877..d8c4ef3f 100644
--- a/src/birth.c
+++ b/src/birth.c
@@ -1427,7 +1427,10 @@ static void gen_random_quests(int n)
/* Arg could not find anything ??? */
if (!tries)
{
- if (wizard) message_add(MESSAGE_MSG, format("Could not find quest monster on lvl %d", rl), TERM_RED);
+ if (wizard)
+ {
+ message_add(format("Could not find quest monster on lvl %d", rl), TERM_RED);
+ }
q_ptr->type = 0;
}
else
@@ -1439,9 +1442,11 @@ static void gen_random_quests(int n)
q_ptr->done = FALSE;
- if (wizard) message_add(MESSAGE_MSG,
- format("Quest for %d on lvl %d",
- q_ptr->r_idx, rl), TERM_RED);
+ if (wizard)
+ {
+ message_add(format("Quest for %d on lvl %d",
+ q_ptr->r_idx, rl), TERM_RED);
+ }
}
lvl += step;
@@ -3508,11 +3513,11 @@ void player_birth(void)
}
/* Note player birth in the message recall */
- message_add(MESSAGE_MSG, " ", TERM_L_BLUE);
- message_add(MESSAGE_MSG, " ", TERM_L_BLUE);
- message_add(MESSAGE_MSG, "====================", TERM_L_BLUE);
- message_add(MESSAGE_MSG, " ", TERM_L_BLUE);
- message_add(MESSAGE_MSG, " ", TERM_L_BLUE);
+ message_add(" ", TERM_L_BLUE);
+ message_add(" ", TERM_L_BLUE);
+ message_add("====================", TERM_L_BLUE);
+ message_add(" ", TERM_L_BLUE);
+ message_add(" ", TERM_L_BLUE);
/* Hack -- outfit the player */
player_outfit();
@@ -3557,7 +3562,10 @@ void player_birth(void)
}
d_ptr->t_level[num] = lev;
- if (wizard) message_add(MESSAGE_MSG, format("Random dungeon town: d_idx:%d, lev:%d", i, lev), TERM_WHITE);
+ if (wizard)
+ {
+ message_add(format("Random dungeon town: d_idx:%d, lev:%d", i, lev), TERM_WHITE);
+ }
/* Create the town */
init_town(d_ptr->t_idx[num], d_ptr->t_level[num]);
diff --git a/src/loadsave.c b/src/loadsave.c
index 598858db..de3bcd60 100644
--- a/src/loadsave.c
+++ b/src/loadsave.c
@@ -2123,27 +2123,28 @@ static void do_messages(int flag) /* FIXME! We should be able to unify this be
/* Read the messages */
if (flag == LS_LOAD)
{
+ byte tmp8u = 0;
for (i = 0; i < num; i++)
{
/* Read the message */
do_string(buf, 128, LS_LOAD);
do_byte(&color, flag);
- do_byte(&type, flag);
+ do_byte(&tmp8u, flag);
/* Save the message */
- message_add(type, buf, color);
+ message_add(buf, color);
}
}
if (flag == LS_SAVE)
{
byte holder;
+ byte zero = 0;
for (i = num - 1; i >= 0; i--)
{
do_string((char *)message_str((s16b)i), 0, LS_SAVE);
holder = message_color((s16b)i);
do_byte(&holder, flag);
- holder = message_type((s16b)i);
- do_byte(&holder, flag);
+ do_byte(&zero, flag);
}
}
}
diff --git a/src/melee2.c b/src/melee2.c
index 96f34bcb..2880c99c 100644
--- a/src/melee2.c
+++ b/src/melee2.c
@@ -958,7 +958,7 @@ void monster_msg(cptr fmt, ...)
msg_print(buf);
else
{
- message_add(MESSAGE_MSG, buf, TERM_WHITE);
+ message_add(buf, TERM_WHITE);
p_ptr->window |= PW_MESSAGE;
}
}
@@ -983,7 +983,7 @@ void cmonster_msg(char a, cptr fmt, ...)
cmsg_print(a, buf);
else
{
- message_add(MESSAGE_MSG, buf, a);
+ message_add(buf, a);
p_ptr->window |= PW_MESSAGE;
}
}
diff --git a/src/messages.c b/src/messages.c
index d39ad84b..e88cf58e 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -49,11 +49,6 @@ static u16b *message__ptr;
static byte *message__color;
/*
- * The array of type, by index [MESSAGE_MAX]
- */
-static byte *message__type;
-
-/*
* The array of message counts, by index [MESSAGE_MAX]
*/
static u16b *message__count;
@@ -90,7 +85,6 @@ void message_init()
/* Message variables */
C_MAKE(message__ptr, MESSAGE_MAX, u16b);
C_MAKE(message__color, MESSAGE_MAX, byte);
- C_MAKE(message__type, MESSAGE_MAX, byte);
C_MAKE(message__count, MESSAGE_MAX, u16b);
C_MAKE(message__buf, MESSAGE_BUF, char);
@@ -175,33 +169,11 @@ byte message_color(int age)
return (color);
}
-/*
- * Recall the type of a saved message
- */
-byte message_type(int age)
-{
- s16b x;
- byte type;
-
- /* Forgotten messages have no text */
- if ((age < 0) || (age >= message_num())) return (MESSAGE_NONE);
-
- /* Acquire the "logical" index */
- x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX;
-
- /* Get the "offset" for the message */
- type = message__type[x];
-
- /* Return the message text */
- return (type);
-}
-
-
/*
* Add a new message, with great efficiency
*/
-void message_add(byte type, cptr str, byte color)
+void message_add(cptr str, byte color)
{
int i, k, x, n;
cptr s;
@@ -286,7 +258,6 @@ void message_add(byte type, cptr str, byte color)
/* Assign the starting address */
message__ptr[x] = message__ptr[i];
message__color[x] = color;
- message__type[x] = type;
message__count[x] = 1;
/* Success */
@@ -376,7 +347,6 @@ void message_add(byte type, cptr str, byte color)
/* Assign the starting address */
message__ptr[x] = message__head;
message__color[x] = color;
- message__type[x] = type;
message__count[x] = 1;
/* Append the new part of the message */
diff --git a/src/messages.h b/src/messages.h
index 2b02f0c3..401c5727 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -3,14 +3,11 @@
#include "h-type.h"
-#define MESSAGE_NONE 0
-#define MESSAGE_MSG 1
-
void message_init();
s16b message_num();
cptr message_str(int age);
byte message_color(int age);
byte message_type(int age);
-void message_add(byte type, cptr msg, byte color);
+void message_add(cptr msg, byte color);
#endif
diff --git a/src/q_hobbit.c b/src/q_hobbit.c
index f3b7d856..b80638ad 100644
--- a/src/q_hobbit.c
+++ b/src/q_hobbit.c
@@ -173,7 +173,10 @@ bool_ quest_hobbit_init_hook(int q_idx)
{
cquest.data[0] = rand_range(26, 34);
cquest.data[1] = turn;
- if (wizard) message_add(MESSAGE_MSG, format("Hobbit level %d", cquest.data[0]), TERM_BLUE);
+ if (wizard)
+ {
+ message_add(format("Hobbit level %d", cquest.data[0]), TERM_BLUE);
+ }
}
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_poison.c b/src/q_poison.c
index e6fed3a1..0c3987df 100644
--- a/src/q_poison.c
+++ b/src/q_poison.c
@@ -220,7 +220,7 @@ bool_ quest_poison_init_hook(int q_idx)
{
cquest.data[1] = TRUE;
cquest.data[0] = rand_int(4);
- if (wizard) message_add(MESSAGE_MSG, format("Wilderness poison %d, %d", wild_locs[cquest.data[0]][0], wild_locs[cquest.data[0]][1]), TERM_BLUE);
+ if (wizard) message_add(format("Wilderness poison %d, %d", wild_locs[cquest.data[0]][0], wild_locs[cquest.data[0]][1]), TERM_BLUE);
}
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_shroom.c b/src/q_shroom.c
index 4d4d7494..c0133e74 100644
--- a/src/q_shroom.c
+++ b/src/q_shroom.c
@@ -272,7 +272,10 @@ bool_ quest_shroom_init_hook(int q_idx)
{
cquest.data[0] = 0;
cquest.data[1] = rand_range(7, 14);
- if (wizard) message_add(MESSAGE_MSG, format("Shrooms number %d", cquest.data[1]), TERM_BLUE);
+ if (wizard)
+ {
+ message_add(format("Shrooms number %d", cquest.data[1]), TERM_BLUE);
+ }
}
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_thrain.c b/src/q_thrain.c
index b2b1be9f..6180706c 100644
--- a/src/q_thrain.c
+++ b/src/q_thrain.c
@@ -212,7 +212,10 @@ bool_ quest_thrain_init_hook(int q)
if (!cquest.data[0])
{
cquest.data[0] = rand_range(d_info[DUNGEON_DOL_GULDUR].mindepth + 1, d_info[DUNGEON_DOL_GULDUR].maxdepth - 1);
- if (wizard) message_add(MESSAGE_MSG, format("Thrain lvl %d", cquest.data[0]), TERM_BLUE);
+ if (wizard)
+ {
+ message_add(format("Thrain lvl %d", cquest.data[0]), TERM_BLUE);
+ }
}
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
{
diff --git a/src/util.c b/src/util.c
index e65e4455..a9a9d10a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2249,7 +2249,7 @@ void cmsg_print(byte color, cptr msg)
/* Memorize the message */
- if (character_generated) message_add(MESSAGE_MSG, msg, color);
+ if (character_generated) message_add(msg, color);
/* Handle "auto_more" */
if (auto_more)
@@ -3978,7 +3978,10 @@ bool_ prefix(cptr s, cptr t)
/* Paranoia */
if (!s || !t)
{
- if (alert_failure) message_add(MESSAGE_MSG, "prefix() called with null argument!", TERM_RED);
+ if (alert_failure)
+ {
+ message_add("prefix() called with null argument!", TERM_RED);
+ }
return FALSE;
}