Example #1
0
string look_table()
{
	if (this_player()->query_temp("pigging_seat"))
		return table_str(this_player()->query_temp("pigging_seat"));
	return table_str("");
}
Example #2
0
static int
table_str_cb(mnbytes_t *key, amqp_value_t *val, mnbytestream_t *bs)
{
    bytestream_nprintf(bs, 1024, "%s=", BDATA(key));
    switch (val->ty->tag) {
    case AMQP_TBOOL:
        (void)bytestream_nprintf(bs, 1024, "%s ", val->value.b ? "#t" : "#f");
        break;

    case AMQP_TINT8:
        (void)bytestream_nprintf(bs, 1024, "%hhd ", val->value.i8);
        break;

    case AMQP_TUINT8:
        (void)bytestream_nprintf(bs, 1024, "0x%02hhx ", val->value.u8);
        break;

    case AMQP_TINT16:
        (void)bytestream_nprintf(bs, 1024, "%hd ", val->value.i16);
        break;

    case AMQP_TUINT16:
        (void)bytestream_nprintf(bs, 1024, "0x%04hx ", val->value.u16);
        break;

    case AMQP_TINT32:
        (void)bytestream_nprintf(bs, 1024, "%d ", val->value.i32);
        break;

    case AMQP_TUINT32:
        (void)bytestream_nprintf(bs, 1024, "0x%08x ", val->value.u32);
        break;

    case AMQP_TINT64:
        (void)bytestream_nprintf(bs, 1024, "%ld ", val->value.i64);
        break;

    case AMQP_TUINT64:
        (void)bytestream_nprintf(bs, 1024, "0x%016lx ", val->value.u64);
        break;

    case AMQP_TFLOAT:
        (void)bytestream_nprintf(bs, 1024, "%f ", val->value.f);
        break;

    case AMQP_TDOUBLE:
        (void)bytestream_nprintf(bs, 1024, "%d ", val->value.d);
        break;

    case AMQP_TSSTR:
    case AMQP_TLSTR:
        if (val->value.str != NULL) {
            (void)bytestream_nprintf(bs,
                               1024,
                               "'%s' ",
                               BDATA(val->value.str));
        } else {
            (void)bytestream_nprintf(bs,
                               1024,
                               "%s ",
                               NULL);
        }
        break;

    case AMQP_TTABLE:
        table_str(&val->value.t, bs);
        break;

    default:
        (void)bytestream_nprintf(bs, 1024, "... ");
    }
    return 0;
}