summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c9
-rw-r--r--src/map/pc_groups.c13
-rw-r--r--src/map/pc_groups.h1
3 files changed, 19 insertions, 4 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 835248918..15443640e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -10095,14 +10095,15 @@ void atcommand_db_load_groups(void) {
cmd->at_groups = aMalloc( pc_group_max * sizeof(char) );
cmd->char_groups = aMalloc( pc_group_max * sizeof(char) );
for(i = 0; i < pc_group_max; i++) {
+ int idx = pc_group_id2idx(atcommand->group_ids[i]);
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_ATCOMMAND ) )
- cmd->at_groups[i] = 1;
+ cmd->at_groups[idx] = 1;
else
- cmd->at_groups[i] = 0;
+ cmd->at_groups[idx] = 0;
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_CHARCOMMAND ) )
- cmd->char_groups[i] = 1;
+ cmd->char_groups[idx] = 1;
else
- cmd->char_groups[i] = 0;
+ cmd->char_groups[idx] = 0;
}
}
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 1a83c8b63..f1f69f7cb 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -414,6 +414,19 @@ int pc_group_id2level(int group_id)
return 0;
return group->level;
}
+/**
+ * Group ID -> group level lookup.
+ * @param group id
+ * @return group index
+ * @public
+ */
+int pc_group_id2idx(int group_id)
+{
+ GroupSettings *group = id2group(group_id);
+ if (group == NULL)
+ return 0;
+ return group->group_pos;
+}
/**
* Initialize PC Groups: allocate DBMaps and read config.
diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h
index 26cd8f39f..0ce7b0d51 100644
--- a/src/map/pc_groups.h
+++ b/src/map/pc_groups.h
@@ -15,6 +15,7 @@ bool pc_group_has_permission(int group_id, int permission);
bool pc_group_should_log_commands(int group_id);
const char* pc_group_id2name(int group_id);
int pc_group_id2level(int group_id);
+int pc_group_id2idx(int group_id);
void pc_group_pc_load(struct map_session_data *);
void do_init_pc_groups(void);