summaryrefslogtreecommitdiff
path: root/src/map/skill.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/skill.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/skill.c')
-rw-r--r--src/map/skill.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 42ab6450f..97f26cca6 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -485,7 +485,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
if (idx == 0)
return 1; // invalid skill id
- if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
+ if (pc->has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
return 0; // can do any damn thing they want
if( skill_id == AL_TELEPORT && sd->skillitem == skill_id && sd->skillitemlv > 2 )
@@ -12235,7 +12235,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16
int i;
bool is_chorus = ( skill->get_inf2(skill_id)&INF2_CHORUS_SKILL );
- if (!battle_config.player_skill_partner_check || pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
+ if (!battle_config.player_skill_partner_check || pc->has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
return is_chorus ? MAX_PARTY : 99; //As if there were infinite partners.
if (cast_flag) { //Execute the skill on the partners.
@@ -12332,7 +12332,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
if (sd->chatID) return 0;
- if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id )
+ if( pc->has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id )
{ //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex]
sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check.
sd->spiritball_old = sd->spiritball; //Need to do Spiritball check.
@@ -13217,7 +13217,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
if( sd->chatID )
return 0;
- if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) {
+ if( pc->has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) {
//GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex]
sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check.
sd->spiritball_old = sd->spiritball; //Need to do Spiritball check.