Added new object variable wearflag. --Rumble

This commit is contained in:
Rumble 2007-06-30 09:47:54 +00:00
parent a43282aad1
commit 52194dacdd
4 changed files with 21 additions and 31 deletions

View file

@ -785,8 +785,6 @@ ACMD(do_wake)
else {
send_to_char(ch, "You awaken, and sit up.\r\n");
act("$n awakens.", TRUE, ch, 0, 0, TO_ROOM);
/* Were they asleep while sitting? */
char_from_furniture(ch);
GET_POS(ch) = POS_SITTING;
}
}

View file

@ -2061,7 +2061,7 @@ ACMD(do_last)
fseek(fp,-1* (sizeof(struct last_entry)),SEEK_CUR);
fread(&mlast,sizeof(struct last_entry),1,fp);
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
if(!*name ||(*name && !strcasecmp(name, mlast.username))) {
if(!*name ||(*name && !str_cmp(name, mlast.username))) {
send_to_char(ch,"%10.10s %20.20s %16.16s - ",
mlast.username, mlast.hostname, ctime(&mlast.time));
if((temp=is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) {

View file

@ -859,24 +859,6 @@ void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
}
}
#if 0 /* change to 1 if you get messages telling you you don't have strncasecmp() */
int strncasecmp (const char *s1, const char *s2, int n)
{
unsigned char c1, c2;
while(*s1 && *s2 && n--) {
c1 = ((*s1 >= 'A') && (*s1 <= 'Z')) ? (*s1++) + ('a' - 'A') : (*s1++);
c2 = ((*s2 >= 'A') && (*s2 <= 'Z')) ? (*s2++) + ('a' - 'A') : (*s2++);
if (c1 != c2)
return (c1 > c2) ? 1 : -1;
}
if (*s1 && !*s2)
return 1;
if (!*s1 && *s2)
return -1;
return 0;
}
#endif
int format_script(struct descriptor_data *d)
{
char nsc[MAX_CMD_LENGTH], *t, line[READ_SIZE];
@ -894,14 +876,14 @@ int format_script(struct descriptor_data *d)
while (t) {
line_num++;
skip_spaces(&t);
if (!strncasecmp(t, "if ", 3) ||
!strncasecmp(t, "switch ", 7)) {
if (!strn_cmp(t, "if ", 3) ||
!strn_cmp(t, "switch ", 7)) {
indent_next = TRUE;
} else if (!strncasecmp(t, "while ", 6)) {
} else if (!strn_cmp(t, "while ", 6)) {
found_case = TRUE; /* so you can 'break' a loop without complains */
indent_next = TRUE;
} else if (!strncasecmp(t, "end", 3) ||
!strncasecmp(t, "done", 4)) {
} else if (!strn_cmp(t, "end", 3) ||
!strn_cmp(t, "done", 4)) {
if (!indent) {
write_to_output(d, "Unmatched 'end' or 'done' (line %d)!\r\n", line_num);
free(sc);
@ -909,7 +891,7 @@ int format_script(struct descriptor_data *d)
}
indent--;
indent_next = FALSE;
} else if (!strncasecmp(t, "else", 4)) {
} else if (!strn_cmp(t, "else", 4)) {
if (!indent) {
write_to_output(d, "Unmatched 'else' (line %d)!\r\n", line_num);
free(sc);
@ -917,8 +899,8 @@ int format_script(struct descriptor_data *d)
}
indent--;
indent_next = TRUE;
} else if (!strncasecmp(t, "case", 4) ||
!strncasecmp(t, "default", 7)) {
} else if (!strn_cmp(t, "case", 4) ||
!strn_cmp(t, "default", 7)) {
if (!indent) {
write_to_output(d, "Case/default outside switch (line %d)!\r\n", line_num);
free(sc);
@ -927,7 +909,7 @@ int format_script(struct descriptor_data *d)
if (!found_case) /* so we don't indent multiple case statements without a break */
indent_next = TRUE;
found_case = TRUE;
} else if (!strncasecmp(t, "break", 5)) {
} else if (!strn_cmp(t, "break", 5)) {
if (!found_case || !indent ) {
write_to_output(d, "Break not in case (line %d)!\r\n", line_num);
free(sc);

View file

@ -24,6 +24,7 @@
/* External variables and functions */
extern const char *pc_class_types[];
extern struct time_info_data time_info;
int find_eq_pos_script(char *arg);
/* Utility functions */
@ -1149,7 +1150,16 @@ o->contains) ? "1" : "0"));
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 3));
break;
case 'w':
if (!str_cmp(field, "weight")){
if (!str_cmp(field, "wearflag")) {
if (subfield && *subfield) {
if (can_wear_on_pos(o, find_eq_pos_script(subfield)))
snprintf(str, slen, "1");
else
snprintf(str, slen, "0");
}
}
else if (!str_cmp(field, "weight")){
if (subfield && *subfield) {
int addition = atoi(subfield);
GET_OBJ_WEIGHT(o) = MAX(1, addition + GET_OBJ_WEIGHT(o));