Created
August 19, 2019 16:48
-
-
Save Helianthella/1dfe5ec9ef65b4734e3a9bc5e3263bc4 to your computer and use it in GitHub Desktop.
gender patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 40dbe9379dca0f0e76e587b885b5da0d210ec825 Mon Sep 17 00:00:00 2001 | |
Subject: [PATCH] add the BeingFlag enum from ManaPlus | |
--- | |
src/Makefile.am | 1 + | |
src/emap/enum/beingflag.h | 21 +++++++++++++++++++++ | |
2 files changed, 22 insertions(+) | |
create mode 100644 src/emap/enum/beingflag.h | |
diff --git a/src/Makefile.am b/src/Makefile.am | |
index d17cc8a..9e766e9 100644 | |
--- a/src/Makefile.am | |
+++ b/src/Makefile.am | |
@@ -113,6 +113,7 @@ MAP_SRC = emap/atcommand.c \ | |
emap/data/session.h \ | |
emap/data/skilld.c \ | |
emap/data/skilld.h \ | |
+ emap/enum/beingflag.h \ | |
emap/enum/esctype.h \ | |
emap/enum/esitype.h \ | |
emap/struct/bgdext.h \ | |
diff --git a/src/emap/enum/beingflag.h b/src/emap/enum/beingflag.h | |
new file mode 100644 | |
index 0000000..9c8d96c | |
--- /dev/null | |
+++ b/src/emap/enum/beingflag.h | |
@@ -0,0 +1,21 @@ | |
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. | |
+// Copyright (c) 2014 - 2019 Evol developers | |
+ | |
+// This is a ManaPlus enum: | |
+// https://gitlab.com/manaplus/manaplus/blob/master/src/being/beingflag.h | |
+ | |
+#ifndef EVOL_MAP_ENUM_BEINGFLAG | |
+#define EVOL_MAP_ENUM_BEINGFLAG | |
+ | |
+typedef enum BeingFlag | |
+{ | |
+ BEINGFLAG_SHOP = 1, | |
+ BEINGFLAG_AWAY = 2, | |
+ BEINGFLAG_INACTIVE = 4, | |
+ BEINGFLAG_GENDER_HIDDEN = 32, | |
+ BEINGFLAG_GM = 64, | |
+ BEINGFLAG_GENDER_MALE = 128, | |
+ BEINGFLAG_SPECIAL = 128 + 64 | |
+} BeingFlag; | |
+ | |
+#endif // EVOL_MAP_ENUM_BEINGFLAG | |
-- | |
2.23.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ac9b5deef41d743a0a2baf5be092979fd42e4319 Mon Sep 17 00:00:00 2001 | |
Subject: [PATCH] remove magic numbers from online list and add support for 3rd | |
gender | |
--- | |
src/emap/map.c | 14 +++++++++----- | |
1 file changed, 9 insertions(+), 5 deletions(-) | |
diff --git a/src/emap/map.c b/src/emap/map.c | |
index 9b38045..ad5033e 100644 | |
--- a/src/emap/map.c | |
+++ b/src/emap/map.c | |
@@ -30,6 +30,7 @@ | |
#include "emap/data/mobd.h" | |
#include "emap/data/npcd.h" | |
#include "emap/data/session.h" | |
+#include "emap/enum/beingflag.h" | |
#include "emap/struct/itemdext.h" | |
#include "emap/struct/mapdext.h" | |
#include "emap/struct/mobdext.h" | |
@@ -144,15 +145,18 @@ void emap_online_list(int fd) | |
continue; | |
uint8 state = data->state; | |
- if (sd->status.sex == 1) | |
- state |= 128; | |
+ | |
+ if (sd->status.sex == SEX_MALE) | |
+ state = (state | BEINGFLAG_GENDER_MALE) & ~BEINGFLAG_GENDER_HIDDEN; | |
+ else if (sd->status.sex == SEX_FEMALE) | |
+ state &= ~(BEINGFLAG_GENDER_MALE | BEINGFLAG_GENDER_HIDDEN); | |
else | |
- state = (state | 128) ^ 128; | |
+ state = (state | BEINGFLAG_GENDER_HIDDEN) & ~BEINGFLAG_GENDER_MALE; | |
if (pc_has_permission(sd, permission_send_gm_flag)) | |
- state |= 64; | |
+ state |= BEINGFLAG_GM; | |
else | |
- state = (state | 64) ^ 64; | |
+ state ^= BEINGFLAG_GM; | |
*ptr = state; | |
ptr ++; | |
-- | |
2.23.0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8e4a77044d62d12b0c1055ee6c16635369341413 Mon Sep 17 00:00:00 2001 | |
Subject: [PATCH] ignore login-defined gender (unused on evol) and treat it as | |
non-binary | |
--- | |
src/echar/char.c | 16 ++++++++++++++++ | |
src/echar/char.h | 2 ++ | |
src/echar/init.c | 3 +++ | |
3 files changed, 21 insertions(+) | |
diff --git a/src/echar/char.c b/src/echar/char.c | |
index c0d80ba..cac3daf 100644 | |
--- a/src/echar/char.c | |
+++ b/src/echar/char.c | |
@@ -346,3 +346,19 @@ void echat_send_login_serverexit(const int code) | |
WFIFOW(chr->login_fd, 2) = code; | |
WFIFOSET(chr->login_fd, 4); | |
} | |
+ | |
+// send non-binary gender to map server | |
+int echar_mmo_gender(const struct char_session_data **sd __attribute__ ((unused)), | |
+ const struct mmo_charstatus **p __attribute__ ((unused)), char *sex) | |
+{ | |
+ hookStop(); | |
+ | |
+ switch (*sex) { | |
+ case 'M': | |
+ return SEX_MALE; | |
+ case 'F': | |
+ return SEX_FEMALE; | |
+ default: | |
+ return 3; // FIXME: this enum has no SEX_OTHER | |
+ } | |
+} | |
diff --git a/src/echar/char.h b/src/echar/char.h | |
index 23a9a4d..9a59a44 100644 | |
--- a/src/echar/char.h | |
+++ b/src/echar/char.h | |
@@ -29,4 +29,6 @@ void echar_parse_map_serverexit(int mapFd); | |
void echat_send_login_serverexit(const int code); | |
+int echar_mmo_gender(const struct char_session_data **, const struct mmo_charstatus **, char *sex); | |
+ | |
#endif // EVOL_CHAR_CHAR | |
diff --git a/src/echar/init.c b/src/echar/init.c | |
index d42542c..1ecf084 100644 | |
--- a/src/echar/init.c | |
+++ b/src/echar/init.c | |
@@ -63,6 +63,9 @@ HPExport void plugin_init (void) | |
addHookPre(chr, parse_char_connect, echar_parse_char_connect_pre); | |
addHookPre(chr, send_HC_ACK_CHARINFO_PER_PAGE_tail, echar_send_HC_ACK_CHARINFO_PER_PAGE_tail_pre); | |
+ // non-binary gender stuff: | |
+ addHookPre(chr, mmo_gender, echar_mmo_gender); | |
+ | |
addHookPost(chr, send_HC_ACK_CHARINFO_PER_PAGE, echar_send_HC_ACK_CHARINFO_PER_PAGE_post); | |
addHookPost(chr, mmo_char_send_characters, echar_mmo_char_send_characters_post); | |
addHookPost(chr, parse_char_connect, echar_parse_char_connect_post); | |
-- | |
2.23.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment