SoundManager::get()->enable_music(true);
}
-FILE * SuperTux::opendata(const char * rel_filename, const char * mode)
+FILE * SuperTux::opendata(const std::string& rel_filename, const char *mode)
{
- char * filename = NULL;
+ std::string filename;
FILE * fi;
- filename = (char *) malloc(sizeof(char) * (strlen(st_dir) +
- strlen(rel_filename) + 1));
-
- strcpy(filename, st_dir);
- /* Open the high score file: */
-
- strcat(filename, rel_filename);
+ filename = st_dir + rel_filename;
/* Try opening the file: */
- fi = fopen(filename, mode);
+ fi = fopen(filename.c_str(), mode);
if (fi == NULL)
{
- fprintf(stderr, "Warning: Unable to open the file \"%s\" ", filename);
+ fprintf(stderr, "Warning: Unable to open the file \"%s\" ", filename.c_str());
if (strcmp(mode, "r") == 0)
fprintf(stderr, "for read!!!\n");
else if (strcmp(mode, "w") == 0)
fprintf(stderr, "for write!!!\n");
}
- free( filename );
return(fi);
}
if (root_obj->type == LISP_TYPE_EOF || root_obj->type == LISP_TYPE_PARSE_ERROR)
return;
- if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-config") != 0)
+ if (strcmp(lisp_symbol(lisp_car(root_obj)), (package_symbol_name+"-config").c_str()) != 0)
return;
LispReader reader(lisp_cdr(root_obj));
if(config)
{
- fprintf(config, "(supertux-config\n");
+ fprintf(config, ("("+package_symbol_name+"-config\n").c_str());
fprintf(config, "\t;; the following options can be set to #t or #f:\n");
fprintf(config, "\t(fullscreen %s)\n", use_fullscreen ? "#t" : "#f");
fprintf(config, "\t(sound %s)\n", SoundManager::get()->sound_enabled() ? "#t" : "#f");