void tt_process_status_effects(void) { struct msr_monster *monster = NULL; if (gbl_game->running == false) return; while ( (monster = msrlst_get_next_monster(monster) ) != NULL) { if (monster->dead == false) { if (se_list_size(monster->status_effects) > 0 ) { se_process(monster); } } } }
static inline int se_recoverbackup(se *i, sr *r) { if (i->conf->path_backup == NULL) return 0; int rc; int exists = sr_fileexists(i->conf->path_backup); if (! exists) { rc = sr_filemkdir(i->conf->path_backup); if (srunlikely(rc == -1)) { sr_error(r->e, "backup directory '%s' create error: %s", i->conf->path_backup, strerror(errno)); return -1; } } /* recover backup sequential number */ DIR *dir = opendir(i->conf->path_backup); if (srunlikely(dir == NULL)) { sr_error(r->e, "backup directory '%s' open error: %s", i->conf->path_backup, strerror(errno)); return -1; } uint32_t bsn = 0; struct dirent *de; while ((de = readdir(dir))) { if (srunlikely(de->d_name[0] == '.')) continue; uint32_t id = 0; rc = se_process(de->d_name, &id); switch (rc) { case 1: case 0: if (id > bsn) bsn = id; break; case -1: /* skip unknown file */ continue; } } closedir(dir); r->seq->bsn = bsn; return 0; }