summaryrefslogtreecommitdiff
path: root/src/char_sql/int_quest.c
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-02 04:10:23 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-02 04:10:23 +0000
commit7af299d591f357471bc8447707a10de9ea5ae0e3 (patch)
tree3a42528f874f1da21ee8aaf552da82181c01bcf7 /src/char_sql/int_quest.c
parent73b9ce7e5d16ef9c2aa639c8442dd8f15c615fca (diff)
downloadhercules-7af299d591f357471bc8447707a10de9ea5ae0e3.tar.gz
hercules-7af299d591f357471bc8447707a10de9ea5ae0e3.tar.bz2
hercules-7af299d591f357471bc8447707a10de9ea5ae0e3.tar.xz
hercules-7af299d591f357471bc8447707a10de9ea5ae0e3.zip
* Questlog code cleanup.
* Fixed range check of autospell and autospell2 using wrong target when it should be used on yourself. * Implemented official behavior of party_show_share_picker. * Restricted zones in 'item_noequip.txt' can now stack. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13987 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_quest.c')
-rw-r--r--src/char_sql/int_quest.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/char_sql/int_quest.c b/src/char_sql/int_quest.c
index 5a1cd09b7..8c7a46e30 100644
--- a/src/char_sql/int_quest.c
+++ b/src/char_sql/int_quest.c
@@ -58,57 +58,6 @@ int mapif_quests_fromsql(int char_id, struct quest questlog[])
return i;
}
-//Save quests
-int mapif_parse_quest_save(int fd)
-{
- int i, j, num2, num1 = (RFIFOW(fd,2)-8)/sizeof(struct quest);
- int char_id = RFIFOL(fd,4);
- struct quest qd1[MAX_QUEST_DB],qd2[MAX_QUEST_DB];
- uint8 buf[MAX_QUEST_DB];
- int count = 0;
-
- memset(qd1, 0, sizeof(qd1));
- memset(qd2, 0, sizeof(qd2));
- memcpy(&qd1, RFIFOP(fd,8), RFIFOW(fd,2)-8);
- num2 = mapif_quests_fromsql(char_id, qd2);
-
- for( i = 0; i < num1; i++ )
- {
- ARR_FIND( 0, num2, j, qd1[i].quest_id == qd2[j].quest_id );
- if( j < num2 ) // Update existed quests
- { // Only states and counts are changable.
- if( qd1[i].state != qd2[j].state || qd1[i].count[0] != qd2[j].count[0] || qd1[i].count[1] != qd2[j].count[1] || qd1[i].count[2] != qd2[j].count[2] )
- mapif_quest_update(char_id, qd1[i]);
-
- if( j < (--num2) )
- {
- memmove(&qd2[j],&qd2[j+1],sizeof(struct quest)*(num2-j));
- memset(&qd2[num2], 0, sizeof(struct quest));
- }
-
- }
- else // Add new quests
- {
- mapif_quest_add(char_id, qd1[i]);
-
- WBUFL(buf,count*4) = qd1[i].quest_id;
- count++;
- }
- }
-
- for( i = 0; i < num2; i++ ) // Quests not in qd1 but in qd2 are to be erased.
- mapif_quest_delete(char_id, qd2[i].quest_id);
-
- WFIFOHEAD(fd,8+4*count);
- WFIFOW(fd,0) = 0x3861;
- WFIFOW(fd,2) = 8+4*count;
- WFIFOL(fd,4) = char_id;
- memcpy(WFIFOP(fd,8), buf, count*4);
- WFIFOSET(fd,WFIFOW(fd,2));
-
- return 0;
-}
-
//Delete a quest
int mapif_quest_delete(int char_id, int quest_id)
{
@@ -159,6 +108,57 @@ int mapif_quest_update(int char_id, struct quest qd)
return 1;
}
+//Save quests
+int mapif_parse_quest_save(int fd)
+{
+ int i, j, num2, num1 = (RFIFOW(fd,2)-8)/sizeof(struct quest);
+ int char_id = RFIFOL(fd,4);
+ struct quest qd1[MAX_QUEST_DB],qd2[MAX_QUEST_DB];
+ int buf[MAX_QUEST_DB];
+ int count = 0;
+
+ memset(qd1, 0, sizeof(qd1));
+ memset(qd2, 0, sizeof(qd2));
+ memcpy(&qd1, RFIFOP(fd,8), RFIFOW(fd,2)-8);
+ num2 = mapif_quests_fromsql(char_id, qd2);
+
+ for( i = 0; i < num1; i++ )
+ {
+ ARR_FIND( 0, num2, j, qd1[i].quest_id == qd2[j].quest_id );
+ if( j < num2 ) // Update existed quests
+ { // Only states and counts are changable.
+ if( qd1[i].state != qd2[j].state || qd1[i].count[0] != qd2[j].count[0] || qd1[i].count[1] != qd2[j].count[1] || qd1[i].count[2] != qd2[j].count[2] )
+ mapif_quest_update(char_id, qd1[i]);
+
+ if( j < (--num2) )
+ {
+ memmove(&qd2[j],&qd2[j+1],sizeof(struct quest)*(num2-j));
+ memset(&qd2[num2], 0, sizeof(struct quest));
+ }
+
+ }
+ else // Add new quests
+ {
+ mapif_quest_add(char_id, qd1[i]);
+
+ WBUFL(buf,count*4) = qd1[i].quest_id;
+ count++;
+ }
+ }
+
+ for( i = 0; i < num2; i++ ) // Quests not in qd1 but in qd2 are to be erased.
+ mapif_quest_delete(char_id, qd2[i].quest_id);
+
+ WFIFOHEAD(fd,8+4*count);
+ WFIFOW(fd,0) = 0x3861;
+ WFIFOW(fd,2) = 8+4*count;
+ WFIFOL(fd,4) = char_id;
+ memcpy(WFIFOP(fd,8), buf, count*4);
+ WFIFOSET(fd,WFIFOW(fd,2));
+
+ return 0;
+}
+
//Send questlog to map server
int mapif_parse_quest_load(int fd)
{