summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-21 11:21:53 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-21 11:22:28 +0300
commita2db08ca3b8fa2392ef5d88d66303b64d6a41ec4 (patch)
tree6d5cf6cc954fae3dc3c66f0f775dfd63f3e7dd79 /src
parentb69fb47e606ff06ada9b530ae46a76abbb374fe6 (diff)
downloadevol-hercules-a2db08ca3b8fa2392ef5d88d66303b64d6a41ec4.tar.gz
evol-hercules-a2db08ca3b8fa2392ef5d88d66303b64d6a41ec4.tar.bz2
evol-hercules-a2db08ca3b8fa2392ef5d88d66303b64d6a41ec4.tar.xz
evol-hercules-a2db08ca3b8fa2392ef5d88d66303b64d6a41ec4.zip
map: translate also npc names.
Also disable strict aliasing warnings in plugin.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/map/clif.c43
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/init.c1
4 files changed, 44 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b73454d..e036427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,7 +63,7 @@ libevol_login_la_LDFLAGS = ${SHARED_LDFLAGS}
libevol_login_la_CFLAGS = ${SHARED_CFLAGS}
libevol_map_la_SOURCES = ${MAP_SRC}
libevol_map_la_LDFLAGS = ${SHARED_LDFLAGS}
-libevol_map_la_CFLAGS = ${SHARED_CFLAGS}
+libevol_map_la_CFLAGS = ${SHARED_CFLAGS} -Wno-strict-aliasing
all-local: libevol_char.la libevol_login.la libevol_map.la
@cp .libs/*.so ../../../../plugins || cp .libs/*.so ../../../plugins || cp .libs/*.so ../../../server-code/plugins || cp .libs/*.so ../../server-code/plugins
diff --git a/src/map/clif.c b/src/map/clif.c
index ed83b52..66a7312 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10,10 +10,13 @@
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
+#include "../../../common/cbasetypes.h"
+#include "../../../map/npc.h"
#include "../../../map/pc.h"
#include "../../../map/quest.h"
#include "map/clif.h"
+#include "map/lang.h"
void eclif_quest_send_list(struct map_session_data *sd)
{
@@ -44,8 +47,6 @@ void eclif_quest_add(struct map_session_data *sd, struct quest *qd)
{
hookStop();
int fd = sd->fd;
- int i;
- struct mob_db *monster;
struct quest_db *qi = quest->db(qd->quest_id);
WFIFOHEAD(fd, packet_len(0x2b3));
@@ -58,3 +59,41 @@ void eclif_quest_add(struct map_session_data *sd, struct quest *qd)
WFIFOSET(fd, 107);
}
+
+void eclif_charnameack(int *fdPtr, struct block_list *bl)
+{
+ if (!bl)
+ {
+ hookStop();
+ return;
+ }
+ if (bl->type == BL_NPC)
+ {
+ hookStop();
+ int fd = *fdPtr;
+ struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data;
+ const char *tr = lang_pctrans(((TBL_NPC*)bl)->name, sd);
+ const int len = 8 + strlen(tr) + 1;
+ // if no recipient specified just update nearby clients
+ if (fd == 0)
+ {
+ char *buf;
+ CREATE(buf, char, len);
+ WBUFW(buf, 0) = 0xB01;
+ WBUFW(buf, 2) = len;
+ WBUFL(buf, 4) = bl->id;
+ memcpy(WBUFP(buf, 8), tr, len);
+ clif->send(buf, len, bl, AREA);
+ aFree(buf);
+ }
+ else
+ {
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = 0xB01;
+ WFIFOW(fd, 2) = len;
+ WFIFOL(fd, 4) = bl->id;
+ memcpy(WFIFOP(fd, 8), tr, len);
+ WFIFOSET(fd, len);
+ }
+ }
+}
diff --git a/src/map/clif.h b/src/map/clif.h
index 6f11c5d..5ad3a7b 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -6,5 +6,6 @@
void eclif_quest_send_list(struct map_session_data *sd);
void eclif_quest_add(struct map_session_data *sd, struct quest *qd);
+void eclif_charnameack(int *fdPtr, struct block_list *bl);
#endif // EVOL_MAP_CLIF
diff --git a/src/map/init.c b/src/map/init.c
index 502e5b3..4e945d7 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -87,6 +87,7 @@ HPExport void plugin_init (void)
addHookPre("npc->checknear", enpc_checknear);
addHookPre("clif->quest_send_list", eclif_quest_send_list);
addHookPre("clif->quest_add", eclif_quest_add);
+ addHookPre("clif->charnameack", eclif_charnameack);
langScriptId = script->add_str("Lang");
}