summaryrefslogtreecommitdiff
path: root/src/modules.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2014-06-26 21:54:30 +0200
committerBardur Arantsson <bardur@scientician.net>2014-06-27 07:42:41 +0200
commitf50ed5b5c1e3caa38a5409cc22ea53fefd5c1209 (patch)
tree827ac3d7301849f2608dba0c1465d65137fffd94 /src/modules.cc
parent143808187704f8feec1b71f4e1c9a4b7efb1d9d6 (diff)
Remove most of z-virt.[ch]
This commit leaves only safe_calloc() as a convenient "non-failing" calloc().
Diffstat (limited to 'src/modules.cc')
-rw-r--r--src/modules.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/modules.cc b/src/modules.cc
index edfc2ee2..059e9200 100644
--- a/src/modules.cc
+++ b/src/modules.cc
@@ -9,15 +9,15 @@
#include "angband.h"
#include "hooks.h"
-static void module_reset_dir_aux(cptr *dir, cptr new_path)
+static void module_reset_dir_aux(char **dir, cptr new_path)
{
char buf[1024];
/* Build the new path */
strnfmt(buf, sizeof (buf), "%s%s%s", *dir, PATH_SEP, new_path);
- string_free(*dir);
- *dir = string_make(buf);
+ free(*dir);
+ *dir = strdup(buf);
/* Make it if needed */
if (!private_check_user_directory(*dir))
@@ -26,7 +26,7 @@ static void module_reset_dir_aux(cptr *dir, cptr new_path)
static void module_reset_dir(cptr dir, cptr new_path)
{
- cptr *d = 0;
+ char **d = 0;
char buf[1025];
if (!strcmp(dir, "core")) d = &ANGBAND_DIR_CORE;
@@ -40,18 +40,20 @@ static void module_reset_dir(cptr dir, cptr new_path)
if (!strcmp(dir, "xtra")) d = &ANGBAND_DIR_XTRA;
if (!strcmp(dir, "user")) d = &ANGBAND_DIR_USER;
if (!strcmp(dir, "note")) d = &ANGBAND_DIR_NOTE;
+
if (
!strcmp(dir, "user") ||
- !strcmp(dir, "note") ||
- !strcmp(dir, "cmov"))
+ !strcmp(dir, "note"))
{
char user_path[1024];
/* copied from init_file_paths */
path_parse(user_path, 1024, PRIVATE_USER_PATH);
strcat(user_path, USER_PATH_VERSION);
strnfmt(buf, 1024, "%s%s%s", user_path, PATH_SEP, new_path);
- string_free(*d);
- *d = string_make(buf);
+
+ free(*d);
+ *d = strdup(buf);
+
// Make it if needed */
if (!private_check_user_directory(*d))
{
@@ -67,8 +69,8 @@ static void module_reset_dir(cptr dir, cptr new_path)
/* Build the new path */
strnfmt(buf, 1024, "%s%s%s%s%s", ANGBAND_DIR_MODULES, PATH_SEP, new_path, PATH_SEP, dir);
- string_free(*d);
- *d = string_make(buf);
+ free(*d);
+ *d = strdup(buf);
}
}
@@ -207,7 +209,8 @@ bool_ select_module()
{
/* Process the module */
init_module(&modules[sel]);
- game_module = string_make(modules[sel].meta.name);
+
+ game_module = modules[sel].meta.name;
activate_module(sel);
@@ -277,7 +280,8 @@ bool_ select_module()
/* Process the module */
init_module(&modules[x]);
- game_module = string_make(modules[x].meta.name);
+
+ game_module = modules[x].meta.name;
activate_module(x);