Jump to content
  • 0

clif_broadcast


Foob

Question


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.02
  • Content Count:  267
  • Reputation:   40
  • Joined:  01/19/17
  • Last Seen:  

Hello,

I'm trying to edit clif_broadcast function from clif.cpp to work with player who has var like example below.

void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, enum send_target target)
{
	nullpo_retv(mes);
	if (len < 2)
		return;

	int lp = (type&BC_COLOR_MASK) ? 4 : 0;
	std::unique_ptr<unsigned char> buf(new unsigned char[4+lp+len]);

	WBUFW(buf.get(),0) = 0x9a;
	WBUFW(buf.get(),2) = 4 + lp + len;
	if (type&BC_BLUE)
		WBUFL(buf.get(),4) = 0x65756c62; //If there's "blue" at the beginning of the message, game client will display it in blue instead of yellow.
	else if (type&BC_WOE)
		WBUFL(buf.get(),4) = 0x73737373; //If there's "ssss", game client will recognize message as 'WoE broadcast'.
	memcpy(WBUFP(buf.get(), 4 + lp), mes, len);
	
	struct map_session_data* sd;
	nullpo_retv(sd);
	int counter = static_cast<int>(pc_readreg2( sd, MY_VAR ));
	
	if(counter < 1)
		clif_send(buf.get(), WBUFW(buf.get(),2), bl, target);
}

When I compile, there's a problem where it says: "uninitialized local variable 'sd' used"

The server will start but come broadcast it will crash and will point out to the line. What am I missing? Is this possible?   

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...