这篇教程C++ ADDMSG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADDMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ ADDMSG函数的具体用法?C++ ADDMSG怎么用?C++ ADDMSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADDMSG函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gm_teleport/** ** GM: TELEPORT <unit> <x> <y> ** requires: permission-key "gmtele" **/static void gm_teleport(const void *tnext, struct unit *u, struct order *ord){ const struct plane *p = rplane(u->region); unit *to = findunit(getid()); int x = rel_to_abs(p, u->faction, getint(), 0); int y = rel_to_abs(p, u->faction, getint(), 1); region *r = findregion(x, y); if (r == NULL || p != rplane(r)) { mistake(u, ord, "region is in another plane."); } else if (to == NULL) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", "")); } else if (rplane(to->region) != rplane(r) && !ucontact(to, u)) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_no_contact", "target", to)); } else { /* checking permissions */ attrib *permissions = a_find(u->faction->attribs, &at_permissions); if (!permissions || !has_permission(permissions, atoi36("gmtele"))) { mistake(u, ord, "permission denied."); } else move_unit(to, r, NULL); }}
开发者ID:UweKopf,项目名称:server,代码行数:29,
示例2: drownvoid drown(region * r){ if (fval(r->terrain, SEA_REGION)) { unit **up = up = &r->units; while (*up) { unit *u = *up; int amphibian_level = 0; if (u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0) { up = &u->next; continue; } if (amphibian_level) { int dead = damage_unit(u, "5d1", false, false); if (dead) { ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_dead", "amount unit region", dead, u, r)); } else { ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_nodead", "unit region", u, r)); } } else if (!(canswim(u) || canfly(u))) { scale_number(u, 0); ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r)); } if (*up == u) up = &u->next; } remove_empty_units_in_region(r); }}
开发者ID:hochl,项目名称:server,代码行数:31,
示例3: age_hurtingstatic int age_hurting(attrib * a){ building *b = (building *) a->data.v; unit *u; int active = 0; if (b == NULL) return AT_AGE_REMOVE; for (u = b->region->units; u; u = u->next) { if (u->building == b) { if (u->faction->magiegebiet == M_DRAIG) { active++; ADDMSG(&b->region->msgs, msg_message("praytoigjarjuk", "unit", u)); } } } if (active) for (u = b->region->units; u; u = u->next) if (playerrace(u->faction->race)) { int i; if (u->faction->magiegebiet != M_DRAIG) { for (i = 0; i != active; ++i) u->hp = (u->hp + 1) / 2; /* make them suffer, but not die */ ADDMSG(&b->region->msgs, msg_message("cryinpain", "unit", u)); } } return AT_AGE_KEEP;}
开发者ID:UweKopf,项目名称:server,代码行数:27,
示例4: volcano_destructionstatic voidvolcano_destruction(region * volcano, region * r, region * rn, const char *damage){ attrib *a; unit **up; int percent = 25, time = 6 + rng_int() % 12; rsettrees(r, 2, 0); rsettrees(r, 1, 0); rsettrees(r, 0, 0); a = a_find(r->attribs, &at_reduceproduction); if (!a) { a = make_reduceproduction(percent, time); } else { /* Produktion vierteln ... */ a->data.sa[0] = (short)percent; /* Für 6-17 Runden */ a->data.sa[1] = (short)(a->data.sa[1] + time); } /* Personen bekommen 4W10 Punkte Schaden. */ for (up = &r->units; *up;) { unit *u = *up; if (u->number) { int dead = damage_unit(u, damage, true, false); if (dead) { ADDMSG(&u->faction->msgs, msg_message("volcano_dead", "unit region dead", u, volcano, dead)); } if (r == volcano && !fval(u->faction, FFL_SELECT)) { fset(u->faction, FFL_SELECT); if (rn) { ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak", "regionv regionn", r, rn)); } else { ADDMSG(&u->faction->msgs, msg_message("volcanooutbreaknn", "region", r)); } } } if (u == *up) up = &u->next; } remove_empty_units_in_region(r);}
开发者ID:hochl,项目名称:server,代码行数:49,
示例5: hungerstatic bool hunger(int number, unit * u){ region *r = u->region; int dead = 0, hpsub = 0; int hp = u->hp / u->number; static const char *damage = 0; static const char *rcdamage = 0; static const race *rc = 0; if (!damage) { damage = get_param(global.parameters, "hunger.damage"); if (damage == NULL) damage = "1d12+12"; } if (rc != u_race(u)) { rcdamage = get_param(u_race(u)->parameters, "hunger.damage"); rc = u_race(u); } while (number--) { int dam = dice_rand(rcdamage ? rcdamage : damage); if (dam >= hp) { ++dead; } else { hpsub += dam; } } if (dead) { /* Gestorbene aus der Einheit nehmen, * Sie bekommen keine Beerdingung. */ ADDMSG(&u->faction->msgs, msg_message("starvation", "unit region dead live", u, r, dead, u->number - dead)); scale_number(u, u->number - dead); deathcounts(r, dead); } if (hpsub > 0) { /* Jetzt die Sch C++ ADDR函数代码示例 C++ ADD函数代码示例
|