Jump to content

flygun

Former Staff
  • Posts

    729
  • Joined

  • Last visited

  • Days Won

    7
  • Feedback

    0%

Posts posted by flygun

  1. On 7/19/2019 at 12:51 AM, Trial said:
    
    m_pThread

    Should be initialized in constructor to avoid undefined behavior, the constructor should look like this

    
    CAsyncSQL::CAsyncSQL()
    	: m_stHost(""), m_stUser(""), m_stPassword(""), m_stDB(""), m_stLocale(""),
    	m_iMsgCount(0), m_iPort(0), m_bEnd(false),
    	m_mtxQuery(), m_mtxResult(),
    	m_iQueryFinished(0), m_ulThreadID(0), m_bConnected(false),
    	m_iCopiedQuery(0),
    	m_pThread(nullptr)
    {
    	memset(&m_hDB, 0, sizeof(m_hDB));
    
    	m_aiPipe[0] = 0;
    	m_aiPipe[1] = 0;
    }

     

    this was the case but somehow it changed ...

     

    Now it's updated !!

    • Love 1
  2. 17 hours ago, masodikbela said:

    You should check if the thread is already joined, or just simply check if you already called Quit, cus db is crashing at the very end of the process, because quit is called from the db too (and also from the destructor of CAsyncSQL).
    NpEVRji.png

    5lM7g8a.png

    i've already mentioned this in the post

     

  3. 15 minutes ago, Koray said:

    You can edit a little more, I think it will look better.

     

    Use nullptr instead of NULL

    Please stop usage header guards in 2019, go for pragma once

    Use smart pointers instead of raw pointers

    Use lock_guard instead of lock manually everytime

    Clear dirty korean commands, unused veriables etc.

     

    Anyway thanks for publishing.

    i'll rewrite the whole file today or tomorrow maximum .. i just wanted to see if actually someone want it ... 

  4. 12 minutes ago, martysama0134 said:

    AsyncSQL.h

    This page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff.
     

    sorry i edited the file after putting the link .. didn't thought that the link will change!
    thanks for noticing 

  5. M2 Download Center

    This is the hidden content, please
    ( Internal )

     

    I edited Async Class to use C++ Standard mutex and thread support

    AsyncSQL.h

    ASyncSQL.cpp

     

    plus if you have this line in main.cpp inside the main function inside the db core source delete it 

    DBManager.Quit();

    this line will close MySQL connections  before making sure that all the queries are done (which may not save the last thing a player do before closing the server) plus it will dump a core file since the db core will abort without successful exit! 

     

    #edited

    • Using std::gurad (which unlock the mutex when the object is destroyed) instead of manually lock and unlock mutex 
    • rewrote the Profiler class with std::chrono 

    #Note : Don't  just copy and paste .. make a backup , test , then use it

    Best regards.

    • Metin2 Dev 27
    • Good 8
    • Love 1
    • Love 9
  6. On 9/29/2018 at 7:34 PM, Shogun said:

    Does this have any practical use?

    upgrading libraries has it's own advantages  such as speed and optimizing  but upgrading the models them self doesn't benefits much  unless you have the full granny source .. 

    so i think the answer is no 

  7. Quote

    Linux® users are often surprised to find that Bash is not the default shell in FreeBSD. In fact, Bash is not included in the default installation. Instead, FreeBSD uses tcsh(1) as the default root shell, and the Bourne shell-compatible sh(1) as the default user shell. sh(1) is very similar to Bash but with a much smaller feature-set. Generally shell scripts written for sh(1) will run in Bash, but the reverse is not always true.

    However, Bash and other shells are available for installation using the FreeBSD Packages and Ports Collection.

    After installing another shell, use chsh(1) to change a user's default shell. It is recommended that the root user's default shell remain unchanged since shells which are not included in the base distribution are installed to /usr/local/bin. In the event of a problem, the file system where /usr/local/bin is located may not be mounted. In this case, rootwould not have access to its default shell, preventing root from logging in and fixing the problem.

    "Linux® users are often surprised to find that Bash is not the default shell in FreeBSD. In fact, Bash is not included in the default installation."

     

    don't get me wrong but FreeBSD is not at risk .. aside from that Thank you <3 

    • Good 2
  8. Spoiler

     

    
    CC = g++49
    
    GAME_VERSION := $(shell cat ../../__REVISION__)
    
    GccMajorVersion := $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
    GccMinorVersion := $(shell expr `$(CC) -dumpversion | cut -f2 -d.`)
    GccMinorEGT8 := $(shell expr $(GccMinorVersion) \>= 8)
    
    INCDIR =
    LIBDIR =
    BINDIR = ..
    OBJDIR = .obj
    $(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi)
    
    ## LIST OF CONSTANTS BEGIN
    ENABLE_GOOGLE_TEST = 0
    ENABLE_HSHIELD_SYSTEM = 0
    ENABLE_XTRAP_SYSTEM = 0
    ENABLE_LUA_5_VERSION = 0
    ENABLE_GCC_AUTODEPEND = 1
    ENABLE_STATIC = 0
    ## LIST OF CONSTANTS END
    
    # Depend Path File
    ifneq ($(ENABLE_GCC_AUTODEPEND), 1)
    DEPFILE = Depend
    endif
    
    # Standard Libraries
    LIBS = -lm -lmd
    
    # Project Flags
    CFLAGS = -m32 -g -Wall -O2 -pipe -fexceptions -fno-strict-aliasing -pthread -D_THREAD_SAFE -DNDEBUG -std=c++11
    
    ifeq ($(ENABLE_STATIC), 1)
    CFLAGS += -static
    endif
    
    ifeq ($(GccMinorEGT8), 1)
    CFLAGS += -Wno-unused-local-typedefs
    endif
    
    # FreeBSD stack protector
    CFLAGS += -fstack-protector-all
    
    # Version defines
    CFLAGS += -D__USER__=\"$(USER)\" -D__HOSTNAME__=\"$(HOSTNAME)\" -D__PWD__=\"$(PWD)\" -D__GAME_VERSION__=\"$(GAME_VERSION)\"
    
    # Boost
    INCDIR += -I../../../Extern/include/boost
    
    # DevIL
    INCDIR += -I../../../Extern/include/IL
    LIBS += ../../../Extern/lib/libIL.a\
    		../../../Extern/lib/libjasper.a\
    		../../../Extern/lib/libpng.a\
    		../../../Extern/lib/libtiff.a\
    		../../../Extern/lib/libjbig.a\
    		../../../Extern/lib/libmng.a\
    		/usr/lib/liblzma.a\
    		../../../Extern/lib/liblcms.a\
    		../../../Extern/lib/libjpeg.a
    
    # MySQL
    INCDIR += -I/usr/local/include/mysql
    LIBS += /usr/local/lib/mysql/libmysqlclient.a /usr/lib/libz.a
    
    # CryptoPP
    LIBS += ../../../Extern/lib/libcryptopp.a
    
    # GTest
    ifeq ($(ENABLE_GOOGLE_TEST), 1)
    LIBS += /usr/local/lib/libgtest.a
    CFLAGS += -DENABLE_GOOGLE_TEST
    endif
    
    # HackShield
    ifeq ($(ENABLE_HSHIELD_SYSTEM), 1)
    INCDIR += -I../../libhackshield/include
    CFLAGS += -DENABLE_HSHIELD_SYSTEM
    endif
    
    # XTrap
    ifeq ($(ENABLE_XTRAP_SYSTEM), 1)
    INCDIR += -I../../libxtrap/include
    CFLAGS += -DENABLE_XTRAP_SYSTEM
    endif
    
    # OpenSSL
    INCDIR += -I/usr/include
    LIBS += -lssl
    # LIBS += /usr/lib/libssl.a
    
    # Lua
    CFLAGS += -DENABLE_LUA_5_VERSION=ENABLE_LUA_5_VERSION
    ifeq ($(ENABLE_LUA_5_VERSION), 2)
    INCDIR += -I../../liblua/5.2/install/include
    LIBDIR += -L../../liblua/5.2/install/lib
    LIBS += ../../liblua/5.2/install/lib/liblua.a
    else
    INCDIR += -I../../liblua/5.0/include
    LIBDIR += -L../../liblua/5.0/lib
    LIBS += ../../liblua/5.0/lib/liblua.a ../../liblua/5.0/lib/liblualib.a
    endif
    
    # Project Libraries
    INCDIR += -I../../../Extern/include
    INCDIR += -I/usr/local/include
    LIBDIR += -L/usr/local/lib
    
    INCDIR += -I../../libserverkey
    LIBDIR += -L../../libthecore/lib -L../../libpoly -L../../libsql -L../../libgame/lib -L../../libserverkey
    LIBS += -lthecore -lpoly -lsql -lgame -lserverkey
    
    # PROJECT_SRC_FILES BEGIN
    MAINCPP = main.cpp
    TESTCPP = test.cpp
    
    CFILE	= minilzo.c
    
    CPPFILE = BattleArena.cpp FSM.cpp MarkConvert.cpp MarkImage.cpp MarkManager.cpp OXEvent.cpp TrafficProfiler.cpp ani.cpp\
    		  arena.cpp banword.cpp battle.cpp blend_item.cpp block_country.cpp buffer_manager.cpp building.cpp castle.cpp\
    		  char.cpp char_affect.cpp char_battle.cpp char_change_empire.cpp char_horse.cpp char_item.cpp char_manager.cpp\
    		  char_quickslot.cpp char_resist.cpp char_skill.cpp char_state.cpp PetSystem.cpp cmd.cpp cmd_emotion.cpp cmd_general.cpp\
    		  cmd_gm.cpp cmd_oxevent.cpp config.cpp constants.cpp crc32.cpp cube.cpp db.cpp desc.cpp\
    		  desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
    		  entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
    		  guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
    		  input_login.cpp input_main.cpp input_p2p.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
    		  item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
    		  locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
    		  messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
    		  party.cpp passpod.cpp pcbang.cpp polymorph.cpp priv_manager.cpp pvp.cpp\
    		  questevent.cpp questlua.cpp questlua_affect.cpp questlua_arena.cpp questlua_ba.cpp questlua_building.cpp\
    		  questlua_danceevent.cpp questlua_dungeon.cpp questlua_forked.cpp questlua_game.cpp questlua_global.cpp\
    		  questlua_guild.cpp questlua_horse.cpp questlua_pet.cpp questlua_item.cpp questlua_marriage.cpp questlua_mgmt.cpp\
    		  questlua_monarch.cpp questlua_npc.cpp questlua_oxevent.cpp questlua_party.cpp questlua_pc.cpp\
    		  questlua_quest.cpp questlua_target.cpp questmanager.cpp questnpc.cpp questpc.cpp\
    		  refine.cpp regen.cpp safebox.cpp sectree.cpp sectree_manager.cpp sequence.cpp shop.cpp\
    		  skill.cpp start_position.cpp target.cpp text_file_loader.cpp trigger.cpp utils.cpp vector.cpp war_map.cpp\
    		  wedding.cpp xmas_event.cpp version.cpp panama.cpp threeway_war.cpp map_location.cpp auth_brazil.cpp\
    		  BlueDragon.cpp BlueDragon_Binder.cpp DragonLair.cpp questlua_dragonlair.cpp\
    		  HackShield.cpp HackShield_Impl.cpp char_hackshield.cpp skill_power.cpp affect.cpp\
    		  SpeedServer.cpp questlua_speedserver.cpp XTrapManager.cpp\
    		  auction_manager.cpp FileMonitor_FreeBSD.cpp ClientPackageCryptInfo.cpp cipher.cpp\
    		  buff_on_attributes.cpp dragon_soul_table.cpp DragonSoul.cpp\
    		  group_text_parse_tree.cpp char_dragonsoul.cpp questlua_dragonsoul.cpp\
    		  shop_manager.cpp shopEx.cpp item_manager_read_tables.cpp shutdown_manager.cpp
    # PROJECT_SRC_FILES END
    
    # PROJECT_OBJ_FILES BEGIN
    COBJS	= $(CFILE:%.c=$(OBJDIR)/%.o)
    CPPOBJS	= $(CPPFILE:%.cpp=$(OBJDIR)/%.o)
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    CDEPS	= $(COBJS:%.o=%.d)
    CPPDEPS	= $(CPPOBJS:%.o=%.d)
    endif
    
    MAINOBJ = $(MAINCPP:%.cpp=$(OBJDIR)/%.o)
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    MAINDEPS = $(MAINOBJ:%.o=%.d)
    endif
    
    TESTOBJ = $(TESTCPP:%.cpp=$(OBJDIR)/%.o)
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    TESTDEPS = $(TESTOBJ:%.o=%.d)
    endif
    # PROJECT_OBJ_FILES END
    
    # Target Paths
    MAIN_TARGET = $(BINDIR)/game_r$(GAME_VERSION)
    TEST_TARGET = $(BINDIR)/test_r$(GAME_VERSION)
    
    # previously -> default: $(MAIN_TARGET) $(TEST_TARGET)
    default: $(MAIN_TARGET)
    test: $(TEST_TARGET)
    
    $(OBJDIR)/%.o: %.c
    	@echo compiling $<
    	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    	@$(CC) -MM -MG -MP $(CFLAGS) $(INCDIR) -c $< -o $(OBJDIR)/$*.d
    	@sed -i '' -e's/$*.o:/$(OBJDIR)\/$*.o:/g' $(OBJDIR)/$*.d
    endif
    
    $(OBJDIR)/%.o: %.cpp
    	@echo compiling $<
    	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    	@$(CC) -MM -MG -MP $(CFLAGS) $(INCDIR) -c $< -o $(OBJDIR)/$*.d
    	@sed -i '' -e's/$*.o:/$(OBJDIR)\/$*.o:/g' $(OBJDIR)/$*.d
    endif
    
    limit_time:
    	@echo update limit time
    	@python update_limit_time.py
    
    $(MAIN_TARGET): $(CPPOBJS) $(COBJS) $(MAINOBJ)
    	@echo linking $(MAIN_TARGET)
    	@$(CC) $(CFLAGS) $(LIBDIR) $(COBJS) $(CPPOBJS) $(MAINOBJ) $(LIBS) -o $(MAIN_TARGET)
    
    $(TEST_TARGET): $(TESTCPP) $(CPPOBJS) $(COBJS) $(TESTOBJ)
    	@echo linking $(TEST_TARGET)
    	@$(CC) $(CFLAGS) $(LIBDIR) $(COBJS) $(CPPOBJS) $(TESTOBJ) $(LIBS) -o $(TEST_TARGET)
    
    dump:
    	@$(CC) -dM -E - < /dev/null > .nope.nope
    
    symlink:
    	@ln -fs game_r$(GAME_VERSION) $(BINDIR)/game_symlink
    
    strip:
    	@cp $(MAIN_TARGET) $(BINDIR)/game_r
    	@strip $(BINDIR)/game_r
    
    clean:
    	@echo cleaning $(MAIN_TARGET) $(TEST_TARGET) $(OBJDIR)
    	@rm -f $(COBJS) $(CPPOBJS) $(MAINOBJ) $(TESTOBJ)
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    	@rm -f $(CDEPS) $(CPPDEPS) $(MAINDEPS) $(TESTDEPS)
    endif
    	@rm -f $(BINDIR)/game_r* $(BINDIR)/test_r* $(BINDIR)/conv
    
    cc-ver:
    	@$(CC) -v
    
    tag:
    	ctags *.cpp *.h *.c
    
    dep:
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    	@echo "Note: gcc autodepend is autodetected, so target dep skipped"
    else
    	makedepend -f $(DEPFILE) $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) $(CFILE) $(MAINCPP) $(TESTCPP) 2> /dev/null > $(DEPFILE)
    endif
    
    # AUTO_DEPEND_CHECK BEGIN
    ifeq ($(ENABLE_GCC_AUTODEPEND), 1)
    sinclude $(CDEPS)
    sinclude $(CPPDEPS)
    sinclude $(MAINDEPS)
    sinclude $(TESTDEPS)
    else
    sinclude $(DEPFILE)
    endif
    # AUTO_DEPEND_CHECK END

     

     

     

    • Love 1
  9. replace

                granny_variant twoSideResult;
    
                if (GrannyFindMatchingMember(pgrnMaterial->ExtendedData.Type, pgrnMaterial->ExtendedData.Object, "Two-sided", &twoSideResult)  
                    && NULL != twoSideResult.Type)
                    GrannyConvertSingleObject(twoSideResult.Type, twoSideResult.Object, TwoSidedFieldType, &twoSided, NULL);
    
                m_bTwoSideRender = 1 == twoSided;

    with this

    			granny_variant TwoSidedVariant;
    			if (GrannyFindMatchingMember(pgrnMaterial->ExtendedData.Type, pgrnMaterial->ExtendedData.Object, "Two-sided", &TwoSidedVariant))
    				GrannyConvertSingleObject(TwoSidedVariant.Type, TwoSidedVariant.Object, TwoSidedFieldType, &twoSided, 0);
    
    			m_bTwoSideRender = 1 == twoSided;

    not tested I'm on mobile

     

  10. first of all .... yes you can compile the source code in vs2017 it's just a program ... the language itself didn't change ...

    but for the error you have to provide us with some information other than just saying that you've got a problem ... programing isn't a job it's a life style

    Best regards

    Flygun !!

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