@@ -988,160 +988,6 @@ int do_top(CommandQueue *queue, int ncmds) {
988988 return count ;
989989}
990990
991- /*
992- * ---------------------------------------------------------------------------
993- * * do_ps: tell player what commands they have pending in the queue
994- */
995-
996- static void show_que (EvaluationContext * evaluation , DbRef player , int key ,
997- BQUE * queue , RuntimeClock * clock , int * qent ,
998- const char * header ) {
999- BQUE * tmp ;
1000- char * bp , * bufp ;
1001- int i ;
1002-
1003- for (tmp = queue ; tmp ; tmp = tmp -> next ) {
1004- (* qent )++ ;
1005- if (key == PS_SUMM )
1006- continue ;
1007- if (* qent == 1 )
1008- notify_printf (evaluation , player , "----- %s Queue -----" , header );
1009-
1010- bufp = unparse_object (evaluation -> world -> database , evaluation , player ,
1011- tmp -> player , 0 );
1012- if (!(key & PS_ALL ))
1013- if ((player !=
1014- game_object_owner (evaluation -> world -> database , tmp -> player )))
1015- continue ;
1016- if ((tmp -> waittime > 0 ) &&
1017- is_good_obj (evaluation -> world -> database , tmp -> sem ))
1018- notify_printf (evaluation , player , "[#%ld/%ld]%s:%s" , tmp -> sem ,
1019- tmp -> waittime - clock -> now , bufp , tmp -> comm );
1020- else if (tmp -> waittime > 0 )
1021- notify_printf (evaluation , player , "[%ld]%s:%s" ,
1022- tmp -> waittime - clock -> now , bufp , tmp -> comm );
1023- else if (is_good_obj (evaluation -> world -> database , tmp -> sem ))
1024- notify_printf (evaluation , player , "[#%ld]%s:%s" , tmp -> sem , bufp ,
1025- tmp -> comm );
1026- else
1027- notify_printf (evaluation , player , "%s:%s" , bufp , tmp -> comm );
1028-
1029- bp = bufp ;
1030- if (key == PS_LONG ) {
1031- for (i = 0 ; i < (tmp -> nargs ); i ++ ) {
1032- if (tmp -> env [i ] != nullptr ) {
1033- safe_str ("; Arg" , bufp , & bp );
1034- safe_chr ((char )(i + '0' ), bufp , & bp );
1035- safe_str ("='" , bufp , & bp );
1036- safe_str (tmp -> env [i ], bufp , & bp );
1037- safe_chr ('\'' , bufp , & bp );
1038- }
1039- }
1040- * bp = '\0' ;
1041- bp = unparse_object (evaluation -> world -> database , evaluation , player ,
1042- tmp -> cause , 0 );
1043- notify_printf (evaluation , player , " Enactor: %s%s" , bp , bufp );
1044- free_lbuf (bp );
1045- }
1046- free_lbuf (bufp );
1047- }
1048- return ;
1049- }
1050-
1051- void do_ps (CommandInvocation * invocation ) {
1052- EvaluationContext * evaluation = & invocation -> context -> evaluation ;
1053- DbRef player = invocation -> player ;
1054- int key = invocation -> key ;
1055- char * target = invocation -> first ;
1056- CommandQueue * queue = invocation -> context -> runtime -> commands ;
1057- DbRef player_targ , obj_targ ;
1058- int pqent , pqtot , wqent , wqtot , sqent , sqtot ;
1059- OBJQE * objq ;
1060- int tempkey ;
1061-
1062- /*
1063- * Figure out what to list the queue for
1064- */
1065-
1066- if ((key & PS_ALL ) && !is_wizard (queue -> world -> database , player )) {
1067- notify (evaluation , player , "Permission denied." );
1068- return ;
1069- }
1070- if (!target || !* target ) {
1071- obj_targ = NOTHING ;
1072- if (key & PS_ALL ) {
1073- player_targ = NOTHING ;
1074- } else {
1075- player_targ = game_object_owner (queue -> world -> database , player );
1076- if (typeof_obj (queue -> world -> database , player ) != TYPE_PLAYER )
1077- obj_targ = player ;
1078- }
1079- } else {
1080- player_targ = game_object_owner (queue -> world -> database , player );
1081- obj_targ = match_controlled (& invocation -> context -> match , player , target );
1082- if (obj_targ == NOTHING )
1083- return ;
1084- if (key & PS_ALL ) {
1085- notify (evaluation , player , "Can't specify a target and /all" );
1086- return ;
1087- }
1088- if (typeof_obj (queue -> world -> database , obj_targ ) == TYPE_PLAYER ) {
1089- player_targ = obj_targ ;
1090- obj_targ = NOTHING ;
1091- }
1092- }
1093- tempkey = key ;
1094- key = key & ~PS_ALL ;
1095- switch (key ) {
1096- case PS_BRIEF :
1097- case PS_SUMM :
1098- case PS_LONG :
1099- break ;
1100- default :
1101- notify (evaluation , player , "Illegal combination of switches." );
1102- return ;
1103- }
1104-
1105- /*
1106- * Go do it
1107- */
1108- pqent = 0 ;
1109- pqtot = 0 ;
1110- if (player_targ == NOTHING ) {
1111- objq = queue -> head ;
1112- while (objq && (objq = objq -> next ) != nullptr ) {
1113- pqent = 0 ;
1114- show_que (evaluation , player , tempkey , objq -> cque , queue -> clock , & pqent ,
1115- "PLAYAH" );
1116- pqtot += pqent ;
1117- }
1118- } else {
1119- pqent = 0 ;
1120- objq = cque_find (queue , player_targ );
1121- if (objq ) {
1122- show_que (evaluation , player , tempkey , objq -> cque , queue -> clock , & pqent ,
1123- "PLAYAH" );
1124- }
1125- }
1126-
1127- wqent = 0 ;
1128- sqent = 0 ;
1129- wqtot = 0 ;
1130- sqtot = 0 ;
1131- show_que (evaluation , player , tempkey , queue -> wait , queue -> clock , & wqent ,
1132- "Wait" );
1133- show_que (evaluation , player , tempkey , queue -> semaphore_first , queue -> clock ,
1134- & sqent , "Semaphore" );
1135-
1136- /*
1137- * Display stats
1138- */
1139-
1140- notify_printf (evaluation , player ,
1141- "Totals: Player...%d/%d Wait...%d/%d Semaphore...%d/%d" ,
1142- pqent , pqtot , wqent , wqtot , sqent , sqtot );
1143- }
1144-
1145991/*
1146992 * ---------------------------------------------------------------------------
1147993 * * do_kick: Queue management
0 commit comments