/* * Wizard moves a user to another room */ void move(UR_OBJECT user) { UR_OBJECT u; RM_OBJECT rm; const char *name; if (word_count < 2) { write_user(user, "Usage: move <user> [<room>]\n"); return; } u = get_user_name(user, word[1]); if (!u) { write_user(user, notloggedon); return; } if (u->login) { write_user(user, "That user is not logged in.\n"); return; } if (word_count < 3) { rm = user->room; } else { rm = get_room(word[2]); if (!rm) { write_user(user, nosuchroom); return; } } if (user == u) { write_user(user, "Trying to move yourself this way is the fourth sign of madness.\n"); return; } if (u->level >= user->level) { write_user(user, "You cannot move a user of equal or higher level than yourself.\n"); return; } if (rm == u->room) { vwrite_user(user, "%s~RS is already in the %s.\n", u->recap, rm->name); return; }; if (!has_room_access(user, rm)) { vwrite_user(user, "The %s is currently private, %s~RS cannot be moved there.\n", rm->name, u->recap); return; } write_user(user, "~FC~OLYou chant an ancient spell...\n"); name = user->vis ? user->recap : invisname; if (!user->vis) { write_monitor(user, user->room, 0); } vwrite_room_except(user->room, user, "%s~RS ~FC~OLchants an ancient spell...\n", name); move_user(u, rm, 2); prompt(u); }
/*** Write text figlets & intros ***/ void write_text_figlet(UR_OBJECT user, UR_OBJECT u, RM_OBJECT rm, char *fig_text, char *name, char *font) { char fig1[ARR_SIZE]; char fig2[ARR_SIZE]; set_crash(); if (strcmp(font,"standard")) sprintf(fig1,"~FRBanner od ~OL%s~RS~FR (%s font): ~RS%s\n", name, font, fig_text); else sprintf(fig1,"~FRBanner od ~OL%s~RS~FR: ~RS%s\n", name, fig_text); sprintf(fig2,"~FRBanner od ~OL%s~RS~FR:\n",name); if (rm) { if (!user->vis) write_monitor(user, rm, 0); write_room(rm, fig2); record(rm, fig1); return; } if (u) { if (u==user) return; if (u->afk) record_afk(u, fig1); else if (u->editing) record_edit(u, fig1); record_tell(u, fig1); sprintf(u->ltell, user->name); if (strcmp(font,"standard")) sprintf(text, "~FRBanner pre ~OL%s~RS~FR (%s font): ~RS%s\n", u->name, font, fig_text ); else sprintf(text, "~FRBanner pre ~OL%s~RS~FR: ~RS%s\n", u->name, fig_text ); write_user(user, text); record_tell(user, text); if (u->afk || u->editing) return; write_user(u, fig2); return; } for (rm=room_first; rm!=NULL; rm=rm->next) record(rm, fig1); if (!user->vis) write_monitor(user, NULL, 0); write_room_except(NULL, fig2, user); write_user(user, fig2); }
void check_periodical() { if(!execute_periodical) return; execute_periodical=0; manage_temperatures(); if(--counter_250ms==0) { if(manage_monitor<=1+NUM_EXTRUDER) write_monitor(); counter_250ms=5; } UI_SLOW; }
int main (int argc, char **argv) { srand(time(NULL)); MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_my_rank); Formura_Init(&navi, MPI_COMM_WORLD); if (argc <= 1) { T_MAX=100; }else{ sscanf(argv[1], "%d", &T_MAX); } if (argc <= 2) { T_MONITOR=100; }else{ sscanf(argv[2], "%d", &T_MONITOR); } init(); double t_begin, t_end; for(;;){ double t = wctime(); if(navi.time_step % T_MONITOR == 0 || navi.time_step <= 3 * T_MONITOR ) { printf("%d step @ %lf sec\n", navi.time_step, t-t_begin); } if(navi.time_step % T_MONITOR == 0) { write_monitor(); } if (navi.time_step >= T_MAX) break; if (navi.time_step == 0) { t_begin = wctime(); start_collection("main"); } Formura_Forward(&navi); // navi.time_step increases if (navi.time_step >= T_MAX) { t_end = wctime(); stop_collection("main"); } } printf("wct = %lf sec\n",t_end - t_begin); MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); }
/* * put speech in a music notes */ void sing_it(UR_OBJECT user, char *inpstr) { #if !!0 static const char usage[] = "Usage: sing [<text>]\n"; #endif const char *name; /* FIXME: Use sentinel other JAILED */ if (user->muzzled != JAILED) { write_user(user, "You are muzzled, you cannot sing.\n"); return; } switch (amsys->ban_swearing) { case SBMAX: if (contains_swearing(inpstr)) { write_user(user, noswearing); return; } break; case SBMIN: if (!is_private_room(user->room)) { inpstr = censor_swear_words(inpstr); } break; case SBOFF: default: /* do nothing as ban_swearing is off */ break; } if (!user->vis) { write_monitor(user, user->room, 0); } name = user->vis ? user->recap : invisname; if (word_count < 2) { sprintf(text, "%s~RS sings a tune...BADLY!\n", name); } else { sprintf(text, "%s~RS sings o/~ %s~RS o/~\n", name, inpstr); } record(user->room, text); write_room(user->room, text); }
/* * Allows a user to alter the minimum level which can use the command given */ void set_command_level(UR_OBJECT user) { CMD_OBJECT cmd; size_t len; enum lvl_value lvl; if (word_count < 3) { write_user(user, "Usage: setcmdlev <command name> <level>|norm\n"); return; } /* FIXME: command search order is different than command_table/exec_com() * because it uses the alpha sorted command list instead! */ len = strlen(word[1]); for (cmd = first_command; cmd; cmd = cmd->next) { if (!strncmp(word[1], cmd->name, len)) { break; } } if (!cmd) { vwrite_user(user, "The command \"~OL%s~RS\" could not be found.\n", word[1]); return; } /* levels and "norm" are checked in upper case */ strtoupper(word[2]); if (!strcmp(word[2], "NORM")) { /* FIXME: Permissions are weak setting level via "norm" */ if (cmd->level == (enum lvl_value) command_table[cmd->id].level) { write_user(user, "That command is already at its normal level.\n"); return; } cmd->level = (enum lvl_value) command_table[cmd->id].level; write_syslog(SYSLOG, 1, "%s has returned level to normal for cmd \"%s\"\n", user->name, cmd->name); write_monitor(user, NULL, 0); vwrite_room(NULL, "~OL~FR--==<~RS The level for command ~OL%s~RS has been returned to %s ~OL~FR>==--\n", cmd->name, user_level[cmd->level].name); return; } lvl = get_level(word[2]); if (lvl == NUM_LEVELS) { write_user(user, "Usage: setcmdlev <command> <level>|norm\n"); return; } if (lvl > user->level) { write_user(user, "You cannot set a command level to one greater than your own.\n"); return; } if (user->level < (enum lvl_value) command_table[cmd->id].level) { write_user(user, "You are not a high enough level to alter that command level.\n"); return; } cmd->level = lvl; write_syslog(SYSLOG, 1, "%s has set the level for cmd \"%s\" to %d (%s)\n", user->name, cmd->name, cmd->level, user_level[cmd->level].name); write_monitor(user, NULL, 0); vwrite_room(NULL, "~OL~FR--==<~RS The level for command ~OL%s~RS has been set to %s ~OL~FR>==--\n", cmd->name, user_level[cmd->level].name); }