fix display of stackable items in shop

This commit is contained in:
Eduardo Bart 2012-04-11 00:37:46 -03:00
parent 4c67e57dd4
commit 0fe5491635
3 changed files with 12 additions and 9 deletions

View File

@ -13,7 +13,7 @@ SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)"
# set debug as default build type
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_BUILD_TYPE)
ENDIF()
# find needed libraries
SET(Boost_USE_STATIC_LIBS ON)
@ -25,11 +25,11 @@ IF(USE_OPENGL_ES2)
ADD_DEFINITIONS(-DOPENGL_ES2)
SET(OPENGL_INCLUDE_DIR ${EGL_INCLUDE_DIR} ${OPENGLES_INCLUDE_DIR})
SET(OPENGL_LIBRARIES ${EGL_LIBRARY} ${OPENGLES_LIBRARY})
ELSE(USE_OPENGL_ES2)
ELSE()
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
SET(OPENGL_LIBRARIES ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
ENDIF(USE_OPENGL_ES2)
ENDIF()
FIND_PACKAGE(Lua REQUIRED)
FIND_PACKAGE(PhysFS REQUIRED)
@ -104,7 +104,7 @@ IF(WIN32)
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
MESSAGE(STATUS "Windows console: OFF")
ENDIF()
ELSE(WIN32)
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
@ -112,7 +112,7 @@ ELSE(WIN32)
SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp)
ENDIF(WIN32)
ENDIF()
INCLUDE_DIRECTORIES(

View File

@ -42,8 +42,11 @@ ItemPtr Item::create(int id)
ItemPtr item = ItemPtr(new Item);
if(id < g_thingsType.getFirstItemId() || id > g_thingsType.getMaxItemid())
logTraceError("invalid item id ", id);
else
else {
item->setId(id);
if(item->isStackable())
item->setCount(1);
}
return item;
}

View File

@ -510,11 +510,11 @@ void ProtocolGame::parseOpenNpcTrade(InputMessage& msg)
int listCount = msg.getU8();
for(int i = 0; i < listCount; ++i) {
int itemId = msg.getU16();
int countOrSubType = msg.getU8();
int subType = msg.getU8();
ItemPtr item = Item::create(itemId);
if(item->isStackable() || item->isFluidContainer() || item->isFluid())
item->setCountOrSubType(countOrSubType);
if(item->isFluidContainer() || item->isFluid())
item->setSubType(subType);
std::string name = msg.getString();
int weight = msg.getU32();