/** * Create and initialize a new server * The default number of channels if 4, * the default number of players is 8. * * @return the new server */ struct server *new_server() { struct server *serv; serv = (struct server *)calloc(1, sizeof(struct server)); if (serv == NULL) { printf("(WW) new_server, calloc failed : %s.\n", strerror(errno)); return NULL; } serv->chans = ar_new(4); serv->players = ar_new(8); serv->bans = ar_new(4); serv->regs = ar_new(8); serv->stats = new_sstat(); serv->privileges = new_sp(); get_machine_name(serv); return serv; }
/** * Generate a test server privilege structure * * @return the structure */ struct server_privileges *new_sp_test() { struct server_privileges *sp; sp = new_sp(); /* administration */ sp->priv[PRIV_SERVER_ADMIN][SP_ADM_REGISTER_PLAYER] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_ADM_STOP_SERVER] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_ADM_START_SERVER] = 1; /* channel permissions */ sp->priv[PRIV_SERVER_ADMIN][SP_CHA_JOIN_WO_PASS] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_CHA_CHANGE_CODEC] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_CHA_CHANGE_MAXUSERS] = 1; /* player privileges */ sp->priv[PRIV_SERVER_ADMIN][SP_PL_GRANT_OP] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_PL_GRANT_AUTOOP] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_PL_GRANT_SA] = 1; /* other */ sp->priv[PRIV_SERVER_ADMIN][SP_OTHER_TEXT_ALL] = 1; sp->priv[PRIV_SERVER_ADMIN][SP_OTHER_SV_KICK] = 1; return sp; }
bool add_shell(spherical_shell_id_pair const& sp) { spherical_shell_id_pair new_sp(sp); new_sp.second.did() = base_type::id(); return shells_.insert(new_sp).second; }