summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2015-05-31 12:10:53 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2015-05-31 12:10:53 +0800
commit893e29db87053b1668878dd3c96cf312fb7ef93c (patch)
treeaffc1dffe355f2e3179a73e123b323d34469cfd5 /src
parenta5a86059b8e70420f0a78d6a377b5702cdfe6792 (diff)
parentbba4ce885b0667f92e0b3f2a26759059317a4c3d (diff)
downloadhercules-893e29db87053b1668878dd3c96cf312fb7ef93c.tar.gz
hercules-893e29db87053b1668878dd3c96cf312fb7ef93c.tar.bz2
hercules-893e29db87053b1668878dd3c96cf312fb7ef93c.tar.xz
hercules-893e29db87053b1668878dd3c96cf312fb7ef93c.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'src')
-rw-r--r--src/common/nullpo.c17
-rw-r--r--src/map/clif.c37
2 files changed, 42 insertions, 12 deletions
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index e61d52257..97b206835 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -8,7 +8,11 @@
#include <stdio.h>
#include <stdarg.h>
+#include <stdlib.h>
#include <string.h>
+#ifdef __GNUC__
+#include <execinfo.h>
+#endif
#include "../common/showmsg.h"
@@ -24,6 +28,12 @@ struct nullpo_interface nullpo_s;
* @param title Message title to display (i.e. failed assertion or nullpo info)
*/
void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) {
+#ifdef __GNUC__
+ void *array[10];
+ int size;
+ char **strings;
+ int i;
+#endif
if (file == NULL)
file = "??";
@@ -32,6 +42,13 @@ void assert_report(const char *file, int line, const char *func, const char *tar
ShowError("--- %s --------------------------------------------\n", title);
ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func);
+#ifdef __GNUC__
+ size = backtrace (array, 10);
+ strings = backtrace_symbols (array, size);
+ for (i = 0; i < size; i++)
+ ShowError("%s\n", strings[i]);
+ free (strings);
+#endif
ShowError("--- end %s ----------------------------------------\n", title);
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 1e3a3c27d..16bb6172c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4628,26 +4628,33 @@ void clif_skillinfoblock(struct map_session_data *sd)
/// 0111 <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradable>.B
void clif_addskill(struct map_session_data *sd, int id)
{
- int fd, idx = skill->get_index(id);
+ int fd, skill_lv, idx = skill->get_index(id);
nullpo_retv(sd);
fd = sd->fd;
if (!fd) return;
- if( sd->status.skill[idx].id <= 0 )
+ if (sd->status.skill[idx].id <= 0)
return;
+ skill_lv = sd->status.skill[idx].lv;
+
WFIFOHEAD(fd, packet_len(0x111));
WFIFOW(fd,0) = 0x111;
WFIFOW(fd,2) = id;
WFIFOL(fd,4) = skill->get_inf(id);
- WFIFOW(fd,8) = sd->status.skill[idx].lv;
- WFIFOW(fd,10) = skill->get_sp(id,sd->status.skill[idx].lv);
- WFIFOW(fd,12)= skill->get_range2(&sd->bl, id,sd->status.skill[idx].lv);
+ WFIFOW(fd,8) = skill_lv;
+ if (skill_lv > 0) {
+ WFIFOW(fd,10) = skill->get_sp(id, skill_lv);
+ WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv);
+ } else {
+ WFIFOW(fd,10) = 0;
+ WFIFOW(fd,12) = 0;
+ }
safestrncpy((char*)WFIFOP(fd,14), skill->get_name(id), NAME_LENGTH);
- if( sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT )
- WFIFOB(fd,38) = (sd->status.skill[idx].lv < skill->tree_get_max(id, sd->status.class_))? 1:0;
+ if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT)
+ WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0;
else
WFIFOB(fd,38) = 0;
WFIFOSET(fd,packet_len(0x111));
@@ -4707,16 +4714,22 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf)
{
const int fd = sd->fd;
int idx = skill->get_index(skill_id);
+ int skill_lv = sd->status.skill[idx].lv;
WFIFOHEAD(fd,packet_len(0x7e1));
WFIFOW(fd,0) = 0x7e1;
WFIFOW(fd,2) = skill_id;
WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id);
- WFIFOW(fd,8) = sd->status.skill[idx].lv;
- WFIFOW(fd,10) = skill->get_sp(skill_id,sd->status.skill[idx].lv);
- WFIFOW(fd,12) = skill->get_range2(&sd->bl,skill_id,sd->status.skill[idx].lv);
- if( sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT )
- WFIFOB(fd,14) = (sd->status.skill[idx].lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0;
+ WFIFOW(fd,8) = skill_lv;
+ if (skill_lv > 0) {
+ WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv);
+ WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv);
+ } else {
+ WFIFOW(fd,10) = 0;
+ WFIFOW(fd,12) = 0;
+ }
+ if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT)
+ WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0;
else
WFIFOB(fd,14) = 0;
WFIFOSET(fd,packet_len(0x7e1));