int main(int argc, const char * argv[]) { //1.初始化数据 Init(); printf("\n------交易前-------------\n"); //2.打印这些初始化数据 ShowProps(); ShowPlayers(); Trade(&players[0], 3); //进行交易 printf("\n------交易后-------------\n"); ShowProps(); ShowPlayers(); return 0; }
void on_pe_ok_clicked(TN_WIDGET *widget,DATA_POINTER d) { TN_WIDGET_PROPS wprops; char *name; char *string; int posx,posy,height,width; RECORD *r; /*Code to update common properties*/ tnGetWidgetProps(active_widget,&wprops); name=tnGetText(pe_nametb); if(strcmp(name,"")==0) { free(name); } else { free(tnGetAttachedData(active_widget)); tnAttachData(active_widget,name); } string=tnGetText(pe_heighttb); if(strcmp(string,"")) { height=atoi(string); if(height<=0) height=wprops.height; } else height=wprops.height; free(string); string=tnGetText(pe_widthtb); if(strcmp(string,"")) { width=atoi(string); if(width<=0) width=wprops.width; } else width=wprops.width; free(string); string=tnGetText(pe_xpostb); if(strcmp(string,"")) { posx=(int)strtol(string,&endp,10); if(*endp!='\0' || posx<0) posx=wprops.posx; } else posx=wprops.posx; free(string); string=tnGetText(pe_ypostb); if(strcmp(string,"")) { posy=(int)strtol(string,&endp,10); if(*endp!='\0' || posy<0) posy=wprops.posy; } else posy=wprops.posy; free(string); r=GetFromProject(active_widget); if(r==NULL) return; /*unknown record!*/ string=tnGetSelectedComboItem(pe_enabledcb); if(string) { r->enabled=(strcmp(string,"TN_TRUE")==0)?TN_TRUE:TN_FALSE; free(string); } string=tnGetSelectedComboItem(pe_visiblecb); if(string) { r->visible=(strcmp(string,"TN_TRUE")==0)?TN_TRUE:TN_FALSE; free(string); } wprops.height=height; wprops.width=width; wprops.posx=posx; wprops.posy=posy; tnSetWidgetProps(active_widget,&wprops); /*Code to update widget specific properties*/ (*PropEditFunc[active_widget->type]) (TND_UPDATE); /*Update the properties display too*/ ShowProps(active_widget); tnDestroyWidget(propeditwin); propeditwin=NULL; tnSetEnabled(propedit_button,TN_TRUE); tnSetEnabled(deletewidget_button,TN_TRUE); tnSetEnabled(callbacks_button,TN_TRUE); }