| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
#include "copyrite.h" |
|---|
| 91 |
#include "config.h" |
|---|
| 92 |
|
|---|
| 93 |
#include <ctype.h> |
|---|
| 94 |
#include <string.h> |
|---|
| 95 |
#ifdef HAVE_STDINT_H |
|---|
| 96 |
#include <stdint.h> |
|---|
| 97 |
#endif |
|---|
| 98 |
#include "conf.h" |
|---|
| 99 |
#include "dbdefs.h" |
|---|
| 100 |
#include "mushdb.h" |
|---|
| 101 |
#include "match.h" |
|---|
| 102 |
#include "externs.h" |
|---|
| 103 |
#include "lock.h" |
|---|
| 104 |
#include "parse.h" |
|---|
| 105 |
#include "attrib.h" |
|---|
| 106 |
#include "flags.h" |
|---|
| 107 |
#include "log.h" |
|---|
| 108 |
#include "extchat.h" |
|---|
| 109 |
#include "strtree.h" |
|---|
| 110 |
#include "mymalloc.h" |
|---|
| 111 |
#include "confmagic.h" |
|---|
| 112 |
|
|---|
| 113 |
#ifdef WIN32 |
|---|
| 114 |
#pragma warning( disable : 4761) |
|---|
| 115 |
#endif |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
typedef enum boolexp_type { |
|---|
| 121 |
BOOLEXP_AND, |
|---|
| 122 |
BOOLEXP_OR, |
|---|
| 123 |
BOOLEXP_NOT, |
|---|
| 124 |
BOOLEXP_CONST, |
|---|
| 125 |
BOOLEXP_ATR, |
|---|
| 126 |
BOOLEXP_IND, |
|---|
| 127 |
BOOLEXP_CARRY, |
|---|
| 128 |
BOOLEXP_IS, |
|---|
| 129 |
BOOLEXP_OWNER, |
|---|
| 130 |
BOOLEXP_EVAL, |
|---|
| 131 |
BOOLEXP_FLAG, |
|---|
| 132 |
BOOLEXP_BOOL |
|---|
| 133 |
} boolexp_type; |
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
struct boolatr { |
|---|
| 141 |
const char *name; |
|---|
| 142 |
char text[BUFFER_LEN]; |
|---|
| 143 |
}; |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
struct boolexp_node { |
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
boolexp_type type; |
|---|
| 158 |
dbref thing; |
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
union { |
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
struct { |
|---|
| 168 |
struct boolexp_node *a; |
|---|
| 169 |
struct boolexp_node *b; |
|---|
| 170 |
} sub; |
|---|
| 171 |
struct boolexp_node *n; |
|---|
| 172 |
struct boolatr *atr_lock; |
|---|
| 173 |
const char *ind_lock; |
|---|
| 174 |
} data; |
|---|
| 175 |
}; |
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
typedef enum bvm_opcode { |
|---|
| 180 |
OP_JMPT, |
|---|
| 181 |
OP_JMPF, |
|---|
| 182 |
OP_TCONST, |
|---|
| 183 |
OP_TATR, |
|---|
| 184 |
OP_TIND, |
|---|
| 185 |
OP_TCARRY, |
|---|
| 186 |
OP_TIS, |
|---|
| 187 |
OP_TOWNER, |
|---|
| 188 |
OP_TEVAL, |
|---|
| 189 |
OP_TFLAG, |
|---|
| 190 |
OP_TTYPE, |
|---|
| 191 |
OP_TPOWER, |
|---|
| 192 |
OP_TCHANNEL, |
|---|
| 193 |
OP_TIP, |
|---|
| 194 |
OP_THOSTNAME, |
|---|
| 195 |
OP_TOBJID, |
|---|
| 196 |
OP_TDBREFLIST, |
|---|
| 197 |
OP_LOADS, |
|---|
| 198 |
OP_LOADR, |
|---|
| 199 |
OP_NEGR, |
|---|
| 200 |
OP_PAREN, |
|---|
| 201 |
OP_LABEL, |
|---|
| 202 |
OP_RET |
|---|
| 203 |
} bvm_opcode; |
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
#define INSN_LEN (1 + sizeof(int)) |
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
struct bvm_asmnode { |
|---|
| 213 |
bvm_opcode op; |
|---|
| 214 |
int arg; |
|---|
| 215 |
struct bvm_asmnode *next; |
|---|
| 216 |
}; |
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
struct bvm_strnode { |
|---|
| 221 |
char *s; |
|---|
| 222 |
size_t len; |
|---|
| 223 |
struct bvm_strnode *next; |
|---|
| 224 |
}; |
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
struct bvm_asm { |
|---|
| 229 |
struct bvm_asmnode *head; |
|---|
| 230 |
struct bvm_asmnode *tail; |
|---|
| 231 |
struct bvm_strnode *shead; |
|---|
| 232 |
struct bvm_strnode *stail; |
|---|
| 233 |
int label; |
|---|
| 234 |
size_t strcount; |
|---|
| 235 |
}; |
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
struct flag_lock_types { |
|---|
| 242 |
const char *name; |
|---|
| 243 |
bvm_opcode op; |
|---|
| 244 |
}; |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
static struct flag_lock_types flag_locks[] = { |
|---|
| 248 |
{"FLAG", OP_TFLAG}, |
|---|
| 249 |
{"POWER", OP_TPOWER}, |
|---|
| 250 |
{"TYPE", OP_TTYPE}, |
|---|
| 251 |
{"CHANNEL", OP_TCHANNEL}, |
|---|
| 252 |
{"OBJID", OP_TOBJID}, |
|---|
| 253 |
{"IP", OP_TIP}, |
|---|
| 254 |
{"HOSTNAME", OP_THOSTNAME}, |
|---|
| 255 |
{"DBREFLIST", OP_TDBREFLIST}, |
|---|
| 256 |
{NULL, OP_RET} |
|---|
| 257 |
}; |
|---|
| 258 |
|
|---|
| 259 |
static uint8_t * |
|---|
| 260 |
safe_get_bytecode(boolexp b) |
|---|
| 261 |
__attribute_malloc__; |
|---|
| 262 |
static uint8_t *get_bytecode(boolexp b, uint16_t * storelen); |
|---|
| 263 |
static struct boolexp_node *alloc_bool(void) __attribute_malloc__; |
|---|
| 264 |
static struct boolatr *alloc_atr(const char *name, |
|---|
| 265 |
const char *s) __attribute_malloc__; |
|---|
| 266 |
static void skip_whitespace(void); |
|---|
| 267 |
static void free_bool(struct boolexp_node *b); |
|---|
| 268 |
static struct boolexp_node *test_atr(char *s, char c); |
|---|
| 269 |
static struct boolexp_node *parse_boolexp_R(void); |
|---|
| 270 |
static struct boolexp_node *parse_boolexp_L(void); |
|---|
| 271 |
static struct boolexp_node *parse_boolexp_O(void); |
|---|
| 272 |
static struct boolexp_node *parse_boolexp_C(void); |
|---|
| 273 |
static struct boolexp_node *parse_boolexp_I(void); |
|---|
| 274 |
static struct boolexp_node *parse_boolexp_A(void); |
|---|
| 275 |
static struct boolexp_node *parse_boolexp_F(void); |
|---|
| 276 |
static struct boolexp_node *parse_boolexp_T(void); |
|---|
| 277 |
static struct boolexp_node *parse_boolexp_E(void); |
|---|
| 278 |
static int check_attrib_lock(dbref player, dbref target, |
|---|
| 279 |
const char *atrname, const char *str); |
|---|
| 280 |
static void free_boolexp_node(struct boolexp_node *b); |
|---|
| 281 |
static int gen_label_id(struct bvm_asm *a); |
|---|
| 282 |
static void append_insn(struct bvm_asm *a, bvm_opcode op, int arg, |
|---|
| 283 |
const char *s); |
|---|
| 284 |
static struct bvm_asm *generate_bvm_asm(struct boolexp_node *b) |
|---|
| 285 |
__attribute_malloc__; |
|---|
| 286 |
static void generate_bvm_asm1(struct bvm_asm *a, struct boolexp_node *b, |
|---|
| 287 |
boolexp_type outer); |
|---|
| 288 |
static size_t pos_of_label(struct bvm_asm *a, int label); |
|---|
| 289 |
static size_t offset_to_string(struct bvm_asm *a, int c); |
|---|
| 290 |
static struct bvm_asmnode *insn_after_label(struct bvm_asm *a, int label); |
|---|
| 291 |
static void opt_thread_jumps(struct bvm_asm *a); |
|---|
| 292 |
static void optimize_bvm_asm(struct bvm_asm *a); |
|---|
| 293 |
static boolexp emit_bytecode(struct bvm_asm *a, int derefs); |
|---|
| 294 |
static void free_bvm_asm(struct bvm_asm *a); |
|---|
| 295 |
#ifdef DEBUG_BYTECODE |
|---|
| 296 |
static int sizeof_boolexp_node(struct boolexp_node *b); |
|---|
| 297 |
static void print_bytecode(boolexp b); |
|---|
| 298 |
#endif |
|---|
| 299 |
extern void complain |
|---|
| 300 |
(dbref player, dbref i, const char *name, const char *desc, ...) |
|---|
| 301 |
__attribute__ ((__format__(__printf__, 4, 5))); |
|---|
| 302 |
void check_lock(dbref player, dbref i, const char *name, boolexp be); |
|---|
| 303 |
int warning_lock_type(const boolexp l); |
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
extern StrTree atr_names; |
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 |
extern StrTree lock_names; |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
extern int loading_db; |
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
static uint8_t *safe_get_bytecode(boolexp b) |
|---|
| 322 |
{ |
|---|
| 323 |
uint8_t *bytecode; |
|---|
| 324 |
uint16_t len; |
|---|
| 325 |
|
|---|
| 326 |
len = chunk_len(b); |
|---|
| 327 |
bytecode = mush_malloc(len, "boolexp.bytecode"); |
|---|
| 328 |
chunk_fetch(b, bytecode, len); |
|---|
| 329 |
return bytecode; |
|---|
| 330 |
} |
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
static uint8_t * |
|---|
| 338 |
get_bytecode(boolexp b, uint16_t * storelen) |
|---|
| 339 |
{ |
|---|
| 340 |
static uint8_t bytecode[BUFFER_LEN * 2]; |
|---|
| 341 |
uint16_t len; |
|---|
| 342 |
|
|---|
| 343 |
len = chunk_fetch(b, bytecode, sizeof bytecode); |
|---|
| 344 |
if (storelen) |
|---|
| 345 |
*storelen = len; |
|---|
| 346 |
return bytecode; |
|---|
| 347 |
} |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
boolexp |
|---|
| 358 |
dup_bool(boolexp b) |
|---|
| 359 |
{ |
|---|
| 360 |
boolexp r; |
|---|
| 361 |
uint8_t *bytecode; |
|---|
| 362 |
uint16_t len = 0; |
|---|
| 363 |
|
|---|
| 364 |
if (b == TRUE_BOOLEXP) |
|---|
| 365 |
return TRUE_BOOLEXP; |
|---|
| 366 |
|
|---|
| 367 |
bytecode = get_bytecode(b, &len); |
|---|
| 368 |
|
|---|
| 369 |
r = chunk_create(bytecode, len, 1); |
|---|
| 370 |
|
|---|
| 371 |
return r; |
|---|
| 372 |
} |
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
void |
|---|
| 379 |
free_boolexp(boolexp b) |
|---|
| 380 |
{ |
|---|
| 381 |
if (b != TRUE_BOOLEXP) |
|---|
| 382 |
chunk_delete(b); |
|---|
| 383 |
} |
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 |
int |
|---|
| 391 |
sizeof_boolexp(boolexp b) |
|---|
| 392 |
{ |
|---|
| 393 |
|
|---|
| 394 |
if (b == TRUE_BOOLEXP) |
|---|
| 395 |
return 0; |
|---|
| 396 |
else |
|---|
| 397 |
return (int) chunk_len(b); |
|---|
| 398 |
} |
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
int |
|---|
| 411 |
eval_boolexp(dbref player , |
|---|
| 412 |
boolexp b , |
|---|
| 413 |
dbref target ) |
|---|
| 414 |
{ |
|---|
| 415 |
static int boolexp_recursion = 0; |
|---|
| 416 |
|
|---|
| 417 |
if (!GoodObject(player)) |
|---|
| 418 |
return 0; |
|---|
| 419 |
|
|---|
| 420 |
if (boolexp_recursion > MAX_DEPTH) { |
|---|
| 421 |
notify(player, T("Too much recursion in lock!")); |
|---|
| 422 |
return 0; |
|---|
| 423 |
} |
|---|
| 424 |
if (b == TRUE_BOOLEXP) { |
|---|
| 425 |
return 1; |
|---|
| 426 |
} else { |
|---|
| 427 |
bvm_opcode op; |
|---|
| 428 |
int arg; |
|---|
| 429 |
ATTR *a; |
|---|
| 430 |
int r = 0; |
|---|
| 431 |
char *s = NULL; |
|---|
| 432 |
uint8_t *bytecode, *pc; |
|---|
| 433 |
|
|---|
| 434 |
bytecode = pc = safe_get_bytecode(b); |
|---|
| 435 |
|
|---|
| 436 |
while (1) { |
|---|
| 437 |
op = (bvm_opcode) *pc; |
|---|
| 438 |
memcpy(&arg, pc + 1, sizeof arg); |
|---|
| 439 |
pc += INSN_LEN; |
|---|
| 440 |
switch (op) { |
|---|
| 441 |
case OP_RET: |
|---|
| 442 |
goto done; |
|---|
| 443 |
case OP_JMPT: |
|---|
| 444 |
if (r) |
|---|
| 445 |
pc = bytecode + arg; |
|---|
| 446 |
break; |
|---|
| 447 |
case OP_JMPF: |
|---|
| 448 |
if (!r) |
|---|
| 449 |
pc = bytecode + arg; |
|---|
| 450 |
break; |
|---|
| 451 |
case OP_LABEL: |
|---|
| 452 |
case OP_PAREN: |
|---|
| 453 |
break; |
|---|
| 454 |
case OP_LOADS: |
|---|
| 455 |
s = (char *) (bytecode + arg); |
|---|
| 456 |
break; |
|---|
| 457 |
case OP_LOADR: |
|---|
| 458 |
r = arg; |
|---|
| 459 |
break; |
|---|
| 460 |
case OP_NEGR: |
|---|
| 461 |
r = !r; |
|---|
| 462 |
break; |
|---|
| 463 |
case OP_TCONST: |
|---|
| 464 |
r = (GoodObject(arg) |
|---|
| 465 |
&& !IsGarbage(arg) |
|---|
| 466 |
&& (arg == player || member(arg, Contents(player)))); |
|---|
| 467 |
break; |
|---|
| 468 |
case OP_TIS: |
|---|
| 469 |
r = (GoodObject(arg) |
|---|
| 470 |
&& !IsGarbage(arg) |
|---|
| 471 |
&& arg == player); |
|---|
| 472 |
break; |
|---|
| 473 |
case OP_TCARRY: |
|---|
| 474 |
r = (GoodObject(arg) |
|---|
| 475 |
&& !IsGarbage(arg) |
|---|
| 476 |
&& member(arg, Contents(player))); |
|---|
| 477 |
break; |
|---|
| 478 |
case OP_TOWNER: |
|---|
| 479 |
r = (GoodObject(arg) |
|---|
| 480 |
&& !IsGarbage(arg) |
|---|
| 481 |
&& Owner(arg) == Owner(player)); |
|---|
| 482 |
break; |
|---|
| 483 |
case OP_TIND: |
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
|
|---|
| 487 |
boolexp_recursion++; |
|---|
| 488 |
if (!GoodObject(arg) || IsGarbage(arg)) |
|---|
| 489 |
r = 0; |
|---|
| 490 |
else if (!Can_Read_Lock(target, arg, s)) |
|---|
| 491 |
r = 0; |
|---|
| 492 |
else |
|---|
| 493 |
r = eval_boolexp(player, getlock(arg, s), arg); |
|---|
| 494 |
boolexp_recursion--; |
|---|
| 495 |
break; |
|---|
| 496 |
case OP_TATR: |
|---|
| 497 |
boolexp_recursion++; |
|---|
| 498 |
a = atr_get(player, s); |
|---|
| 499 |
if (!a || !Can_Read_Attr(target, player, a)) |
|---|
| 500 |
r = 0; |
|---|
| 501 |
else { |
|---|
| 502 |
char tbuf[BUFFER_LEN]; |
|---|
| 503 |
strcpy(tbuf, atr_value(a)); |
|---|
| 504 |
r = local_wild_match((char *) bytecode + arg, tbuf); |
|---|
| 505 |
} |
|---|
| 506 |
boolexp_recursion--; |
|---|
| 507 |
break; |
|---|
| 508 |
case OP_TEVAL: |
|---|
| 509 |
boolexp_recursion++; |
|---|
| 510 |
r = check_attrib_lock(player, target, s, (char *) bytecode + arg); |
|---|
| 511 |
boolexp_recursion--; |
|---|
| 512 |
break; |
|---|
| 513 |
case OP_TFLAG: |
|---|
| 514 |
|
|---|
| 515 |
if (sees_flag("FLAG", target, player, (char *) bytecode + arg)) |
|---|
| 516 |
r = 1; |
|---|
| 517 |
else |
|---|
| 518 |
r = 0; |
|---|
| 519 |
break; |
|---|
| 520 |
case OP_TPOWER: |
|---|
| 521 |
if (sees_flag("POWER", target, player, (char *) bytecode + arg)) |
|---|
| 522 |
r = 1; |
|---|
| 523 |
else |
|---|
| 524 |
r = 0; |
|---|
| 525 |
break; |
|---|
| 526 |
case OP_TOBJID: |
|---|
| 527 |
{ |
|---|
| 528 |
dbref d; |
|---|
| 529 |
d = parse_objid((char *) bytecode + arg); |
|---|
| 530 |
r = (player == d); |
|---|
| 531 |
break; |
|---|
| 532 |
} |
|---|
| 533 |
case OP_TCHANNEL: |
|---|
| 534 |
{ |
|---|
| 535 |
CHAN *chan; |
|---|
| 536 |
boolexp_recursion++; |
|---|
| 537 |
find_channel((char *) bytecode + arg, &chan, target); |
|---|
| 538 |
r = chan && onchannel(player, chan); |
|---|
| 539 |
boolexp_recursion--; |
|---|
| 540 |
} |
|---|
| 541 |
break; |
|---|
| 542 |
case OP_TIP: |
|---|
| 543 |
boolexp_recursion++; |
|---|
| 544 |
if (!Connected(Owner(player))) |
|---|
| 545 |
r = 0; |
|---|
| 546 |
else { |
|---|
| 547 |
|
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 |
a = atr_get(Owner(player), "LASTIP"); |
|---|
| 552 |
if (!a || !Can_Read_Attr(target, player, a)) |
|---|
| 553 |
r = 0; |
|---|
| 554 |
else { |
|---|
| 555 |
char *p = least_idle_ip(Owner(player)); |
|---|
| 556 |
r = p ? quick_wild((char *) bytecode + arg, p) : 0; |
|---|
| 557 |
} |
|---|
| 558 |
} |
|---|
| 559 |
boolexp_recursion--; |
|---|
| 560 |
break; |
|---|
| 561 |
case OP_THOSTNAME: |
|---|
| 562 |
boolexp_recursion++; |
|---|
| 563 |
if (!Connected(Owner(player))) |
|---|
| 564 |
r = 0; |
|---|
| 565 |
else { |
|---|
| 566 |
|
|---|
| 567 |
a = atr_get(Owner(player), "LASTSITE"); |
|---|
| 568 |
if (!a || !Can_Read_Attr(target, player, a)) |
|---|
| 569 |
r = 0; |
|---|
| 570 |
else { |
|---|
| 571 |
char *p = least_idle_hostname(Owner(player)); |
|---|
| 572 |
r = p ? quick_wild((char *) bytecode + arg, p) : 0; |
|---|
| 573 |
} |
|---|
| 574 |
} |
|---|
| 575 |
boolexp_recursion--; |
|---|
| 576 |
break; |
|---|
| 577 |
case OP_TTYPE: |
|---|
| 578 |
switch (bytecode[arg]) { |
|---|
| 579 |
case 'R': |
|---|
| 580 |
r = Typeof(player) == TYPE_ROOM; |
|---|
| 581 |
break; |
|---|
| 582 |
case 'E': |
|---|
| 583 |
r = Typeof(player) == TYPE_EXIT; |
|---|
| 584 |
break; |
|---|
| 585 |
case 'T': |
|---|
| 586 |
r = Typeof(player) == TYPE_THING; |
|---|
| 587 |
break; |
|---|
| 588 |
case 'P': |
|---|
| 589 |
r = Typeof(player) == TYPE_PLAYER; |
|---|
| 590 |
break; |
|---|
| 591 |
} |
|---|
| 592 |
break; |
|---|
| 593 |
case OP_TDBREFLIST: |
|---|