Hm. This is the literal changes I made to your code to get it to work:
Code:
diff --git a/src/act.other.c b/src/act.other.c
index 4798105..583d51a 100644
--- a/src/act.other.c
+++ b/src/act.other.c
@@ -277,8 +277,10 @@ ACMD(do_practice)
if (*arg)
send_to_char(ch, "You can only practice skills in your guild.\r\n");
- else
+ else {
list_skills(ch);
+ list_spells(ch);
+ }
}
ACMD(do_visible)
diff --git a/src/db.c b/src/db.c
index fda7ac6..a1ef865 100644
--- a/src/db.c
+++ b/src/db.c
@@ -752,6 +752,7 @@ void boot_db(void)
log("Sorting command list and spells.");
sort_commands();
+ sort_skills();
sort_spells();
log("Booting mail system.");
diff --git a/src/spec_procs.c b/src/spec_procs.c
index c852622..5745c42 100644
--- a/src/spec_procs.c
+++ b/src/spec_procs.c
@@ -35,6 +35,7 @@ static void npc_steal(struct char_data *ch, struct char_data *victim);
/* Special procedures for mobiles. */
static int spell_sort_info[MAX_SKILLS + 1];
+static int skill_sort_info[MAX_SKILLS + 1];
@@ -45,13 +46,23 @@ static int compare_spells(const void *x, const void *y)
return strcmp(spell_info[a].name, spell_info[b].name);
}
+void sort_skills(void)
+{
+ int a;
+ /* initialize array, avoiding reserved. */
+ for (a = 55; a <= 200; a++)
+ skill_sort_info[a] = a;
+
+ /* I don't care about sorting right now just freakin show the skills*/
+ qsort(&skill_sort_info[1], MAX_SKILLS, sizeof(int), compare_spells);
+}
void sort_spells(void)
{
int a;
/* initialize array, avoiding reserved. */
- for (a = 1; a <= MAX_SKILLS; a++)
+ for (a = 1; a <= 54; a++)
spell_sort_info[a] = a;
qsort(&spell_sort_info[1], MAX_SKILLS, sizeof(int), compare_spells);
@@ -96,6 +107,7 @@ static const char *prac_types[] = {
#define MAXGAIN(ch) (prac_params[MAX_PER_PRAC][(int)GET_CLASS(ch)])
#define SPLSKL(ch) (prac_types[prac_params[PRAC_TYPE][(int)GET_CLASS(ch)]])
+/*
void list_skills(struct char_data *ch)
{
const char *overflow = "\r\n**OVERFLOW**\r\n";
@@ -116,10 +128,62 @@ void list_skills(struct char_data *ch)
len += ret;
}
}
+ if (len >= sizeof(buf2))
+ strcpy(buf2 + sizeof(buf2) - strlen(overflow) - 1, overflow); / * strcpy: OK * /
+
+ page_string(ch->desc, buf2, TRUE);
+}
+*/
+
+void list_skills(struct char_data *ch)
+{
+ const char *overflow = "\r\n**OVERFLOW**\r\n";
+ int i, sortpos, ret;
+ size_t len = 0;
+ char buf2[MAX_STRING_LENGTH];
+ send_to_char(ch, " --- [SKILL DATABASE] ---\r\n");
+ for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
+ i = skill_sort_info[sortpos];
+ if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
+ ret = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));
+ if (ret < 0 || len + ret >= sizeof(buf2))
+ break;
+ len += ret;
+ }
+ }
if (len >= sizeof(buf2))
strcpy(buf2 + sizeof(buf2) - strlen(overflow) - 1, overflow); /* strcpy: OK */
page_string(ch->desc, buf2, TRUE);
+
+ send_to_char(ch, "\n - You have %d practice%s available -\r\n", GET_PRACTICES(ch),
+ GET_PRACTICES(ch) == 1 ? "" : "s");
+}
+
+
+void list_spells(struct char_data *ch)
+{
+ const char *overflow = "\r\n**OVERFLOW**\r\n";
+ int i, sortpos, ret;
+ size_t len = 0;
+ char buf2[MAX_STRING_LENGTH];
+ send_to_char(ch, " --- [PROGRAM DATABASE] ---\r\n");
+ for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
+ i = spell_sort_info[sortpos];
+ if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
+ ret = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));
+ if (ret < 0 || len + ret >= sizeof(buf2))
+ break;
+ len += ret;
+ }
+ }
+ if (len >= sizeof(buf2))
+ strcpy(buf2 + sizeof(buf2) - strlen(overflow) - 1, overflow); /* strcpy: OK */
+
+ page_string(ch->desc, buf2, TRUE);
+
+ send_to_char(ch, "\n - You have %d download%s available -\r\n", GET_PRACTICES(ch),
+ GET_PRACTICES(ch) == 1 ? "" : "s");
}
SPECIAL(guild)
diff --git a/src/spec_procs.h b/src/spec_procs.h
index 3bb8bd7..df9cc60 100644
--- a/src/spec_procs.h
+++ b/src/spec_procs.h
@@ -34,7 +34,9 @@ const char *get_spec_func_name(SPECIAL(*func));
****************************************************************************/
/* Utility functions */
void sort_spells(void);
+void list_spells(struct char_data *ch);
void list_skills(struct char_data *ch);
+void sort_skills(void);
/* Special functions */
SPECIAL(guild);