summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-27 11:18:58 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-27 11:18:58 +0000
commita46c1fbcb1b7df32c678af8f0bbfda801d6142dc (patch)
tree7911e6f38e2e13b8d1b31b34e61f46ffe35b459c /src/map
parent7df1201fe4659ecaea754e101ebd5bcd4051e4f2 (diff)
downloadhercules-a46c1fbcb1b7df32c678af8f0bbfda801d6142dc.tar.gz
hercules-a46c1fbcb1b7df32c678af8f0bbfda801d6142dc.tar.bz2
hercules-a46c1fbcb1b7df32c678af8f0bbfda801d6142dc.tar.xz
hercules-a46c1fbcb1b7df32c678af8f0bbfda801d6142dc.zip
* Reimplemented mmo_char_fromsql using sql statements. (fixes bugreport:93)
* Fixed buildin_gethominfo not being included in the script engine. (bugreport:124) * homunculus_evolution -> homevolution in script_commands.txt. * Deleted item DEFAULT from item_db.txt and regenerated item_db.sql. (bugreport:103) * Skip empty lines and give more feedback (for invalid lines) when reading item_db.txt/item_db2.txt. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11311 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c1
-rw-r--r--src/map/itemdb.c81
-rw-r--r--src/map/script.c2
3 files changed, 53 insertions, 31 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 2124a9181..da70bbd06 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -277,7 +277,6 @@ ACMD_FUNC(readmail); // [Valaris]
ACMD_FUNC(deletemail); // [Valaris]
ACMD_FUNC(sendmail); // [Valaris]
ACMD_FUNC(sendprioritymail); // [Valaris]
-ACMD_FUNC(deletemail); // [Valaris]
ACMD_FUNC(refreshonline); // [Valaris]
#endif
#ifdef DMALLOC
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 101738989..f6cdf6b3f 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -742,10 +742,10 @@ static bool itemdb_parse_dbrow(char** str, char* source, int line)
if (id->slot > MAX_SLOTS)
{
- ShowWarning("itemdb_parse_dbrow: Item %d (%s) specifies %d slots, but the server only supports up to %d\n", nameid, id->jname, id->slot, MAX_SLOTS);
+ ShowWarning("itemdb_parse_dbrow: Item %d (%s) specifies %d slots, but the server only supports up to %d. Using %d slots.\n", nameid, id->jname, id->slot, MAX_SLOTS, MAX_SLOTS);
id->slot = MAX_SLOTS;
}
-
+
itemdb_jobid2mapid(id->class_base, (unsigned int)strtoul(str[11],NULL,0));
id->class_upper = atoi(str[12]);
id->sex = atoi(str[13]);
@@ -812,58 +812,79 @@ static int itemdb_readdb(void)
// process rows one by one
while(fgets(line, sizeof(line), fp))
{
- char *str[32], *p, *np;
+ char *str[32], *p;
int i;
lines++;
if(line[0] == '/' && line[1] == '/')
continue;
memset(str, 0, sizeof(str));
- for(i = 0, np = p = line; i < 19 && p; i++)
+
+ p = line;
+ while( ISSPACE(*p) )
+ ++p;
+ if( *p == '\0' )
+ continue;// empty line
+ for( i = 0; i < 19; ++i )
{
str[i] = p;
- if ((p = strchr(p,',')) != NULL) {
- *p++ = '\0'; np = p;
- }
+ p = strchr(p,',');
+ if( p == NULL )
+ break;// comma not found
+ *p = '\0';
+ ++p;
}
- if( i < 19 )
+ if( p == NULL )
{
- ShowWarning("itemdb_readdb: Insufficient columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ ShowError("itemdb_readdb: Insufficient columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
continue;
}
- if((p=strchr(np,'{')) == NULL)
+ // Script
+ if( *p != '{' )
+ {
+ ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
continue;
- str[19] = p; //Script
- np = strchr(p,'}');
- while (np && np[1] && np[1] != ',')
- np = strchr(np+1,'}'); //Jump close brackets until the next field is found.
- if (!np || !np[1]) {
- continue; //Couldn't find the end of the script field.
}
- np[1] = '\0'; //Set end of script
- np += 2; //Skip to next field
+ str[19] = p;
+ p = strstr(p+1,"},");
+ if( p == NULL )
+ {
+ ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ continue;
+ }
+ p[1] = '\0';
+ p += 2;
- if(!np || (p=strchr(np,'{'))==NULL)
+ // OnEquip_Script
+ if( *p != '{' )
+ {
+ ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
continue;
- str[20] = p; //Equip Script
- np = strchr(p,'}');
- while (np && np[1] && np[1] != ',')
- np = strchr(np+1,'}'); //Jump close brackets until the next field is found.
- if (!np || !np[1]) {
- continue; //Couldn't find the end of the script field.
}
- np[1] = '\0'; //Set end of script
- np += 2; //Skip comma, to next field
+ str[20] = p;
+ p = strstr(p+1,"},");
+ if( p == NULL )
+ {
+ ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ continue;
+ }
+ p[1] = '\0';
+ p += 2;
- if(!np || (p=strchr(np,'{'))==NULL)
+ // OnUnequip_Script (last column)
+ if( *p != '{' )
+ {
+ ShowError("itemdb_readdb: Invalid format (OnUnequip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
continue;
- str[21] = p; //Unequip script, last column.
+ }
+ str[21] = p;
+
if (!itemdb_parse_dbrow(str, path, lines))
continue;
-
+
count++;
}
diff --git a/src/map/script.c b/src/map/script.c
index 1aeff2e2e..306076fc4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3954,6 +3954,7 @@ BUILDIN_FUNC(getusersname); //jA commands added [Lupus]
BUILDIN_FUNC(dispbottom);
BUILDIN_FUNC(recovery);
BUILDIN_FUNC(getpetinfo);
+BUILDIN_FUNC(gethominfo);
BUILDIN_FUNC(checkequipedcard);
BUILDIN_FUNC(globalmes);
BUILDIN_FUNC(jump_zero);
@@ -4293,6 +4294,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getusersname,"*"),
BUILDIN_DEF(recovery,""),
BUILDIN_DEF(getpetinfo,"i"),
+ BUILDIN_DEF(gethominfo,"i"),
BUILDIN_DEF(checkequipedcard,"i"),
BUILDIN_DEF(jump_zero,"ii"), //for future jA script compatibility
BUILDIN_DEF(globalmes,"s*"),