summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/int_rodex.c20
-rw-r--r--src/common/HPMDataCheck.h2
-rw-r--r--src/common/HPMSymbols.inc.h2
-rw-r--r--src/common/nullpo.h9
-rw-r--r--src/map/intif.c22
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.sources.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.Hooks.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.sources.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.sources.inc2
18 files changed, 45 insertions, 36 deletions
diff --git a/src/char/int_rodex.c b/src/char/int_rodex.c
index f5d036991..b7314e726 100644
--- a/src/char/int_rodex.c
+++ b/src/char/int_rodex.c
@@ -346,27 +346,28 @@ int64 inter_rodex_savemessage(struct rodex_message* msg)
*------------------------------------------*/
void mapif_rodex_sendinbox(int fd, int char_id, int8 opentype, int8 flag, int count, struct rodex_maillist *mails)
{
- int per_packet = (UINT16_MAX - 15) / sizeof(struct rodex_message);
+ int per_packet = (UINT16_MAX - 16) / sizeof(struct rodex_message);
int sent = 0;
+ bool is_first = true;
nullpo_retv(mails);
Assert_retv(char_id > 0);
Assert_retv(count >= 0);
do {
- int i = 15, j, size, limit;
+ int i = 16, j, size, limit;
+ int to_send = count - sent;
bool is_last = true;
- if (count <= per_packet) {
- size = count * sizeof(struct rodex_message) + 15;
- limit = count;
+ if (to_send <= per_packet) {
+ size = to_send * sizeof(struct rodex_message) + 16;
+ limit = to_send;
is_last = true;
} else {
- int to_send = count - sent;
limit = min(to_send, per_packet);
if (limit != to_send) {
is_last = false;
}
- size = limit * sizeof(struct rodex_message) + 15;
+ size = limit * sizeof(struct rodex_message) + 16;
}
WFIFOHEAD(fd, size);
@@ -376,11 +377,14 @@ void mapif_rodex_sendinbox(int fd, int char_id, int8 opentype, int8 flag, int co
WFIFOB(fd, 8) = opentype;
WFIFOB(fd, 9) = flag;
WFIFOB(fd, 10) = is_last;
- WFIFOL(fd, 11) = count;
+ WFIFOB(fd, 11) = is_first;
+ WFIFOL(fd, 12) = limit;
for (j = 0; j < limit; ++j, ++sent, i += sizeof(struct rodex_message)) {
memcpy(WFIFOP(fd, i), &VECTOR_INDEX(*mails, sent), sizeof(struct rodex_message));
}
WFIFOSET(fd, size);
+
+ is_first = false;
} while (sent < count);
}
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index a8524bdda..6f241bcd6 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2014-2017 Hercules Dev Team
+ * Copyright (C) 2014-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 5ee8a014b..58540ee36 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index 28d058dc0..ae0c82364 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -23,15 +23,10 @@
#include "common/hercules.h"
-// enabled by default on debug builds
-#if defined(DEBUG) && !defined(NULLPO_CHECK)
+// if need disable nullpo checks this line can be commented
#define NULLPO_CHECK
-#endif
-
-// Skip assert checks on release builds
-#if !defined(RELEASE) && !defined(ASSERT_CHECK)
+// if need disable asserts checks this line can be commented
#define ASSERT_CHECK
-#endif
/** Assert */
diff --git a/src/map/intif.c b/src/map/intif.c
index 60edc8d8b..be6b75d96 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -2438,7 +2438,8 @@ void intif_parse_RequestRodexOpenInbox(int fd)
#endif
int8 flag = RFIFOB(fd, 9);
int8 is_end = RFIFOB(fd, 10);
- int count = RFIFOL(fd, 11);
+ int is_first = RFIFOB(fd, 11);
+ int count = RFIFOL(fd, 12);
int i, j;
sd = map->charid2sd(RFIFOL(fd, 4));
@@ -2446,16 +2447,25 @@ void intif_parse_RequestRodexOpenInbox(int fd)
if (sd == NULL) // user is not online anymore
return;
- sd->rodex.total = count;
- if (RFIFOW(fd, 2) - 15 != sd->rodex.total * sizeof(struct rodex_message)) {
- ShowError("intif_parse_RodexInboxOpenReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd, 2) - 15, sd->rodex.total * sizeof(struct rodex_message));
+ if (is_first == false && sd->rodex.total == 0) {
+ ShowError("intif_parse_RodexInboxOpenReceived: mail list received in wrong order.\n");
return;
}
- if (flag == 0)
+ if (is_first)
+ sd->rodex.total = count;
+ else
+ sd->rodex.total += count;
+
+ if (RFIFOW(fd, 2) - 16 != count * sizeof(struct rodex_message)) {
+ ShowError("intif_parse_RodexInboxOpenReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd, 2) - 16, count * sizeof(struct rodex_message));
+ return;
+ }
+
+ if (flag == 0 && is_first)
VECTOR_CLEAR(sd->rodex.messages);
- for (i = 0, j = 15; i < count; ++i, j += sizeof(struct rodex_message)) {
+ for (i = 0, j = 16; i < count; ++i, j += sizeof(struct rodex_message)) {
struct rodex_message msg = { 0 };
VECTOR_ENSURE(sd->rodex.messages, 1, 1);
memcpy(&msg, RFIFOP(fd, j), sizeof(struct rodex_message));
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 6586d87af..1f51af1aa 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index 3eeb7fd91..d7e6f524d 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
index bbd484fe1..14dc89804 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
index a372f83b3..1836bf6ba 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
index b5e9afc08..8b2f1b071 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
index 0cbce8b7d..f8c270de3 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
index a6a907806..8cec39974 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
index 6071c472b..658ee874d 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
index 8c3b935ac..55ced3025 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index c30654d6d..7a482a669 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 0e4fa7cc3..3ba6a3f5b 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index b096466df..3b1281dad 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
index ada63e53d..23f762151 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2017 Hercules Dev Team
+ * Copyright (C) 2013-2018 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by