コード例 #1
0
void LevelFactory::LoadLevelListFromXML(const std::string& aXMLPath)
{
	myLevelPaths.clear();
	XMLReader reader;
	reader.OpenDocument(aXMLPath);
	std::string levelPath = "";
	int ID = 0;
	int lastID = ID - 1;

	tinyxml2::XMLElement* levelElement = reader.FindFirstChild("level");
	for (; levelElement != nullptr; levelElement = reader.FindNextElement(levelElement))
	{
		lastID = ID;
		
		reader.ForceReadAttribute(levelElement, "ID", ID);
		reader.ForceReadAttribute(levelElement, "path", levelPath);
		myLevelPaths[ID] = levelPath;

		if (ID - 1 != lastID)
		{
			DL_ASSERT("[LevelFactory] Wrong ID-number in levelList.xml! The numbers should be counting up, in order.");
		}
		if (myCurrentID >= 10)
		{
			DL_ASSERT("[LevelFactory] Can't handle level ID with two digits.");
		}
	}
	reader.CloseDocument();
}
コード例 #2
0
ファイル: Sprite.cpp プロジェクト: nian0601/Spaceshooter
void Prism::Sprite::ResizeTexture(ID3D11Texture2D* aSrcTexture)
{
	myTexture->Release();
	myShaderView->Release();

	D3D11_TEXTURE2D_DESC desc;
	aSrcTexture->GetDesc(&desc);
	desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

	HRESULT hr = Engine::GetInstance()->GetDevice()->CreateTexture2D(&desc, NULL, &myTexture);
	if (FAILED(hr))
	{
		DL_ASSERT("Failed to CreateTexture2D");
	}
	Engine::GetInstance()->SetDebugName(myTexture, "Sprite::myTexture");

	hr = Engine::GetInstance()->GetDevice()->CreateShaderResourceView(myTexture, NULL, &myShaderView);
	if (FAILED(hr))
	{
		DL_ASSERT("Failed to CopyFromD3DTexture");
	}
	Engine::GetInstance()->SetDebugName(myShaderView, "Sprite::myShaderView");

	CopyFromD3DTexture(aSrcTexture);

	mySurfaces.DeleteAll();
	InitSurface("DiffuseTexture", myShaderView);
}
コード例 #3
0
ファイル: XMLWriter.cpp プロジェクト: wardh/ZeldaClone
void XMLWriter::SetAttribute(XMLElement aElement, const std::string& aAttributeName, const bool aValue)
{
	if (myHasCreatedDoc == false)
	{
		DL_DEBUG("[XMLWriter]: Tried to [InsertElement] before Creating an document");
		DL_ASSERT("[XMLWriter]: Failed to SaveDocument");
	}

	if (aElement == nullptr)
	{
		if (aValue == true)
		{
			DL_DEBUG("[XMLWriter]: Tried to [SetAttribute] to a Element that dint exist. Attribute: %s, Value: %s", aAttributeName.c_str(), "true");

		}
		else
		{
			DL_DEBUG("[XMLWriter]: Tried to [SetAttribute] to a Element that dint exist. Attribute: %s, Value: %s", aAttributeName.c_str(), "false");

		}

		DL_ASSERT("[XMLWriter]: Failed to SetAttribute");
	}

	aElement->SetAttribute(aAttributeName.c_str(), aValue);
	myHasUnsavedChanges = true;
}
コード例 #4
0
ファイル: LineRenderer.cpp プロジェクト: ebithril/ModelViewer
	void LineRenderer::DrawLines(CU::GrowingArray<CU::RenderCommandLine, unsigned int>& someLines)
	{
		if (someLines.Size() > 0)
		{
			D3D11_MAPPED_SUBRESOURCE resource;
			ZeroMemory(&resource, sizeof(resource));
			myEngine->GetContext()->Map(myLineDummyBuffer.myVertexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);

			memcpy(resource.pData, reinterpret_cast<void*>(&(someLines[0].myFirstPoint.x)), someLines.Size() * sizeof(float) * 8);

			myEngine->GetContext()->Unmap(myLineDummyBuffer.myVertexBuffer.Get(), 0);
			myEngine->GetContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
			myEngine->GetContext()->IASetVertexBuffers(0, 1, &myLineDummyBuffer.myVertexBuffer, &myLineDummyBuffer.myStride, &myLineDummyBuffer.myByteOffset);
			myEngine->GetContext()->IASetInputLayout(myLineInputLayout.Get());

			COMObjectPointer<ID3DX11EffectPass> pass = myLineTechnique->GetPassByIndex(0);

			if (pass->IsValid() == false)
			{
				DL_ASSERT("Pass invalid");
			}
			HRESULT passResult = pass->Apply(NULL, myEngine->GetContext().Get());
			if (FAILED(passResult))
			{
				DL_ASSERT("Pass failed.");
			}
			myEngine->GetContext()->Draw(someLines.Size() * 2, 0);
		}
	}
