diff -i smaug14/src/comm.c smaug18/src/comm.c 8c8 < * Tricops and Fireblade | * --- > * Tricops, Fireblade, Edmond, Conran | * 75a76 > 80a82 > void add_member args( ( CHAR_DATA * ch, char *clanname ) ); 449c451,452 < sprintf( buf, "ALARM CLOCK! In section %s", buf ); --- > // Fix from Igor Romanenko > sprintf( buf, "ALARM CLOCK! In section %s", alarm_section ); 912a916,919 > /* > write_to_buffer( dnew, "\x1b[1;32m", 0 ); > */ > 1054c1061,1062 < sprintf( log_buf, "Closing link to %s.", ch->pcdata->filename ); --- > sprintf( log_buf, "Closing link to %s. (INRoom %d)", > ch->pcdata->filename, ( ch->in_room ? ch->in_room->vnum : -1 ) ); 1055a1064,1076 > if ( ch && ch->fighting ) > { > struct tm *t = localtime( ¤t_time ); > > sprintf( log_buf, "%d/%d, %d:%2d, %s, %s, %d/%d, %d", > t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, > ch->pcdata->filename, > ch->fighting->who ? ch->fighting->who->name : "", > ch->fighting->who ? ch->fighting->who->hit : -1, > ch->fighting->who ? ch->fighting->who->max_hit : -1, ch->in_room ? ch->in_room->vnum : -1 ); > append_to_file( CUTLINK_FILE, log_buf ); > } > 1059a1081,1089 > if ( dclose->connected == CON_EDITING ) > { > if ( ch->last_cmd ) > ch->last_cmd( ch, "" ); > else > stop_editing( ch ); > dclose->connected = CON_PLAYING; > } > 1227,1229c1257,1258 < /* sprintf( log_buf, "%s input spamming!", d->host ); < log_string( log_buf ); < */ --- > /* sprintf( log_buf, "%s input spamming!", d->host ); */ > /* log_string( log_buf ); */ 1257d1285 < 1310a1339,1343 > /* > * Let's add a color code if -prompt. It's a dynamic world > * and this will nearly eradicate color bleeding - Luc 09/2000 > */ > 1312a1346,1349 > else > set_char_color( AT_ACTION, ch ); > > 1373a1411,1413 > if ( MPSilent ) > return; > 1409c1449 < if ( d->outsize > 32000 ) --- > if ( d->outsize > 32000 ) /* pagerfile size */ 1461,1462d1500 < < 1484a1523,1581 > void show_classes_to_nanny( DESCRIPTOR_DATA * d ) > { > CHAR_DATA *ch; > sh_int cnt = 0; > int iClass; > > ch = d->character; > > ch_printf_color( ch, "\n\r\n\r>he following classes are available (or type &W'help [class]'&G)\n\r" ); > for ( iClass = 0; iClass < MAX_PC_CLASS - 3; iClass++ ) > { > if ( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' ) > { > if ( iClass > 0 ) > cnt++; > } > ch_printf_color( ch, "&W %-15.15s ", class_table[iClass]->who_name ); > if ( cnt == 3 ) > { > send_to_char( "\n\r", ch ); > cnt = 0; > } > } > ch_printf_color( ch, "\n\r&GPlease select\n\r&W: " ); > return; > } > > void show_races_to_nanny( DESCRIPTOR_DATA * d ) > { > CHAR_DATA *ch; > sh_int cnt = 0; > int iRace; > > ch = d->character; > > ch_printf_color( ch, "\n\r\n\r>he following races are available to your class (or type &W'help [race]'&G)\n\r" ); > for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ ) > { > if ( iRace != RACE_VAMPIRE > && race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0' > && !IS_SET( race_table[iRace]->class_restriction, 1 << ch->class ) > && str_cmp( race_table[iRace]->race_name, "unused" ) ) > { > if ( iRace >= 0 ) > { > cnt++; > ch_printf_color( ch, " &W%-15.15s ", race_table[iRace]->race_name ); > } > if ( cnt == 3 ) > { > send_to_char( "\n\r", ch ); > cnt = 0; > } > } > } > ch_printf_color( ch, "\n\r&GPlease select\n\r&W: " ); > return; > } > 1492a1590 > char buf2[MAX_STRING_LENGTH]; 1528c1626 < write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); --- > write_to_buffer( d, "That name is reserved, please try another.\n\rName: ", 0 ); 1564c1662 < write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); --- > write_to_buffer( d, "That name is reserved, please try another.\n\rName: ", 0 ); 1580c1678 < write_to_buffer( d, "Your playerfile is corrupt...Please notify Thoric@mud.compulink.com.\n\r", 0 ); --- > write_to_buffer( d, "Your playerfile is corrupt...Please notify derek@idirect.com.\n\r", 0 ); 1621c1719 < write_to_buffer( d, "You are denied access.\n\r", 0 ); --- > ch_printf_color( ch, "\n\r&RYou are denied access.\n\r" ); 1634c1732 < write_to_buffer( d, "This hacking attempt has been logged.\n\r", 0 ); --- > ch_printf_color( ch, "\n\r&RThis hacking attempt has been logged.\n\r" ); 1639d1736 < 1652,1653c1749,1750 < write_to_buffer( d, "The game is wizlocked. Only immortals can connect now.\n\r", 0 ); < write_to_buffer( d, "Please try back later.\n\r", 0 ); --- > ch_printf_color( ch, "\n\r&RThe game is wizlocked. Only immortals can connect at this time.\n\r" ); > ch_printf_color( ch, "Please try back later ...\n\r" ); 1683c1780 < * write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); --- > * write_to_buffer( d, "That name is reserved, please try another.\n\rName: ", 0 ); 1744a1842,1849 > if ( !d->character ) > { > sprintf( log_buf, "Bad player file %s@%s.", argument, d->host ); > log_string( log_buf ); > write_to_buffer( d, "Your playerfile is corrupt...Please notify derek@idirect.com\n\r", 0 ); > close_socket( d, FALSE ); > return; > } 1745a1851 > 1751c1857,1862 < sprintf( log_buf, "%s@%s(%s) has connected.", ch->pcdata->filename, d->host, d->user ); --- > > sprintf( buf2, "%s , %s", ch->pcdata->filename, d->host ); > append_to_file( CHARCOUNT_FILE, buf2 ); > sprintf( log_buf, "%s@%s(%s) has connected. (INRoom %d)", > ch->pcdata->filename, d->host, d->user, ( ch->in_room ? ch->in_room->vnum : -1 ) ); > 1827a1939,1945 > write_to_buffer( d, "\n\rPlease select your color preference\n\r ANSI\n\r RIP\n\r No color support\n\r: ", > 0 ); > d->connected = CON_GET_WANT_RIPANSI; > break; > > > case CON_GET_WANT_RIPANSI: 1829c1947,1971 < write_to_buffer( d, "\n\rWhat is your sex (M/F/N)? ", 0 ); --- > switch ( argument[0] ) > { > case 'r': > case 'R': > xSET_BIT( ch->act, PLR_RIP ); > xSET_BIT( ch->act, PLR_ANSI ); > break; > case 'a': > case 'A': > xSET_BIT( ch->act, PLR_ANSI ); > break; > case 'n': > case 'N': > break; > default: > write_to_buffer( d, "Invalid selection\n\r ANSI\n\r RIP\n\r No color support\n\r: ", 0 ); > return; > } > > ch_printf_color( ch, "\n\r\n\r\n\r\n\r\n\r\n\r\n\r" ); > ch_printf_color( ch, "&G&gRealms of Despair greets you, &G%s ...\n\r", capitalize( ch->name ) ); > ch_printf_color( ch, "&gPlease continue and choose your gender, class and race.\n\r" ); > ch_printf_color( ch, "&G&g================================================================\n\r" ); > ch_printf_color( ch, > "\n\r&GWhich gender will your character be?\n\r &WMale\n\r Female\n\r Neutral\n\r&GPlease select\n\r&w: " ); 1849c1991,1992 < write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 ); --- > ch_printf_color( ch, > "\n\r&GWhich gender will your character be?\n\r &WMale\n\r Female\n\r Neutral\n\r&GPlease select\n\r&W: " ); 1853,1878c1996 < write_to_buffer( d, "\n\rSelect a class, or type help [class] to learn more about that class.\n\r[", 0 ); < buf[0] = '\0'; < < /* < * Take this out SHADDAI < */ < for ( iClass = 0; iClass < MAX_PC_CLASS - 2; iClass++ ) < { < if ( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' ) < { < if ( iClass > 0 ) < { < if ( strlen( buf ) + strlen( class_table[iClass]->who_name ) > 77 ) < { < strcat( buf, "\n\r" ); < write_to_buffer( d, buf, 0 ); < buf[0] = '\0'; < } < else < strcat( buf, " " ); < } < } < strcat( buf, class_table[iClass]->who_name ); < } < strcat( buf, "]\n\r: " ); < write_to_buffer( d, buf, 0 ); --- > show_classes_to_nanny( d ); 1887d2004 < 1895,1896c2012,2014 < do_help( ch, argument ); < write_to_buffer( d, "Please choose a class: ", 0 ); --- > do_nanny_help( ch, argument ); > ch_printf_color( ch, > "&G\n\rPlease select ( press &W[Enter]&G to see classes again )\n\r&W: " ); 1901c2019,2020 < write_to_buffer( d, "No such help topic. Please choose a class: ", 0 ); --- > ch_printf_color( ch, "&R* I'm afraid there is no description for that class.\n\r\n\r" ); > show_classes_to_nanny( d ); 1922c2041,2043 < write_to_buffer( d, "That's not a class.\n\rWhat IS your class? ", 0 ); --- > if ( arg[0] != '\0' ) > ch_printf_color( ch, "&R* I'm afraid there is no such class available.\n\r\n\r" ); > show_classes_to_nanny( d ); 1926d2046 < 1929c2049,2050 < write_to_buffer( d, "That class is not currently avaiable.\n\rWhat IS your class? ", 0 ); --- > ch_printf_color( ch, "&R *I'm afraid there is no such class available.\n\r" ); > show_classes_to_nanny( d ); 1933,1958c2054 < write_to_buffer( d, "\n\rYou may choose from the following races, or type help [race] to learn more:\n\r[", < 0 ); < buf[0] = '\0'; < for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ ) < { < if ( iRace != RACE_VAMPIRE < && race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0' < && !IS_SET( race_table[iRace]->class_restriction, 1 << ch->class ) < && str_cmp( race_table[iRace]->race_name, "unused" ) ) < { < if ( iRace > 0 ) < { < if ( strlen( buf ) + strlen( race_table[iRace]->race_name ) > 77 ) < { < strcat( buf, "\n\r" ); < write_to_buffer( d, buf, 0 ); < buf[0] = '\0'; < } < else < strcat( buf, " " ); < } < strcat( buf, race_table[iRace]->race_name ); < } < } < strcat( buf, "]\n\r: " ); < write_to_buffer( d, buf, 0 ); --- > show_races_to_nanny( d ); 1963a2060 > 1971,1972c2068,2069 < do_help( ch, argument ); < write_to_buffer( d, "Please choose a race: ", 0 ); --- > do_nanny_help( ch, argument ); > ch_printf_color( ch, "&G\n\rPlease select ( press &W[Enter]&G to see races again )\n\r&W: " ); 1976c2073,2074 < write_to_buffer( d, "No help on that topic. Please choose a race: ", 0 ); --- > ch_printf_color( ch, "&R* I'm afraid there is no description for that race.\n\r\n\r" ); > show_races_to_nanny( d ); 1980d2077 < 1992c2089,2090 < || !race_table[iRace]->race_name || race_table[iRace]->race_name[0] == '\0' --- > || !race_table[iRace]->race_name > || race_table[iRace]->race_name[0] == '\0' 1997c2095,2097 < write_to_buffer( d, "That's not a race.\n\rWhat IS your race? ", 0 ); --- > if ( arg[0] != '\0' ) > ch_printf_color( ch, "&R* I'm afraid there is no such race available.\n\r\n\r" ); > show_races_to_nanny( d ); 1999a2100 > 2002c2103,2104 < write_to_buffer( d, "That race is not currently available.\n\rWhat is your race? ", 0 ); --- > ch_printf_color( ch, "&R *I'm afraid there is no such race available.\n\r" ); > show_races_to_nanny( d ); 2006,2028d2107 < write_to_buffer( d, "\n\rWould you like RIP, ANSI or no graphic/color support, (R/A/N)? ", 0 ); < d->connected = CON_GET_WANT_RIPANSI; < break; < < case CON_GET_WANT_RIPANSI: < switch ( argument[0] ) < { < case 'r': < case 'R': < xSET_BIT( ch->act, PLR_RIP ); < xSET_BIT( ch->act, PLR_ANSI ); < break; < case 'a': < case 'A': < xSET_BIT( ch->act, PLR_ANSI ); < break; < case 'n': < case 'N': < break; < default: < write_to_buffer( d, "Invalid selection.\n\rRIP, ANSI or NONE? ", 0 ); < return; < } 2033c2112,2114 < write_to_buffer( d, "Press [ENTER] ", 0 ); --- > /* > ch_printf_color( ch, "&GPress &W[&GEnter&W]&G " ); > */ 2048,2050d2128 < if ( ch->position == POS_MOUNTED ) < ch->position = POS_STANDING; < 2057a2136,2138 > /* > * Added DMOTD, replaces AMOTD/MOTD for deadlies - Blod, 8/2000 > */ 2060c2141,2143 < if ( ch->level == 50 ) --- > else if ( IS_PKILL( ch ) ) > do_help( ch, "dmotd" ); > else if ( ch->level == 50 ) 2062,2064c2145 < if ( ch->level < 50 && ch->level > 0 ) < do_help( ch, "motd" ); < if ( ch->level == 0 ) --- > else if ( ch->level == 0 ) 2065a2147,2148 > else > do_help( ch, "motd" ); 2079a2163,2184 > /* > * ALL of the following can be removed after 90 days (IE all > * * the players had to have logged in, any thing added between > * * these comments should be timestamped. -Shaddai > */ > > if ( !IS_NPC( ch ) && ch->pcdata->clan ) > add_member( ch, ch->pcdata->clan_name ); > > /* > * April 16th, but probably won't port till May so update this > */ > if ( xIS_SET( ch->deaf, CHANNEL_SHOUT ) ) > xREMOVE_BIT( ch->deaf, CHANNEL_SHOUT ); > if ( !IS_NPC( ch ) && IS_PKILL( ch ) && IS_SET( ch->pcdata->flags, PCFLAG_NOSUMMON ) ) > REMOVE_BIT( ch->pcdata->flags, PCFLAG_NOSUMMON ); > > > /* > * End timestamped stuff -Shaddai > */ > 2110a2216,2263 > switch ( class_table[ch->class]->attr_second ) > { > case APPLY_STR: > ch->perm_str = 14; > break; > case APPLY_INT: > ch->perm_int = 14; > break; > case APPLY_WIS: > ch->perm_wis = 14; > break; > case APPLY_DEX: > ch->perm_dex = 14; > break; > case APPLY_CON: > ch->perm_con = 14; > break; > case APPLY_CHA: > ch->perm_cha = 14; > break; > case APPLY_LCK: > ch->perm_lck = 14; > break; > } > switch ( class_table[ch->class]->attr_deficient ) > { > case APPLY_STR: > ch->perm_str = 9; > break; > case APPLY_INT: > ch->perm_int = 9; > break; > case APPLY_WIS: > ch->perm_wis = 9; > break; > case APPLY_DEX: > ch->perm_dex = 9; > break; > case APPLY_CON: > ch->perm_con = 9; > break; > case APPLY_CHA: > ch->perm_cha = 9; > break; > case APPLY_LCK: > ch->perm_lck = 9; > break; > } 2155,2161d2307 < /* < * ch->resist += race_table[ch->race]->resist; drats < */ < /* < * ch->susceptible += race_table[ch->race]->suscept; drats < */ < 2170a2317 > ch->gold = 0; 2179a2327 > SET_BIT( ch->pcdata->flags, PCFLAG_HINTS ); 2215c2363,2365 < else if ( ch->in_room && ( IS_IMMORTAL( ch ) || !IS_SET( ch->in_room->room_flags, ROOM_PROTOTYPE ) ) ) --- > else if ( ch->in_room && ( IS_IMMORTAL( ch ) > || ( !xIS_SET( ch->in_room->room_flags, ROOM_PROTOTYPE ) > && !xIS_SET( ch->in_room->room_flags, ROOM_NOLOG ) ) ) ) 2235c2385,2395 < act( AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_CANSEE ); --- > /* > * Login trigger by Edmond > */ > rprog_login_trigger( ch ); > mprog_login_trigger( ch ); > > if ( class_table[ch->class]->login_other ) > act( AT_ACTION, class_table[ch->class]->login_other, ch, NULL, NULL, TO_CANSEE ); > else > act( AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_CANSEE ); > 2241a2402,2426 > if ( !IS_PKILL( ch ) ) > xSET_BIT( ch->act, PLR_NICE ); > SET_BIT( ch->pcdata->flags, PCFLAG_NORECALL ); > xSET_BIT( ch->act, PLR_COMBINE ); > > { /* FIX up bugged players */ > if ( ch->played < 0 ) > ch->played = 1000; > if ( ch->max_hit < 0 ) > ch->max_hit = 10; > if ( ch->hit < 0 ) > ch->hit = 1; > if ( ch->max_mana < 0 ) > ch->max_mana = 10; > if ( ch->mana < 0 ) > ch->mana = 1; > if ( ch->max_move < 0 ) > ch->max_move = 10; > if ( ch->move < 0 ) > ch->move = 1; > if ( ch->position < POS_SLEEPING || ch->position == POS_MOUNTED ) > ch->position = POS_STANDING; > if ( ch->exp < 0 ) > ch->exp = 10; > } 2244a2430 > check_loginmsg( ch ); 2252c2438,2441 < --- > /* Crashy crashy > if ( ch->first_carrying ) > do_autofinddupe( ch->last_carrying ); Keep an eye out for performance problems -Shaddai > */ 2377c2566,2573 < send_to_char( "Reconnecting.\n\r", ch ); --- > if ( d->host ) > ch->pcdata->recent_site = STRALLOC( d->host ); > if ( class_table[ch->class]->reconnect ) > ch_printf( ch, "%s\n\r", class_table[ch->class]->reconnect ); > else > send_to_char( "Reconnecting.\n\r", ch ); > rprog_login_trigger( ch ); > mprog_login_trigger( ch ); 2379,2380c2575,2581 < act( AT_ACTION, "$n has reconnected.", ch, NULL, NULL, TO_CANSEE ); < sprintf( log_buf, "%s@%s(%s) reconnected.", ch->pcdata->filename, d->host, d->user ); --- > check_loginmsg( ch ); > if ( class_table[ch->class]->reconnect_other ) > act( AT_ACTION, class_table[ch->class]->reconnect_other, ch, NULL, NULL, TO_CANSEE ); > else > act( AT_ACTION, "$n has reconnected.", ch, NULL, NULL, TO_CANSEE ); > sprintf( log_buf, "%s@%s(%s) reconnected. (INRoom %d)", > ch->pcdata->filename, d->host, d->user, ( ch->in_room ? ch->in_room->vnum : -1 ) ); 2417c2618 < write_to_buffer( d, "Already connected - try again.\n\r", 0 ); --- > write_to_buffer( d, "That character is already connected - try again.\n\r", 0 ); 2434a2636,2637 > if ( d->host ) > ch->pcdata->recent_site = STRALLOC( d->host ); 2439a2643 > check_loginmsg( ch ); 2441c2645,2646 < sprintf( log_buf, "%s@%s reconnected, kicking off old link.", ch->pcdata->filename, d->host ); --- > sprintf( log_buf, "%s@%s reconnected, kicking off old link. (INRoom %d)", > ch->pcdata->filename, d->host, ( ch->in_room ? ch->in_room->vnum : -1 ) ); 2486a2692,2696 > /* > * Void triggers by Edmond > */ > rprog_void_trigger( ch ); > mprog_void_trigger( ch ); 2527,2530d2736 < /* < * Clear out old color stuff < */ < /* make_color_sequence(NULL, NULL, NULL);*/ 2578c2784 < if ( d->pagesize > 32000 ) --- > if ( d->pagesize >= 24 * MAX_STRING_LENGTH ) /* pagefile size */ 2580d2785 < bug( "Pager overflow. Ignoring.\n\r" ); 2584a2790,2791 > // Move bug call here to avoid infinite loops. Compliments of Daltorak -- Alty > bug( "Pager overflow (%s). Ignoring.\n\r", d->character ? d->character->name : "???" ); 2587c2794,2797 < d->pagesize *= 2; --- > if ( d->pagesize < 8 * MAX_STRING_LENGTH ) > d->pagesize *= 2; > else > d->pagesize = 24 * MAX_STRING_LENGTH; 2618a2829 > 2641,2644d2851 < /* < * Clear out old color stuff < */ < /* make_color_sequence(NULL, NULL, NULL);*/ 2683a2891,2893 > > > /* Modified to fix color bleeding bugs - Luc 09/2000 */ 2687a2898 > int nc; 2691d2901 < 2696,2700c2906,2922 < if ( AType == 7 ) < strcpy( buf, "\033[m" ); < else < sprintf( buf, "\033[0;%d;%s%dm", ( AType & 8 ) == 8, ( AType > 15 ? "5;" : "" ), ( AType & 7 ) + 30 ); < write_to_buffer( ch->desc, buf, strlen( buf ) ); --- > > /* > * Figure_color does return a 5 bits code, where bit 3 is the intensity > * and bit 4 is the blink attribute. d->prevcolor is a whole 8 bits, > * with blink in bit 7, so we need to move it into place :P Also, we > * will reset the background color to black. Not sure it's a good thing > * though. Luc 09/2000 > */ > > ch->desc->prevcolor = ( AType & 0x0F ) | ( AType & AT_BLINK ? 0x80 : 0 ); > /* > * The whole sequence should not be longer than 12 chars. A simple reset > * does not suffice because of different ways it's interpreted by different > * clients. - Luc 09/2000 > */ > nc = sprintf( buf, "\033[0;%s%s3%dm", AType & 8 ? "1;" : "", AType & AT_BLINK ? "5;" : "", AType & 7 ); > write_to_buffer( ch->desc, buf, nc ); 2702d2923 < return; 2704a2926,2928 > > > /* Modified to fix color bleeding bugs - Luc 09/2000 */ 2712d2935 < 2716,2720c2939,2945 < AType = figure_color( AType, ch ); < if ( AType == 7 ) < strcpy( buf, "\033[m" ); < else < sprintf( buf, "\033[0;%d;%s%dm", ( AType & 8 ) == 8, ( AType > 15 ? "5;" : "" ), ( AType & 7 ) + 30 ); --- > AType = figure_color( AType, och ); > ch->desc->prevcolor = ( AType & 0x0F ) | ( AType & AT_BLINK ? 0x80 : 0 ); > > /* > * The whole sequence should not be longer than 12 chars. > */ > sprintf( buf, "\033[0;%s%s3%dm", AType & 8 ? "1;" : "", AType & AT_BLINK ? "5;" : "", AType & 7 ); 2722d2946 < ch->desc->pagecolor = AType; 2724d2947 < return; 2727a2951 > 2863c3087,3096 < i = ( char * ) arg1; --- > /* > * bug fix - Edmond i = (char *) arg1; break; > */ > if ( arg1 ) > i = ( char * ) arg1; > else > { > bug( "Act: Bad variable $t" ); > i = " <@@@> "; > } 2866c3099,3108 < i = ( char * ) arg2; --- > /* > * same bug fix as above - i = (char *) arg2; break; > */ > if ( arg2 ) > i = ( char * ) arg2; > else > { > bug( "Act: Bad variable $T" ); > i = " <@@@> "; > } 2952c3194,3205 < i = ( !to || can_see_obj( to, obj1 ) ? obj_short( obj1 ) : "something" ); --- > if ( !to || can_see_obj( to, obj1 ) ) > { > /* > * Prevents act programs from triggering off note shorts > */ > if ( ( !to || IS_NPC( to ) ) && ( obj1->item_type == ITEM_PAPER ) ) > i = obj1->pIndexData->short_descr; > else > i = obj_short( obj1 ); > } > else > i = "something"; 2955c3208,3219 < i = ( !to || can_see_obj( to, obj2 ) ? obj_short( obj2 ) : "something" ); --- > if ( !to || can_see_obj( to, obj2 ) ) > { > /* > * Prevents act programs from triggering off note shorts > */ > if ( ( !to || IS_NPC( to ) ) && ( obj2->item_type == ITEM_PAPER ) ) > i = obj2->pIndexData->short_descr; > else > i = obj_short( obj2 ); > } > else > i = "something"; 2956a3221,3225 > /* case 'p': i = (!to || can_see_obj(to, obj1) > ? obj_short(obj1) : "something"); break; > case 'P': i = (!to || can_see_obj(to, obj2) > ? obj_short(obj2) : "something"); break; > */ 2988a3258 > const char *str; 2991a3262,3270 > #define ACTF_NONE 0 > #define ACTF_TXT BV00 > #define ACTF_CH BV01 > #define ACTF_OBJ BV02 > > OBJ_DATA *obj1 = ( OBJ_DATA * ) arg1; > OBJ_DATA *obj2 = ( OBJ_DATA * ) arg2; > int flags1 = ACTF_NONE, flags2 = ACTF_NONE; > 3003a3283,3351 > // Do some proper type checking here.. Sort of. We base it on the $* params. > // This is kinda lame really, but I suppose in some weird sense it beats having > // to pass like 8 different NULL parameters every time we need to call act().. > for ( str = format; *str; ++str ) > { > if ( *str == '$' ) > { > if ( !*++str ) > break; > switch ( *str ) > { > default: > bug( "Act: bad code %c for format %s.", *str, format ); > break; > > case 't': > flags1 |= ACTF_TXT; > obj1 = NULL; > break; > > case 'T': > case 'd': > flags2 |= ACTF_TXT; > vch = NULL; > obj2 = NULL; > break; > > case 'n': > case 'e': > case 'm': > case 's': > case 'q': > break; > > case 'N': > case 'E': > case 'M': > case 'S': > case 'Q': > flags2 |= ACTF_CH; > obj2 = NULL; > break; > > case 'p': > flags1 |= ACTF_OBJ; > break; > > case 'P': > flags2 |= ACTF_OBJ; > vch = NULL; > break; > } > } > } > > > if ( flags1 != ACTF_NONE && flags1 != ACTF_TXT && flags1 != ACTF_CH && flags1 != ACTF_OBJ ) > { > bug( "Act: arg1 has more than one type in format %s. Setting all NULL.", format ); > obj1 = NULL; > } > > if ( flags2 != ACTF_NONE && flags2 != ACTF_TXT && flags2 != ACTF_CH && flags2 != ACTF_OBJ ) > { > bug( "Act: arg2 has more than one type in format %s. Setting all NULL.", format ); > vch = NULL; > obj2 = NULL; > } > 3041c3389 < rprog_act_trigger( txt, to->in_room, ch, ( OBJ_DATA * ) arg1, ( void * ) arg2 ); --- > rprog_act_trigger( txt, to->in_room, ch, obj1, vch, obj2 ); 3044c3392 < oprog_act_trigger( txt, to_obj, ch, ( OBJ_DATA * ) arg1, ( void * ) arg2 ); --- > oprog_act_trigger( txt, to_obj, ch, obj1, vch, obj2 ); 3065c3413 < ( !IS_IMMORTAL( to ) && !IS_NPC( ch ) && ( xIS_SET( ch->act, PLR_WIZINVIS ) --- > ( !IS_NPC( ch ) && ( xIS_SET( ch->act, PLR_WIZINVIS ) 3097c3445 < mprog_act_trigger( txt, to, ch, ( OBJ_DATA * ) arg1, ( void * ) arg2 ); --- > mprog_act_trigger( txt, to, ch, obj1, vch, obj2 ); 3120c3468 < send_to_char( "Illegal name, try another.\n\r", ch ); --- > send_to_char( "That name is reserved, please try another.\n\r", ch ); 3123a3472,3474 > if ( check_playing( ch->desc, argument, FALSE ) == BERR ) > return; > 3198a3550,3638 > /* This is meant to be used for "%*.*s" type formatters in the *printf family. > Pass in the color-coded string and a goal length, and it will return the > number of color-coded characters from the string are required to make the > goal length visible when drawn to someone's screen. > If the number of non-color characters in the string is less than the goal, > then the remainder is added to the total. > This should mean that code like: > > int len = colorlen(somestring, 50); > ch_printf_color(ch, "%*.*s", len, len, somestring); > will _always_ display a 50-character field, regardless of what's contained > in the string somestring. > */ > int colorlen( const char *s, int goal ) > { > const char *p = s; > > while ( *s && goal > 0 ) > { > switch ( *s ) > { > case '&': > if ( s[1] == '-' ) > { > --goal; > s += 2; > break; > } > case '^': > ++s; > if ( *s == s[-1] ) > { > --goal; > ++s; > } > else if ( getcolor( *s ) >= 0 ) > { > ++s; > } > break; > default: > --goal; > ++s; > break; > } > } > return ( s - p ) + goal; > } > > /* This is sort of counterpoint to the above function. It takes a color-coded > string and simply returns the display length. Basically a strlen() but > ignores color codes. > */ > int c_strlen( const char *s ) > { > int len = 0; > > while ( *s ) > { > switch ( *s ) > { > case '&': > if ( s[1] == '-' ) > { > ++len; > s += 2; > break; > } > case '^': > ++s; > if ( *s == s[-1] ) > { > ++len; > ++s; > } > else if ( getcolor( *s ) >= 0 ) > { > ++s; > } > break; > default: > ++len; > ++s; > break; > } > } > return len; > } > 3234c3674,3682 < strcpy( pbuf, "\033[m" ); --- > /* > * Most clients, especially mud clients, don't revert to gray but > * to a 'default color' after a reset sequence. If we set to gray > * the prevcolor field we may experience color bleeding since > * make_color_sequence will try to curb on redundant codes based > * on prevcolor, hence ignoring explicit requests to set a Gray > * foreground - Luc 09/2000 > */ > strcpy( pbuf, "\033[0;37m" ); 3236c3684 < pbuf += 3; --- > pbuf += 7; 3238,3241d3685 < /* < * Clear out old color stuff < */ < /* make_color_sequence(NULL, NULL, NULL);*/ 3337c3781 < if ( !IS_IMMORTAL( ch ) ) --- > if ( !IS_IMMORTAL( ch ) && IS_PKILL( ch ) ) 3408c3852 < if ( !IS_IMMORTAL( ch ) ) --- > if ( !IS_IMMORTAL( ch ) && IS_PKILL( ch ) ) 3452a3897,3910 > case 'L': /* Heck, why not -- Blodkai, 1/5/2001 */ > if ( ch->wait <= 0 ) > sprintf( pbuf, " " ); > else if ( ch->wait <= 6 ) > sprintf( pbuf, "|" ); > else if ( ch->wait <= 12 ) > sprintf( pbuf, "||" ); > else if ( ch->wait <= 18 ) > sprintf( pbuf, "|||" ); > else if ( ch->wait <= 24 ) > sprintf( pbuf, "||||" ); > else > sprintf( pbuf, "!!!!!" ); > break; 3468c3926,3937 < sprintf( pbuf, "%s", flag_string( ch->in_room->room_flags, r_flags ) ); --- > sprintf( pbuf, "%s", ext_flag_string( &ch->in_room->room_flags, r_flags ) ); > break; > case 'D': /*display DND status */ > if ( IS_IMMORTAL( ch ) ) > { > if ( IS_SET( ch->pcdata->flags, PCFLAG_DND ) ) > strcpy( pbuf, "DND" ); > } > break; > case 'p': /* display who is on appear list. */ > if ( IS_IMMORTAL( ch ) ) > sprintf( pbuf, "(%s)", ch->pcdata->see_me[0] ? ch->pcdata->see_me : "" ); 3479a3949,3954 > case 'w': > stat = ch->carry_weight; > break; > case 'W': > stat = can_carry_w( ch ); > break; 3518a3994,3996 > > /* Huge modifications due to a slew of old bugs causing > color bleeding. See also set_char_color() - Luc 09/2000 */ 3521c3999 < int ln; --- > int ln = 0; 3564c4042,4045 < int newcol; --- > /* > * Getcolor() returns color and intensity infos, 4 bits > */ > int newcol = getcolor( *col ); 3566c4047 < if ( ( newcol = getcolor( *col ) ) < 0 ) --- > if ( newcol < 0 ) 3581,3582c4062,4074 < strcpy( buf, "\033[" ); < if ( ( cl & 0x88 ) != ( d->prevcolor & 0x88 ) ) --- > > /* > * Any color-enabled client understands a color-change sequence, > * but it seems most of them don't understand intensity or blink > * reset codes, only the 'set' ones or the general reset. Other > * clients instead do reset to weird foreground colors instead of > * the standard grey, so to obtain the same behavior through the > * spectrum we will resend the whole shabang if a reset occur to > * either intensity or blink :P > * Luc - 09/2000 > */ > > if ( ( ( d->prevcolor ^ cl ) & 0x88 ) & ( cl ^ 0x88 ) ) 3584,3590c4076,4084 < strcat( buf, "m\033[" ); < if ( ( cl & 0x08 ) ) < strcat( buf, "1;" ); < if ( ( cl & 0x80 ) ) < strcat( buf, "5;" ); < d->prevcolor = 0x07 | ( cl & 0x88 ); < ln = strlen( buf ); --- > /* > * One or both the attribs have been reset. Let's > * resend the whole color status. Luc 09/2000 > */ > ln = sprintf( buf, "\033[0;%s%s3%d;", > ( cl & 0x08 ) ? "1;" : "", ( cl & 0x80 ) ? "5;" : "", cl & 0x07 ); > if ( ( cl & 0x70 ) != 0 ) > ln += sprintf( buf + ln, "4%d;", ( cl & 0x70 ) >> 4 ); > buf[ln - 1] = 'm'; 3593,3594d4086 < ln = 2; < if ( ( cl & 0x07 ) != ( d->prevcolor & 0x07 ) ) 3596,3604c4088,4103 < sprintf( buf + ln, "3%d;", cl & 0x07 ); < ln += 3; < } < if ( ( cl & 0x70 ) != ( d->prevcolor & 0x70 ) ) < { < sprintf( buf + ln, "4%d;", ( cl & 0x70 ) >> 4 ); < ln += 3; < } < if ( buf[ln - 1] == ';' ) --- > /* > * No attribs cleared, so let's send only what's needed, > * plus a changed attribute can only mean it has been set, > * not reset, otherwise we would not be here. Luc 09/2000 > */ > unsigned char changes = cl ^ d->prevcolor; > > ln = sprintf( buf, "\033[" ); > if ( changes & 0x08 ) /* High Brightness */ > ln += sprintf( buf + ln, "1;" ); > if ( changes & 0x80 ) /* Blink */ > ln += sprintf( buf + ln, "5;" ); > if ( changes & 0x07 ) /* Foreground */ > ln += sprintf( buf + ln, "3%d;", cl & 0x07 ); > if ( changes & 0x70 ) /* Background */ > ln += sprintf( buf + ln, "4%d;", ( cl & 0x70 ) >> 4 ); 3606,3609d4104 < else < { < buf[ln++] = 'm'; < buf[ln] = '\0'; 3618a4114,4115 > > 3626a4124 > /* Well, Daltorak figured this could do with some commentting, so here goes -- Alty */ 3637a4136,4138 > /* > * Calculate # lines on player's screen > */ 3640a4142,4144 > /* > * Next page > */ 3643a4148,4150 > /* > * Previous page > */ 3646a4154,4156 > /* > * Redraw > */ 3649a4160,4162 > /* > * Non-stop. > */ 3653a4167,4169 > /* > * Quit > */ 3662,3663c4178,4182 < while ( lines < 0 && d->pagepoint >= d->pagebuf ) < if ( *( --d->pagepoint ) == '\n' ) --- > /* > * Search back if we need to. > */ > while ( lines < 0 && --d->pagepoint >= d->pagebuf ) > if ( *d->pagepoint == '\n' ) 3665,3666c4184,4186 < if ( *d->pagepoint == '\n' && *( ++d->pagepoint ) == '\r' ) < ++d->pagepoint; --- > /* > * pagepoint could go out of range in the above loop > */ 3668a4189,4197 > /* > * Skip a blank line if there is one. Could make this skip all blanks, but > * that was annoying (screwed up some places where blanks were wanted) > */ > if ( *d->pagepoint == '\n' && *( ++d->pagepoint ) == '\r' ) > ++d->pagepoint; > /* > * Find the end of the page > */ 3675a4205,4207 > /* > * If there's anything to show, show it > */ 3681a4214,4216 > /* > * If only whitespace remaining, terminate paging > */ 3692a4228,4230 > /* > * Display the pager prompt > */ 3699a4238,4240 > /* > * Restore previous color > */ 3704c4245 < if ( d->pagecolor == 7 ) --- > if ( d->prevcolor == 7 ) 3707,3708c4248,4249 < sprintf( buf, "\033[0;%d;%s%dm", ( d->pagecolor & 8 ) == 8, < ( d->pagecolor > 15 ? "5;" : "" ), ( d->pagecolor & 7 ) + 30 ); --- > sprintf( buf, "\033[0;%s%s3%dm", > d->prevcolor & 8 ? "1;" : "", d->prevcolor > 15 ? "5;" : "", d->prevcolor & 7 );