summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-05-08 05:34:35 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-05-08 05:34:35 +0000
commit0f130e615463dfa6150d097c72a4612868e180f5 (patch)
tree1af4bfc2105efa6dac73cc112155aaf5f9a65f8f /src
parent77d43dcefbbfbcbaf2b1cd1f5da2017673c1b5dc (diff)
downloadhercules-0f130e615463dfa6150d097c72a4612868e180f5.tar.gz
hercules-0f130e615463dfa6150d097c72a4612868e180f5.tar.bz2
hercules-0f130e615463dfa6150d097c72a4612868e180f5.tar.xz
hercules-0f130e615463dfa6150d097c72a4612868e180f5.zip
* Updated/revised description of instance-related script commands (bugreport:4880).
- Fixed 'instance_create' would return -4 (party already instancing) when the requested party was not found. - 'instance_create' return value -2 now means 'party not found' rather than 'missing parameter'. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14809 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/instance.c13
-rw-r--r--src/map/script.c4
2 files changed, 8 insertions, 9 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index 6fa3a2c0a..e9ff2b409 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -31,22 +31,21 @@ struct s_instance instance[MAX_INSTANCE];
/*--------------------------------------
* name : instance name
* Return value could be
- * -4 = already exists | -3 = no free instances | -2 = missing parameter | -1 = invalid type
+ * -4 = already exists | -3 = no free instances | -2 = party not found | -1 = invalid type
* On success return instance_id
*--------------------------------------*/
int instance_create(int party_id, const char *name)
{
int i;
- struct party_data *p = NULL;
+ struct party_data* p;
- if( !party_id || !name )
+ if( ( p = party_search(party_id) ) == NULL )
{
- ShowError("map_instance_create: missing parameter.\n");
+ ShowError("instance_create: party %d not found for instance '%s'.\n", party_id, name);
return -2;
}
- p = party_search(party_id);
- if( !p || p->instance_id )
+ if( p->instance_id )
return -4; // Party already instancing
// Searching a Free Instance
@@ -54,7 +53,7 @@ int instance_create(int party_id, const char *name)
ARR_FIND(1, MAX_INSTANCE, i, instance[i].state == INSTANCE_FREE);
if( i == MAX_INSTANCE )
{
- ShowError("map_instance_create: no free instances, consider increasing MAX_INSTANCE.\n");
+ ShowError("instance_create: no free instances, consider increasing MAX_INSTANCE.\n");
return -3;
}
diff --git a/src/map/script.c b/src/map/script.c
index 4f565b9ed..0b6732f08 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14360,11 +14360,11 @@ BUILDIN_FUNC(instance_create)
}
else if( res < 0 )
{
- char *err;
+ const char *err;
switch(res)
{
case -3: err = "No free instances"; break;
- case -2: err = "Missing parameter"; break;
+ case -2: err = "Invalid party ID"; break;
case -1: err = "Invalid type"; break;
default: err = "Unknown"; break;
}