Jump to content

[C++] GuildMark size


Go to solution Solved by .Various,

Recommended Posts

Version of Files 41023

Hello people!

 

I'm pretty new in source development, so I wanted to start by changing "easy" things.

First of all I wanted to change the GuildMark size from 16x12 to 20x16.

 

So here are the code changes I've already done (comments == old code):

 

Game Source:

Spoiler

MarkImage.h


struct SGuildMark
{
	enum
	{
		WIDTH = 20,  // 16
		HEIGHT = 16,  // 12,
 		SIZE = WIDTH * HEIGHT,
	};
	// [...]
};

packet.h


typedef struct command_mark_upload
{
	BYTE	header;
	DWORD	gid;
	BYTE	image[20*16*4];  // 16*12*4
} TPacketCGMarkUpload;

MarkConvert.cpp


bool GuildMarkConvert(const std::vector<DWORD> & vecGuildID)
{
	// [...]
	while (fgets(line, sizeof(line)-1, fp))
	{
		// [...]
		uint sx = col * SGuildMark::WIDTH;  //  col * 16;
		uint sy = row * SGuildMark::HEIGHT;  // row * 12;
    }
	// [...]
}

 

 

Client Source:

Spoiler

MarkImage.h


struct SGuildMark
{
	enum
	{
		WIDTH = 20,  // 16,
		HEIGHT = 16,  // 12,
		SIZE = WIDTH * HEIGHT,
	};
	// [...]
};

Packet.h


enum
{
	// [...]
	MARK_DATA_SIZE = 20*16,  // 16*12
	// [...]
}

GrpMarkInstance.h


class CGraphicMarkInstance
{
	// [...]
	protected:
		enum
		{
			MARK_WIDTH = 20,  // 16
			MARK_HEIGHT = 16,  // 12
		};
	// [...]
}

GrpMarkInstance.cpp


// [...]
int CGraphicMarkInstance::GetWidth()
{
	if (IsEmpty())
		return 0;

	return MARK_WIDTH;  // 16
}

int CGraphicMarkInstance::GetHeight()
{
	if (IsEmpty())
		return 0;

	return MARK_HEIGHT;  // 12
}
// [...]

 

 

So these are my changes but it doesn't work.

What did I forget?

 

Sincerly,
.Various

 

Link to comment
Share on other sites

  • Solution

Okay people, I solved it :)

 

What I forgot was to change the send/recv buffer-size. Obviously 1024 was enough for a 16x12 Image (Header[1] + GuildID[4] +  Image[16*12*4] =773), but not enough for a 20x16 Image (Header[1] + GuildID[4] +  Image[20*16*4] =1285). Solution is to increase the size (I doubled it).


Client-Side:

Spoiler

 

GuildMarkUploader.cpp


bool CGuildMarkUploader::Connect(const CNetworkAddress& c_rkNetAddr, DWORD dwHandle, DWORD dwRandomKey, DWORD dwGuildID, const char* c_szFileName, UINT* peError)
{
	// [...]
	SetRecvBufferSize(2048);  // 1024
	SetSendBufferSize(2048);  // 1024
	// [...]
}

 


 

 

 

  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.