diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/char/Makefile.in | 14 | ||||
-rw-r--r-- | src/char/char.c | 32 | ||||
-rw-r--r-- | src/char/int_guild.c | 2 | ||||
-rw-r--r-- | src/char/int_pet.c | 2 |
5 files changed, 41 insertions, 25 deletions
diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 22b793bef..8c71a3b4c 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -9,7 +9,7 @@ set( SQL_CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" ) # char sql # if( BUILD_SQL_SERVERS ) -message( STATUS "Creating target char-server_sql" ) +message( STATUS "Creating target char-server" ) set( SQL_CHAR_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/char.h" "${CMAKE_CURRENT_SOURCE_DIR}/int_auction.h" @@ -46,15 +46,15 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_CHAR_HEADER source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( char FILES ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) include_directories( ${INCLUDE_DIRS} ) -add_executable( char-server_sql ${SOURCE_FILES} ) -add_dependencies( char-server_sql ${DEPENDENCIES} ) -target_link_libraries( char-server_sql ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( char-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +add_executable( char-server ${SOURCE_FILES} ) +add_dependencies( char-server ${DEPENDENCIES} ) +target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} ) +set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( INSTALL_COMPONENT_RUNTIME ) - cpack_add_component( Runtime_charserver_sql DESCRIPTION "char-server (sql version)" DISPLAY_NAME "char-server_sql" GROUP Runtime ) - install( TARGETS char-server_sql + cpack_add_component( Runtime_charserver_sql DESCRIPTION "char-server (sql version)" DISPLAY_NAME "char-server" GROUP Runtime ) + install( TARGETS char-server DESTINATION "." COMPONENT Runtime_charserver_sql ) endif( INSTALL_COMPONENT_RUNTIME ) -message( STATUS "Creating target char-server_sql - done" ) +message( STATUS "Creating target char-server - done" ) endif( BUILD_SQL_SERVERS ) diff --git a/src/char/Makefile.in b/src/char/Makefile.in index bfe9d1585..a64145dea 100644 --- a/src/char/Makefile.in +++ b/src/char/Makefile.in @@ -29,21 +29,21 @@ endif @SET_MAKE@ ##################################################################### -.PHONY : all char-server_sql clean help +.PHONY : all char-server clean help -all: char-server_sql +all: char-server -char-server_sql: $(CHAR_SERVER_SQL_DEPENDS) +char-server: $(CHAR_SERVER_SQL_DEPENDS) @echo " LD $@" - @@CC@ @LDFLAGS@ -o ../../char-server_sql@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ + @@CC@ @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ clean: @echo " CLEAN char" - @rm -rf *.o obj_sql ../../char-server_sql@EXEEXT@ + @rm -rf *.o obj_sql ../../char-server@EXEEXT@ help: - @echo "possible targets are 'char-server_sql' 'all' 'clean' 'help'" - @echo "'char-server_sql' - char server (SQL version)" + @echo "possible targets are 'char-server' 'all' 'clean' 'help'" + @echo "'char-server' - char server (SQL version)" @echo "'all' - builds all above targets" @echo "'clean' - cleans builds and objects" @echo "'help' - outputs this message" diff --git a/src/char/char.c b/src/char/char.c index effcd6c31..e7220aa36 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #include "../common/cbasetypes.h" #include "../common/core.h" @@ -3768,7 +3769,18 @@ int parse_char(int fd) char_id = atoi(data); Sql_FreeResult(sql_handle); - mmo_char_fromsql(char_id, &char_dat, true); + + /* set char as online prior to loading its data so 3rd party applications will realise the sql data is not reliable */ + set_char_online(-2,char_id,sd->account_id); + if( !mmo_char_fromsql(char_id, &char_dat, true) ) { /* failed? set it back offline */ + set_char_offline(char_id, sd->account_id); + /* failed to load something. REJECT! */ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = 0; + WFIFOSET(fd,3); + break;/* jump off this boat */ + } //Have to switch over to the DB instance otherwise data won't propagate [Kevin] cd = (struct mmo_charstatus *)idb_get(char_db_, char_id); @@ -3867,8 +3879,6 @@ int parse_char(int fd) node->ip = ipl; idb_put(auth_db, sd->account_id, node); - set_char_online(-2,node->char_id,sd->account_id); - } break; @@ -4821,10 +4831,16 @@ int do_init(int argc, char **argv) Sql_ShowDebug(sql_handle); set_defaultparse(parse_char); - char_fd = make_listen_bind(bind_ip, char_port); - ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port); - + + if( (char_fd = make_listen_bind(bind_ip,char_port)) == -1 ) { + ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",char_port); + exit(EXIT_FAILURE); + } + Sql_HerculesUpdateCheck(sql_handle); + + ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port); + if( runflag != CORE_ST_STOP ) { shutdown_callback = do_shutdown; diff --git a/src/char/int_guild.c b/src/char/int_guild.c index e25ebd902..7c2086722 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -1,4 +1,4 @@ -// Copyright (c) Hercules dev team, licensed under GNU GPL. +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 7a6c217f9..311ccd4be 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -1,4 +1,4 @@ -// Copyright (c) Hercules dev team, licensed under GNU GPL. +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams |