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

View File

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

View File

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