コード例 #5
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
bool XMLReader::ForceReadAttribute(const XMLElement aElementToReadFrom, const std::string& aAttributeToRead, bool* aTargetVariable) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [ReadAttribute(bool)] before Opening the document");

	if (aElementToReadFrom->QueryBoolAttribute(aAttributeToRead.c_str(), aTargetVariable) == tinyxml2::XML_NO_ERROR)
		return true;

	DL_DEBUG("Failed to read Attribute: [ %s ], from Element: [ %s ], in Document: [ %s ]", aAttributeToRead.c_str(), aElementToReadFrom->Name(), myFilePath.c_str());
	DL_ASSERT("Failed to [ForceReadAttribute(bool)], check DebugLog for more info");
	return false;
}
コード例 #6
0
ファイル: Sprite.cpp プロジェクト: nian0601/Spaceshooter
Prism::Sprite::Sprite(ID3D11Texture2D* aTexture, const CU::Vector2<float>& aSpriteSize
	, const CU::Vector2<float>& aHotSpot)
	: mySize(aSpriteSize)
	, myHotspot(aHotSpot)
	, myTexture(nullptr)
	, myShaderView(nullptr)
{
	myFileName = "Inited from ID3D11Texture";

	myEffect = Engine::GetInstance()->GetEffectContainer()->GetEffect("Data/Resource/Shader/S_effect_sprite.fx");
	myEffect->AddListener(this);

	D3D11_INPUT_ELEMENT_DESC vertexDesc[] =
	{
		{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
		{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	};

	D3D11_TEXTURE2D_DESC desc;
	aTexture->GetDesc(&desc);
	desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

	HRESULT hr = Engine::GetInstance()->GetDevice()->CreateTexture2D(&desc, NULL, &myTexture);
	if (FAILED(hr))
	{
		DL_ASSERT("Failed to CreateTexture2D");
	}
	Engine::GetInstance()->SetDebugName(myTexture, "Sprite::myTexture");

	hr = Engine::GetInstance()->GetDevice()->CreateShaderResourceView(myTexture, NULL, &myShaderView);
	if (FAILED(hr))
	{
		DL_ASSERT("Failed to CopyFromD3DTexture");
	}
	Engine::GetInstance()->SetDebugName(myShaderView, "Sprite::myShaderView");

	
	CopyFromD3DTexture(aTexture);

	InitInputLayout(vertexDesc, ARRAYSIZE(vertexDesc), "Sprite::InputLayout");
	InitVertexBuffer(sizeof(VertexPosUV), D3D11_USAGE_IMMUTABLE, 0);
	InitSurface("DiffuseTexture", myShaderView);
	InitIndexBuffer();
	InitBlendState("Sprite::BlendState");

	ZeroMemory(myInitData, sizeof(myInitData));

	CreateVertices();
}
コード例 #7
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
bool XMLReader::ForceReadAttribute(const XMLElement aElementToReadFrom, const std::string& aAttributeToRead, std::string& aTargetVariable) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [ForceReadAttribute(string)] before Opening the document");

	if (aElementToReadFrom->FindAttribute(aAttributeToRead.c_str()) != 0)
	{
		aTargetVariable = aElementToReadFrom->Attribute(aAttributeToRead.c_str());
		return true;
	}

	DL_DEBUG("Failed to read Attribute: [ %s ], from Element: [ %s ], in Document: [ %s ]", aAttributeToRead.c_str(), aElementToReadFrom->Name(), myFilePath.c_str());
	DL_ASSERT("Failed to [ForceReadAttribute(string)], check DebugLog for more info");
	return false;
}
コード例 #8
0
ファイル: dl_convert.cpp プロジェクト: matricks/datalibrary
dl_error_t dl_internal_convert_no_header( dl_ctx_t       dl_ctx,
                                          unsigned char* packed_instance, unsigned char* packed_instance_base,
                                          unsigned char* out_instance,    size_t         out_instance_size,
                                          size_t*        needed_size,
                                          dl_endian_t    src_endian,      dl_endian_t    out_endian,
                                          dl_ptr_size_t  src_ptr_size,    dl_ptr_size_t  out_ptr_size,
                                          const SDLType* root_type,       size_t         base_offset )
{
	dl_binary_writer writer;
	dl_binary_writer_init( &writer, out_instance, out_instance_size, out_instance == 0x0, src_endian, out_endian, out_ptr_size );

	SConvertContext ConvCtx( src_endian, out_endian, src_ptr_size, out_ptr_size );

	ConvCtx.m_lInstances.Add(SInstance(packed_instance, root_type, 0x0, dl_type_t(DL_TYPE_ATOM_POD | DL_TYPE_STORAGE_STRUCT)));
	dl_error_t err = dl_internal_convert_collect_instances(dl_ctx, root_type, packed_instance, packed_instance_base, ConvCtx);

	// TODO: we need to sort the instances here after their offset!

	SInstance* insts = ConvCtx.m_lInstances.GetBasePtr();
	std::sort( insts, insts + ConvCtx.m_lInstances.Len(), dl_internal_sort_pred );

	for(unsigned int i = 0; i < ConvCtx.m_lInstances.Len(); ++i)
	{
		err = dl_internal_convert_write_instance( dl_ctx, ConvCtx.m_lInstances[i], &ConvCtx.m_lInstances[i].m_OffsetAfterPatch, ConvCtx, &writer );
		if(err != DL_ERROR_OK) 
			return err;
	}

	if(out_instance != 0x0) // no need to patch data if we are only calculating size
	{
		for(unsigned int i = 0; i < ConvCtx.m_lPatchOffset.Len(); ++i)
		{
			SConvertContext::PatchPos& PP = ConvCtx.m_lPatchOffset[i];

			// find new offset
			pint NewOffset = pint(-1);

			for(unsigned int j = 0; j < ConvCtx.m_lInstances.Len(); ++j )
			{
				pint OldOffset = ConvCtx.m_lInstances[j].m_pAddress - packed_instance_base;

				if(OldOffset == PP.m_OldOffset)
				{
					NewOffset = ConvCtx.m_lInstances[j].m_OffsetAfterPatch;
					break;
				}
			}

			DL_ASSERT(NewOffset != pint(-1) && "We should have found the instance!");

			dl_binary_writer_seek_set( &writer, PP.m_Pos );
			dl_binary_writer_write_ptr( &writer, NewOffset + base_offset );
		}
	}

	dl_binary_writer_seek_end( &writer );
	*needed_size = (unsigned int)dl_binary_writer_tell( &writer );

	return err;
}
コード例 #9
0
ファイル: dl_convert.cpp プロジェクト: matricks/datalibrary
static pint DLInternalReadPtrData( const uint8*  _pPtrData,
								   dl_endian_t   _SourceEndian,
								   dl_ptr_size_t _PtrSize )
{
	switch(_PtrSize)
	{
		case DL_PTR_SIZE_32BIT:
		{
			uint32 Offset = *(uint32*)_pPtrData;

			if(_SourceEndian != DL_ENDIAN_HOST)
				return (pint)dl_swap_endian_uint32( Offset );
			else
				return (pint)Offset;
		}
		break;
		case DL_PTR_SIZE_64BIT:
		{
			uint64 Offset = *(uint64*)_pPtrData;

			if(_SourceEndian != DL_ENDIAN_HOST)
				return (pint)dl_swap_endian_uint64( Offset );
			else
				return (pint)Offset;
		}
		break;
		default:
			DL_ASSERT(false && "Invalid ptr-size");
	}

	return 0;
}
コード例 #10
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::FindNextElement(XMLElement aPrevElement, const std::string& aElementName) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindNextElement] before Opening the document");

	return aPrevElement->NextSiblingElement(aElementName.c_str());
}
コード例 #11
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::FindNextElement(XMLElement aPrevElement) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindNextElement] before Opening the document");

	return aPrevElement->NextSiblingElement();
}
コード例 #12
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::FindFirstChild(const std::string& aChildName) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindFirstChild] before Opening the document");

	return myDoc->FirstChildElement(aChildName.c_str());
}
コード例 #13
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
std::string XMLReader::GetElementName(XMLElement aElement) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [GetElementName] before Opening the document");

	return aElement->Name();
}
コード例 #14
0
ファイル: Worker.cpp プロジェクト: wardh/ZeldaClone
	Worker::~Worker()
	{
		if (myThread != nullptr)
		{
			DL_ASSERT("Worker not destroyed.");
		}
	}
