コード例 #1
0
ファイル: CQuery.cpp プロジェクト: COJIDAT/vcmi-ios
CQuery::CQuery(void)
{
	boost::unique_lock<boost::mutex> l(Queries::mx);

	static QueryID QID = QueryID(0);

	queryID = ++QID;
	logGlobal->traceStream() << "Created a new query with id " << queryID;
}
コード例 #2
0
CQuery::CQuery(void)
{
	boost::unique_lock<boost::mutex> l(Queries::mx);

	static QueryID QID = QueryID(0);

	queryID = ++QID;
	logGlobal->trace("Created a new query with id %d", queryID);
}
コード例 #3
0
bool QueryReply::applyGh( CGameHandler *gh )
{
	auto playerToConnection = gh->connections.find(player);
	if(playerToConnection == gh->connections.end())
		COMPLAIN_AND_RETURN("No such player!");
	if(playerToConnection->second != c)
		COMPLAIN_AND_RETURN("Message came from wrong connection!");
	if(qid == QueryID(-1))
		COMPLAIN_AND_RETURN("Cannot answer the query with id -1!");

	assert(vstd::contains(gh->states.players, player));
	return gh->queryReply(qid, answer, player);
}
コード例 #4
0
ファイル: InfoWindows.cpp プロジェクト: COJIDAT/vcmi-ios
CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo &comps, const TButtonsInfo &Buttons, bool delComps)
{
	OBJ_CONSTRUCTION_CAPTURING_ALL;

	type |= BLOCK_ADV_HOTKEYS;
	ID = QueryID(-1);
	for(auto & Button : Buttons)
	{
		CButton *button = new CButton(Point(0,0), Button.first, CButton::tooltip(), std::bind(&CInfoWindow::close,this));
		button->borderColor = Colors::METALLIC_GOLD;
		button->addCallback(Button.second); //each button will close the window apart from call-defined actions
		buttons.push_back(button);
	}

	text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE);
	if(!text->slider)
	{
		text->resize(text->label->textSize);
	}

	if(buttons.size())
	{
		buttons.front()->assignedKeys.insert(SDLK_RETURN); //first button - reacts on enter
		buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape
	}

	for(auto & comp : comps)
	{
		comp->recActions = 0xff;
		addChild(comp);
		comp->recActions &= ~(SHOWALL | UPDATE);
		components.push_back(comp);
	}
	setDelComps(delComps);
	CMessage::drawIWindow(this,Text,player);
}
コード例 #5
0
bool KInteractiveConnect::SendMsg(KEMessage *msg)
{
  printf("+- Interactive::SendMessage MESSAGE::Emmiting slotReceiveMsg\n");
  emit signalReceiveMsg(msg,QueryID());
  return true;
}
コード例 #6
0
ファイル: InfoWindows.cpp プロジェクト: COJIDAT/vcmi-ios
CInfoWindow::CInfoWindow()
{
	ID = QueryID(-1);
	setDelComps(false);
	text = nullptr;
}