summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorPiotr HaƂaczkiewicz <piotr.halaczkiewicz@gmail.com>2013-07-31 05:07:50 -0700
committerPiotr HaƂaczkiewicz <piotr.halaczkiewicz@gmail.com>2013-07-31 05:07:50 -0700
commit871e2f2a56431cf13f193e00b261aae5460bebc1 (patch)
treeaa2c7bd3223471328452b7b7980c0a379a9d4b9f /src/map/clif.c
parent43d95751dcc937a2caddb5b793f5c45666abfee0 (diff)
parente7750ecfff5bf856ecc9f38ea327c6b6cc535761 (diff)
downloadhercules-871e2f2a56431cf13f193e00b261aae5460bebc1.tar.gz
hercules-871e2f2a56431cf13f193e00b261aae5460bebc1.tar.bz2
hercules-871e2f2a56431cf13f193e00b261aae5460bebc1.tar.xz
hercules-871e2f2a56431cf13f193e00b261aae5460bebc1.zip
Merge pull request #71 from HerculesWS/permission-cache-fix
Permission cache overhaul * Reworked group permission caching in session data (follow-up to cd45c30ab2dcc44bfbfac283d15bb09b3d4644bc) * Removed duplicated information from session data in favor of direct pointer to group settings. * Added getters for all group data required to process permissions and related stuff. * Added new functions to PC interface and updated calls everywhere. * Extracted function to set new group for a player (used at login, group config reload, manual adjustment of group). * Moved command permission config parsing to atcommand module. * Improved dummy map session handling. * Since it's required for all map sessions to have a valid group, dummy sessions are now created by a designated function. * Updated related code that uses dummy sessions (console `gm use` and script `atcommand`, `useatcmd`). * Various minor improvements and cleanups. * Eliminated some global variables related to loading atcommand permissions for group by passing them directly to function. * Moved definition of global array holding PC permission names from header file to source file. * Streamlined destuction of atcommands database to use DBApply helper function instead of DBIterator. * Replaced hardcoded position of console dummy session with defines from mapindex.h (thx Haruna for pointing it out). * Removed fixed length restriction on group names.
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index a1e0eedb2..3657d0e43 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2948,7 +2948,7 @@ int clif_hpmeter_sub(struct block_list *bl, va_list ap) {
if( !tsd->fd || tsd == sd )
return 0;
- if( !pc_has_permission(tsd, PC_PERM_VIEW_HPMETER) )
+ if( !pc->has_permission(tsd, PC_PERM_VIEW_HPMETER) )
return 0;
WFIFOHEAD(tsd->fd,packet_len(cmd));
WFIFOW(tsd->fd,0) = cmd;
@@ -3776,7 +3776,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok)
}
void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) {
- if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), iTimer->gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), iTimer->gettick()) > 0 && !pc->has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
clif->colormes(sd->fd,COLOR_RED,msg_txt(1455));
return;
} else {
@@ -4345,7 +4345,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
}
if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || //Party-mate, or hpdisp setting.
(sd->bg_id && sd->bg_id == dstsd->bg_id) || //BattleGround
- pc_has_permission(sd, PC_PERM_VIEW_HPMETER)
+ pc->has_permission(sd, PC_PERM_VIEW_HPMETER)
)
clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp);
@@ -13527,7 +13527,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
{
int x,y,type;
- if( pc_has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE) )
+ if (!pc->has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE))
return;
x = RFIFOW(fd,2);
@@ -14389,7 +14389,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
char charname[NAME_LENGTH];
struct map_session_data* pl_sd;
- if(!pc_has_permission(sd, PC_PERM_USE_CHECK))
+ if(!pc->has_permission(sd, PC_PERM_USE_CHECK))
return;
safestrncpy(charname, (const char*)RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname));
@@ -15411,7 +15411,7 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd)
if (!tsd)
return;
- if( tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT) )
+ if( tsd->status.show_equip || pc->has_permission(sd, PC_PERM_VIEW_EQUIPMENT) )
clif->viewequip_ack(sd, tsd);
else
clif->viewequip_fail(sd);