📄 smonitor_dev.c
字号:
/* * Copyright (c) 1999 - 2001, Artur Merke <amerke@ira.uka.de> * * This file is part of FrameView2d. * * FrameView2d is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * FrameView2d is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FrameView2d; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include "smonitor_dev.h"#include "global_defs.h"#include <boost/cstdint.hpp>#ifdef HAVE_SSTREAM#include <sstream>#else#include <strstream>#endif#include <iostream>#include <iomanip>#include <cstdio> /* Standard I/O definitions. */#include <cstdlib> /* Standard C Library definitions. */#include <cstring> /* C Library string functions. */#include <cctype> /* isprint(...) */#include <netinet/in.h> /* wegen htons(...)*/#include <cmath>//#include "object2d.h"#include "rgb_db.h"#include "ascii_processor.h"#include "str2val.h"//#include "tools.h"//#define DEBUG(XXX) cout << "\ndebug(" << __LINE__ << "):" XXX << flush#define DEBUG(XXX)typedef boost::int16_t Int16;typedef boost::int32_t Int32;//#define WEBFIELD 1 //just a macro which doesn't show the menu and the players (for the NetPlayer)/***************************************************************************** \short soccerserver parameters (version 1 and 2) This part contains server specific data types, which are taken from the files - sserver-6.XX/server/param.h - sserver-6.XX/server/utility and for the extension for protocol version 2 - sserver-7.00/server/param.h - sserver-7.00/server/utility*/namespace SSrv {// from utility.h#define PI M_PI// from param.h#define SHOWINFO_SCALE 16.0#define SHOWINFO_SCALE2 65536.0 //ver. 2#define SHOWINFO_SCALE2_int 65536 //art!#define NO_INFO 0 //ver. 2#define SHOW_MODE 1#define MSG_MODE 2#define DRAW_MODE 3#define BLANK_MODE 4#define PM_MODE 5 //ver. 2#define TEAM_MODE 6 //ver. 2#define PT_MODE 7 //ver. 2#define PARAM_MODE 8 //ver. 2#define PPARAM_MODE 9 //ver. 2#define FRAMEVIEW_MODE 10 //art!!!#define DrawClear 0#define DrawPoint 1#define DrawCircle 2#define DrawLine 3#define MSG_BOARD 1#define LOG_BOARD 2//#define MAX_PLAYER 11#define DISABLE 0x0000#define STAND 0x0001#define KICK 0x0002#define KICK_FAULT 0x0004#define GOALIE 0x0008#define CATCH 0x0010#define CATCH_FAULT 0x0020#define BALL_TO_PLAYER 0x0040#define PLAYER_TO_BAL 0x0080#define DISCARD 0x0100#define BALL_COLLIDE 0x0400 // player collided with the ball#define PLAYER_COLLIDE 0x0800 // player collided with another player#define TACKLE 0x1000#define TACKLE_FAULT 0x2000#define BACK_PASS 0x4000#define FREE_KICK_FAULT 0x8000#define PLAYMODE_STRINGS {"",\ "before_kick_off",\ "time_over",\ "play_on",\ "kick_off_l",\ "kick_off_r",\ "kick_in_l",\ "kick_in_r",\ "free_kick_l",\ "free_kick_r",\ "corner_kick_l",\ "corner_kick_r",\ "goal_kick_l",\ "goal_kick_r",\ "goal_l",\ "goal_r",\ "drop_ball",\ "offside_l",\ "offside_r",\ "penalty_kick_l",\ "penalty_kick_r",\ "first_half_over",\ "pause",\ "human_judge",\ "foul_charge_l",\ "foul_charge_r",\ "foul_push_l",\ "foul_push_r",\ "foul_multiple_attack_l",\ "foul_multiple_attack_r",\ "foul_ballout_l",\ "foul_ballout_r",\ "back_pass_l", \ "back_pass_r", \ "free_kick_fault_l", \ "free_kick_fault_r", \ "catch_fault_l", \ "catch_fault_r", \ "indirect_free_kick_l", \ "indirect_free_kick_r",\ "penalty_setup_l", \ "penalty_setup_r",\ "penalty_ready_l",\ "penalty_ready_r", \ "penalty_taken_l", \ "penalty_taken_r", \ "penalty_miss_l", \ "penalty_miss_r", \ "penalty_score_l", \ "penalty_score_r" \ }const int PLAYMODE_STRINGS_SIZE = 36 + 14;#define COLOR_NAME_MAX 64typedef struct { Int16 enable ; Int16 side ; Int16 unum ; Int16 angle ; Int16 x ; Int16 y ;} pos_t ;typedef struct { char name[16] ; Int16 score ;} team_t ;typedef struct { char pmode ; team_t team[2] ; pos_t pos[MAX_PLAYER * 2 + 1] ; Int16 time ;} showinfo_t ;typedef struct { Int16 board ; char message[2048] ;} msginfo_t ;typedef struct { Int16 x ; Int16 y ; char color[COLOR_NAME_MAX] ;} pointinfo_t ;typedef struct { Int16 x ; Int16 y ; Int16 r ; char color[COLOR_NAME_MAX] ;} circleinfo_t ;typedef struct { Int16 x1 ; Int16 y1 ; Int16 x2 ; Int16 y2 ; char color[COLOR_NAME_MAX] ;} lineinfo_t ;typedef struct { Int16 mode ; union { pointinfo_t pinfo ; circleinfo_t cinfo ; lineinfo_t linfo ; } object ;} drawinfo_t ;typedef struct { Int16 mode ; union { showinfo_t show ; msginfo_t msg ; drawinfo_t draw ; } body ;} dispinfo_t ;typedef struct { Int32 x; Int32 y; Int32 deltax; Int32 deltay;} ball_t;typedef struct { Int16 mode; Int16 type; Int32 x; Int32 y; Int32 deltax; Int32 deltay; Int32 body_angle; Int32 head_angle; Int32 view_width; Int16 view_quality; Int32 stamina; Int32 effort; Int32 recovery; Int16 kick_count; Int16 dash_count; Int16 turn_count; Int16 say_count; Int16 tneck_count; Int16 catch_count; Int16 move_count; Int16 chg_view_count;} player_t;typedef struct { char pmode ; team_t team[2] ; ball_t ball; player_t pos[MAX_PLAYER * 2] ; Int16 time ;} showinfo_t2 ;typedef struct { Int16 id; Int32 player_speed_max; Int32 stamina_inc_max; Int32 player_decay; Int32 inertia_moment; Int32 dash_power_rate; Int32 player_size; Int32 kickable_margin; Int32 kick_rand; Int32 extra_stamina; Int32 effort_max; Int32 effort_min; // spare variables which are to be used for paramenter added in the future Int32 sparelong1; Int32 sparelong2; Int32 sparelong3; Int32 sparelong4; Int32 sparelong5; Int32 sparelong6; Int32 sparelong7; Int32 sparelong8; Int32 sparelong9; Int32 sparelong10;} player_type_t;typedef struct{ Int32 gwidth ; /* goal width */ Int32 inertia_moment ; /* intertia moment for turn */ Int32 psize ; /* player size */ Int32 pdecay ; /* player decay */ Int32 prand ; /* player rand */ Int32 pweight ; /* player weight */ Int32 pspeed_max ; /* player speed max */ // th 6.3.00 Int32 paccel_max ; /* player acceleration max */ // Int32 stamina_max ; /* player stamina max */ Int32 stamina_inc ; /* player stamina inc */ Int32 recover_init ; /* player recovery init */ Int32 recover_dthr ; /* player recovery decriment threshold */ Int32 recover_min ; /* player recovery min */ Int32 recover_dec ; /* player recovery decriment */ Int32 effort_init ; /* player dash effort init */ Int32 effort_dthr ; /* player dash effort decriment threshold */ Int32 effort_min ; /* player dash effrot min */ Int32 effort_dec ; /* player dash effort decriment */ Int32 effort_ithr ; /* player dash effort incriment threshold */ Int32 effort_inc ; /* player dash effort incriment */ // pfr 8/14/00: for RC2000 evaluation Int32 kick_rand; /* noise added directly to kicks */ Int16 team_actuator_noise; /* flag whether to use team specific actuator noise */ Int32 prand_factor_l; /* factor to multiple prand for left team */ Int32 prand_factor_r; /* factor to multiple prand for right team */ Int32 kick_rand_factor_l; /* factor to multiple kick_rand for left team */ Int32 kick_rand_factor_r; /* factor to multiple kick_rand for right team */ Int32 bsize ; /* ball size */ Int32 bdecay ; /* ball decay */ Int32 brand ; /* ball rand */ Int32 bweight ; /* ball weight */ Int32 bspeed_max ; /* ball speed max */ // th 6.3.00 Int32 baccel_max; /* ball acceleration max */ // Int32 dprate ; /* dash power rate */ Int32 kprate ; /* kick power rate */ Int32 kmargin ; /* kickable margin */ Int32 ctlradius ; /* control radius */ Int32 ctlradius_width ; /* (control radius) - (plyaer size) */ Int32 maxp ; /* max power */ Int32 minp ; /* min power */ Int32 maxm ; /* max moment */ Int32 minm ; /* min moment */ Int32 maxnm ; /* max neck moment */ Int32 minnm ; /* min neck moment */ Int32 maxn ; /* max neck angle */ Int32 minn ; /* min neck angle */ Int32 visangle ; /* visible angle */ Int32 visdist ; /* visible distance */ Int32 windir ; /* wind direction */ Int32 winforce ; /* wind force */ Int32 winang ; /* wind angle for rand */ Int32 winrand ; /* wind force for force */ Int32 kickable_area ; /* kickable_area */ Int32 catch_area_l ; /* goalie catchable area length */ Int32 catch_area_w ; /* goalie catchable area width */ Int32 catch_prob ; /* goalie catchable possibility */ Int16 goalie_max_moves; /* goalie max moves after a catch */ Int32 ckmargin ; /* corner kick margin */ Int32 offside_area ; /* offside active area size */ Int16 win_no ; /* wind factor is none */ Int16 win_random ; /* wind factor is random */ Int16 say_cnt_max ; /* max count of coach SAY */ Int16 SayCoachMsgSize ; /* max length of coach SAY */ Int16 clang_win_size; Int16 clang_define_win; Int16 clang_meta_win; Int16 clang_advice_win; Int16 clang_info_win; Int16 clang_mess_delay; Int16 clang_mess_per_cycle; Int16 half_time ; /* half time */ Int16 sim_st ; /* simulator step interval msec */ Int16 send_st ; /* udp send step interval msec */ Int16 recv_st ; /* udp recv step interval msec */ Int16 sb_step ; /* sense_body interval step msec */ Int16 lcm_st ; /* lcm of all the above steps msec */ Int16 SayMsgSize ; /* string size of say message */ Int16 hear_max ; /* player hear_capacity_max */ Int16 hear_inc ; /* player hear_capacity_inc */ Int16 hear_decay ; /* player hear_capacity_decay */ Int16 cban_cycle ; /* goalie catch ban cycle */ Int16 slow_down_factor ; /* factor to slow down simulator and send intervals */ Int16 useoffside ; /* flag for using off side rule */ Int16 kickoffoffside ; /* flag for permit kick off offside */ Int32 offside_kick_margin ; /* offside kick margin */ Int32 audio_dist ; /* audio cut off distance */ Int32 dist_qstep ; /* quantize step of distance */ Int32 land_qstep ; /* quantize step of distance for landmark */ Int32 dir_qstep ; /* quantize step of direction */ Int32 dist_qstep_l ; /* team right quantize step of distance */ Int32 dist_qstep_r ; /* team left quantize step of distance */ Int32 land_qstep_l ; /* team right quantize step of distance for landmark */ Int32 land_qstep_r ; /* team left quantize step of distance for landmark */ Int32 dir_qstep_l ; /* team left quantize step of direction */ Int32 dir_qstep_r ; /* team right quantize step of direction */ Int16 CoachMode ; /* coach mode */ Int16 CwRMode ; /* coach with referee mode */ Int16 old_hear ; /* old format for hear command (coach) */ Int16 sv_st ; /* online coach's look interval step */ // spare variables which are to be used for paramenter added in the future Int32 sparelong1; Int32 sparelong2; Int32 sparelong3; Int32 sparelong4; Int32 sparelong5; Int32 sparelong6; Int32 sparelong7; Int32 sparelong8; Int32 sparelong9; Int32 sparelong10; Int16 spareshort1; Int16 spareshort2; Int16 spareshort3; Int16 spareshort4; Int16 spareshort5; Int16 spareshort6; Int16 spareshort7;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -