Skip to content
Browse files

Fixes titles of chests, workbenches and furnaces.

According to http://wiki.vg/Protocol#Open_Window_.280x64.29 the
OPEN_WINDOW message takes the window title as an ordinary UCS-2
string whereas the string was sent as a UTF-8 string.
  • Loading branch information...
1 parent 74e2f42 commit e7d99e05a029e21519e965c6f4d4ab8d5e4ced97 @fredreichbier committed Apr 5, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/inventory.cpp
View
10 src/inventory.cpp
@@ -971,9 +971,9 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)type << (int8_t)INVENTORYTYPE_CHEST;
if(_chestData->large())
{
- user->buffer.writeString(std::string("Large chest"));
+ user->buffer << std::string("Large chest");
} else {
- user->buffer.writeString(std::string("Chest"));
+ user->buffer << std::string("Chest");
}
user->buffer << (int8_t)(_chestData->size()); // size.. not a very good idea. lets just hope this will only return 27 or 54
@@ -990,8 +990,7 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
case WINDOW_WORKBENCH:
user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)WINDOW_WORKBENCH << (int8_t)INVENTORYTYPE_WORKBENCH;
- user->buffer.writeString(std::string("Workbench"));
- user->buffer << (int8_t)0;
+ user->buffer << std::string("Workbench") << (int8_t)0;
for (uint32_t i = 0; i < openWorkbenches.size(); i++)
{
@@ -1014,8 +1013,7 @@ bool Inventory::windowOpen(User* user, int8_t type, int32_t x, int32_t y, int32_
case WINDOW_FURNACE:
user->buffer << (int8_t)PACKET_OPEN_WINDOW << (int8_t)WINDOW_FURNACE << (int8_t)INVENTORYTYPE_FURNACE;
- user->buffer.writeString(std::string("Furnace"));
- user->buffer << (int8_t)0;
+ user->buffer << std::string("Furnace") << (int8_t)0;
for (uint32_t i = 0; i < chunk->furnaces.size(); i++)
{

0 comments on commit e7d99e0

Please sign in to comment.
Something went wrong with that request. Please try again.