Jump to content

Салом

Banned
  • Posts

    50
  • Joined

  • Last visited

  • Days Won

    2
  • Feedback

    0%

Posts posted by Салом

  1. AddToCharacter take two agrguments not three.

    INVENTORY_MAX_COUNT dosen't exist in source, unless you changed his name.

    C++11 is required for these codes to work. You are using lambda expression which is a c++11 feature, same for auto.

     

    Here it's the fixed version.

    Spoiler
    
    {
    	std::vector<CItem*> collectItems;
    	std::vector<WORD> oldCells;
    	int totalSize = 0;
    	for (auto i = 0; i < INVENTORY_MAX_NUM; ++i) {
    		auto item = ch->GetInventoryItem(i);
    		if (item) {
    			totalSize += item->GetSize();
    			oldCells.push_back(item->GetCell());
    			collectItems.push_back(item);
    		}
    	}
    	if (totalSize - 3 >= INVENTORY_MAX_NUM) {
    		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("INVENTORY_FULL_CANNOT_SORT"));
    		return;
    	}
    
    	for (auto& item : collectItems) {
    		item->RemoveFromCharacter();
    	}
    
    	std::sort(collectItems.begin(), collectItems.end(),
    	          []( CItem* a,  CItem* b) {
    		          return a->GetVnum() < b->GetVnum();
    	          });
    
    	for (auto& sortedItem : collectItems) {
    		auto cell = ch->GetEmptyInventory(sortedItem->GetSize());
    		sortedItem->AddToCharacter(ch, TItemPos(INVENTORY, cell));
    	}
    }

     

     

    eYEBWK4qQbC7YzVZR52P9A.png

     

    You get the errors because your compiler dosen't support C++11.

     

    From what source did you steal the codes?

  2. La 14.03.2017 la 23:50, Tasho a spus:

    Thanks for release, but why you create a new bool for what? to look like more tutorial code? need only 3 lines.

    
    	const TPixelPosition& c_rkPPosCur = NEW_GetCurPixelPositionRef();
    	if (CPythonBackground::Instance().isAttrOn(c_rkPPosCur.x, c_rkPPosCur.y, CTerrainImpl::ATTRIBUTE_BANPK))
    		return FALSE;

    Also the check is already exist, just need to copy-paste check from:

    
    bool CInstanceBase::IsInSafe() // InstanceBase.cpp

    Original idea is from: Rubinum2.

    PS: Here is nothing to coding, is just copy 3 lines from other part and put in this part. ", you just copy also them idea and + title name video from rubinum.  i will release a code of mine "

    Readability

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.