예제 #1
0
/****************************************************************
...
*****************************************************************/
void handle_diplomacy_remove_clause(struct packet_diplomacy_info *pa)
{
  struct Diplomacy_dialog *pdialog;

  if((pdialog=find_diplomacy_dialog(&game.players[pa->plrno0],
				&game.players[pa->plrno1]))) {
    remove_clause(&pdialog->treaty, &game.players[pa->plrno_from],
		  pa->clause_type, pa->value);
    
    update_diplomacy_dialog(pdialog);
  }

}
예제 #2
0
void distribute_spec_problem(SpecData *spec)
{
	ClauseSet *target;

	for(int i = spec->problem->num_clauses - 1; i >= 0; i--) {
		target = distribute_get_target(spec->problem->clauses[i], spec);

		assert(target == spec->P || target == spec->R);

		insert_clause(spec->problem->clauses[i], target, &spec->cl_ct);

		remove_clause(i, spec->problem);
	}	
	
	if (target == spec->R)
		set_maximal_literals(spec->R);

	return;
}
예제 #3
0
/**************************************************************************
...
**************************************************************************/
void handle_diplomacy_remove_clause(struct player *pplayer, 
				    struct packet_diplomacy_info *packet)
{
  struct Treaty *ptreaty;
  struct player *plr0, *plr1, *pgiver;
  
  plr0=&game.players[packet->plrno0];
  plr1=&game.players[packet->plrno1];
  pgiver=&game.players[packet->plrno_from];
  
  if((ptreaty=find_treaty(plr0, plr1))) {
    if(remove_clause(ptreaty, pgiver, packet->clause_type, packet->value)) {
      send_packet_diplomacy_info(plr0->conn, 
				 PACKET_DIPLOMACY_REMOVE_CLAUSE, packet);
      send_packet_diplomacy_info(plr1->conn, 
				 PACKET_DIPLOMACY_REMOVE_CLAUSE, packet);
    }
  }

}
예제 #4
0
void flwor_expr::remove_clause(flwor_clause* c, csize posHint)
{
  if (posHint < theClauses.size() && theClauses[posHint] == c)
    return remove_clause(posHint);
  
  csize numClauses = theClauses.size();
  csize i = 0;
  for (; i < numClauses; ++i)
  {
    if (theClauses[i] != c)
      continue;

    if (theClauses[i]->theFlworExpr == this)
      theClauses[i]->theFlworExpr = NULL;

    theClauses.erase(theClauses.begin() + i);

    return;
  }

  assert(i < numClauses);
}