const char *subshort(const MudObject *what) { const char *s = what->get("subname"); if (s) return s; return what->get("short"); } void describe_liquid_to(MudObject *player, const MudObject *what) { int amt = what->array_get_int("$fillamt", 0); int vol = what->get_int("volume", 0); MudObject *stuff = what->array_get_object("$fill", 0); if (!stuff) { player->printf("I can't identify what stuff is in there. A bug.\n"); return; } if (!amt) { player->printf("%#Y %[is/are] empty.\n", what); return; } if (amt==vol) { player->printf("%#Y %[is/are] full of ^o%s^n.\n", what, subshort(stuff)); return; } int prop = (amt * 10) / vol; switch (prop) { case 0: player->printf("%#Y %[contains/contain] a few drops of ^o%s^n.\n", what, subshort(stuff)); break; case 1: player->printf("%#Y %[contains/contain] a bit of ^o%s^n.\n", what, subshort(stuff)); break; case 2: player->printf("%#Y %[is/are] under half-full of ^o%s^n.\n", what, subshort(stuff)); break; case 3: player->printf("%#Y %[is/are] nearly half-full of ^o%s^n.\n", what, subshort(stuff)); break; case 4: case 5: case 6: player->printf("%#Y %[is/are] about half-full of ^o%s^n.\n", what, subshort(stuff)); break; case 7: player->printf("%#Y %[is/are] just over half-full of ^o%s^n.\n", what, subshort(stuff)); break; case 8: player->printf("%#Y %[is/are] over half-full of ^o%s^n.\n", what, subshort(stuff)); break; case 9: player->printf("%#Y %[is/are] almost full of ^o%s^n.\n", what, subshort(stuff)); break; } return; } showto::~showto() { } bool can_see(const MudObject *o) { if (o->get_flag(FL_BLIND)) return 0; if (o->get_flag(FL_SLEEPING)) return 0; TeleWorld worn = clothes(const_cast<MudObject*>(o)); int lefteye = 1; int righteye = 1; if (o->get_int("b.eyes", 1)==0) { lefteye = righteye = 0; } if (o->get_int("b.lefteye", 1)==0) { lefteye = 0; } if (o->get_int("b.righteye", 1)==0) { righteye = 0; } MudObject *q; int i; foreach((&worn), q, i) { if (!q->get_flag(FL_BLIND)) continue; const char *wo = q->get("$wornon"); if (!wo) wo = q->get("wornon"); if (streq(wo, "eyes")) { lefteye = 0; righteye = 0; } if (streq(wo, "lefteye")) lefteye = 0; if (streq(wo, "righteye")) righteye = 0; } return lefteye || righteye; }