Beispiel #1
0
void TradeManager::ListSelect(aui_Control *control, uint32 action, uint32 data, void *cookie)
{
	if(action != AUI_LISTBOX_ACTION_SELECT && action != AUI_LISTBOX_ACTION_DOUBLECLICKSELECT) {
		return;
	}

	Assert(s_tradeManager);
	if(!s_tradeManager) return;

	ctp2_ListBox *lb = (ctp2_ListBox *)control;
	Assert(lb == s_tradeManager->m_createList);
	if(lb != s_tradeManager->m_createList) return;

	s_tradeManager->UpdateAdviceText();

	ctp2_ListItem *item = (ctp2_ListItem *)lb->GetSelectedItem();
	bool canCreate = false;
	if(item) {
		CreateListData *data = (CreateListData *)item->GetUserData();
		Assert(data);
		if(data) {
			Player *pl = g_player[g_selected_item->GetVisiblePlayer()];
			Assert(pl);
			if(pl && (data->m_caravans <= pl->m_tradeTransportPoints - pl->m_usedTradeTransportPoints)) {
				canCreate = true;
			}
		}
	}
	s_tradeManager->m_createButton->Enable(canCreate);

	if(action == AUI_LISTBOX_ACTION_DOUBLECLICKSELECT) {
		
		CreateRoute(NULL, AUI_BUTTON_ACTION_EXECUTE, 0, NULL);
	}
}
Beispiel #2
0
/*********************************
* Set up interface routing
**********************************/
int InitRouteInterface(){
	int RouteID;
	DEBUGPATH;
	
	if ( (RouteID=CreateRoute("Interface"))==ROUTE_NONE){
		printf("Couldn't create route Interface\n");
		return FALSE;
	}
	
	Globals.Routes[RouteID].RouteFunc=RouteInterface;
	Globals.Routes[RouteID].AddNode=RouteInterfaceAddNode;
	
	return TRUE;
}
DXMRoute* DXMNodeDagAdapter::AddRoute(MDagPath& path)
{

	if( g_DebugExtreme )
	{
		MString name= MFnDependencyNode(GetNode()->GetSite()).name();
		MString pathName= path.fullPathName();
		DXCC_DPFA_REPORT( "(This: %s) (Path: %s)", name.asChar(), pathName.asChar() );
	}

	if(FindRoute(path))
		return NULL;

	DXCC_ASSERT( path.node() == GetNode()->GetSite() );

	DXMRoute* route= CreateRoute();
	Routes.SetAt(route, route);

	route->Initialize(this, path);

	return route;
}
Beispiel #4
0
void TradeManager::SummaryListSelect(aui_Control *control, uint32 action, uint32 data, void *cookie)
{
	if(action != AUI_LISTBOX_ACTION_SELECT && action != AUI_LISTBOX_ACTION_DOUBLECLICKSELECT) {
		return;
	}

	Assert(s_tradeManager);
	if(!s_tradeManager) return;

	ctp2_ListBox *lb = (ctp2_ListBox *)control;
	Assert(lb == s_tradeManager->m_summaryList);
	if(lb != s_tradeManager->m_summaryList) return;

	ctp2_ListItem *item = (ctp2_ListItem *)lb->GetSelectedItem();
	if(item) {
		s_tradeManager->m_breakButton->Enable(TRUE);
	} else {
		s_tradeManager->m_breakButton->Enable(FALSE);
	}
	if(action == AUI_LISTBOX_ACTION_DOUBLECLICKSELECT) {
		
		CreateRoute(NULL, AUI_BUTTON_ACTION_EXECUTE, 0, NULL);
	}
}