? dipls.gz ? ideee ? reaction-time.diff ? schnelldipl Index: common/unit.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v retrieving revision 1.89 diff -u -r1.89 unit.h --- common/unit.h 2002/08/07 11:21:49 1.89 +++ common/unit.h 2002/10/26 14:07:39 @@ -133,6 +133,7 @@ bool paradropped; bool connecting; int transported_by; + struct timeval begin,end; struct goto_route *pgr; }; Index: server/unithand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v retrieving revision 1.234 diff -u -r1.234 unithand.c --- server/unithand.c 2002/09/27 12:32:48 1.234 +++ server/unithand.c 2002/10/26 14:07:42 @@ -269,11 +269,31 @@ struct unit *pdiplomat=player_find_unit_by_id(pplayer, packet->diplomat_id); struct unit *pvictim=find_unit_by_id(packet->target_id); struct city *pcity=find_city_by_id(packet->target_id); + long sec,usec; if (!pdiplomat || !unit_flag(pdiplomat, F_DIPLOMAT)) { return; } + /* This measures the time a player needs between the popup is sent to the client and + * a diplomat-action packet is sent to server */ + if (gettimeofday(&pdiplomat->end,(struct timezone *)0)) { + freelog(LOG_ERROR, "can not get time\n"); + } + freelog(LOG_VERBOSE,"Starting time is : %d sec %d usec\n", + (int)pdiplomat->begin.tv_sec, (int)pdiplomat->begin.tv_usec); + freelog(LOG_VERBOSE,"End time of action: %d sec %d usec\n", + (int)pdiplomat->end.tv_sec, (int)pdiplomat->end.tv_usec); + freelog (LOG_NORMAL, "Diplomat Action performed."); + sec = pdiplomat->end.tv_sec - pdiplomat->begin.tv_sec; + usec = pdiplomat->end.tv_usec - pdiplomat->begin.tv_usec; + if(usec < 0) { + usec += 1000000; + sec--; + } + freelog(LOG_NORMAL,"reaction time for %s is: %d sec %d usec\n", pplayer->name, + (int)sec, (int)usec); + if(pdiplomat->moves_left > 0) { switch(packet->action_type) { case DIPLOMAT_BRIBE: @@ -932,6 +952,14 @@ } packet.diplomat_id = punit->id; packet.action_type = DIPLOMAT_CLIENT_POPUP_DIALOG; + + /* get the time to measure diplomat-actions */ + if (gettimeofday(&punit->begin,(struct timezone *)0)) { + freelog(LOG_ERROR, "can not get time\n"); + } + freelog(LOG_VERBOSE,"Time start: %d sec %d usec\n", + (int)punit->begin.tv_sec,(int)punit->begin.tv_usec); + lsend_packet_diplomat_action(player_reply_dest(pplayer), &packet); return FALSE; } else if (!can_unit_move_to_tile(punit, dest_x, dest_y, igzoc)) {