コード例 #15
0
	void AddWrittenPtr( const void* ptr, uintptr_t pos )
	{
		DL_ASSERT( num_written_ptrs < (int)DL_ARRAY_LENGTH(written_ptrs) );
		written_ptrs[num_written_ptrs].ptr = ptr;
		written_ptrs[num_written_ptrs].pos = pos;
		++num_written_ptrs;
	}
コード例 #16
0
void * dlthread_get_shmem(
    size_t nbytes,
    dlthread_comm_t const comm_idx)
{
  size_t myid;
  void * ptr;
  comm_t * comm;

  if (comm_idx != DLTHREAD_COMM_SINGLE) {
    myid = dlthread_get_id(comm_idx);

    comm = my_comms+comm_idx;

    DL_ASSERT(comm->buffer != NULL,"Null buffer on communicator %zu\n", \
        (size_t)comm_idx);

    if (myid == 0) {
      ptr = malloc(nbytes); 

      ((void**)comm->buffer)[0] = ptr;
    }

    dlthread_barrier(comm_idx);

    ptr = ((void**)comm->buffer)[0];

    dlthread_barrier(comm_idx);
  } else {
    ptr = malloc(nbytes);
  }

  return ptr;
}
コード例 #17
0
std::string EntityFactory::ConvertToPowerUpInGameName(ePowerUpType aPowerUpType)
{
	if (aPowerUpType == ePowerUpType::HEALTHKIT)
	{
		return "Health kit";
	}
	else if (aPowerUpType == ePowerUpType::SHIELDBOOST)
	{
		return "Shield boost";
	}
	else if (aPowerUpType == ePowerUpType::FIRERATEBOOST)
	{
		return "Firerate";
	}
	else if (aPowerUpType == ePowerUpType::WEAPON_UPGRADE)
	{
		return "Upgrade";
	}
	else if (aPowerUpType == ePowerUpType::EMP)
	{
		return "EMP";
	}
	else if (aPowerUpType == ePowerUpType::HOMING)
	{
		return "Homing";
	}
	else if (aPowerUpType == ePowerUpType::INVULNERABLITY)
	{
		return "Invulnerability";
	}

	DL_ASSERT("[EntityFactory] Wrong powerup enum in ConvertToPowerUpInGameName.");
	return "";
}
コード例 #18
0
ファイル: XMLWriter.cpp プロジェクト: wardh/ZeldaClone
XMLWriter::~XMLWriter()
{
	if (myHasUnsavedChanges == true)
	{
		DL_DEBUG("[XMLWriter]: Destructor got called before everything was saved. File being edited was: %s", mySavePath.c_str());
		DL_ASSERT("[XMLSave]: Dint save all changes to a document");
	}
}
コード例 #19
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::FindFirstChild() const
{
	if (myHasOpenedDoc == false)
	{
		DL_ASSERT("[XMLReader]: Tried to [FindFirstChild] before Opening the document");
	}
	return myDoc->FirstChildElement();
}
コード例 #20
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
void XMLReader::DebugFirstChild(const std::string& aChildName) const
{
	if (myDoc->FirstChildElement(aChildName.c_str()) == nullptr)
	{
		DL_DEBUG("Failed to [ForceFindFirstChild]. Parent: [ Document ], Child: [ %s ], File: [ %s ]", aChildName.c_str(), myFilePath.c_str());
		DL_ASSERT("Failed to [ForceFindFirstChild], check DebugLog for more info");
	}
}
コード例 #21
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
void XMLReader::DebugFirstChild(XMLElement aParent) const
{
	if (aParent->FirstChildElement() == nullptr)
	{
		DL_DEBUG("Failed to [ForceFindFirstChild]. Parent: [ %s ], Child: [ First ], File:  [ %s ]", aParent->Name(), myFilePath.c_str());
		DL_ASSERT("Failed to [ForceFindFirstChild], check DebugLog for more info");
	}
}
コード例 #22
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
void XMLReader::DebugNextElement(XMLElement aParent, const std::string& aChildName) const
{
	if (aParent->NextSiblingElement(aChildName.c_str()) == nullptr)
	{
		DL_DEBUG("Failed to [ForceFindNextElement]. Parent: [ %s ], Child: [ %s ], File: [ %s ]", aParent->Name(), aChildName.c_str(), myFilePath.c_str());
		DL_ASSERT("Failed to [ForceFindNextElement], check DebugLog for more info");
	}
}
コード例 #23
0
vtx_t par_eseprefine(
    ctrl_t * const ctrl,
    graph_t * const graph,
    esinfo_t * const esinfo)
{
  vtx_t nmoves;
  wgt_t maxpwgt[2];

  wgt_t * const pwgts = graph->pwgts;

  DL_ASSERT(check_esinfo(esinfo,graph,(pid_t const **)graph->where), \
      "Bad esinfo before refinement");
  DL_ASSERT(check_esbnd(esinfo->bnd,graph),"Bad boundary before refinement");

  maxpwgt[0] = graph->tvwgt * ctrl->tpwgts[0] * ctrl->ubfactor;
  maxpwgt[1] = graph->tvwgt * ctrl->tpwgts[1] * ctrl->ubfactor;

  if (graph->nedges < SERIAL_FM_FACTOR*sqrt(graph->dist.nthreads)) {
    nmoves = __eseprefine_FM1S(ctrl,graph,ctrl->nrefpass,esinfo,maxpwgt);
  } else {
    switch (ctrl->rtype) {
      case MTMETIS_RTYPE_FM:
        nmoves = __eseprefine_FM1S(ctrl,graph,ctrl->nrefpass,esinfo,maxpwgt);
        break;
      case MTMETIS_RTYPE_GREEDY:
        nmoves = __par_eseprefine_GREEDY(ctrl,graph,ctrl->nrefpass,esinfo, \
            maxpwgt);
        break;
      default:
        dl_error("Unknown refinement type for edge separators '%d'\n", \
            ctrl->rtype);
    }
  }

  DL_ASSERT_EQUALS(graph->mincut,par_graph_cut(graph, \
        (pid_t const **)graph->where),"%"PF_WGT_T);
  DL_ASSERT_EQUALS(wgt_lsum(graph->pwgts,2),graph->tvwgt,"%"PF_TWGT_T);
  DL_ASSERT(check_esbnd(esinfo->bnd,graph),"Bad boundary before refinement");

  par_vprintf(ctrl->verbosity,MTMETIS_VERBOSITY_HIGH,"%zu) [%"PF_VTX_T" %" \
      PF_ADJ_T"] {%"PF_WGT_T":%"PF_WGT_T" %"PF_WGT_T" # %"PF_WGT_T":%" \
      PF_WGT_T" %"PF_VTX_T"}\n",graph->level,graph->nvtxs,graph->nedges, \
      pwgts[0],pwgts[1],graph->mincut,maxpwgt[0],maxpwgt[1],nmoves);

  return nmoves;
}
コード例 #24
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::ForceFindFirstChild(XMLElement aParent) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindFirstChild] before Opening the document");

	DebugFirstChild(aParent);

	return aParent->FirstChildElement();
}
コード例 #25
0
ファイル: dl_convert.cpp プロジェクト: matricks/datalibrary
static pint dl_internal_ptr_size(dl_ptr_size_t size_enum)
{
	switch(size_enum)
	{
		case DL_PTR_SIZE_32BIT: return 4;
		case DL_PTR_SIZE_64BIT: return 8;
		default: DL_ASSERT("unknown ptr size!"); return 0;
	}
}
コード例 #26
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::ForceFindFirstChild(XMLElement aParent, const std::string& aChildName) const
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindFirstChild] before Opening the document");


	DebugFirstChild(aParent, aChildName);

	return aParent->FirstChildElement(aChildName.c_str());
}
コード例 #27
0
ファイル: XMLReader.cpp プロジェクト: wardh/ZeldaClone
XMLElement XMLReader::ForceFindNextElement(const std::string& aElementName)
{
	if (myHasOpenedDoc == false)
		DL_ASSERT("[XMLReader]: Tried to [FindNextElement] before Opening the document");

	DebugNextElement(aElementName);

	return myDoc->NextSiblingElement(aElementName.c_str());

}
コード例 #28
0
WeaponDataType WeaponFactory::GetWeapon(const std::string& aWeaponName)
{
	auto it = myWeaponsTypes.find(aWeaponName);
	if (myWeaponsTypes.find(aWeaponName) == myWeaponsTypes.end())
	{
		std::string errorMessage = "[WeaponFactory]: Could not find the weapon " + aWeaponName + ".";
		DL_ASSERT(errorMessage.c_str());
	}
	return it->second;
}
コード例 #29
0
ファイル: XMLWriter.cpp プロジェクト: wardh/ZeldaClone
void XMLWriter::ResetDocument()
{
	if (myHasCreatedDoc == false)
	{
		DL_DEBUG("[XMLWriter]: Tried to [ResetDocument] before Creating an document");
		DL_ASSERT("[XMLWriter]: Failed to SaveDocument");
	}

	myDoc.DeleteChildren();
}
コード例 #30
0
static inline wgt_t __par_update_neighbor(
    pid_t const side,
    vtx_t const v,
    adj_t const ewgt,
    pid_t const * const where,
    esnbrinfo_t * const nbrinfo,
    vtx_iset_t * const bnd,
    vw_pq_t * const q)
{
  wgt_t cut, gain;

  pid_t const other = side ^ 0x01;

  /* update connectivity */
  nbrinfo[v].con[side] += ewgt;
  nbrinfo[v].con[other] -= ewgt;

  /* remove or add to boundary */
  if (where[v] == side) {
    cut = -ewgt;
    if (nbrinfo[v].con[other] == 0) {
      vtx_iset_remove(v,bnd);
    }
  } else {
    cut = ewgt;
    if (!vtx_iset_contains(v,bnd)) {
      vtx_iset_add(v,bnd);
      /* add to queue */
      if (q) {
        gain = nbrinfo[v].con[side] - \
            nbrinfo[v].con[other];
        vw_pq_push(gain,v,q);
      }
    } else {
      if (q) {
        gain = nbrinfo[v].con[side] - \
            nbrinfo[v].con[other];
        if (vw_pq_contains(v,q)) {
          gain = nbrinfo[v].con[side] - \
              nbrinfo[v].con[other];
          vw_pq_update(gain,v,q);
        } else {
          vw_pq_push(gain,v,q);
        }
      }
    }
  }

  DL_ASSERT(nbrinfo[v].con[other] >= 0,"Negative con %"PF_WGT_T":%"PF_WGT_T \
      " ewgt = %"PF_WGT_T" for %"PF_TID_T":%"PF_VTX_T"\n",nbrinfo[v].con[0], \
      nbrinfo[v].con[1],ewgt,(tid_t)dlthread_get_id(DLTHREAD_COMM_ROOT),v);

  return cut;
}