diff options
author | Haru <haru@dotalux.com> | 2016-12-02 16:00:08 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-12-03 15:38:56 +0100 |
commit | 76801cdf48a979728034cb81b81c989f7f655f5a (patch) | |
tree | 0c7ab7e9170515c982399df7eda3bd2577521a06 /src/map/clif.c | |
parent | cfa4ae95efca5557d085c56815259f47e6f380fb (diff) | |
download | hercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.gz hercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.bz2 hercules-76801cdf48a979728034cb81b81c989f7f655f5a.tar.xz hercules-76801cdf48a979728034cb81b81c989f7f655f5a.zip |
Clarify some Job Class vs MapID confusion (2/2)
This commit ensures that `sd->job` and related variables only contain
MapIDs (i.e. the serverside optimized values, where High Novice is
MAPID_NOVICE | JOBL_UPPER) and are never checked against the
client-based Job Class values.
As a rule of thumb, from now on, when a variable is named `job` or
`jobid`, it is intended to contain a MapID and not a Job Class ID. The
type of such variable shall be an unsigned `uint16` or `uint32`.
To ensure that related third party code is also verified when this
commit is merged, the variable `struct map_session_data::class_ (i.e.
`sd->class_`) is renamed to `job`.
Some issues in related lines are also fixed, including:
- The atcommand `@mount` would not check properly that the requesting
character is a 2nd class Swordsman type.
- `pc->addfame()` would silently accept invalid MapIDs, sending unknown
values to the client (more on this in a subsequent commit).
- `pc->famerank()` would not use the passed job as a bitmask, causing
the caller to have to mask it beforehand (more on this in a
subsequent commit).
- The Soul Linker check in TK_JUMPKICK wasn't future-proof (no harm
caused currently).
- Gunslingers would be able to be targeted by Spiritual Bestowment
(`MO_KITRANSLATION`) and Spiritual Sphere Absorption
(`MO_ABSORBSPIRITS`) due to a faulty check introduced when the
Rebellion class was implemented (causing unintended interaction with
Coins).
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index f29a1357e..0b8f6c2ee 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13824,7 +13824,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) { if (sd->state.doridori) return; - switch (sd->class_&MAPID_UPPERMASK) { + switch (sd->job & MAPID_UPPERMASK) { case MAPID_SOUL_LINKER: case MAPID_STAR_GLADIATOR: case MAPID_TAEKWON: @@ -13852,7 +13852,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /* game client is currently broken on this (not sure the packetver range) */ /* it sends the request when the criteria doesn't match (and of course we let it fail) */ /* so restoring the old parse_globalmes method. */ - if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { unsigned int next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if( next ) { @@ -14226,7 +14226,7 @@ void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) nullpo_retv(sd); fd = sd->fd; - upperMask = sd->class_&MAPID_UPPERMASK; + upperMask = sd->job & MAPID_UPPERMASK; WFIFOHEAD(fd, len); WFIFOW(fd, 0) = 0x97d; WFIFOW(fd, 2) = type; |