Fixed bugreport:6187 @reloadscript now reload map config files seeking for npcs.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16403 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
32d72d3196
commit
8d8baccf71
@ -3949,6 +3949,7 @@ ACMD_FUNC(reloadscript)
|
|||||||
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
|
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
|
||||||
|
|
||||||
flush_fifos();
|
flush_fifos();
|
||||||
|
map_reloadnpc(); // reload config files seeking for npcs
|
||||||
script_reload();
|
script_reload();
|
||||||
npc_reload();
|
npc_reload();
|
||||||
|
|
||||||
|
@ -3338,6 +3338,52 @@ int map_config_read(char *cfgName)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void map_reloadnpc_sub(char *cfgName)
|
||||||
|
{
|
||||||
|
char line[1024], w1[1024], w2[1024];
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fp = fopen(cfgName,"r");
|
||||||
|
if( fp == NULL )
|
||||||
|
{
|
||||||
|
ShowError("Map configuration file not found at: %s\n", cfgName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( fgets(line, sizeof(line), fp) )
|
||||||
|
{
|
||||||
|
char* ptr;
|
||||||
|
|
||||||
|
if( line[0] == '/' && line[1] == '/' )
|
||||||
|
continue;
|
||||||
|
if( (ptr = strstr(line, "//")) != NULL )
|
||||||
|
*ptr = '\n'; //Strip comments
|
||||||
|
if( sscanf(line, "%[^:]: %[^\t\r\n]", w1, w2) < 2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Strip trailing spaces
|
||||||
|
ptr = w2 + strlen(w2);
|
||||||
|
while (--ptr >= w2 && *ptr == ' ');
|
||||||
|
ptr++;
|
||||||
|
*ptr = '\0';
|
||||||
|
|
||||||
|
if (strcmpi(w1, "npc") == 0)
|
||||||
|
npc_addsrcfile(w2);
|
||||||
|
else if (strcmpi(w1, "import") == 0)
|
||||||
|
map_reloadnpc_sub(w2);
|
||||||
|
else
|
||||||
|
ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void map_reloadnpc()
|
||||||
|
{
|
||||||
|
npc_addsrcfile("clear"); // this will clear the current script list
|
||||||
|
map_reloadnpc_sub(MAP_CONF_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
int inter_config_read(char *cfgName)
|
int inter_config_read(char *cfgName)
|
||||||
{
|
{
|
||||||
char line[1024],w1[1024],w2[1024];
|
char line[1024],w1[1024],w2[1024];
|
||||||
|
@ -681,6 +681,9 @@ struct map_session_data * map_nick2sd(const char*);
|
|||||||
struct mob_data * map_getmob_boss(int m);
|
struct mob_data * map_getmob_boss(int m);
|
||||||
struct mob_data * map_id2boss(int id);
|
struct mob_data * map_id2boss(int id);
|
||||||
|
|
||||||
|
// reload config file looking only for npcs
|
||||||
|
void map_reloadnpc();
|
||||||
|
|
||||||
/// Bitfield of flags for the iterator.
|
/// Bitfield of flags for the iterator.
|
||||||
enum e_mapitflags
|
enum e_mapitflags
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user