bool cast_spell(ang_spell spell) { bool b; variant res; var_init(&res); spell(SPELL_CAST, &res); b = var_get_bool(&res); var_clear(&res); return b; }
static void open_autoconnect() { char **hubs = db_vars_hubs(); char **hub; // TODO: make sure the tabs are opened in the same order as they were in the last run? for(hub=hubs; *hub; hub++) if(var_get_bool(db_vars_hubid(*hub), VAR_autoconnect)) ui_tab_open(uit_hub_create(*hub+1, TRUE), FALSE, NULL); listen_refresh(); g_strfreev(hubs); }
static bool _describe_spell(spell_info *spell, int col_height) { bool result = TRUE; variant info; var_init(&info); (spell->fn)(SPELL_ON_BROWSE, &info); if (!var_get_bool(&info)) { char tmp[62*5]; int i, line; rect_t display = ui_menu_rect(); /* 2 lines below list of spells, 5 lines for description */ for (i = 0; i < 7; i++) Term_erase(display.x, display.y + col_height + i + 2, display.cx); /* Get the description, and line break it (max 5 lines) */ (spell->fn)(SPELL_DESC, &info); roff_to_buf(var_get_string(&info), 62, tmp, sizeof(tmp)); line = display.y + col_height + 3; for(i = 0; tmp[i]; i += 1+strlen(&tmp[i])) { put_str(&tmp[i], line, display.x + 2); line++; } (spell->fn)(SPELL_INFO, &info); put_str(format("%^s", var_get_string(&info)), line, display.x + 2); result = FALSE; } var_clear(&info); return result; }
static void wiki_handle_save() { char * user; char * name; char * title; char * text; char * userid; /* user's shortname */ char * password; /* users password */ char * group; /* name of a group page */ char * type; /* type of a group page */ char * topic; /* topic of a page */ int seqno; bool saved; bool priv; bool hidden; if (!user_is_authenticated()) { html_login_page(); return; } if (!wiki_check_method(HTTP_POST)) return; /* If page was submitted, then try to save it */ name = var_get_val(server->variables, "page"); if (name == NULL) { out_write_error("406", /* not acceptable */ "There is no page name in the POST data!", "How can you save a not named page?"); return; } if (!is_wikiword(name)) { out_write_error("406", /* not acceptable */ "This is no valid page title!", "The page title must be a WikiWord!"); return; } /* if the text was empty, then delete the page */ text = var_get_val(server->variables, "text"); if (text == NULL || strlen(text) == 0) { if (page_del(pagelist_find_page(name))) { out_write_page("DeletePage", MODE_HTML); } return; } user = user_get_logname(); title = var_get_val(server->variables, "title"); group = var_get_val(server->variables, "group"); type = var_get_val(server->variables, "pagetype"); topic = var_get_val(server->variables, "topic"); password = var_get_val(server->variables, "password"); userid = var_get_val(server->variables, "userid"); seqno = var_get_int(server->variables, "seqno"); priv = var_get_bool(server->variables, "private"); hidden = var_get_bool(server->variables, "hidden"); /* now really change the page, given all the data */ saved = page_edit(name, title, text, topic, user, userid, password, group, type, seqno, priv, hidden); if (saved) out_write_page(name, MODE_HTML); else out_write_error("500", /* internal error */ "Could not save the page!", "Maybe, somebody other has changed it in the meantime?"); }