diff options
79 files changed, 2352 insertions, 2471 deletions
@@ -1,22 +1,13 @@ # files generated during make -*.o -src/char/char -char-server -src/ladmin/ladmin +/obj/ +# Copied executables +/char-server /ladmin -src/login/login -login-server -src/map/map -map-server -eathena-monitor -magic-interpreter-parser.h -magic-interpreter-parser.c -magic-interpreter-lexer.c -magic-interpreter-parser.output +/login-server +/map-server +/eathena-monitor +# Generated source files +src/map/magic-interpreter-parser.h +src/map/magic-interpreter-parser.c +src/map/magic-interpreter-lexer.c -src/tool/adduser -src/tool/itemfrob -src/tool/mapfrob -src/tool/marriage-info -src/tool/eathena-monitor -src/webserver/webserver diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..7d0be35 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,77 @@ +#! /usr/bin/make -f +SHELL=/bin/bash +BUILD_DIR = obj +default: login-server char-server map-server ladmin eathena-monitor +.DELETE_ON_ERROR: +include make.defs + +.PHONY: all clean common +.PRECIOUS: %/ +%/: + +mkdir -p $@ + +# The default recipe is suboptimal +%.c: %.l + $(LEX) -o $@ $< +%.c %.h: %.y + $(BISON) -d -o $*.c $< + + +# All this duplication is required because make handles pattern rules specially +${BUILD_DIR}/char/%.o: src/char/%.c | ${BUILD_DIR}/char/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/common/%.o: src/common/%.c | ${BUILD_DIR}/common/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/ladmin/%.o: src/ladmin/%.c | ${BUILD_DIR}/ladmin/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/login/%.o: src/login/%.c | ${BUILD_DIR}/login/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/map/%.o: src/map/%.c | ${BUILD_DIR}/map/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/tool/%.o: src/tool/%.c | ${BUILD_DIR}/tool/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/webserver/%.o: src/webserver/%.c | ${BUILD_DIR}/webserver/ + $(COMPILE.c) -o $@ $< +${BUILD_DIR}/webserver/pages/%.o: src/webserver/pages/%.c | ${BUILD_DIR}/webserver/pages/ + $(COMPILE.c) -o $@ $< + +PROGS = login-server char-server map-server ladmin eathena-monitor webserver +# Things to actually make +all: ${PROGS} +clean: + rm -rf ${PROGS} ${BUILD_DIR}/ +common: ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o + +# Top level programs +login-server: ${BUILD_DIR}/login/login + cp -f $< $@ +char-server: ${BUILD_DIR}/char/char + cp -f $< $@ +map-server: ${BUILD_DIR}/map/map + cp -f $< $@ +ladmin: ${BUILD_DIR}/ladmin/ladmin + cp -f $< $@ +eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor + cp -f $< $@ +webserver: ${BUILD_DIR}/webserver/main + cp -f $< $@ + +# Executable dependencies - generated by hand +${BUILD_DIR}/char/char: ${BUILD_DIR}/char/char.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_guild.o ${BUILD_DIR}/char/int_storage.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o +${BUILD_DIR}/ladmin/ladmin: ${BUILD_DIR}/ladmin/ladmin.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/mt_rand.o +${BUILD_DIR}/login/login: ${BUILD_DIR}/login/login.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o +${BUILD_DIR}/map/map: LDLIBS=-lm +${BUILD_DIR}/map/map: ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/tmw.o ${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/map/magic-interpreter-base.o ${BUILD_DIR}/map/magic-expr.o ${BUILD_DIR}/map/magic-stmt.o ${BUILD_DIR}/map/magic.o ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/chrif.o ${BUILD_DIR}/map/clif.o ${BUILD_DIR}/map/pc.o ${BUILD_DIR}/map/npc.o ${BUILD_DIR}/map/chat.o ${BUILD_DIR}/map/path.o ${BUILD_DIR}/map/itemdb.o ${BUILD_DIR}/map/mob.o ${BUILD_DIR}/map/script.o ${BUILD_DIR}/map/storage.o ${BUILD_DIR}/map/skill.o ${BUILD_DIR}/map/skill-pools.o ${BUILD_DIR}/map/atcommand.o ${BUILD_DIR}/map/battle.o ${BUILD_DIR}/map/intif.o ${BUILD_DIR}/map/trade.o ${BUILD_DIR}/map/party.o ${BUILD_DIR}/map/guild.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o +${BUILD_DIR}/tool/eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor.o +${BUILD_DIR}/tool/adduser: ${BUILD_DIR}/tool/adduser.o ${BUILD_DIR}/common/socket.o +${BUILD_DIR}/tool/itemfrob: ${BUILD_DIR}/tool/itemfrob.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_guild.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o +${BUILD_DIR}/tool/mapfrob: ${BUILD_DIR}/tool/mapfrob.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_guild.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o +${BUILD_DIR}/tool/marriage-info: ${BUILD_DIR}/tool/marriage-info.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_guild.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o +${BUILD_DIR}/webserver/main: ${BUILD_DIR}/webserver/main.o ${BUILD_DIR}/webserver/parse.o ${BUILD_DIR}/webserver/generate.o ${BUILD_DIR}/webserver/htmlstyle.o ${BUILD_DIR}/webserver/logs.o ${BUILD_DIR}/webserver/pages/about.o ${BUILD_DIR}/webserver/pages/sample.o ${BUILD_DIR}/webserver/pages/notdone.o + +deps.make: + for F in `find src/ -name '*.c'`; do \ + gcc -m32 -std=c99 -MM "$$F" -MT "$$(sed 's/src/$${BUILD_DIR}/;s/\.c/.o/' <<< "$$F")"; \ + done > deps.make + +include deps.make diff --git a/Makefile b/Makefile deleted file mode 100644 index c34b691..0000000 --- a/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -include make.defs - -all: login-server char-server map-server ladmin -tools: tool eathena-monitor - - -common: src/common - ${MAKE} -C src/common -login-server: common src/login - ${MAKE} -C src/login - ${CP} src/login/login login-server -char-server: common src/char - ${MAKE} -C src/char - ${CP} src/char/char char-server -map-server: common src/map - ${MAKE} -C src/map - ${CP} src/map/map map-server -ladmin: common src/ladmin - ${MAKE} -C src/ladmin - -clean: clean-common clean-login clean-char clean-map clean-ladmin clean-tools - -clean-common: - ${MAKE} -C src/common clean -clean-login: - ${MAKE} -C src/login clean -clean-char: - ${MAKE} -C src/char clean -clean-map: - ${MAKE} -C src/map clean -clean-ladmin: - ${MAKE} -C src/ladmin clean - -# This target is separate for historical reasons, and because it is optional -tool: common src/tool - ${MAKE} -C src/tool -eathena-monitor: tool - ${CP} src/tool/eathena-monitor . -clean-tools: - ${MAKE} -C src/tool clean diff --git a/deps.make b/deps.make new file mode 100644 index 0000000..34c7328 --- /dev/null +++ b/deps.make @@ -0,0 +1,308 @@ +${BUILD_DIR}/webserver/main.o: src/webserver/main.c +${BUILD_DIR}/webserver/logs.o: src/webserver/logs.c +${BUILD_DIR}/webserver/generate.o: src/webserver/generate.c +${BUILD_DIR}/webserver/parse.o: src/webserver/parse.c +${BUILD_DIR}/webserver/pages/about.o: src/webserver/pages/about.c +${BUILD_DIR}/webserver/pages/notdone.o: src/webserver/pages/notdone.c +${BUILD_DIR}/webserver/pages/sample.o: src/webserver/pages/sample.c +${BUILD_DIR}/webserver/htmlstyle.o: src/webserver/htmlstyle.c +${BUILD_DIR}/common/mt_rand.o: src/common/mt_rand.c src/common/mt_rand.h \ + src/common/sanity.h +${BUILD_DIR}/common/timer.o: src/common/timer.c src/common/timer.h \ + src/common/sanity.h src/common/utils.h +${BUILD_DIR}/common/nullpo.o: src/common/nullpo.c src/common/nullpo.h \ + src/common/sanity.h +${BUILD_DIR}/common/lock.o: src/common/lock.c src/common/lock.h \ + src/common/socket.h src/common/sanity.h +${BUILD_DIR}/common/grfio.o: src/common/grfio.c src/common/utils.h \ + src/common/grfio.h src/common/mmo.h src/common/socket.h \ + src/common/sanity.h +${BUILD_DIR}/common/md5calc.o: src/common/md5calc.c src/common/md5calc.h \ + src/common/sanity.h src/common/mt_rand.h +${BUILD_DIR}/common/dbtest.o: src/common/dbtest.c src/common/db.h \ + src/common/sanity.h +${BUILD_DIR}/common/db.o: src/common/db.c src/common/db.h \ + src/common/sanity.h src/common/utils.h +${BUILD_DIR}/common/socket.o: src/common/socket.c src/common/mmo.h \ + src/common/utils.h src/common/socket.h src/common/sanity.h +${BUILD_DIR}/common/core.o: src/common/core.c src/common/core.h \ + src/common/socket.h src/common/sanity.h src/common/timer.h \ + src/common/version.h src/common/mt_rand.h src/common/nullpo.h +${BUILD_DIR}/login/login.o: src/login/login.c src/login/../common/core.h \ + src/login/../common/socket.h src/login/../common/sanity.h \ + src/login/../common/timer.h src/login/login.h src/login/../common/mmo.h \ + src/login/../common/utils.h src/login/../common/version.h \ + src/login/../common/db.h src/login/../common/lock.h \ + src/login/../common/mt_rand.h src/login/../common/md5calc.h +${BUILD_DIR}/char/int_guild.o: src/char/int_guild.c src/char/inter.h \ + src/char/int_guild.h src/char/int_storage.h src/char/../common/mmo.h \ + src/char/../common/utils.h src/char/char.h src/char/../common/socket.h \ + src/char/../common/sanity.h src/char/../common/db.h \ + src/char/../common/lock.h +${BUILD_DIR}/char/inter.o: src/char/inter.c src/char/../common/mmo.h \ + src/char/../common/utils.h src/char/char.h src/char/../common/socket.h \ + src/char/../common/sanity.h src/char/../common/timer.h \ + src/char/../common/db.h src/char/inter.h src/char/int_party.h \ + src/char/int_guild.h src/char/int_storage.h src/char/../common/lock.h +${BUILD_DIR}/char/int_party.o: src/char/int_party.c src/char/inter.h \ + src/char/int_party.h src/char/../common/mmo.h src/char/../common/utils.h \ + src/char/char.h src/char/../common/socket.h src/char/../common/sanity.h \ + src/char/../common/db.h src/char/../common/lock.h +${BUILD_DIR}/char/int_storage.o: src/char/int_storage.c \ + src/char/../common/mmo.h src/char/../common/utils.h \ + src/char/../common/socket.h src/char/../common/sanity.h \ + src/char/../common/db.h src/char/../common/lock.h src/char/char.h \ + src/char/inter.h src/char/int_storage.h src/char/int_guild.h +${BUILD_DIR}/char/char.o: src/char/char.c src/char/../common/core.h \ + src/char/../common/socket.h src/char/../common/sanity.h \ + src/char/../common/timer.h src/char/../common/mmo.h \ + src/char/../common/utils.h src/char/../common/version.h \ + src/char/../common/lock.h src/char/char.h src/char/inter.h \ + src/char/int_guild.h src/char/int_party.h src/char/int_storage.h +${BUILD_DIR}/tool/itemfrob.o: src/tool/itemfrob.c \ + src/tool/../common/mmo.h src/tool/../common/utils.h \ + src/tool/../char/char.c src/tool/../char/../common/core.h \ + src/tool/../char/../common/socket.h src/tool/../char/../common/sanity.h \ + src/tool/../char/../common/timer.h src/tool/../char/../common/mmo.h \ + src/tool/../char/../common/version.h src/tool/../char/../common/lock.h \ + src/tool/../char/char.h src/tool/../char/inter.h \ + src/tool/../char/int_guild.h src/tool/../char/int_party.h \ + src/tool/../char/int_storage.h +${BUILD_DIR}/tool/eathena-monitor.o: src/tool/eathena-monitor.c +${BUILD_DIR}/tool/adduser.o: src/tool/adduser.c +${BUILD_DIR}/tool/marriage-info.o: src/tool/marriage-info.c \ + src/tool/../login/login.h src/tool/../common/mmo.h \ + src/tool/../common/utils.h src/tool/../char/char.c \ + src/tool/../char/../common/core.h src/tool/../char/../common/socket.h \ + src/tool/../char/../common/sanity.h src/tool/../char/../common/timer.h \ + src/tool/../char/../common/mmo.h src/tool/../char/../common/version.h \ + src/tool/../char/../common/lock.h src/tool/../char/char.h \ + src/tool/../char/inter.h src/tool/../char/int_guild.h \ + src/tool/../char/int_party.h src/tool/../char/int_storage.h +${BUILD_DIR}/tool/skillfrob.o: src/tool/skillfrob.c \ + src/tool/../common/mmo.h src/tool/../common/utils.h \ + src/tool/../char/char.c src/tool/../char/../common/core.h \ + src/tool/../char/../common/socket.h src/tool/../char/../common/sanity.h \ + src/tool/../char/../common/timer.h src/tool/../char/../common/mmo.h \ + src/tool/../char/../common/version.h src/tool/../char/../common/lock.h \ + src/tool/../char/char.h src/tool/../char/inter.h \ + src/tool/../char/int_guild.h src/tool/../char/int_party.h \ + src/tool/../char/int_storage.h +${BUILD_DIR}/tool/convert.o: src/tool/convert.c +${BUILD_DIR}/tool/mapfrob.o: src/tool/mapfrob.c src/tool/../common/mmo.h \ + src/tool/../common/utils.h src/tool/../char/char.c \ + src/tool/../char/../common/core.h src/tool/../char/../common/socket.h \ + src/tool/../char/../common/sanity.h src/tool/../char/../common/timer.h \ + src/tool/../char/../common/mmo.h src/tool/../char/../common/version.h \ + src/tool/../char/../common/lock.h src/tool/../char/char.h \ + src/tool/../char/inter.h src/tool/../char/int_guild.h \ + src/tool/../char/int_party.h src/tool/../char/int_storage.h +${BUILD_DIR}/map/itemdb.o: src/map/itemdb.c src/map/../common/db.h \ + src/map/../common/sanity.h src/map/../common/grfio.h \ + src/map/../common/nullpo.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/timer.h src/map/battle.h \ + src/map/itemdb.h src/map/script.h src/map/pc.h \ + src/map/../common/socket.h src/map/../common/mt_rand.h +${BUILD_DIR}/map/magic.o: src/map/magic.c src/map/magic-interpreter.h \ + src/map/../common/nullpo.h src/map/../common/sanity.h src/map/battle.h \ + src/map/chat.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/timer.h \ + src/map/../common/db.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/intif.h src/map/itemdb.h src/map/magic.h src/map/mob.h \ + src/map/npc.h src/map/pc.h src/map/party.h src/map/script.h \ + src/map/skill.h src/map/trade.h src/map/../common/socket.h +${BUILD_DIR}/map/guild.o: src/map/guild.c src/map/guild.h \ + src/map/storage.h src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/db.h src/map/../common/sanity.h \ + src/map/../common/timer.h src/map/../common/socket.h \ + src/map/../common/nullpo.h src/map/battle.h src/map/npc.h src/map/pc.h \ + src/map/map.h src/map/mob.h src/map/intif.h src/map/clif.h src/map/tmw.h +${BUILD_DIR}/map/mob.o: src/map/mob.c src/map/../common/timer.h \ + src/map/../common/sanity.h src/map/../common/socket.h \ + src/map/../common/db.h src/map/../common/nullpo.h \ + src/map/../common/mt_rand.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/clif.h src/map/storage.h \ + src/map/intif.h src/map/pc.h src/map/mob.h src/map/guild.h \ + src/map/itemdb.h src/map/skill.h src/map/magic.h src/map/battle.h \ + src/map/party.h src/map/npc.h +${BUILD_DIR}/map/storage.o: src/map/storage.c src/map/../common/db.h \ + src/map/../common/sanity.h src/map/../common/nullpo.h src/map/storage.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/chrif.h \ + src/map/itemdb.h src/map/map.h src/map/../common/timer.h src/map/clif.h \ + src/map/intif.h src/map/pc.h src/map/guild.h src/map/battle.h \ + src/map/atcommand.h +${BUILD_DIR}/map/path.o: src/map/path.c src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/db.h src/map/battle.h src/map/../common/nullpo.h +${BUILD_DIR}/map/magic-interpreter-parser.o: \ + src/map/magic-interpreter-parser.c src/map/magic-interpreter.h \ + src/map/../common/nullpo.h src/map/../common/sanity.h src/map/battle.h \ + src/map/chat.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/timer.h \ + src/map/../common/db.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/intif.h src/map/itemdb.h src/map/magic.h src/map/mob.h \ + src/map/npc.h src/map/pc.h src/map/party.h src/map/script.h \ + src/map/skill.h src/map/trade.h src/map/../common/socket.h \ + src/map/magic-expr.h src/map/magic-interpreter-aux.h +${BUILD_DIR}/map/skill.o: src/map/skill.c src/map/../common/timer.h \ + src/map/../common/sanity.h src/map/../common/nullpo.h \ + src/map/../common/mt_rand.h src/map/magic.h src/map/clif.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/../common/db.h \ + src/map/storage.h src/map/intif.h src/map/battle.h src/map/itemdb.h \ + src/map/mob.h src/map/party.h src/map/pc.h src/map/script.h \ + src/map/skill.h src/map/../common/socket.h +${BUILD_DIR}/map/magic-interpreter-lexer.o: \ + src/map/magic-interpreter-lexer.c src/map/magic-interpreter.h \ + src/map/../common/nullpo.h src/map/../common/sanity.h src/map/battle.h \ + src/map/chat.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/timer.h \ + src/map/../common/db.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/intif.h src/map/itemdb.h src/map/magic.h src/map/mob.h \ + src/map/npc.h src/map/pc.h src/map/party.h src/map/script.h \ + src/map/skill.h src/map/trade.h src/map/../common/socket.h \ + src/map/magic-interpreter-parser.h +${BUILD_DIR}/map/magic-stmt.o: src/map/magic-stmt.c \ + src/map/magic-interpreter.h src/map/../common/nullpo.h \ + src/map/../common/sanity.h src/map/battle.h src/map/chat.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/db.h src/map/chrif.h \ + src/map/clif.h src/map/storage.h src/map/intif.h src/map/itemdb.h \ + src/map/magic.h src/map/mob.h src/map/npc.h src/map/pc.h src/map/party.h \ + src/map/script.h src/map/skill.h src/map/trade.h \ + src/map/../common/socket.h src/map/magic-expr.h \ + src/map/magic-interpreter-aux.h src/map/magic-expr-eval.h +${BUILD_DIR}/map/chat.o: src/map/chat.c src/map/../common/db.h \ + src/map/../common/sanity.h src/map/../common/nullpo.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/clif.h src/map/storage.h src/map/pc.h \ + src/map/chat.h src/map/npc.h +${BUILD_DIR}/map/skill-pools.o: src/map/skill-pools.c \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/nullpo.h src/map/../common/mt_rand.h src/map/magic.h \ + src/map/clif.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/db.h src/map/storage.h \ + src/map/intif.h src/map/battle.h src/map/itemdb.h src/map/mob.h \ + src/map/party.h src/map/pc.h src/map/script.h src/map/skill.h \ + src/map/../common/socket.h +${BUILD_DIR}/map/trade.o: src/map/trade.c src/map/clif.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/db.h src/map/storage.h src/map/itemdb.h \ + src/map/trade.h src/map/pc.h src/map/npc.h src/map/battle.h \ + src/map/../common/nullpo.h +${BUILD_DIR}/map/party.o: src/map/party.c src/map/party.h \ + src/map/../common/db.h src/map/../common/sanity.h \ + src/map/../common/timer.h src/map/../common/socket.h \ + src/map/../common/nullpo.h src/map/pc.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/battle.h \ + src/map/intif.h src/map/clif.h src/map/storage.h src/map/skill.h \ + src/map/magic.h src/map/tmw.h +${BUILD_DIR}/map/npc.o: src/map/npc.c src/map/../common/nullpo.h \ + src/map/../common/sanity.h src/map/../common/timer.h src/map/battle.h \ + src/map/clif.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/db.h src/map/storage.h \ + src/map/intif.h src/map/itemdb.h src/map/mob.h src/map/npc.h \ + src/map/pc.h src/map/script.h src/map/skill.h src/map/magic.h \ + src/map/../common/socket.h +${BUILD_DIR}/map/magic-interpreter-base.o: \ + src/map/magic-interpreter-base.c src/map/magic.h src/map/clif.h \ + src/map/map.h src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/db.h src/map/storage.h src/map/intif.h \ + src/map/magic-interpreter.h src/map/../common/nullpo.h src/map/battle.h \ + src/map/chat.h src/map/chrif.h src/map/itemdb.h src/map/mob.h \ + src/map/npc.h src/map/pc.h src/map/party.h src/map/script.h \ + src/map/skill.h src/map/trade.h src/map/../common/socket.h \ + src/map/magic-expr.h src/map/magic-interpreter-aux.h +${BUILD_DIR}/map/pc.o: src/map/pc.c src/map/../common/socket.h \ + src/map/../common/sanity.h src/map/../common/timer.h \ + src/map/../common/db.h src/map/../common/nullpo.h \ + src/map/../common/mt_rand.h src/map/atcommand.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/battle.h \ + src/map/chat.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/guild.h src/map/intif.h src/map/itemdb.h src/map/mob.h \ + src/map/npc.h src/map/party.h src/map/pc.h src/map/script.h \ + src/map/skill.h src/map/magic.h src/map/trade.h +${BUILD_DIR}/map/tmw.o: src/map/tmw.c src/map/tmw.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/db.h src/map/../common/socket.h \ + src/map/../common/version.h src/map/../common/nullpo.h \ + src/map/atcommand.h src/map/battle.h src/map/chat.h src/map/chrif.h \ + src/map/clif.h src/map/storage.h src/map/guild.h src/map/intif.h \ + src/map/itemdb.h src/map/magic.h src/map/mob.h src/map/npc.h \ + src/map/party.h src/map/pc.h src/map/script.h src/map/skill.h \ + src/map/trade.h +${BUILD_DIR}/map/intif.o: src/map/intif.c src/map/../common/nullpo.h \ + src/map/../common/sanity.h src/map/../common/socket.h \ + src/map/../common/timer.h src/map/battle.h src/map/chrif.h \ + src/map/clif.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/db.h src/map/storage.h \ + src/map/guild.h src/map/intif.h src/map/party.h src/map/pc.h +${BUILD_DIR}/map/magic-expr.o: src/map/magic-expr.c src/map/magic-expr.h \ + src/map/magic-interpreter.h src/map/../common/nullpo.h \ + src/map/../common/sanity.h src/map/battle.h src/map/chat.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/timer.h src/map/../common/db.h src/map/chrif.h \ + src/map/clif.h src/map/storage.h src/map/intif.h src/map/itemdb.h \ + src/map/magic.h src/map/mob.h src/map/npc.h src/map/pc.h src/map/party.h \ + src/map/script.h src/map/skill.h src/map/trade.h \ + src/map/../common/socket.h src/map/magic-interpreter-aux.h \ + src/map/magic-expr-eval.h src/map/../common/mt_rand.h +${BUILD_DIR}/map/battle.o: src/map/battle.c src/map/battle.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/nullpo.h src/map/clif.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/../common/db.h \ + src/map/storage.h src/map/guild.h src/map/itemdb.h src/map/mob.h \ + src/map/pc.h src/map/skill.h src/map/magic.h src/map/intif.h \ + src/map/../common/socket.h src/map/../common/mt_rand.h +${BUILD_DIR}/map/script.o: src/map/script.c src/map/../common/socket.h \ + src/map/../common/sanity.h src/map/../common/timer.h \ + src/map/../common/lock.h src/map/../common/mt_rand.h src/map/atcommand.h \ + src/map/map.h src/map/../common/mmo.h src/map/../common/utils.h \ + src/map/../common/db.h src/map/battle.h src/map/chat.h src/map/chrif.h \ + src/map/clif.h src/map/storage.h src/map/guild.h src/map/intif.h \ + src/map/itemdb.h src/map/mob.h src/map/npc.h src/map/party.h \ + src/map/pc.h src/map/script.h src/map/skill.h src/map/magic.h +${BUILD_DIR}/map/clif.o: src/map/clif.c src/map/../common/socket.h \ + src/map/../common/sanity.h src/map/../common/timer.h \ + src/map/../common/version.h src/map/../common/nullpo.h \ + src/map/../common/md5calc.h src/map/../common/mt_rand.h \ + src/map/atcommand.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/../common/db.h src/map/battle.h \ + src/map/chat.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/guild.h src/map/intif.h src/map/itemdb.h src/map/magic.h \ + src/map/mob.h src/map/npc.h src/map/party.h src/map/pc.h \ + src/map/script.h src/map/skill.h src/map/tmw.h src/map/trade.h +${BUILD_DIR}/map/chrif.o: src/map/chrif.c src/map/../common/socket.h \ + src/map/../common/sanity.h src/map/../common/timer.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/../common/db.h \ + src/map/battle.h src/map/chrif.h src/map/clif.h src/map/storage.h \ + src/map/intif.h src/map/npc.h src/map/pc.h src/map/../common/nullpo.h \ + src/map/itemdb.h +${BUILD_DIR}/map/atcommand.o: src/map/atcommand.c \ + src/map/../common/socket.h src/map/../common/sanity.h \ + src/map/../common/timer.h src/map/../common/nullpo.h \ + src/map/../common/mt_rand.h src/map/atcommand.h src/map/map.h \ + src/map/../common/mmo.h src/map/../common/utils.h src/map/../common/db.h \ + src/map/battle.h src/map/clif.h src/map/storage.h src/map/chrif.h \ + src/map/guild.h src/map/intif.h src/map/itemdb.h src/map/mob.h \ + src/map/npc.h src/map/pc.h src/map/party.h src/map/script.h \ + src/map/skill.h src/map/magic.h src/map/trade.h src/map/../common/core.h \ + src/map/tmw.h +${BUILD_DIR}/map/map.o: src/map/map.c src/map/../common/core.h \ + src/map/../common/timer.h src/map/../common/sanity.h \ + src/map/../common/db.h src/map/../common/grfio.h \ + src/map/../common/mt_rand.h src/map/map.h src/map/../common/mmo.h \ + src/map/../common/utils.h src/map/chrif.h src/map/clif.h \ + src/map/storage.h src/map/intif.h src/map/npc.h src/map/pc.h \ + src/map/mob.h src/map/chat.h src/map/itemdb.h src/map/skill.h \ + src/map/magic.h src/map/trade.h src/map/party.h src/map/battle.h \ + src/map/script.h src/map/guild.h src/map/atcommand.h \ + src/map/../common/nullpo.h src/map/../common/socket.h +${BUILD_DIR}/ladmin/ladmin.o: src/ladmin/ladmin.c \ + src/ladmin/../common/core.h src/ladmin/../common/socket.h \ + src/ladmin/../common/sanity.h src/ladmin/ladmin.h \ + src/ladmin/../common/version.h src/ladmin/../common/mmo.h \ + src/ladmin/../common/utils.h src/ladmin/../common/md5calc.h @@ -1,20 +1,15 @@ # defaults CC = gcc -CFLAGS = -pipe -g -fno-strict-aliasing -Wall -Wextra -Werror=all -Werror=implicit-function-declaration -CP = cp -f -# The below might cause problems sometimes -# CP = cp -lf -# CP = cp -sf +BISON = bison +CFLAGS = -pipe -g @warnings # works on both x86 and x86_64 override CC += -m32 -std=gnu99 +# TODO check if this is actually needed - I don't think it should be ifeq ($(findstring CYGWIN,$(shell uname)), CYGWIN) override CFLAGS += -DFD_SETSIZE=4096 -DCYGWIN else override CFLAGS += -fstack-protector endif -# The default recipe is suboptimal -%.c: %.l - $(LEX) -o $@ $< diff --git a/src/char/GNUmakefile b/src/char/GNUmakefile new file mode 100644 index 0000000..cd7ad57 --- /dev/null +++ b/src/char/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. char-server +clean: + rm -r ../../obj/char/ +%:: + make -C ../.. obj/char/$@ diff --git a/src/char/Makefile b/src/char/Makefile deleted file mode 100644 index c448627..0000000 --- a/src/char/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../../make.defs - -all: char - -COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/mt_rand.o -COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/timer.h ../common/mt_rand.h -char: char.o inter.o int_party.o int_guild.o int_storage.o $(COMMON_OBJ) - -char.o: char.c char.h inter.h $(COMMON_H) ../common/version.h -inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h char.h $(COMMON_H) -int_party.o: int_party.c int_party.h inter.h char.h $(COMMON_H) -int_guild.o: int_guild.c int_guild.h int_storage.h inter.h char.h $(COMMON_H) -int_storage.o: int_storage.c int_storage.h int_guild.h inter.h char.h $(COMMON_H) - -clean: - rm -f *.o char diff --git a/src/char/char.c b/src/char/char.c index 59dea17..2a46283 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -133,7 +133,7 @@ int char_log (char *fmt, ...) if (logfp) { if (fmt[0] == '\0') // jump a line if no message - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); else { gettimeofday (&tv, NULL); @@ -246,7 +246,7 @@ int mmo_char_tostr (char *str, struct mmo_charstatus *p) } str_p += sprintf (str_p, "%d\t%d,%d\t%s\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d" "\t%s,%d,%d\t%s,%d,%d,%d\t", p->char_id, p->account_id, p->char_num, p->name, // - p->class, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, p->hp, p->max_hp, p->sp, p->max_sp, p->str, p->agi, p->vit, p->int_, p->dex, p->luk, p->status_point, p->skill_point, p->option, p->karma, p->manner, // + p->pc_class, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, p->hp, p->max_hp, p->sp, p->max_sp, p->str, p->agi, p->vit, p->int_, p->dex, p->luk, p->status_point, p->skill_point, p->option, p->karma, p->manner, // p->party_id, p->guild_id, 0, p->hair, p->hair_color, p->clothes_color, p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, p->last_point.map, p->last_point.x, p->last_point.y, // p->save_point.map, p->save_point.x, p->save_point.y, p->partner_id); @@ -364,7 +364,7 @@ int mmo_char_fromstr (char *str, struct mmo_charstatus *p) p->char_id = tmp_int[0]; p->account_id = tmp_int[1]; p->char_num = tmp_int[2]; - p->class = tmp_int[3]; + p->pc_class = tmp_int[3]; p->base_level = tmp_int[4]; p->job_level = tmp_int[5]; p->base_exp = tmp_int[6]; @@ -437,8 +437,8 @@ int mmo_char_fromstr (char *str, struct mmo_charstatus *p) printf (" Character readed. Suggestion: change the wisp server name.\n"); char_log - ("mmo_auth_init: ******WARNING: character name has wisp server name: Character name '%s' = wisp server name '%s'." - RETCODE, p->name, wisp_server_name); + ("mmo_auth_init: ******WARNING: character name has wisp server name: Character name '%s' = wisp server name '%s'.\n", + p->name, wisp_server_name); } if (str[next] == '\n' || str[next] == '\r') @@ -603,8 +603,8 @@ int mmo_char_init (void) if (fp == NULL) { printf ("Characters file not found: %s.\n", char_txt); - char_log ("Characters file not found: %s." RETCODE, char_txt); - char_log ("Id for the next created character: %d." RETCODE, + char_log ("Characters file not found: %s.\n", char_txt); + char_log ("Id for the next created character: %d.\n", char_id_count); return 0; } @@ -653,43 +653,35 @@ int mmo_char_init (void) { case -1: char_log - ("Duplicate character id in the next character line (character not readed):" - RETCODE); + ("Duplicate character id in the next character line (character not readed):\n"); break; case -2: char_log - ("Duplicate character name in the next character line (character not readed):" - RETCODE); + ("Duplicate character name in the next character line (character not readed):\n"); break; case -3: char_log - ("Invalid memo point structure in the next character line (character not readed):" - RETCODE); + ("Invalid memo point structure in the next character line (character not readed):\n"); break; case -4: char_log - ("Invalid inventory item structure in the next character line (character not readed):" - RETCODE); + ("Invalid inventory item structure in the next character line (character not readed):\n"); break; case -5: char_log - ("Invalid cart item structure in the next character line (character not readed):" - RETCODE); + ("Invalid cart item structure in the next character line (character not readed):\n"); break; case -6: char_log - ("Invalid skill structure in the next character line (character not readed):" - RETCODE); + ("Invalid skill structure in the next character line (character not readed):\n"); break; case -7: char_log - ("Invalid register structure in the next character line (character not readed):" - RETCODE); + ("Invalid register structure in the next character line (character not readed):\n"); break; default: // 0 char_log - ("Unabled to get a character in the next line - Basic structure of line (before inventory) is incorrect (character not readed):" - RETCODE); + ("Unabled to get a character in the next line - Basic structure of line (before inventory) is incorrect (character not readed):\n"); break; } char_log ("%s", line); @@ -700,23 +692,23 @@ int mmo_char_init (void) if (char_num == 0) { printf ("mmo_char_init: No character found in %s.\n", char_txt); - char_log ("mmo_char_init: No character found in %s." RETCODE, + char_log ("mmo_char_init: No character found in %s.\n", char_txt); } else if (char_num == 1) { printf ("mmo_char_init: 1 character read in %s.\n", char_txt); - char_log ("mmo_char_init: 1 character read in %s." RETCODE, char_txt); + char_log ("mmo_char_init: 1 character read in %s.\n", char_txt); } else { printf ("mmo_char_init: %d characters read in %s.\n", char_num, char_txt); - char_log ("mmo_char_init: %d characters read in %s." RETCODE, + char_log ("mmo_char_init: %d characters read in %s.\n", char_num, char_txt); } - char_log ("Id for the next created character: %d." RETCODE, + char_log ("Id for the next created character: %d.\n", char_id_count); return 0; @@ -757,7 +749,7 @@ void mmo_char_sync (void) if (fp == NULL) { printf ("WARNING: Server can't not save characters.\n"); - char_log ("WARNING: Server can't not save characters." RETCODE); + char_log ("WARNING: Server can't not save characters.\n"); } else { @@ -765,9 +757,9 @@ void mmo_char_sync (void) { // create only once the line, and save it in the 2 files (it's speeder than repeat twice the loop and create twice the line) mmo_char_tostr (line, &char_dat[id[i]]); // use of sorted index - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } - fprintf (fp, "%d\t%%newid%%" RETCODE, char_id_count); + fprintf (fp, "%d\t%%newid%%\n", char_id_count); lock_fclose (fp, char_txt, &lock); } @@ -780,17 +772,16 @@ void mmo_char_sync (void) printf ("WARNING: Server can't not create backup of characters file.\n"); char_log - ("WARNING: Server can't not create backup of characters file." - RETCODE); + ("WARNING: Server can't not create backup of characters file.\n"); return; } for (i = 0; i < char_num; i++) { // create only once the line, and save it in the 2 files (it's speeder than repeat twice the loop and create twice the line) mmo_char_tostr (line, &char_dat[id[i]]); // use of sorted index - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } - fprintf (fp, "%d\t%%newid%%" RETCODE, char_id_count); + fprintf (fp, "%d\t%%newid%%\n", char_id_count); lock_fclose (fp, backup_txt, &lock); } @@ -857,17 +848,15 @@ static void remove_prefix_blanks (char *name) int make_new_char (int fd, unsigned char *dat) { int i, j; - struct char_session_data *sd; - - sd = session[fd]->session_data; + struct char_session_data *sd = (struct char_session_data *)session[fd]->session_data; // remove control characters from the name dat[23] = '\0'; if (remove_control_chars (dat)) { char_log - ("Make new char error (control char received in the name): (connection #%d, account: %d)." - RETCODE, fd, sd->account_id); + ("Make new char error (control char received in the name): (connection #%d, account: %d).\n", + fd, sd->account_id); return -1; } @@ -879,8 +868,8 @@ int make_new_char (int fd, unsigned char *dat) if (strlen (dat) < 4) { char_log - ("Make new char error (character name too small): (connection #%d, account: %d, name: '%s')." - RETCODE, fd, sd->account_id, dat); + ("Make new char error (character name too small): (connection #%d, account: %d, name: '%s').\n", + fd, sd->account_id, dat); return -1; } @@ -891,8 +880,8 @@ int make_new_char (int fd, unsigned char *dat) if (strchr (char_name_letters, dat[i]) == NULL) { char_log - ("Make new char error (invalid letter in the name): (connection #%d, account: %d), name: %s, invalid letter: %c." - RETCODE, fd, sd->account_id, dat, dat[i]); + ("Make new char error (invalid letter in the name): (connection #%d, account: %d), name: %s, invalid letter: %c.\n", + fd, sd->account_id, dat, dat[i]); return -1; } } @@ -902,8 +891,8 @@ int make_new_char (int fd, unsigned char *dat) if (strchr (char_name_letters, dat[i]) != NULL) { char_log - ("Make new char error (invalid letter in the name): (connection #%d, account: %d), name: %s, invalid letter: %c." - RETCODE, fd, sd->account_id, dat, dat[i]); + ("Make new char error (invalid letter in the name): (connection #%d, account: %d), name: %s, invalid letter: %c.\n", + fd, sd->account_id, dat, dat[i]); return -1; } } // else, all letters/symbols are authorised (except control char removed before) @@ -914,8 +903,8 @@ int make_new_char (int fd, unsigned char *dat) dat[31] >= 12) { // hair color (dat[31] can not be negativ) char_log - ("Make new char error (invalid values): (connection #%d, account: %d) slot %d, name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d" - RETCODE, fd, sd->account_id, dat[30], dat, dat[24], dat[25], + ("Make new char error (invalid values): (connection #%d, account: %d) slot %d, name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d\n", + fd, sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]); @@ -928,8 +917,8 @@ int make_new_char (int fd, unsigned char *dat) if (dat[i] < 1 || dat[i] > 9) { char_log - ("Make new char error (invalid stat value: not between 1 to 9): (connection #%d, account: %d) slot %d, name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d" - RETCODE, fd, sd->account_id, dat[30], dat, dat[24], dat[25], + ("Make new char error (invalid stat value: not between 1 to 9): (connection #%d, account: %d) slot %d, name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d\n", + fd, sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]); @@ -944,8 +933,8 @@ int make_new_char (int fd, unsigned char *dat) && strcasecmp (char_dat[i].name, dat) == 0)) { char_log - ("Make new char error (name already exists): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %s), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d." - RETCODE, fd, sd->account_id, dat[30], dat, char_dat[i].name, + ("Make new char error (name already exists): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %s), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d.\n", + fd, sd->account_id, dat[30], dat, char_dat[i].name, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]); @@ -955,8 +944,8 @@ int make_new_char (int fd, unsigned char *dat) && char_dat[i].char_num == dat[30]) { char_log - ("Make new char error (slot already used): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %s), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d." - RETCODE, fd, sd->account_id, dat[30], dat, char_dat[i].name, + ("Make new char error (slot already used): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %s), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d.\n", + fd, sd->account_id, dat[30], dat, char_dat[i].name, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]); @@ -967,8 +956,8 @@ int make_new_char (int fd, unsigned char *dat) if (strcmp (wisp_server_name, dat) == 0) { char_log - ("Make new char error (name used is wisp name for server): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %d), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d." - RETCODE, fd, sd->account_id, dat[30], dat, char_dat[i].name, + ("Make new char error (name used is wisp name for server): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %d), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d.\n", + fd, sd->account_id, dat[30], dat, char_dat[i].name, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]); @@ -991,8 +980,8 @@ int make_new_char (int fd, unsigned char *dat) sin_addr[3]); char_log - ("Creation of New Character: (connection #%d, account: %d) slot %d, character Name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d. [%s]" - RETCODE, fd, sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], + ("Creation of New Character: (connection #%d, account: %d) slot %d, character Name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d. [%s]\n", + fd, sd->account_id, dat[30], dat, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31], ip); @@ -1003,7 +992,7 @@ int make_new_char (int fd, unsigned char *dat) char_dat[i].account_id = sd->account_id; char_dat[i].char_num = dat[30]; strcpy (char_dat[i].name, dat); - char_dat[i].class = 0; + char_dat[i].pc_class = 0; char_dat[i].base_level = 1; char_dat[i].job_level = 1; char_dat[i].base_exp = 0; @@ -1054,9 +1043,9 @@ int make_new_char (int fd, unsigned char *dat) //---------------------------------------------------- // This function return the name of the job (by [Yor]) //---------------------------------------------------- -char *job_name (int class) +char *job_name (int pc_class) { - switch (class) + switch (pc_class) { case 0: return "Novice"; @@ -1217,7 +1206,7 @@ void create_online_files (void) if (online_display_option == 0) // we display nothing, so return return; - //char_log("Creation of online players files." RETCODE); + //char_log("Creation of online players files.\n"); // Get number of online players, id of each online players players = 0; @@ -1278,13 +1267,13 @@ void create_online_files (void) break; case 4: // by job (and job level) for (j = 0; j < players; j++) - if (char_dat[i].class < char_dat[id[j]].class || + if (char_dat[i].pc_class < char_dat[id[j]].pc_class || // if same job, we sort by job level. - (char_dat[i].class == char_dat[id[j]].class && + (char_dat[i].pc_class == char_dat[id[j]].pc_class && char_dat[i].job_level < char_dat[id[j]].job_level) || // if same job and job level, we sort by job exp. - (char_dat[i].class == char_dat[id[j]].class && + (char_dat[i].pc_class == char_dat[id[j]].pc_class && char_dat[i].job_level == char_dat[id[j]].job_level && char_dat[i].job_exp < @@ -1459,7 +1448,7 @@ void create_online_files (void) // displaying of the job if (online_display_option & 6) { - char *jobname = job_name (char_dat[j].class); + char *jobname = job_name (char_dat[j].pc_class); if ((online_display_option & 6) == 6) { fprintf (fp2, " <td>%s %d/%d</td>\n", @@ -1638,7 +1627,7 @@ int mmo_char_send006b (int fd, struct char_session_data *sd) WFIFOW (fd, j + 46) = (p->sp > 0x7fff) ? 0x7fff : p->sp; WFIFOW (fd, j + 48) = (p->max_sp > 0x7fff) ? 0x7fff : p->max_sp; WFIFOW (fd, j + 50) = DEFAULT_WALK_SPEED; // p->speed; - WFIFOW (fd, j + 52) = p->class; + WFIFOW (fd, j + 52) = p->pc_class; WFIFOW (fd, j + 54) = p->hair; // WFIFOW(fd,j+56) = p->weapon; // dont send weapon since TMW does not support it WFIFOW (fd, j + 56) = 0; @@ -1790,7 +1779,7 @@ int disconnect_player (int accound_id) // disconnect player if online on char-server for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == accound_id) { @@ -1849,7 +1838,7 @@ void parse_tologin (int fd) return; } - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; while (RFIFOREST (fd) >= 2) { @@ -1892,7 +1881,7 @@ void parse_tologin (int fd) // printf("parse_tologin 2713 : %d\n", RFIFOB(fd,6)); for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == RFIFOL (fd, 2)) { if (RFIFOB (fd, 6) != 0) @@ -1935,7 +1924,7 @@ void parse_tologin (int fd) return; for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == RFIFOL (fd, 2)) { @@ -1979,7 +1968,7 @@ void parse_tologin (int fd) { if (char_dat[i].account_id == acc) { - int jobclass = char_dat[i].class; + int jobclass = char_dat[i].pc_class; char_dat[i].sex = sex; // auth_fifo[i].sex = sex; if (jobclass == 19 || jobclass == 20 || @@ -1989,18 +1978,18 @@ void parse_tologin (int fd) // job modification if (jobclass == 19 || jobclass == 20) { - char_dat[i].class = (sex) ? 19 : 20; + char_dat[i].pc_class = (sex) ? 19 : 20; } else if (jobclass == 4020 || jobclass == 4021) { - char_dat[i].class = + char_dat[i].pc_class = (sex) ? 4020 : 4021; } else if (jobclass == 4042 || jobclass == 4043) { - char_dat[i].class = + char_dat[i].pc_class = (sex) ? 4042 : 4043; } } @@ -2034,8 +2023,7 @@ void parse_tologin (int fd) return; if (RFIFOL (fd, 4) < 1) char_log - ("Receiving a message for broadcast, but message is void." - RETCODE); + ("Receiving a message for broadcast, but message is void.\n"); else { // at least 1 map-server @@ -2044,8 +2032,7 @@ void parse_tologin (int fd) break; if (i == MAX_MAP_SERVERS) char_log - ("'ladmin': Receiving a message for broadcast, but no map-server is online." - RETCODE); + ("'ladmin': Receiving a message for broadcast, but no map-server is online.\n"); else { char buf[128]; @@ -2063,23 +2050,22 @@ void parse_tologin (int fd) // if message is only composed of spaces if (p[0] == '\0') char_log - ("Receiving a message for broadcast, but message is only a lot of spaces." - RETCODE); + ("Receiving a message for broadcast, but message is only a lot of spaces.\n"); // else send message to all map-servers else { if (RFIFOW (fd, 2) == 0) { char_log - ("'ladmin': Receiving a message for broadcast (message (in yellow): %s)" - RETCODE, message); + ("'ladmin': Receiving a message for broadcast (message (in yellow): %s)\n", + message); lp = 4; } else { char_log - ("'ladmin': Receiving a message for broadcast (message (in blue): %s)" - RETCODE, message); + ("'ladmin': Receiving a message for broadcast (message (in blue): %s)\n", + message); lp = 8; } // split message to max 80 char @@ -2216,7 +2202,7 @@ void parse_tologin (int fd) for (j = 0; j < fd_max; j++) { if (session[j] - && (sd2 = session[j]->session_data) + && (sd2 = (struct char_session_data*)session[j]->session_data) && sd2->account_id == char_dat[char_num - 1].account_id) { @@ -2290,8 +2276,8 @@ void parse_tologin (int fd) ("From login-server: receiving of %d GM accounts information.\n", GM_num); char_log - ("From login-server: receiving of %d GM accounts information." - RETCODE, GM_num); + ("From login-server: receiving of %d GM accounts information.\n", + GM_num); create_online_files (); // update online players files (perhaps some online players change of GM level) // send new gm acccounts level to map-servers memcpy (buf, RFIFOP (fd, 0), RFIFOW (fd, 2)); @@ -2311,7 +2297,7 @@ void parse_tologin (int fd) for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == acc) { @@ -2353,8 +2339,8 @@ void map_anti_freeze_system (timer_id tid, tick_t tick, custom_id_t id, custom_d ("Map-server anti-freeze system: char-server #%d is freezed -> disconnection.\n", i); char_log - ("Map-server anti-freeze system: char-server #%d is freezed -> disconnection." - RETCODE, i); + ("Map-server anti-freeze system: char-server #%d is freezed -> disconnection.\n", + i); session[server_fd[i]]->eof = 1; } } @@ -2423,8 +2409,8 @@ void parse_frommap (int fd) id, j, p[0], p[1], p[2], p[3], server[id].port); printf ("Map-server %d loading complete.\n", id); char_log - ("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d. Map-server %d loading complete." - RETCODE, id, j, p[0], p[1], p[2], p[3], + ("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d. Map-server %d loading complete.\n", + id, j, p[0], p[1], p[2], p[3], server[id].port, id); } WFIFOW (fd, 0) = 0x2afb; @@ -2437,8 +2423,8 @@ void parse_frommap (int fd) if (j == 0) { printf ("WARNING: Map-Server %d have NO map.\n", id); - char_log ("WARNING: Map-Server %d have NO map." - RETCODE, id); + char_log ("WARNING: Map-Server %d have NO map.\n", + id); // Transmitting maps information to the other map-servers } else @@ -2963,7 +2949,7 @@ void parse_char (int fd) return; } - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; while (RFIFOREST (fd) >= 2) { @@ -3113,8 +3099,8 @@ void parse_char (int fd) if (ch != 9) { char_log - ("Character Selected, Account ID: %d, Character Slot: %d, Character Name: %s [%s]" - RETCODE, sd->account_id, RFIFOB (fd, 2), + ("Character Selected, Account ID: %d, Character Slot: %d, Character Name: %s [%s]\n", + sd->account_id, RFIFOB (fd, 2), char_dat[sd->found_char[ch]].name, ip); // searching map server i = search_mapserver (char_dat @@ -3290,7 +3276,7 @@ void parse_char (int fd) (char_dat[i].max_sp > 0x7fff) ? 0x7fff : char_dat[i].max_sp; WFIFOW (fd, 2 + 50) = DEFAULT_WALK_SPEED; // char_dat[i].speed; - WFIFOW (fd, 2 + 52) = char_dat[i].class; + WFIFOW (fd, 2 + 52) = char_dat[i].pc_class; WFIFOW (fd, 2 + 54) = char_dat[i].hair; WFIFOW (fd, 2 + 58) = char_dat[i].base_level; @@ -3412,7 +3398,7 @@ void parse_char (int fd) for (j = 0; j < fd_max; j++) { if (session[j] - && (sd2 = + && (sd2 = (struct char_session_data*) session[j]->session_data) && sd2->account_id == char_dat[char_num - 1].account_id) @@ -4027,8 +4013,7 @@ void term_func (void) delete_session (login_fd); delete_session (char_fd); - char_log ("----End of char-server (normal end with closing of all files)." - RETCODE); + char_log ("----End of char-server (normal end with closing of all files).\n"); } int do_init (int argc, char **argv) @@ -4037,7 +4022,7 @@ int do_init (int argc, char **argv) // a newline in the log... char_log (""); - char_log ("The char-server starting..." RETCODE); + char_log ("The char-server starting...\n"); char_config_read ((argc < 2) ? CHAR_CONF_NAME : argv[1]); lan_config_read ((argc > 1) ? argv[1] : LOGIN_LAN_CONF_NAME); @@ -4080,8 +4065,8 @@ int do_init (int argc, char **argv) i = add_timer_interval (gettick () + 1000, map_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000); // checks every X seconds user specifies } - char_log ("The char-server is ready (Server is listening on the port %d)." - RETCODE, char_port); + char_log ("The char-server is ready (Server is listening on the port %d).\n", + char_port); printf ("The char-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 9715700..05aae6b 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -49,7 +49,7 @@ int inter_guild_tostr (char *str, struct guild *g) len += sprintf (str + len, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t%s\t", m->account_id, m->char_id, m->hair, m->hair_color, m->gender, - m->class, m->lv, m->exp, m->exp_payper, m->position, + m->pc_class, m->lv, m->exp, m->exp_payper, m->position, ((m->account_id > 0) ? m->name : "-")); } // 役職 @@ -154,7 +154,7 @@ int inter_guild_fromstr (char *str, struct guild *g) m->hair = tmp_int[2]; m->hair_color = tmp_int[3]; m->gender = tmp_int[4]; - m->class = tmp_int[5]; + m->pc_class = tmp_int[5]; m->lv = tmp_int[6]; m->exp = tmp_int[7]; m->exp_payper = tmp_int[8]; @@ -398,7 +398,7 @@ int inter_guildcastle_fromstr (char *str, struct guild_castle *gc) } // ギルド関連データベース読み込み -int inter_guild_readdb () +int inter_guild_readdb (void) { int i; FILE *fp; @@ -424,7 +424,7 @@ int inter_guild_readdb () } // ギルドデータの読み込み -int inter_guild_init () +int inter_guild_init (void) { char line[16384]; struct guild *g; @@ -535,9 +535,7 @@ int inter_guild_init () struct guild *inter_guild_search (int guild_id) { - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); return g; } @@ -550,7 +548,7 @@ void inter_guild_save_sub (db_key_t key, db_val_t data, va_list ap) inter_guild_tostr (line, (struct guild *) data); fp = va_arg (ap, FILE *); - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } // ギルド城データのセーブ用 @@ -561,11 +559,11 @@ void inter_castle_save_sub (db_key_t key, db_val_t data, va_list ap) inter_guildcastle_tostr (line, (struct guild_castle *) data); fp = va_arg (ap, FILE *); - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } // ギルドデータのセーブ -int inter_guild_save () +int inter_guild_save (void) { FILE *fp; int lock; @@ -839,7 +837,7 @@ int mapif_guild_memberinfoshort (struct guild *g, int idx) WBUFL (buf, 10) = 0 /*g->member[idx].char_id*/; WBUFB (buf, 14) = g->member[idx].online; WBUFW (buf, 15) = g->member[idx].lv; - WBUFW (buf, 17) = g->member[idx].class; + WBUFW (buf, 17) = g->member[idx].pc_class; mapif_sendall (buf, 19); return 0; } @@ -1082,7 +1080,7 @@ int mapif_parse_CreateGuild (int fd, int account_id, char *name, mapif_guild_created (fd, account_id, g); mapif_guild_info (fd, g); - inter_log ("guild %s (id=%d) created by master %s (id=%d)" RETCODE, + inter_log ("guild %s (id=%d) created by master %s (id=%d)\n", name, g->guild_id, master->name, master->account_id); return 0; @@ -1091,9 +1089,7 @@ int mapif_parse_CreateGuild (int fd, int account_id, char *name, // ギルド情報要求 int mapif_parse_GuildInfo (int fd, int guild_id) { - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g != NULL) { guild_calcinfo (g); @@ -1108,17 +1104,14 @@ int mapif_parse_GuildInfo (int fd, int guild_id) // ギルドメンバ追加要求 int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m) { - struct guild *g; - int i; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) { mapif_guild_memberadded (fd, guild_id, m->account_id, 0 /*char_id*/, 1); return 0; } - for (i = 0; i < g->max_member; i++) + for (int i = 0; i < g->max_member; i++) { if (g->member[i].account_id == 0) { @@ -1140,13 +1133,10 @@ int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m) int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) { - struct guild *g = NULL; - int i, j; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g != NULL) { - for (i = 0; i < MAX_GUILD; i++) + for (int i = 0; i < MAX_GUILD; i++) { if (g->member[i].account_id == account_id) { @@ -1154,7 +1144,9 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id, // printf("%d %s\n", i, g->member[i].name); if (flag) - { // 追放の場合追放リストに入れる + { + int j; + // 追放の場合追放リストに入れる for (j = 0; j < MAX_GUILDEXPLUSION; j++) { if (g->explusion[j].account_id == 0) @@ -1191,26 +1183,23 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id, // オンライン/Lv更新 int mapif_parse_GuildChangeMemberInfoShort (int fd, int guild_id, int account_id, int char_id, - int online, int lv, int class) + int online, int lv, int pc_class) { - struct guild *g; - int i, alv, c; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; g->connect_member = 0; - alv = 0; - c = 0; - for (i = 0; i < MAX_GUILD; i++) + int alv = 0; + int c = 0; + for (int i = 0; i < MAX_GUILD; i++) { if (g->member[i].account_id == account_id) { g->member[i].online = online; g->member[i].lv = lv; - g->member[i].class = class; + g->member[i].pc_class = pc_class; mapif_guild_memberinfoshort (g, i); } if (g->member[i].account_id > 0) @@ -1244,9 +1233,7 @@ void guild_break_sub (db_key_t key, db_val_t data, va_list ap) // ギルド解散要求 int mapif_parse_BreakGuild (int fd, int guild_id) { - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; @@ -1255,7 +1242,7 @@ int mapif_parse_BreakGuild (int fd, int guild_id) inter_guild_storage_delete (guild_id); mapif_guild_broken (guild_id, 0); - inter_log ("guild %s (id=%d) broken" RETCODE, g->name, guild_id); + inter_log ("guild %s (id=%d) broken\n", g->name, guild_id); free (g); return 0; @@ -1272,10 +1259,9 @@ int mapif_parse_GuildMessage (int fd, int guild_id, int account_id, char *mes, int mapif_parse_GuildBasicInfoChange (int fd, int guild_id, int type, const char *data, int len) { - struct guild *g; short dw = *((short *) data); - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; @@ -1307,9 +1293,7 @@ int mapif_parse_GuildMemberInfoChange (int fd, int guild_id, int account_id, const char *data, int len) { int i; - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; @@ -1351,7 +1335,7 @@ int mapif_parse_GuildMemberInfoChange (int fd, int guild_id, int account_id, int mapif_parse_GuildPosition (int fd, int guild_id, int idx, struct guild_position *p) { - struct guild *g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL || idx < 0 || idx >= MAX_GUILDPOSITION) { @@ -1368,7 +1352,7 @@ int mapif_parse_GuildPosition (int fd, int guild_id, int idx, int mapif_parse_GuildSkillUp (int fd, int guild_id, int skill_num, int account_id) { - struct guild *g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); int idx = skill_num - 10000; if (g == NULL || skill_num < 10000) @@ -1394,8 +1378,8 @@ int mapif_parse_GuildAlliance (int fd, int guild_id1, int guild_id2, struct guild *g[2]; int j, i; - g[0] = numdb_search (guild_db, guild_id1); - g[1] = numdb_search (guild_db, guild_id2); + g[0] = (struct guild *)numdb_search (guild_db, guild_id1); + g[1] = (struct guild *)numdb_search (guild_db, guild_id2); if (g[0] == NULL || g[1] == NULL) return 0; @@ -1436,9 +1420,7 @@ int mapif_parse_GuildAlliance (int fd, int guild_id1, int guild_id2, int mapif_parse_GuildNotice (int fd, int guild_id, const char *mes1, const char *mes2) { - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; memcpy (g->mes1, mes1, 60); @@ -1451,9 +1433,7 @@ int mapif_parse_GuildNotice (int fd, int guild_id, const char *mes1, int mapif_parse_GuildEmblem (int fd, int len, int guild_id, int dummy, const char *data) { - struct guild *g; - - g = numdb_search (guild_db, guild_id); + struct guild *g = (struct guild *)numdb_search (guild_db, guild_id); if (g == NULL) return 0; memcpy (g->emblem_data, data, len); @@ -1465,7 +1445,7 @@ int mapif_parse_GuildEmblem (int fd, int len, int guild_id, int dummy, int mapif_parse_GuildCastleDataLoad (int fd, int castle_id, int index) { - struct guild_castle *gc = numdb_search (castle_db, castle_id); + struct guild_castle *gc = (struct guild_castle *)numdb_search (castle_db, castle_id); if (gc == NULL) { @@ -1560,7 +1540,7 @@ int mapif_parse_GuildCastleDataLoad (int fd, int castle_id, int index) int mapif_parse_GuildCastleDataSave (int fd, int castle_id, int index, int value) { - struct guild_castle *gc = numdb_search (castle_db, castle_id); + struct guild_castle *gc = (struct guild_castle *)numdb_search (castle_db, castle_id); if (gc == NULL) { @@ -1572,8 +1552,8 @@ int mapif_parse_GuildCastleDataSave (int fd, int castle_id, int index, if (gc->guild_id != value) { int gid = (value) ? value : gc->guild_id; - struct guild *g = numdb_search (guild_db, gid); - inter_log ("guild %s (id=%d) %s castle id=%d" RETCODE, + struct guild *g = (struct guild *)numdb_search (guild_db, gid); + inter_log ("guild %s (id=%d) %s castle id=%d\n", (g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", index); } diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 954addf..5ac9a51 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -2,8 +2,8 @@ #ifndef _INT_GUILD_H_ #define _INT_GUILD_H_ -int inter_guild_init (); -int inter_guild_save (); +int inter_guild_init (void); +int inter_guild_save (void); int inter_guild_parse_frommap (int fd); struct guild *inter_guild_search (int guild_id); int inter_guild_mapif_init (int fd); diff --git a/src/char/int_party.c b/src/char/int_party.c index b728b1e..6f8d023 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -87,7 +87,7 @@ int inter_party_fromstr (char *str, struct party *p) } // パーティデータのロード -int inter_party_init () +int inter_party_init (void) { char line[8192]; struct party *p; @@ -140,11 +140,11 @@ void inter_party_save_sub (db_key_t key, db_val_t data, va_list ap) inter_party_tostr (line, (struct party *) data); fp = va_arg (ap, FILE *); - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } // パーティーデータのセーブ -int inter_party_save () +int inter_party_save (void) { FILE *fp; int lock; @@ -460,9 +460,7 @@ int mapif_parse_CreateParty (int fd, int account_id, char *name, char *nick, // パーティ情報要求 int mapif_parse_PartyInfo (int fd, int party_id) { - struct party *p; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p != NULL) mapif_party_info (fd, p); else @@ -475,17 +473,14 @@ int mapif_parse_PartyInfo (int fd, int party_id) int mapif_parse_PartyAddMember (int fd, int party_id, int account_id, char *nick, char *map, int lv) { - struct party *p; - int i; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p == NULL) { mapif_party_memberadded (fd, party_id, account_id, 1); return 0; } - for (i = 0; i < MAX_PARTY; i++) + for (int i = 0; i < MAX_PARTY; i++) { if (p->member[i].account_id == 0) { @@ -519,14 +514,12 @@ int mapif_parse_PartyAddMember (int fd, int party_id, int account_id, int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id, int exp, int item) { - struct party *p; - int flag = 0; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p == NULL) return 0; p->exp = exp; + int flag = 0; if (exp > 0 && !party_check_exp_share (p)) { flag |= 0x01; @@ -542,13 +535,10 @@ int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id, // パーティ脱退要求 int mapif_parse_PartyLeave (int fd, int party_id, int account_id) { - struct party *p; - int i; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p != NULL) { - for (i = 0; i < MAX_PARTY; i++) + for (int i = 0; i < MAX_PARTY; i++) { if (p->member[i].account_id == account_id) { @@ -569,14 +559,11 @@ int mapif_parse_PartyLeave (int fd, int party_id, int account_id) int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id, char *map, int online, int lv) { - struct party *p; - int i; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p == NULL) return 0; - for (i = 0; i < MAX_PARTY; i++) + for (int i = 0; i < MAX_PARTY; i++) { if (p->member[i].account_id == account_id) { @@ -604,9 +591,7 @@ int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id, // パーティ解散要求 int mapif_parse_BreakParty (int fd, int party_id) { - struct party *p; - - p = numdb_search (party_db, party_id); + struct party *p = (struct party *)numdb_search (party_db, party_id); if (p == NULL) return 0; diff --git a/src/char/int_party.h b/src/char/int_party.h index 738b624..2007ed5 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -2,8 +2,8 @@ #ifndef _INT_PARTY_H_ #define _INT_PARTY_H_ -int inter_party_init (); -int inter_party_save (); +int inter_party_init (void); +int inter_party_save (void); int inter_party_parse_frommap (int fd); diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 99af725..e565572 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -248,7 +248,7 @@ struct guild_storage *guild2storage (int guild_id) //--------------------------------------------------------- // 倉庫データを読み込む -int inter_storage_init () +int inter_storage_init (void) { char line[65536]; int c = 0, tmp_int; @@ -328,7 +328,7 @@ void guild_storage_db_final (db_key_t k, db_val_t data, va_list ap) free (p); } -void inter_storage_final () +void inter_storage_final (void) { numdb_final (storage_db, storage_db_final); numdb_final (guild_storage_db, guild_storage_db_final); @@ -342,12 +342,12 @@ void inter_storage_save_sub (db_key_t key, db_val_t data, va_list ap) storage_tostr (line, (struct storage *) data); fp = va_arg (ap, FILE *); if (*line) - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } //--------------------------------------------------------- // 倉庫データを書き込む -int inter_storage_save () +int inter_storage_save (void) { FILE *fp; int lock; @@ -378,13 +378,13 @@ void inter_guild_storage_save_sub (db_key_t key, db_val_t data, va_list ap) guild_storage_tostr (line, (struct guild_storage *) data); fp = va_arg (ap, FILE *); if (*line) - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } } //--------------------------------------------------------- // 倉庫データを書き込む -int inter_guild_storage_save () +int inter_guild_storage_save (void) { FILE *fp; int lock; diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 5036600..f1859c6 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -2,10 +2,10 @@ #ifndef _INT_STORAGE_H_ #define _INT_STORAGE_H_ -int inter_storage_init (); -void inter_storage_final (); -int inter_storage_save (); -int inter_guild_storage_save (); +int inter_storage_init (void); +void inter_storage_final (void); +int inter_storage_save (void); +int inter_guild_storage_save (void); int inter_storage_delete (int account_id); int inter_guild_storage_delete (int guild_id); struct storage *account2storage (int account_id); diff --git a/src/char/inter.c b/src/char/inter.c index f563931..e886bf6 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -106,7 +106,7 @@ int inter_accreg_fromstr (const char *str, struct accreg *reg) } // アカウント変数の読み込み -int inter_accreg_init () +int inter_accreg_init (void) { char line[8192]; FILE *fp; @@ -150,12 +150,12 @@ void inter_accreg_save_sub (db_key_t key, db_val_t data, va_list ap) { inter_accreg_tostr (line, reg); fp = va_arg (ap, FILE *); - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } } // アカウント変数のセーブ -int inter_accreg_save () +int inter_accreg_save (void) { FILE *fp; int lock; @@ -262,7 +262,7 @@ int inter_log (char *fmt, ...) } // セーブ -int inter_save () +int inter_save (void) { inter_party_save (); inter_guild_save (); @@ -358,7 +358,7 @@ int mapif_account_reg (int fd, unsigned char *src) // アカウント変数要求返信 int mapif_account_reg_reply (int fd, int account_id) { - struct accreg *reg = numdb_search (accreg_db, account_id); + struct accreg *reg = (struct accreg *)numdb_search (accreg_db, account_id); WFIFOW (fd, 0) = 0x3804; WFIFOL (fd, 4) = account_id; @@ -395,7 +395,7 @@ void check_ttl_wisdata_sub (db_key_t key, db_val_t data, va_list ap) wis_dellist[wis_delnum++] = wd->id; } -int check_ttl_wisdata () +int check_ttl_wisdata (void) { unsigned long tick = gettick (); int i; @@ -406,7 +406,7 @@ int check_ttl_wisdata () numdb_foreach (wis_db, check_ttl_wisdata_sub, tick); for (i = 0; i < wis_delnum; i++) { - struct WisData *wd = numdb_search (wis_db, wis_dellist[i]); + struct WisData *wd = (struct WisData *)numdb_search (wis_db, wis_dellist[i]); printf ("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst); // removed. not send information after a timeout. Just no answer for the player @@ -499,7 +499,7 @@ int mapif_parse_WisRequest (int fd) int mapif_parse_WisReply (int fd) { int id = RFIFOL (fd, 2), flag = RFIFOB (fd, 6); - struct WisData *wd = numdb_search (wis_db, id); + struct WisData *wd = (struct WisData *)numdb_search (wis_db, id); if (wd == NULL) return 0; // This wisp was probably suppress before, because it was timeout of because of target was found on another map-server @@ -530,7 +530,7 @@ int mapif_parse_WisToGM (int fd) int mapif_parse_AccReg (int fd) { int j, p; - struct accreg *reg = numdb_search (accreg_db, (numdb_key_t)RFIFOL (fd, 4)); + struct accreg *reg = (struct accreg*)numdb_search (accreg_db, (numdb_key_t)RFIFOL (fd, 4)); if (reg == NULL) { diff --git a/src/char/inter.h b/src/char/inter.h index 7ad7d08..219f195 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -3,7 +3,7 @@ #define _INTER_H_ int inter_init (const char *file); -int inter_save (); +int inter_save (void); int inter_parse_frommap (int fd); int inter_mapif_init (int fd); diff --git a/src/common/GNUmakefile b/src/common/GNUmakefile new file mode 100644 index 0000000..555f81e --- /dev/null +++ b/src/common/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. common +clean: + rm -r ../../obj/common/ +%:: + make -C ../.. obj/common/$@ diff --git a/src/common/Makefile b/src/common/Makefile deleted file mode 100644 index 43552dc..0000000 --- a/src/common/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../../make.defs -all: core.o socket.o timer.o grfio.o db.o lock.o nullpo.o mt_rand.o md5calc.o - -core.o: core.c core.h -socket.o: socket.c socket.h mmo.h -timer.o: timer.c timer.h -grfio.o: grfio.c grfio.h -db.o: db.c db.h -lock.o: lock.c lock.h -nullpo.o: nullpo.c nullpo.h -mt_rand.o: mt_rand.c mt_rand.h -md5calc.o: md5calc.c md5calc.h - -clean: - rm -f *.o diff --git a/src/common/db.c b/src/common/db.c index cee17df..f56a511 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -229,7 +229,7 @@ static void db_rebalance_erase (struct dbn *z, struct dbn **root) z->parent->right = y; y->parent = z->parent; { - int tmp = y->color; + dbn_color tmp = y->color; y->color = z->color; z->color = tmp; } diff --git a/src/common/md5calc.c b/src/common/md5calc.c index d5ebcf8..ba8f6af 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -165,7 +165,7 @@ void MD5_to_bin(MD5_state state, uint8_t out[0x10]) out[i] = state.val[i/4] >> 8*(i%4); } -static const char hex[0x10] = "0123456789abcdef"; +static const char hex[] = "0123456789abcdef"; void MD5_to_str(MD5_state state, char out[0x21]) { @@ -198,7 +198,7 @@ MD5_state MD5_from_string(const char* msg, const size_t msglen) if (64 - rem > 8) { for (int i=0; i<8; i++) - buf[0x38+i] = (msglen*8) >> (i*8); + buf[0x38+i] = ((uint64_t)msglen*8) >> (i*8); } for (int i=0; i<0x10; i++) X[i] = buf[4*i+0] | buf[4*i+1]<<8 | buf[4*i+2]<<16 | buf[4*i+3]<<24; @@ -207,7 +207,7 @@ MD5_state MD5_from_string(const char* msg, const size_t msglen) { memset(buf,'\0', 0x38); for (int i=0; i<8; i++) - buf[0x38+i] = (msglen*8) >> (i*8); + buf[0x38+i] = ((uint64_t)msglen*8) >> (i*8); for (int i=0; i<0x10; i++) X[i] = buf[4*i+0] | buf[4*i+1]<<8 | buf[4*i+2]<<16 | buf[4*i+3]<<24; MD5_do_block(&state, block); @@ -291,7 +291,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt) return obuf; } -const char *make_salt() { +const char *make_salt(void) { static char salt[6]; for (int i=0; i<5; i++) salt[i] = MPRAND(48, 78); diff --git a/src/common/md5calc.h b/src/common/md5calc.h index cf1425f..b864791 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -53,7 +53,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt); /// return some random characters (statically allocated) // Currently, returns a 5-char string -const char *make_salt(); +const char *make_salt(void); /// check plaintext password against saved saltcrypt bool pass_ok(const char *password, const char *crypted); diff --git a/src/common/mmo.h b/src/common/mmo.h index 906f5c1..64e0523 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -5,12 +5,6 @@ # include <time.h> # include "utils.h" // LCCWIN32 -# ifdef CYGWIN -# define RETCODE "\r\n" -# else -# define RETCODE "\n" -# endif - # define FIFOSIZE_SERVERLINK 256*1024 // set to 0 to not check IP of player between each server. @@ -101,7 +95,7 @@ struct mmo_charstatus int base_exp, job_exp, zeny; - short class; + short pc_class; short status_point, skill_point; int hp, max_hp, sp, max_sp; short option, karma, manner; @@ -176,7 +170,7 @@ struct party struct guild_member { int account_id, char_id; - short hair, hair_color, gender, class, lv; + short hair, hair_color, gender, pc_class, lv; int exp, exp_payper; short online, position; int rsv1, rsv2; diff --git a/src/common/nullpo.c b/src/common/nullpo.c index de10517..8c7c405 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -47,6 +47,8 @@ void nullpo_info (const char *file, int line, const char *func) /// Actual output function static void nullpo_info_core (const char *file, int line, const char *func, + const char *fmt, va_list ap) __attribute__((format(printf, 4, 0))); +static void nullpo_info_core (const char *file, int line, const char *func, const char *fmt, va_list ap) { if (!file) diff --git a/src/common/socket.c b/src/common/socket.c index 7c86b1a..67a5102 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -23,8 +23,8 @@ fd_set readfds; int fd_max; int currentuse; -const uint32_t rfifo_size = 65536; -const uint32_t wfifo_size = 65536; +const uint32_t RFIFO_SIZE = 65536; +const uint32_t WFIFO_SIZE = 65536; struct socket_data *session[FD_SETSIZE]; @@ -126,11 +126,11 @@ static void connect_client (int listen_fd) fcntl (fd, F_SETFL, O_NONBLOCK); CREATE (session[fd], struct socket_data, 1); - CREATE (session[fd]->rdata, uint8_t, rfifo_size); - CREATE (session[fd]->wdata, uint8_t, wfifo_size); + CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE); + CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE); - session[fd]->max_rdata = rfifo_size; - session[fd]->max_wdata = wfifo_size; + session[fd]->max_rdata = RFIFO_SIZE; + session[fd]->max_wdata = WFIFO_SIZE; session[fd]->func_recv = recv_to_fifo; session[fd]->func_send = send_from_fifo; session[fd]->func_parse = default_func_parse; @@ -231,11 +231,11 @@ int make_connection (uint32_t ip, uint16_t port) FD_SET (fd, &readfds); CREATE (session[fd], struct socket_data, 1); - CREATE (session[fd]->rdata, uint8_t, rfifo_size); - CREATE (session[fd]->wdata, uint8_t, wfifo_size); + CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE); + CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE); - session[fd]->max_rdata = rfifo_size; - session[fd]->max_wdata = wfifo_size; + session[fd]->max_rdata = RFIFO_SIZE; + session[fd]->max_wdata = WFIFO_SIZE; session[fd]->func_recv = recv_to_fifo; session[fd]->func_send = send_from_fifo; session[fd]->func_parse = default_func_parse; @@ -399,7 +399,7 @@ FILE *fopen_ (const char *path, const char *mode) return f; } -bool free_fds () +bool free_fds (void) { return currentuse < SOFT_LIMIT; } diff --git a/src/common/socket.h b/src/common/socket.h index 0e15f5b..b886df0 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -130,6 +130,6 @@ void set_defaultparse (void (*defaultparse) (int)); /// Wrappers to track number of free FDs void fclose_ (FILE * fp); FILE *fopen_ (const char *path, const char *mode); -bool free_fds (); +bool free_fds (void); #endif // SOCKET_H diff --git a/src/common/timer.c b/src/common/timer.c index f4be19b..6795824 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -51,7 +51,7 @@ static void push_timer_heap (timer_id index) if (timer_heap == NULL || timer_heap[0] + 1 >= timer_heap_max) { timer_heap_max += 256; - RECREATE (timer_heap, int, timer_heap_max); + RECREATE (timer_heap, timer_id, timer_heap_max); memset (timer_heap + (timer_heap_max - 256), 0, sizeof (timer_id) * 256); } // timer_heap[0] is the greatest index into the heap, which increases @@ -71,14 +71,14 @@ static void push_timer_heap (timer_id index) timer_heap[h + 1] = index; } -static timer_id top_timer_heap () +static timer_id top_timer_heap (void) { if (!timer_heap || !timer_heap[0]) return -1; return timer_heap[1]; } -static timer_id pop_timer_heap () +static timer_id pop_timer_heap (void) { if (!timer_heap || !timer_heap[0]) return -1; @@ -227,7 +227,7 @@ interval_t do_timer (tick_t tick) switch (timer_data[i].type) { case TIMER_ONCE_AUTODEL: - timer_data[i].type = 0; + timer_data[i].type = TIMER_NONE; if (free_timer_list_pos >= free_timer_list_max) { free_timer_list_max += 256; diff --git a/src/common/timer.h b/src/common/timer.h index e363a56..e6a292c 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -5,8 +5,9 @@ enum TIMER_TYPE { - TIMER_ONCE_AUTODEL = 1, - TIMER_INTERVAL = 2, + TIMER_NONE, + TIMER_ONCE_AUTODEL, + TIMER_INTERVAL, }; /// This is needed to produce a signed result when 2 ticks are subtracted # define DIFF_TICK(a,b) ((int32_t)((a)-(b))) diff --git a/src/ladmin/GNUmakefile b/src/ladmin/GNUmakefile new file mode 100644 index 0000000..1461bcf --- /dev/null +++ b/src/ladmin/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. ladmin +clean: + rm -r ../../obj/ladmin/ +%:: + make -C ../.. obj/ladmin/$@ diff --git a/src/ladmin/Makefile b/src/ladmin/Makefile deleted file mode 100644 index 4b4d2ec..0000000 --- a/src/ladmin/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../../make.defs - -all: ladmin - -COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/mt_rand.o -COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/mt_rand.h - -ladmin: ladmin.o ../common/md5calc.o $(COMMON_OBJ) -ladmin.o: ladmin.c ladmin.h ../common/md5calc.h $(COMMON_H) - -clean: - rm -f *.o ladmin diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c index 49f52ca..1fb2804 100644 --- a/src/ladmin/ladmin.c +++ b/src/ladmin/ladmin.c @@ -255,7 +255,7 @@ int already_exit_function = 0; // sometimes, the exit function is called twice. //------------------------------ // Writing function of logs file //------------------------------ -int ladmin_log (char *fmt, ...) +int ladmin_log (const char *fmt, ...) { FILE *logfp; va_list ap; @@ -268,7 +268,7 @@ int ladmin_log (char *fmt, ...) if (logfp) { if (fmt[0] == '\0') // jump a line if no message - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); else { gettimeofday (&tv, NULL); @@ -307,7 +307,7 @@ int remove_control_chars (unsigned char *str) //--------------------------------------------- // Function to return ordonal text of a number. //--------------------------------------------- -char *makeordinal (int number) +const char *makeordinal (int number) { if (defaultlanguage == 'F') { @@ -355,8 +355,8 @@ int verify_accountname (char *account_name) ("Caractère interdit trouvé dans le nom du compte (%d%s caractère).\n", i + 1, makeordinal (i + 1)); ladmin_log - ("Caractère interdit trouvé dans le nom du compte (%d%s caractère)." - RETCODE, i + 1, makeordinal (i + 1)); + ("Caractère interdit trouvé dans le nom du compte (%d%s caractère).\n", + i + 1, makeordinal (i + 1)); } else { @@ -364,8 +364,8 @@ int verify_accountname (char *account_name) ("Illegal character found in the account name (%d%s character).\n", i + 1, makeordinal (i + 1)); ladmin_log - ("Illegal character found in the account name (%d%s character)." - RETCODE, i + 1, makeordinal (i + 1)); + ("Illegal character found in the account name (%d%s character).\n", + i + 1, makeordinal (i + 1)); } return 0; } @@ -378,16 +378,14 @@ int verify_accountname (char *account_name) printf ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères.\n"); ladmin_log - ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères." - RETCODE); + ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères.\n"); } else { printf ("Account name is too short. Please input an account name of 4-23 bytes.\n"); ladmin_log - ("Account name is too short. Please input an account name of 4-23 bytes." - RETCODE); + ("Account name is too short. Please input an account name of 4-23 bytes.\n"); } return 0; } @@ -399,16 +397,14 @@ int verify_accountname (char *account_name) printf ("Nom du compte trop long. Entrez un nom de compte de 4-23 caractères.\n"); ladmin_log - ("Nom du compte trop long. Entrez un nom de compte de 4-23 caractères." - RETCODE); + ("Nom du compte trop long. Entrez un nom de compte de 4-23 caractères.\n"); } else { printf ("Account name is too long. Please input an account name of 4-23 bytes.\n"); ladmin_log - ("Account name is too long. Please input an account name of 4-23 bytes." - RETCODE); + ("Account name is too long. Please input an account name of 4-23 bytes.\n"); } return 0; } @@ -470,13 +466,11 @@ int typepasswd (char *password) if (defaultlanguage == 'F') { ladmin_log - ("Aucun mot de passe n'a été donné. Demande d'un mot de passe." - RETCODE); + ("Aucun mot de passe n'a été donné. Demande d'un mot de passe.\n"); } else { - ladmin_log ("No password was given. Request to obtain a password." - RETCODE); + ladmin_log ("No password was given. Request to obtain a password.\n"); } memset (password1, '\0', sizeof (password1)); @@ -508,30 +502,28 @@ int typepasswd (char *password) printf ("Erreur de vérification du mot de passe: Saisissez le même mot de passe svp.\n"); ladmin_log - ("Erreur de vérification du mot de passe: Saisissez le même mot de passe svp." - RETCODE); - ladmin_log (" Premier mot de passe: %s, second mot de passe: %s." - RETCODE, password1, password2); + ("Erreur de vérification du mot de passe: Saisissez le même mot de passe svp.\n"); + ladmin_log (" Premier mot de passe: %s, second mot de passe: %s.\n", + password1, password2); } else { printf ("Password verification failed. Please input same password.\n"); ladmin_log - ("Password verification failed. Please input same password." - RETCODE); - ladmin_log (" First password: %s, second password: %s." RETCODE, + ("Password verification failed. Please input same password.\n"); + ladmin_log (" First password: %s, second password: %s.\n", password1, password2); } return 0; } if (defaultlanguage == 'F') { - ladmin_log ("Mot de passe saisi: %s." RETCODE, password1); + ladmin_log ("Mot de passe saisi: %s.\n", password1); } else { - ladmin_log ("Typed password: %s." RETCODE, password1); + ladmin_log ("Typed password: %s.\n", password1); } strcpy (password, password1); return 1; @@ -554,8 +546,8 @@ int verify_password (char *password) ("Caractère interdit trouvé dans le mot de passe (%d%s caractère).\n", i + 1, makeordinal (i + 1)); ladmin_log - ("Caractère interdit trouvé dans le nom du compte (%d%s caractère)." - RETCODE, i + 1, makeordinal (i + 1)); + ("Caractère interdit trouvé dans le nom du compte (%d%s caractère).\n", + i + 1, makeordinal (i + 1)); } else { @@ -563,8 +555,8 @@ int verify_password (char *password) ("Illegal character found in the password (%d%s character).\n", i + 1, makeordinal (i + 1)); ladmin_log - ("Illegal character found in the password (%d%s character)." - RETCODE, i + 1, makeordinal (i + 1)); + ("Illegal character found in the password (%d%s character).\n", + i + 1, makeordinal (i + 1)); } return 0; } @@ -577,16 +569,14 @@ int verify_password (char *password) printf ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères.\n"); ladmin_log - ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères." - RETCODE); + ("Nom du compte trop court. Entrez un nom de compte de 4-23 caractères.\n"); } else { printf ("Account name is too short. Please input an account name of 4-23 bytes.\n"); ladmin_log - ("Account name is too short. Please input an account name of 4-23 bytes." - RETCODE); + ("Account name is too short. Please input an account name of 4-23 bytes.\n"); } return 0; } @@ -598,16 +588,14 @@ int verify_password (char *password) printf ("Mot de passe trop long. Entrez un mot de passe de 4-23 caractères.\n"); ladmin_log - ("Mot de passe trop long. Entrez un mot de passe de 4-23 caractères." - RETCODE); + ("Mot de passe trop long. Entrez un mot de passe de 4-23 caractères.\n"); } else { printf ("Password is too long. Please input a password of 4-23 bytes.\n"); ladmin_log - ("Password is too long. Please input a password of 4-23 bytes." - RETCODE); + ("Password is too long. Please input a password of 4-23 bytes.\n"); } return 0; } @@ -772,11 +760,11 @@ void display_help (char *param, int language) if (defaultlanguage == 'F') { - ladmin_log ("Affichage des commandes ou d'une commande." RETCODE); + ladmin_log ("Affichage des commandes ou d'une commande.\n"); } else { - ladmin_log ("Displaying of the commands or a command." RETCODE); + ladmin_log ("Displaying of the commands or a command.\n"); } if (language == 1) @@ -1626,8 +1614,7 @@ int addaccount (char *param, int emailflag) ("Entrez un nom de compte, un sexe et un mot de passe svp.\n"); printf ("<exemple> add nomtest Male motdepassetest\n"); ladmin_log - ("Nombre incorrect de paramètres pour créer un compte (commande 'add')." - RETCODE); + ("Nombre incorrect de paramètres pour créer un compte (commande 'add').\n"); } else { @@ -1635,8 +1622,7 @@ int addaccount (char *param, int emailflag) ("Please input an account name, a sex and a password.\n"); printf ("<example> add testname Male testpass\n"); ladmin_log - ("Incomplete parameters to create an account ('add' command)." - RETCODE); + ("Incomplete parameters to create an account ('add' command).\n"); } return 136; } @@ -1656,8 +1642,7 @@ int addaccount (char *param, int emailflag) printf ("<exemple> create nomtest Male mo@mail.com motdepassetest\n"); ladmin_log - ("Nombre incorrect de paramètres pour créer un compte (commande 'create')." - RETCODE); + ("Nombre incorrect de paramètres pour créer un compte (commande 'create').\n"); } else { @@ -1666,8 +1651,7 @@ int addaccount (char *param, int emailflag) printf ("<example> create testname Male my@mail.com testpass\n"); ladmin_log - ("Incomplete parameters to create an account ('create' command)." - RETCODE); + ("Incomplete parameters to create an account ('create' command).\n"); } return 136; } @@ -1681,10 +1665,10 @@ int addaccount (char *param, int emailflag) if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_", name[i]) == NULL) { if (defaultlanguage == 'F') { printf("Caractère interdit (%c) trouvé dans le nom du compte (%d%s caractère).\n", name[i], i+1, makeordinal(i+1)); - ladmin_log("Caractère interdit (%c) trouvé dans le nom du compte (%d%s caractère)." RETCODE, name[i], i+1, makeordinal(i+1)); + ladmin_log("Caractère interdit (%c) trouvé dans le nom du compte (%d%s caractère).\n", name[i], i+1, makeordinal(i+1)); } else { printf("Illegal character (%c) found in the account name (%d%s character).\n", name[i], i+1, makeordinal(i+1)); - ladmin_log("Illegal character (%c) found in the account name (%d%s character)." RETCODE, name[i], i+1, makeordinal(i+1)); + ladmin_log("Illegal character (%c) found in the account name (%d%s character).\n", name[i], i+1, makeordinal(i+1)); } return 101; } @@ -1696,13 +1680,13 @@ int addaccount (char *param, int emailflag) if (defaultlanguage == 'F') { printf ("Sexe incorrect [%s]. Entrez M ou F svp.\n", sex); - ladmin_log ("Sexe incorrect [%s]. Entrez M ou F svp." RETCODE, + ladmin_log ("Sexe incorrect [%s]. Entrez M ou F svp.\n", sex); } else { printf ("Illegal gender [%s]. Please input M or F.\n", sex); - ladmin_log ("Illegal gender [%s]. Please input M or F." RETCODE, + ladmin_log ("Illegal gender [%s]. Please input M or F.\n", sex); } return 103; @@ -1715,16 +1699,16 @@ int addaccount (char *param, int emailflag) printf ("Email trop courte [%s]. Entrez une e-mail valide svp.\n", email); ladmin_log - ("Email trop courte [%s]. Entrez une e-mail valide svp." - RETCODE, email); + ("Email trop courte [%s]. Entrez une e-mail valide svp.\n", + email); } else { printf ("Email is too short [%s]. Please input a valid e-mail.\n", email); ladmin_log - ("Email is too short [%s]. Please input a valid e-mail." - RETCODE, email); + ("Email is too short [%s]. Please input a valid e-mail.\n", + email); } return 109; } @@ -1736,8 +1720,8 @@ int addaccount (char *param, int emailflag) ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp.\n", email); ladmin_log - ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp." - RETCODE, email); + ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp.\n", + email); } else { @@ -1745,8 +1729,8 @@ int addaccount (char *param, int emailflag) ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most.\n", email); ladmin_log - ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most." - RETCODE, email); + ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most.\n", + email); } return 109; } @@ -1756,15 +1740,15 @@ int addaccount (char *param, int emailflag) { printf ("Email incorrecte [%s]. Entrez une e-mail valide svp.\n", email); - ladmin_log ("Email incorrecte [%s]. Entrez une e-mail valide svp." - RETCODE, email); + ladmin_log ("Email incorrecte [%s]. Entrez une e-mail valide svp.\n", + email); } else { printf ("Invalid email [%s]. Please input a valid e-mail.\n", email); - ladmin_log ("Invalid email [%s]. Please input a valid e-mail." - RETCODE, email); + ladmin_log ("Invalid email [%s]. Please input a valid e-mail.\n", + email); } return 109; } @@ -1780,12 +1764,11 @@ int addaccount (char *param, int emailflag) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour créer un compte." - RETCODE); + ("Envoi d'un requête au serveur de logins pour créer un compte.\n"); } else { - ladmin_log ("Request to login-server to create an account." RETCODE); + ladmin_log ("Request to login-server to create an account.\n"); } WFIFOW (login_fd, 0) = 0x7930; @@ -1825,8 +1808,7 @@ int banaddaccount (char *param) (" Cette exemple ajoute 1 mois et 1 seconde, et soustrait 2 minutes\n"); printf (" et 6 ans dans le même temps.\n"); ladmin_log - ("Nombre incorrect de paramètres pour modifier la fin de ban d'un compte (commande 'banadd')." - RETCODE); + ("Nombre incorrect de paramètres pour modifier la fin de ban d'un compte (commande 'banadd').\n"); } else { @@ -1836,8 +1818,7 @@ int banaddaccount (char *param) (" this example adds 1 month and 1 second, and substracts 2 minutes\n"); printf (" and 6 years at the same time.\n"); ladmin_log - ("Incomplete parameters to modify the ban date/time of an account ('banadd' command)." - RETCODE); + ("Incomplete parameters to modify the ban date/time of an account ('banadd' command).\n"); } return 136; } @@ -1942,8 +1923,7 @@ int banaddaccount (char *param) (" Cette exemple ajoute 1 mois et 1 seconde, et soustrait 2 minutes\n"); printf (" et 6 ans dans le même temps.\n"); ladmin_log - ("Aucun ajustement n'est pas un ajustement (commande 'banadd')." - RETCODE); + ("Aucun ajustement n'est pas un ajustement (commande 'banadd').\n"); } else { @@ -1961,8 +1941,7 @@ int banaddaccount (char *param) (" this example adds 1 month and 1 second, and substracts 2 minutes\n"); printf (" and 6 years at the same time.\n"); ladmin_log - ("No adjustment isn't an adjustment ('banadd' command)." - RETCODE); + ("No adjustment isn't an adjustment ('banadd' command).\n"); } return 137; } @@ -1973,16 +1952,14 @@ int banaddaccount (char *param) printf ("Entrez un ajustement d'années correct (de -127 à 127), svp.\n"); ladmin_log - ("Ajustement de l'année hors norme (commande 'banadd')." - RETCODE); + ("Ajustement de l'année hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the years (from -127 to 127).\n"); ladmin_log - ("Abnormal adjustement for the year ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the year ('banadd' command).\n"); } return 137; } @@ -1992,16 +1969,14 @@ int banaddaccount (char *param) { printf ("Entrez un ajustement de mois correct (de -255 à 255), svp.\n"); - ladmin_log ("Ajustement du mois hors norme (commande 'banadd')." - RETCODE); + ladmin_log ("Ajustement du mois hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the months (from -255 to 255).\n"); ladmin_log - ("Abnormal adjustement for the month ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the month ('banadd' command).\n"); } return 137; } @@ -2011,16 +1986,14 @@ int banaddaccount (char *param) { printf ("Entrez un ajustement de jours correct (de -32767 à 32767), svp.\n"); - ladmin_log ("Ajustement des jours hors norme (commande 'banadd')." - RETCODE); + ladmin_log ("Ajustement des jours hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the days (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the days ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the days ('banadd' command).\n"); } return 137; } @@ -2031,16 +2004,14 @@ int banaddaccount (char *param) printf ("Entrez un ajustement d'heures correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des heures hors norme (commande 'banadd')." - RETCODE); + ("Ajustement des heures hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the hours (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the hours ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the hours ('banadd' command).\n"); } return 137; } @@ -2051,16 +2022,14 @@ int banaddaccount (char *param) printf ("Entrez un ajustement de minutes correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des minutes hors norme (commande 'banadd')." - RETCODE); + ("Ajustement des minutes hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the minutes (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the minutes ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the minutes ('banadd' command).\n"); } return 137; } @@ -2071,16 +2040,14 @@ int banaddaccount (char *param) printf ("Entrez un ajustement de secondes correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des secondes hors norme (commande 'banadd')." - RETCODE); + ("Ajustement des secondes hors norme (commande 'banadd').\n"); } else { printf ("Please give a correct adjustment for the seconds (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the seconds ('banadd' command)." - RETCODE); + ("Abnormal adjustement for the seconds ('banadd' command).\n"); } return 137; } @@ -2088,13 +2055,11 @@ int banaddaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour modifier la date d'un bannissement." - RETCODE); + ("Envoi d'un requête au serveur de logins pour modifier la date d'un bannissement.\n"); } else { - ladmin_log ("Request to login-server to modify a ban date/time." - RETCODE); + ladmin_log ("Request to login-server to modify a ban date/time.\n"); } WFIFOW (login_fd, 0) = 0x794c; @@ -2143,8 +2108,7 @@ int bansetaccountsub (char *name, char *date, char *time) printf ("Vous pouvez aussi mettre 0 à la place si vous utilisez la commande 'banset'.\n"); ladmin_log - ("Format incorrect pour la date/heure (commande'banset' ou 'ban')." - RETCODE); + ("Format incorrect pour la date/heure (commande'banset' ou 'ban').\n"); } else { @@ -2153,8 +2117,7 @@ int bansetaccountsub (char *name, char *date, char *time) printf ("You can imput 0 instead of if you use 'banset' command.\n"); ladmin_log - ("Invalid format for the date/time ('banset' or 'ban' command)." - RETCODE); + ("Invalid format for the date/time ('banset' or 'ban' command).\n"); } return 102; } @@ -2179,16 +2142,14 @@ int bansetaccountsub (char *name, char *date, char *time) { printf ("Entrez un mois correct svp (entre 1 et 12).\n"); ladmin_log - ("Mois incorrect pour la date (command 'banset' ou 'ban')." - RETCODE); + ("Mois incorrect pour la date (command 'banset' ou 'ban').\n"); } else { printf ("Please give a correct value for the month (from 1 to 12).\n"); ladmin_log - ("Invalid month for the date ('banset' or 'ban' command)." - RETCODE); + ("Invalid month for the date ('banset' or 'ban' command).\n"); } return 102; } @@ -2199,16 +2160,14 @@ int bansetaccountsub (char *name, char *date, char *time) { printf ("Entrez un jour correct svp (entre 1 et 31).\n"); ladmin_log - ("Jour incorrect pour la date (command 'banset' ou 'ban')." - RETCODE); + ("Jour incorrect pour la date (command 'banset' ou 'ban').\n"); } else { printf ("Please give a correct value for the day (from 1 to 31).\n"); ladmin_log - ("Invalid day for the date ('banset' or 'ban' command)." - RETCODE); + ("Invalid day for the date ('banset' or 'ban' command).\n"); } return 102; } @@ -2221,8 +2180,7 @@ int bansetaccountsub (char *name, char *date, char *time) ("Entrez un jour correct en fonction du mois (%d) svp.\n", month); ladmin_log - ("Jour incorrect pour ce mois correspondant (command 'banset' ou 'ban')." - RETCODE); + ("Jour incorrect pour ce mois correspondant (command 'banset' ou 'ban').\n"); } else { @@ -2230,8 +2188,7 @@ int bansetaccountsub (char *name, char *date, char *time) ("Please give a correct value for a day of this month (%d).\n", month); ladmin_log - ("Invalid day for this month ('banset' or 'ban' command)." - RETCODE); + ("Invalid day for this month ('banset' or 'ban' command).\n"); } return 102; } @@ -2241,16 +2198,14 @@ int bansetaccountsub (char *name, char *date, char *time) { printf ("Entrez une heure correcte svp (entre 0 et 23).\n"); ladmin_log - ("Heure incorrecte pour l'heure (command 'banset' ou 'ban')." - RETCODE); + ("Heure incorrecte pour l'heure (command 'banset' ou 'ban').\n"); } else { printf ("Please give a correct value for the hour (from 0 to 23).\n"); ladmin_log - ("Invalid hour for the time ('banset' or 'ban' command)." - RETCODE); + ("Invalid hour for the time ('banset' or 'ban' command).\n"); } return 102; } @@ -2261,16 +2216,14 @@ int bansetaccountsub (char *name, char *date, char *time) printf ("Entrez des minutes correctes svp (entre 0 et 59).\n"); ladmin_log - ("Minute incorrecte pour l'heure (command 'banset' ou 'ban')." - RETCODE); + ("Minute incorrecte pour l'heure (command 'banset' ou 'ban').\n"); } else { printf ("Please give a correct value for the minutes (from 0 to 59).\n"); ladmin_log - ("Invalid minute for the time ('banset' or 'ban' command)." - RETCODE); + ("Invalid minute for the time ('banset' or 'ban' command).\n"); } return 102; } @@ -2281,16 +2234,14 @@ int bansetaccountsub (char *name, char *date, char *time) printf ("Entrez des secondes correctes svp (entre 0 et 59).\n"); ladmin_log - ("Seconde incorrecte pour l'heure (command 'banset' ou 'ban')." - RETCODE); + ("Seconde incorrecte pour l'heure (command 'banset' ou 'ban').\n"); } else { printf ("Please give a correct value for the seconds (from 0 to 59).\n"); ladmin_log - ("Invalid second for the time ('banset' or 'ban' command)." - RETCODE); + ("Invalid second for the time ('banset' or 'ban' command).\n"); } return 102; } @@ -2311,8 +2262,7 @@ int bansetaccountsub (char *name, char *date, char *time) ("Entrez une date et une heure svp (format: aaaa/mm/jj hh:mm:ss).\n"); printf ("Vous pouvez aussi mettre 0 à la place si vous utilisez la commande 'banset'.\n"); - ladmin_log ("Date incorrecte. (command 'banset' ou 'ban')." - RETCODE); + ladmin_log ("Date incorrecte. (command 'banset' ou 'ban').\n"); } else { @@ -2321,8 +2271,7 @@ int bansetaccountsub (char *name, char *date, char *time) ("Please input a date and a time (format: yyyy/mm/dd hh:mm:ss).\n"); printf ("You can imput 0 instead of if you use 'banset' command.\n"); - ladmin_log ("Invalid date. ('banset' or 'ban' command)." - RETCODE); + ladmin_log ("Invalid date. ('banset' or 'ban' command).\n"); } return 102; } @@ -2331,12 +2280,11 @@ int bansetaccountsub (char *name, char *date, char *time) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour fixer un ban." - RETCODE); + ("Envoi d'un requête au serveur de logins pour fixer un ban.\n"); } else { - ladmin_log ("Request to login-server to set a ban." RETCODE); + ladmin_log ("Request to login-server to set a ban.\n"); } WFIFOW (login_fd, 0) = 0x794a; @@ -2374,8 +2322,7 @@ int banaccount (char *param) printf (" unban/unbanish <nom du compte>\n"); printf (" Heure par défaut [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Nombre incorrect de paramètres pour fixer un ban (commande 'banset' ou 'ban')." - RETCODE); + ("Nombre incorrect de paramètres pour fixer un ban (commande 'banset' ou 'ban').\n"); } else { @@ -2389,8 +2336,7 @@ int banaccount (char *param) printf (" unban/unbanish <account name>\n"); printf (" Default time [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Incomplete parameters to set a ban ('banset' or 'ban' command)." - RETCODE); + ("Incomplete parameters to set a ban ('banset' or 'ban' command).\n"); } return 136; } @@ -2424,8 +2370,7 @@ int bansetaccount (char *param) printf (" unban/unbanish <nom du compte>\n"); printf (" Heure par défaut [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Nombre incorrect de paramètres pour fixer un ban (commande 'banset' ou 'ban')." - RETCODE); + ("Nombre incorrect de paramètres pour fixer un ban (commande 'banset' ou 'ban').\n"); } else { @@ -2439,8 +2384,7 @@ int bansetaccount (char *param) printf (" unban/unbanish <account name>\n"); printf (" Default time [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Incomplete parameters to set a ban ('banset' or 'ban' command)." - RETCODE); + ("Incomplete parameters to set a ban ('banset' or 'ban' command).\n"); } return 136; } @@ -2476,8 +2420,7 @@ int unbanaccount (char *param) printf (" unban/unbanish <nom du compte>\n"); printf (" Heure par défaut [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Nombre incorrect de paramètres pour fixer un ban (commande 'unban')." - RETCODE); + ("Nombre incorrect de paramètres pour fixer un ban (commande 'unban').\n"); } else { @@ -2491,8 +2434,7 @@ int unbanaccount (char *param) printf (" unban/unbanish <account name>\n"); printf (" Default time [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Incomplete parameters to set a ban ('unban' command)." - RETCODE); + ("Incomplete parameters to set a ban ('unban' command).\n"); } return 136; } @@ -2520,16 +2462,14 @@ int checkaccount (char *param) printf ("Entrez un nom de compte svp.\n"); printf ("<exemple> check testname motdepasse\n"); ladmin_log - ("Nombre incorrect de paramètres pour tester le mot d'un passe d'un compte (commande 'check')." - RETCODE); + ("Nombre incorrect de paramètres pour tester le mot d'un passe d'un compte (commande 'check').\n"); } else { printf ("Please input an account name.\n"); printf ("<example> check testname password\n"); ladmin_log - ("Incomplete parameters to check the password of an account ('check' command)." - RETCODE); + ("Incomplete parameters to check the password of an account ('check' command).\n"); } return 136; } @@ -2550,12 +2490,11 @@ int checkaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour test un mot de passe." - RETCODE); + ("Envoi d'un requête au serveur de logins pour test un mot de passe.\n"); } else { - ladmin_log ("Request to login-server to check a password." RETCODE); + ladmin_log ("Request to login-server to check a password.\n"); } WFIFOW (login_fd, 0) = 0x793a; @@ -2589,16 +2528,14 @@ int delaccount (char *param) printf ("Entrez un nom de compte svp.\n"); printf ("<exemple> del nomtestasupprimer\n"); ladmin_log - ("Aucun nom donné pour supprimer un compte (commande 'delete')." - RETCODE); + ("Aucun nom donné pour supprimer un compte (commande 'delete').\n"); } else { printf ("Please input an account name.\n"); printf ("<example> del testnametodelete\n"); ladmin_log - ("No name given to delete an account ('delete' command)." - RETCODE); + ("No name given to delete an account ('delete' command).\n"); } return 136; } @@ -2631,14 +2568,12 @@ int delaccount (char *param) { printf ("Suppression annulée.\n"); ladmin_log - ("Suppression annulée par l'utilisateur (commande 'delete')." - RETCODE); + ("Suppression annulée par l'utilisateur (commande 'delete').\n"); } else { printf ("Deletion canceled.\n"); - ladmin_log ("Deletion canceled by user ('delete' command)." - RETCODE); + ladmin_log ("Deletion canceled by user ('delete' command).\n"); } return 121; } @@ -2646,12 +2581,11 @@ int delaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour détruire un compte." - RETCODE); + ("Envoi d'un requête au serveur de logins pour détruire un compte.\n"); } else { - ladmin_log ("Request to login-server to delete an acount." RETCODE); + ladmin_log ("Request to login-server to delete an acount.\n"); } WFIFOW (login_fd, 0) = 0x7932; @@ -2681,16 +2615,14 @@ int changeemail (char *param) printf ("Entrez un nom de compte et une email svp.\n"); printf ("<exemple> email testname nouveauemail\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer l'email d'un compte (commande 'email')." - RETCODE); + ("Nombre incorrect de paramètres pour changer l'email d'un compte (commande 'email').\n"); } else { printf ("Please input an account name and an email.\n"); printf ("<example> email testname newemail\n"); ladmin_log - ("Incomplete parameters to change the email of an account ('email' command)." - RETCODE); + ("Incomplete parameters to change the email of an account ('email' command).\n"); } return 136; } @@ -2707,16 +2639,16 @@ int changeemail (char *param) printf ("Email trop courte [%s]. Entrez une e-mail valide svp.\n", email); ladmin_log - ("Email trop courte [%s]. Entrez une e-mail valide svp." - RETCODE, email); + ("Email trop courte [%s]. Entrez une e-mail valide svp.\n", + email); } else { printf ("Email is too short [%s]. Please input a valid e-mail.\n", email); ladmin_log - ("Email is too short [%s]. Please input a valid e-mail." - RETCODE, email); + ("Email is too short [%s]. Please input a valid e-mail.\n", + email); } return 109; } @@ -2728,8 +2660,8 @@ int changeemail (char *param) ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp.\n", email); ladmin_log - ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp." - RETCODE, email); + ("Email trop longue [%s]. Entrez une e-mail de 39 caractères maximum svp.\n", + email); } else { @@ -2737,8 +2669,8 @@ int changeemail (char *param) ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most.\n", email); ladmin_log - ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most." - RETCODE, email); + ("Email is too long [%s]. Please input an e-mail with 39 bytes at the most.\n", + email); } return 109; } @@ -2748,15 +2680,15 @@ int changeemail (char *param) { printf ("Email incorrecte [%s]. Entrez une e-mail valide svp.\n", email); - ladmin_log ("Email incorrecte [%s]. Entrez une e-mail valide svp." - RETCODE, email); + ladmin_log ("Email incorrecte [%s]. Entrez une e-mail valide svp.\n", + email); } else { printf ("Invalid email [%s]. Please input a valid e-mail.\n", email); - ladmin_log ("Invalid email [%s]. Please input a valid e-mail." - RETCODE, email); + ladmin_log ("Invalid email [%s]. Please input a valid e-mail.\n", + email); } return 109; } @@ -2764,12 +2696,11 @@ int changeemail (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer une email." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer une email.\n"); } else { - ladmin_log ("Request to login-server to change an email." RETCODE); + ladmin_log ("Request to login-server to change an email.\n"); } WFIFOW (login_fd, 0) = 0x7940; @@ -2784,19 +2715,17 @@ int changeemail (char *param) //----------------------------------------------------- // Sub-function: Asking of the number of online players //----------------------------------------------------- -int getlogincount () +int getlogincount (void) { if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir le nombre de joueurs en jeu." - RETCODE); + ("Envoi d'un requête au serveur de logins pour obtenir le nombre de joueurs en jeu.\n"); } else { ladmin_log - ("Request to login-server to obtain the # of online players." - RETCODE); + ("Request to login-server to obtain the # of online players.\n"); } WFIFOW (login_fd, 0) = 0x7938; @@ -2826,16 +2755,14 @@ int changegmlevel (char *param) printf ("Entrez un nom de compte et un niveau de GM svp.\n"); printf ("<exemple> gm nomtest 80\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le Niveau de GM d'un compte (commande 'gm')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le Niveau de GM d'un compte (commande 'gm').\n"); } else { printf ("Please input an account name and a GM level.\n"); printf ("<example> gm testname 80\n"); ladmin_log - ("Incomplete parameters to change the GM level of an account ('gm' command)." - RETCODE); + ("Incomplete parameters to change the GM level of an account ('gm' command).\n"); } return 136; } @@ -2853,8 +2780,8 @@ int changegmlevel (char *param) ("Niveau de GM incorrect [%d]. Entrez une valeur de 0 à 99 svp.\n", GM_level); ladmin_log - ("Niveau de GM incorrect [%d]. La valeur peut être de 0 à 99." - RETCODE, GM_level); + ("Niveau de GM incorrect [%d]. La valeur peut être de 0 à 99.\n", + GM_level); } else { @@ -2862,8 +2789,8 @@ int changegmlevel (char *param) ("Illegal GM level [%d]. Please input a value from 0 to 99.\n", GM_level); ladmin_log - ("Illegal GM level [%d]. The value can be from 0 to 99." - RETCODE, GM_level); + ("Illegal GM level [%d]. The value can be from 0 to 99.\n", + GM_level); } return 103; } @@ -2871,12 +2798,11 @@ int changegmlevel (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer un niveau de GM." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer un niveau de GM.\n"); } else { - ladmin_log ("Request to login-server to change a GM level." RETCODE); + ladmin_log ("Request to login-server to change a GM level.\n"); } WFIFOW (login_fd, 0) = 0x793e; @@ -2907,16 +2833,14 @@ int idaccount (char *param) printf ("Entrez un nom de compte svp.\n"); printf ("<exemple> id nomtest\n"); ladmin_log - ("Aucun nom donné pour rechecher l'id d'un compte (commande 'id')." - RETCODE); + ("Aucun nom donné pour rechecher l'id d'un compte (commande 'id').\n"); } else { printf ("Please input an account name.\n"); printf ("<example> id testname\n"); ladmin_log - ("No name given to search an account id ('id' command)." - RETCODE); + ("No name given to search an account id ('id' command).\n"); } return 136; } @@ -2929,12 +2853,11 @@ int idaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour connaître l'id d'un compte." - RETCODE); + ("Envoi d'un requête au serveur de logins pour connaître l'id d'un compte.\n"); } else { - ladmin_log ("Request to login-server to know an account id." RETCODE); + ladmin_log ("Request to login-server to know an account id.\n"); } WFIFOW (login_fd, 0) = 0x7944; @@ -2956,14 +2879,12 @@ int infoaccount (int account_id) { printf ("Entrez un id ayant une valeur positive svp.\n"); ladmin_log - ("Une valeur négative a été donné pour trouver le compte." - RETCODE); + ("Une valeur négative a été donné pour trouver le compte.\n"); } else { printf ("Please input a positive value for the id.\n"); - ladmin_log ("Negative value was given to found the account." - RETCODE); + ladmin_log ("Negative value was given to found the account.\n"); } return 136; } @@ -2971,14 +2892,12 @@ int infoaccount (int account_id) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir le information d'un compte (par l'id)." - RETCODE); + ("Envoi d'un requête au serveur de logins pour obtenir le information d'un compte (par l'id).\n"); } else { ladmin_log - ("Request to login-server to obtain information about an account (by its id)." - RETCODE); + ("Request to login-server to obtain information about an account (by its id).\n"); } WFIFOW (login_fd, 0) = 0x7954; @@ -3007,7 +2926,7 @@ int sendbroadcast (short type, char *message) { printf ("<exemple> kamib un message\n"); } - ladmin_log ("Le message est vide (commande 'kami(b)')." RETCODE); + ladmin_log ("Le message est vide (commande 'kami(b)').\n"); } else { @@ -3020,7 +2939,7 @@ int sendbroadcast (short type, char *message) { printf ("<example> kamib a message\n"); } - ladmin_log ("The message is void ('kami(b)' command)." RETCODE); + ladmin_log ("The message is void ('kami(b)' command).\n"); } return 136; } @@ -3047,14 +2966,14 @@ int changelanguage (char *language) printf ("Entrez une langue svp.\n"); printf ("<exemple> language english\n"); printf (" language français\n"); - ladmin_log ("La langue est vide (commande 'language')." RETCODE); + ladmin_log ("La langue est vide (commande 'language').\n"); } else { printf ("Please input a language.\n"); printf ("<example> language english\n"); printf (" language français\n"); - ladmin_log ("The language is void ('language' command)." RETCODE); + ladmin_log ("The language is void ('language' command).\n"); } return 136; } @@ -3066,13 +2985,12 @@ int changelanguage (char *language) if (defaultlanguage == 'F') { printf ("Changement de la langue d'affichage en Français.\n"); - ladmin_log ("Changement de la langue d'affichage en Français." - RETCODE); + ladmin_log ("Changement de la langue d'affichage en Français.\n"); } else { printf ("Displaying language changed to English.\n"); - ladmin_log ("Displaying language changed to English." RETCODE); + ladmin_log ("Displaying language changed to English.\n"); } } else @@ -3082,15 +3000,13 @@ int changelanguage (char *language) printf ("Langue non paramétrée (langues possibles: 'Français' ou 'English').\n"); ladmin_log - ("Langue non paramétrée (Français ou English nécessaire)." - RETCODE); + ("Langue non paramétrée (Français ou English nécessaire).\n"); } else { printf ("Undefined language (possible languages: Français or English).\n"); - ladmin_log ("Undefined language (must be Français or English)." - RETCODE); + ladmin_log ("Undefined language (must be Français or English).\n"); } } @@ -3151,14 +3067,14 @@ int listaccount (char *param, int type) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir la liste des comptes de %d à %d." - RETCODE, list_first, list_last); + ("Envoi d'un requête au serveur de logins pour obtenir la liste des comptes de %d à %d.\n", + list_first, list_last); } else { ladmin_log - ("Request to login-server to obtain the list of accounts from %d to %d." - RETCODE, list_first, list_last); + ("Request to login-server to obtain the list of accounts from %d to %d.\n", + list_first, list_last); } WFIFOW (login_fd, 0) = 0x7920; @@ -3226,16 +3142,14 @@ int changememo (char *param) printf ("Entrez un nom de compte et un mémo svp.\n"); printf ("<exemple> memo nomtest nouveau memo\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le mémo d'un compte (commande 'email')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le mémo d'un compte (commande 'email').\n"); } else { printf ("Please input an account name and a memo.\n"); printf ("<example> memo testname new memo\n"); ladmin_log - ("Incomplete parameters to change the memo of an account ('email' command)." - RETCODE); + ("Incomplete parameters to change the memo of an account ('email' command).\n"); } return 136; } @@ -3252,16 +3166,16 @@ int changememo (char *param) printf ("Mémo trop long (%d caractères).\n", strlen (memo)); printf ("Entrez un mémo de 254 caractères maximum svp.\n"); ladmin_log - ("Mémo trop long (%d caractères). Entrez un mémo de 254 caractères maximum svp." - RETCODE, strlen (memo)); + ("Mémo trop long (%d caractères). Entrez un mémo de 254 caractères maximum svp.\n", + strlen (memo)); } else { printf ("Memo is too long (%d characters).\n", strlen (memo)); printf ("Please input a memo of 254 bytes at the maximum.\n"); ladmin_log - ("Email is too long (%d characters). Please input a memo of 254 bytes at the maximum." - RETCODE, strlen (memo)); + ("Email is too long (%d characters). Please input a memo of 254 bytes at the maximum.\n", + strlen (memo)); } return 102; } @@ -3269,12 +3183,11 @@ int changememo (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer un mémo." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer un mémo.\n"); } else { - ladmin_log ("Request to login-server to change a memo." RETCODE); + ladmin_log ("Request to login-server to change a memo.\n"); } WFIFOW (login_fd, 0) = 0x7942; @@ -3299,26 +3212,22 @@ int nameaccount (int id) { printf ("Entrez un id ayant une valeur positive svp.\n"); ladmin_log - ("Id négatif donné pour rechecher le nom d'un compte (commande 'name')." - RETCODE); + ("Id négatif donné pour rechecher le nom d'un compte (commande 'name').\n"); } else { printf ("Please input a positive value for the id.\n"); ladmin_log - ("Negativ id given to search an account name ('name' command)." - RETCODE); + ("Negativ id given to search an account name ('name' command).\n"); } return 136; } if (defaultlanguage == 'F') ladmin_log - ("Envoi d'un requête au serveur de logins pour connaître le nom d'un compte." - RETCODE); + ("Envoi d'un requête au serveur de logins pour connaître le nom d'un compte.\n"); else - ladmin_log ("Request to login-server to know an account name." - RETCODE); + ladmin_log ("Request to login-server to know an account name.\n"); WFIFOW (login_fd, 0) = 0x7946; WFIFOL (login_fd, 2) = id; @@ -3348,16 +3257,14 @@ int changepasswd (char *param) printf ("Entrez un nom de compte svp.\n"); printf ("<exemple> passwd nomtest nouveaumotdepasse\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le mot d'un passe d'un compte (commande 'password')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le mot d'un passe d'un compte (commande 'password').\n"); } else { printf ("Please input an account name.\n"); printf ("<example> passwd testname newpassword\n"); ladmin_log - ("Incomplete parameters to change the password of an account ('password' command)." - RETCODE); + ("Incomplete parameters to change the password of an account ('password' command).\n"); } return 136; } @@ -3378,12 +3285,11 @@ int changepasswd (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer un mot de passe." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer un mot de passe.\n"); } else { - ladmin_log ("Request to login-server to change a password." RETCODE); + ladmin_log ("Request to login-server to change a password.\n"); } WFIFOW (login_fd, 0) = 0x7934; @@ -3399,7 +3305,7 @@ int changepasswd (char *param) // Sub-function: Request to login-server to reload GM configuration file // this function have no answer //---------------------------------------------------------------------- -int reloadGM () +int reloadGM (void) { WFIFOW (login_fd, 0) = 0x7955; WFIFOSET (login_fd, 2); @@ -3408,16 +3314,14 @@ int reloadGM () if (defaultlanguage == 'F') { ladmin_log - ("Demande de recharger le fichier de configuration des GM envoyée." - RETCODE); + ("Demande de recharger le fichier de configuration des GM envoyée.\n"); printf ("Demande de recharger le fichier de configuration des GM envoyée.\n"); printf ("Vérifiez les comptes GM actuels (après rechargement):\n"); } else { - ladmin_log ("Request to reload the GM configuration file sended." - RETCODE); + ladmin_log ("Request to reload the GM configuration file sended.\n"); printf ("Request to reload the GM configuration file sended.\n"); printf ("Check the actual GM accounts (after reloading):\n"); } @@ -3445,16 +3349,14 @@ int changesex (char *param) printf ("Entrez un nom de compte et un sexe svp.\n"); printf ("<exemple> sex nomtest Male\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le sexe d'un compte (commande 'sex')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le sexe d'un compte (commande 'sex').\n"); } else { printf ("Please input an account name and a sex.\n"); printf ("<example> sex testname Male\n"); ladmin_log - ("Incomplete parameters to change the sex of an account ('sex' command)." - RETCODE); + ("Incomplete parameters to change the sex of an account ('sex' command).\n"); } return 136; } @@ -3470,13 +3372,13 @@ int changesex (char *param) if (defaultlanguage == 'F') { printf ("Sexe incorrect [%s]. Entrez M ou F svp.\n", sex); - ladmin_log ("Sexe incorrect [%s]. Entrez M ou F svp." RETCODE, + ladmin_log ("Sexe incorrect [%s]. Entrez M ou F svp.\n", sex); } else { printf ("Illegal gender [%s]. Please input M or F.\n", sex); - ladmin_log ("Illegal gender [%s]. Please input M or F." RETCODE, + ladmin_log ("Illegal gender [%s]. Please input M or F.\n", sex); } return 103; @@ -3485,12 +3387,11 @@ int changesex (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer un sexe." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer un sexe.\n"); } else { - ladmin_log ("Request to login-server to change a sex." RETCODE); + ladmin_log ("Request to login-server to change a sex.\n"); } WFIFOW (login_fd, 0) = 0x793c; @@ -3542,8 +3443,7 @@ int changestatesub (char *name, int state, char *error_message7) printf (" block <nom compte>\n"); printf (" unblock <nom compte>\n"); ladmin_log - ("Valeur incorrecte pour le statut d'un compte (commande 'state', 'block' ou 'unblock')." - RETCODE); + ("Valeur incorrecte pour le statut d'un compte (commande 'state', 'block' ou 'unblock').\n"); } else { @@ -3552,8 +3452,7 @@ int changestatesub (char *name, int state, char *error_message7) printf (" block <account name>\n"); printf (" unblock <account name>\n"); ladmin_log - ("Invalid value for the state of an account ('state', 'block' or 'unblock' command)." - RETCODE); + ("Invalid value for the state of an account ('state', 'block' or 'unblock' command).\n"); } return 151; } @@ -3576,16 +3475,14 @@ int changestatesub (char *name, int state, char *error_message7) printf ("Message d'erreur trop court. Entrez un message de 1-19 caractères.\n"); ladmin_log - ("Message d'erreur trop court. Entrez un message de 1-19 caractères." - RETCODE); + ("Message d'erreur trop court. Entrez un message de 1-19 caractères.\n"); } else { printf ("Error message is too short. Please input a message of 1-19 bytes.\n"); ladmin_log - ("Error message is too short. Please input a message of 1-19 bytes." - RETCODE); + ("Error message is too short. Please input a message of 1-19 bytes.\n"); } return 102; } @@ -3596,16 +3493,14 @@ int changestatesub (char *name, int state, char *error_message7) printf ("Message d'erreur trop long. Entrez un message de 1-19 caractères.\n"); ladmin_log - ("Message d'erreur trop long. Entrez un message de 1-19 caractères." - RETCODE); + ("Message d'erreur trop long. Entrez un message de 1-19 caractères.\n"); } else { printf ("Error message is too long. Please input a message of 1-19 bytes.\n"); ladmin_log - ("Error message is too long. Please input a message of 1-19 bytes." - RETCODE); + ("Error message is too long. Please input a message of 1-19 bytes.\n"); } return 102; } @@ -3614,12 +3509,11 @@ int changestatesub (char *name, int state, char *error_message7) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour changer un statut." - RETCODE); + ("Envoi d'un requête au serveur de logins pour changer un statut.\n"); } else { - ladmin_log ("Request to login-server to change a state." RETCODE); + ladmin_log ("Request to login-server to change a state.\n"); } WFIFOW (login_fd, 0) = 0x7936; @@ -3657,8 +3551,7 @@ int changestate (char *param) printf (" block <nom compte>\n"); printf (" unblock <nom compte>\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'state')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'state').\n"); } else { @@ -3668,8 +3561,7 @@ int changestate (char *param) printf (" block <account name>\n"); printf (" unblock <account name>\n"); ladmin_log - ("Incomplete parameters to change the state of an account ('state' command)." - RETCODE); + ("Incomplete parameters to change the state of an account ('state' command).\n"); } return 136; } @@ -3699,8 +3591,7 @@ int unblockaccount (char *param) printf (" block <nom compte>\n"); printf (" unblock <nom compte>\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'unblock')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'unblock').\n"); } else { @@ -3710,8 +3601,7 @@ int unblockaccount (char *param) printf (" block <account name>\n"); printf (" unblock <account name>\n"); ladmin_log - ("Incomplete parameters to change the state of an account ('unblock' command)." - RETCODE); + ("Incomplete parameters to change the state of an account ('unblock' command).\n"); } return 136; } @@ -3741,8 +3631,7 @@ int blockaccount (char *param) printf (" block <nom compte>\n"); printf (" unblock <nom compte>\n"); ladmin_log - ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'block')." - RETCODE); + ("Nombre incorrect de paramètres pour changer le statut d'un compte (commande 'block').\n"); } else { @@ -3752,8 +3641,7 @@ int blockaccount (char *param) printf (" block <account name>\n"); printf (" unblock <account name>\n"); ladmin_log - ("Incomplete parameters to change the state of an account ('block' command)." - RETCODE); + ("Incomplete parameters to change the state of an account ('block' command).\n"); } return 136; } @@ -3787,8 +3675,7 @@ int timeaddaccount (char *param) (" Cette exemple ajoute 1 mois et 1 seconde, et soustrait 2 minutes\n"); printf (" et 6 ans dans le même temps.\n"); ladmin_log - ("Nombre incorrect de paramètres pour modifier une date limite d'utilisation (commande 'timeadd')." - RETCODE); + ("Nombre incorrect de paramètres pour modifier une date limite d'utilisation (commande 'timeadd').\n"); } else { @@ -3798,8 +3685,7 @@ int timeaddaccount (char *param) (" this example adds 1 month and 1 second, and substracts 2 minutes\n"); printf (" and 6 years at the same time.\n"); ladmin_log - ("Incomplete parameters to modify a limit time ('timeadd' command)." - RETCODE); + ("Incomplete parameters to modify a limit time ('timeadd' command).\n"); } return 136; } @@ -3904,8 +3790,7 @@ int timeaddaccount (char *param) (" Cette exemple ajoute 1 mois et 1 seconde, et soustrait 2 minutes\n"); printf (" et 6 ans dans le même temps.\n"); ladmin_log - ("Aucun ajustement n'est pas un ajustement (commande 'timeadd')." - RETCODE); + ("Aucun ajustement n'est pas un ajustement (commande 'timeadd').\n"); } else { @@ -3923,8 +3808,7 @@ int timeaddaccount (char *param) (" this example adds 1 month and 1 second, and substracts 2 minutes\n"); printf (" and 6 years at the same time.\n"); ladmin_log - ("No adjustment isn't an adjustment ('timeadd' command)." - RETCODE); + ("No adjustment isn't an adjustment ('timeadd' command).\n"); } return 137; } @@ -3935,16 +3819,14 @@ int timeaddaccount (char *param) printf ("Entrez un ajustement d'années correct (de -127 à 127), svp.\n"); ladmin_log - ("Ajustement de l'année hors norme ('timeadd' command)." - RETCODE); + ("Ajustement de l'année hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the years (from -127 to 127).\n"); ladmin_log - ("Abnormal adjustement for the year ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the year ('timeadd' command).\n"); } return 137; } @@ -3954,16 +3836,14 @@ int timeaddaccount (char *param) { printf ("Entrez un ajustement de mois correct (de -255 à 255), svp.\n"); - ladmin_log ("Ajustement du mois hors norme ('timeadd' command)." - RETCODE); + ladmin_log ("Ajustement du mois hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the months (from -255 to 255).\n"); ladmin_log - ("Abnormal adjustement for the month ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the month ('timeadd' command).\n"); } return 137; } @@ -3973,16 +3853,14 @@ int timeaddaccount (char *param) { printf ("Entrez un ajustement de jours correct (de -32767 à 32767), svp.\n"); - ladmin_log ("Ajustement des jours hors norme ('timeadd' command)." - RETCODE); + ladmin_log ("Ajustement des jours hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the days (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the days ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the days ('timeadd' command).\n"); } return 137; } @@ -3993,16 +3871,14 @@ int timeaddaccount (char *param) printf ("Entrez un ajustement d'heures correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des heures hors norme ('timeadd' command)." - RETCODE); + ("Ajustement des heures hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the hours (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the hours ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the hours ('timeadd' command).\n"); } return 137; } @@ -4013,16 +3889,14 @@ int timeaddaccount (char *param) printf ("Entrez un ajustement de minutes correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des minutes hors norme ('timeadd' command)." - RETCODE); + ("Ajustement des minutes hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the minutes (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the minutes ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the minutes ('timeadd' command).\n"); } return 137; } @@ -4033,16 +3907,14 @@ int timeaddaccount (char *param) printf ("Entrez un ajustement de secondes correct (de -32767 à 32767), svp.\n"); ladmin_log - ("Ajustement des secondes hors norme ('timeadd' command)." - RETCODE); + ("Ajustement des secondes hors norme ('timeadd' command).\n"); } else { printf ("Please give a correct adjustment for the seconds (from -32767 to 32767).\n"); ladmin_log - ("Abnormal adjustement for the seconds ('timeadd' command)." - RETCODE); + ("Abnormal adjustement for the seconds ('timeadd' command).\n"); } return 137; } @@ -4050,13 +3922,11 @@ int timeaddaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour modifier une date limite d'utilisation." - RETCODE); + ("Envoi d'un requête au serveur de logins pour modifier une date limite d'utilisation.\n"); } else { - ladmin_log ("Request to login-server to modify a time limit." - RETCODE); + ladmin_log ("Request to login-server to modify a time limit.\n"); } WFIFOW (login_fd, 0) = 0x7950; @@ -4103,8 +3973,7 @@ int timesetaccount (char *param) (" timeset <nom_du_compte> 0 (0 = illimité)\n"); printf (" Heure par défaut [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Nombre incorrect de paramètres pour fixer une date limite d'utilisation (commande 'timeset')." - RETCODE); + ("Nombre incorrect de paramètres pour fixer une date limite d'utilisation (commande 'timeset').\n"); } else { @@ -4115,8 +3984,7 @@ int timesetaccount (char *param) (" timeset <account_name> 0 (0 = unlimited)\n"); printf (" Default time [hh:mm:ss]: 23:59:59.\n"); ladmin_log - ("Incomplete parameters to set a limit time ('timeset' command)." - RETCODE); + ("Incomplete parameters to set a limit time ('timeset' command).\n"); } return 136; } @@ -4140,16 +4008,14 @@ int timesetaccount (char *param) printf ("Entrez 0 ou une date et une heure svp (format: 0 ou aaaa/mm/jj hh:mm:ss).\n"); ladmin_log - ("Format incorrect pour la date/heure ('timeset' command)." - RETCODE); + ("Format incorrect pour la date/heure ('timeset' command).\n"); } else { printf ("Please input 0 or a date and a time (format: 0 or yyyy/mm/dd hh:mm:ss).\n"); ladmin_log - ("Invalid format for the date/time ('timeset' command)." - RETCODE); + ("Invalid format for the date/time ('timeset' command).\n"); } return 102; } @@ -4173,15 +4039,13 @@ int timesetaccount (char *param) if (defaultlanguage == 'F') { printf ("Entrez un mois correct svp (entre 1 et 12).\n"); - ladmin_log ("Mois incorrect pour la date ('timeset' command)." - RETCODE); + ladmin_log ("Mois incorrect pour la date ('timeset' command).\n"); } else { printf ("Please give a correct value for the month (from 1 to 12).\n"); - ladmin_log ("Invalid month for the date ('timeset' command)." - RETCODE); + ladmin_log ("Invalid month for the date ('timeset' command).\n"); } return 102; } @@ -4191,15 +4055,13 @@ int timesetaccount (char *param) if (defaultlanguage == 'F') { printf ("Entrez un jour correct svp (entre 1 et 31).\n"); - ladmin_log ("Jour incorrect pour la date ('timeset' command)." - RETCODE); + ladmin_log ("Jour incorrect pour la date ('timeset' command).\n"); } else { printf ("Please give a correct value for the day (from 1 to 31).\n"); - ladmin_log ("Invalid day for the date ('timeset' command)." - RETCODE); + ladmin_log ("Invalid day for the date ('timeset' command).\n"); } return 102; } @@ -4212,16 +4074,14 @@ int timesetaccount (char *param) ("Entrez un jour correct en fonction du mois (%d) svp.\n", month); ladmin_log - ("Jour incorrect pour ce mois correspondant ('timeset' command)." - RETCODE); + ("Jour incorrect pour ce mois correspondant ('timeset' command).\n"); } else { printf ("Please give a correct value for a day of this month (%d).\n", month); - ladmin_log ("Invalid day for this month ('timeset' command)." - RETCODE); + ladmin_log ("Invalid day for this month ('timeset' command).\n"); } return 102; } @@ -4231,15 +4091,13 @@ int timesetaccount (char *param) { printf ("Entrez une heure correcte svp (entre 0 et 23).\n"); ladmin_log - ("Heure incorrecte pour l'heure ('timeset' command)." - RETCODE); + ("Heure incorrecte pour l'heure ('timeset' command).\n"); } else { printf ("Please give a correct value for the hour (from 0 to 23).\n"); - ladmin_log ("Invalid hour for the time ('timeset' command)." - RETCODE); + ladmin_log ("Invalid hour for the time ('timeset' command).\n"); } return 102; } @@ -4250,15 +4108,13 @@ int timesetaccount (char *param) printf ("Entrez des minutes correctes svp (entre 0 et 59).\n"); ladmin_log - ("Minute incorrecte pour l'heure ('timeset' command)." - RETCODE); + ("Minute incorrecte pour l'heure ('timeset' command).\n"); } else { printf ("Please give a correct value for the minutes (from 0 to 59).\n"); - ladmin_log ("Invalid minute for the time ('timeset' command)." - RETCODE); + ladmin_log ("Invalid minute for the time ('timeset' command).\n"); } return 102; } @@ -4269,15 +4125,13 @@ int timesetaccount (char *param) printf ("Entrez des secondes correctes svp (entre 0 et 59).\n"); ladmin_log - ("Seconde incorrecte pour l'heure ('timeset' command)." - RETCODE); + ("Seconde incorrecte pour l'heure ('timeset' command).\n"); } else { printf ("Please give a correct value for the seconds (from 0 to 59).\n"); - ladmin_log ("Invalid second for the time ('timeset' command)." - RETCODE); + ladmin_log ("Invalid second for the time ('timeset' command).\n"); } return 102; } @@ -4296,14 +4150,14 @@ int timesetaccount (char *param) printf ("Date incorrecte.\n"); printf ("Ajoutez 0 ou une date et une heure svp (format: 0 ou aaaa/mm/jj hh:mm:ss).\n"); - ladmin_log ("Date incorrecte. ('timeset' command)." RETCODE); + ladmin_log ("Date incorrecte. ('timeset' command).\n"); } else { printf ("Invalid date.\n"); printf ("Please add 0 or a date and a time (format: 0 or yyyy/mm/dd hh:mm:ss).\n"); - ladmin_log ("Invalid date. ('timeset' command)." RETCODE); + ladmin_log ("Invalid date. ('timeset' command).\n"); } return 102; } @@ -4312,12 +4166,11 @@ int timesetaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour fixer une date limite d'utilisation." - RETCODE); + ("Envoi d'un requête au serveur de logins pour fixer une date limite d'utilisation.\n"); } else { - ladmin_log ("Request to login-server to set a time limit." RETCODE); + ladmin_log ("Request to login-server to set a time limit.\n"); } WFIFOW (login_fd, 0) = 0x7948; @@ -4347,14 +4200,13 @@ int whoaccount (char *param) { printf ("Entrez un nom de compte svp.\n"); printf ("<exemple> who nomtest\n"); - ladmin_log ("Aucun nom n'a été donné pour trouver le compte." - RETCODE); + ladmin_log ("Aucun nom n'a été donné pour trouver le compte.\n"); } else { printf ("Please input an account name.\n"); printf ("<example> who testname\n"); - ladmin_log ("No name was given to found the account." RETCODE); + ladmin_log ("No name was given to found the account.\n"); } return 136; } @@ -4366,14 +4218,12 @@ int whoaccount (char *param) if (defaultlanguage == 'F') { ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir le information d'un compte (par le nom)." - RETCODE); + ("Envoi d'un requête au serveur de logins pour obtenir le information d'un compte (par le nom).\n"); } else { ladmin_log - ("Request to login-server to obtain information about an account (by its name)." - RETCODE); + ("Request to login-server to obtain information about an account (by its name).\n"); } WFIFOW (login_fd, 0) = 0x7952; @@ -4387,14 +4237,13 @@ int whoaccount (char *param) //-------------------------------------------------------- // Sub-function: Asking of the version of the login-server //-------------------------------------------------------- -int checkloginversion () +int checkloginversion (void) { if (defaultlanguage == 'F') ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir sa version." - RETCODE); + ("Envoi d'un requête au serveur de logins pour obtenir sa version.\n"); else - ladmin_log ("Request to login-server to obtain its version." RETCODE); + ladmin_log ("Request to login-server to obtain its version.\n"); WFIFOW (login_fd, 0) = 0x7530; WFIFOSET (login_fd, 2); @@ -4408,7 +4257,7 @@ int checkloginversion () // this function wait until user type a command // and analyse the command. //--------------------------------------------- -int prompt () +int prompt (void) { int i, j; char buf[1024]; @@ -4530,12 +4379,12 @@ int prompt () { if (defaultlanguage == 'F') { - ladmin_log ("Commande: '%s' (sans paramètre)" RETCODE, + ladmin_log ("Commande: '%s' (sans paramètre)\n", command, parameters); } else { - ladmin_log ("Command: '%s' (without parameters)" RETCODE, + ladmin_log ("Command: '%s' (without parameters)\n", command, parameters); } } @@ -4543,12 +4392,12 @@ int prompt () { if (defaultlanguage == 'F') { - ladmin_log ("Commande: '%s', paramètres: '%s'" RETCODE, + ladmin_log ("Commande: '%s', paramètres: '%s'\n", command, parameters); } else { - ladmin_log ("Command: '%s', parameters: '%s'" RETCODE, + ladmin_log ("Command: '%s', parameters: '%s'\n", command, parameters); } } @@ -4721,12 +4570,12 @@ int prompt () if (defaultlanguage == 'F') { printf ("Commande inconnue [%s].\n", buf); - ladmin_log ("Commande inconnue [%s]." RETCODE, buf); + ladmin_log ("Commande inconnue [%s].\n", buf); } else { printf ("Unknown command [%s].\n", buf); - ladmin_log ("Unknown command [%s]." RETCODE, buf); + ladmin_log ("Unknown command [%s].\n", buf); } } } @@ -4749,8 +4598,8 @@ void parse_fromlogin (int fd) ("Impossible de se connecter au serveur de login [%s:%d] !\n", loginserverip, loginserverport); ladmin_log - ("Impossible de se connecter au serveur de login [%s:%d] !" - RETCODE, loginserverip, loginserverport); + ("Impossible de se connecter au serveur de login [%s:%d] !\n", + loginserverip, loginserverport); } else { @@ -4758,8 +4607,8 @@ void parse_fromlogin (int fd) ("Impossible to have a connection with the login-server [%s:%d] !\n", loginserverip, loginserverport); ladmin_log - ("Impossible to have a connection with the login-server [%s:%d] !" - RETCODE, loginserverip, loginserverport); + ("Impossible to have a connection with the login-server [%s:%d] !\n", + loginserverip, loginserverport); } close (fd); delete_session (fd); @@ -4767,7 +4616,7 @@ void parse_fromlogin (int fd) } // printf("parse_fromlogin : %d %d %d\n", fd, RFIFOREST(fd), RFIFOW(fd,0)); - sd = session[fd]->session_data; + sd = (struct char_session_data *)session[fd]->session_data; while (RFIFOREST (fd) >= 2) { @@ -4786,8 +4635,7 @@ void parse_fromlogin (int fd) (" - système d'administration non activé, ou\n"); printf (" - IP non autorisée.\n"); ladmin_log - ("Erreur de login: mot de passe incorrect, système d'administration non activé, ou IP non autorisée." - RETCODE); + ("Erreur de login: mot de passe incorrect, système d'administration non activé, ou IP non autorisée.\n"); } else { @@ -4797,8 +4645,7 @@ void parse_fromlogin (int fd) (" - administration system not activated, or\n"); printf (" - unauthorised IP.\n"); ladmin_log - ("Error at login: incorrect password, administration system not activated, or unauthorised IP." - RETCODE); + ("Error at login: incorrect password, administration system not activated, or unauthorised IP.\n"); } session[fd]->eof = 1; //bytes_to_read = 1; // not stop at prompt @@ -4808,22 +4655,20 @@ void parse_fromlogin (int fd) if (defaultlanguage == 'F') { printf ("Connexion établie.\n"); - ladmin_log ("Connexion établie." RETCODE); + ladmin_log ("Connexion établie.\n"); printf ("Lecture de la version du serveur de login...\n"); ladmin_log - ("Lecture de la version du serveur de login..." - RETCODE); + ("Lecture de la version du serveur de login...\n"); } else { Iprintf ("Established connection.\n"); - ladmin_log ("Established connection." RETCODE); + ladmin_log ("Established connection.\n"); Iprintf ("Reading of the version of the login-server...\n"); ladmin_log - ("Reading of the version of the login-server..." - RETCODE); + ("Reading of the version of the login-server...\n"); } //bytes_to_read = 1; // unchanged checkloginversion (); @@ -4859,18 +4704,16 @@ void parse_fromlogin (int fd) if (defaultlanguage == 'F') { Iprintf ("Réception de la clef MD5.\n"); - ladmin_log ("Réception de la clef MD5." RETCODE); + ladmin_log ("Réception de la clef MD5.\n"); Iprintf ("Envoi du mot de passe crypté...\n"); - ladmin_log ("Envoi du mot de passe crypté..." - RETCODE); + ladmin_log ("Envoi du mot de passe crypté...\n"); } else { Iprintf ("Receiving of the MD5 key.\n"); - ladmin_log ("Receiving of the MD5 key." RETCODE); + ladmin_log ("Receiving of the MD5 key.\n"); Iprintf ("Sending of the encrypted password...\n"); - ladmin_log ("Sending of the encrypted password..." - RETCODE); + ladmin_log ("Sending of the encrypted password...\n"); } } bytes_to_read = 1; @@ -4920,8 +4763,7 @@ void parse_fromlogin (int fd) if (defaultlanguage == 'F') { ladmin_log - (" Réception d'une liste des comptes vide." - RETCODE); + (" Réception d'une liste des comptes vide.\n"); if (list_count == 0) printf ("Aucun compte trouvé.\n"); else if (list_count == 1) @@ -4931,8 +4773,7 @@ void parse_fromlogin (int fd) } else { - ladmin_log (" Receiving of a void accounts list." - RETCODE); + ladmin_log (" Receiving of a void accounts list.\n"); if (list_count == 0) { Iprintf ("No account found.\n"); @@ -4950,11 +4791,9 @@ void parse_fromlogin (int fd) { int i; if (defaultlanguage == 'F') - ladmin_log (" Réception d'une liste des comptes." - RETCODE); + ladmin_log (" Réception d'une liste des comptes.\n"); else - ladmin_log (" Receiving of a accounts list." - RETCODE); + ladmin_log (" Receiving of a accounts list.\n"); for (i = 4; i < RFIFOW (fd, 2); i += 38) { int j; @@ -5047,12 +4886,12 @@ void parse_fromlogin (int fd) // asking of the following acounts if (defaultlanguage == 'F') ladmin_log - ("Envoi d'un requête au serveur de logins pour obtenir la liste des comptes de %d à %d (complément)." - RETCODE, list_first, list_last); + ("Envoi d'un requête au serveur de logins pour obtenir la liste des comptes de %d à %d (complément).\n", + list_first, list_last); else ladmin_log - ("Request to login-server to obtain the list of accounts from %d to %d (complement)." - RETCODE, list_first, list_last); + ("Request to login-server to obtain the list of accounts from %d to %d (complement).\n", + list_first, list_last); WFIFOW (login_fd, 0) = 0x7920; WFIFOL (login_fd, 2) = list_first; WFIFOL (login_fd, 6) = list_last; @@ -5073,8 +4912,8 @@ void parse_fromlogin (int fd) ("Echec à la création du compte [%s]. Un compte identique existe déjà.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec à la création du compte [%s]. Un compte identique existe déjà." - RETCODE, RFIFOP (fd, 6)); + ("Echec à la création du compte [%s]. Un compte identique existe déjà.\n", + RFIFOP (fd, 6)); } else { @@ -5082,8 +4921,8 @@ void parse_fromlogin (int fd) ("Account [%s] creation failed. Same account already exists.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] creation failed. Same account already exists." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] creation failed. Same account already exists.\n", + RFIFOP (fd, 6)); } } else @@ -5092,8 +4931,8 @@ void parse_fromlogin (int fd) { printf ("Compte [%s] créé avec succès [id: %d].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); - ladmin_log ("Compte [%s] créé avec succès [id: %d]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ladmin_log ("Compte [%s] créé avec succès [id: %d].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5101,8 +4940,8 @@ void parse_fromlogin (int fd) ("Account [%s] is successfully created [id: %d].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s] is successfully created [id: %d]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s] is successfully created [id: %d].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5120,8 +4959,8 @@ void parse_fromlogin (int fd) ("Echec de la suppression du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec de la suppression du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec de la suppression du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5129,8 +4968,8 @@ void parse_fromlogin (int fd) ("Account [%s] deletion failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] deletion failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] deletion failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5140,8 +4979,8 @@ void parse_fromlogin (int fd) printf ("Compte [%s][id: %d] SUPPRIME avec succès.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Compte [%s][id: %d] SUPPRIME avec succès." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Compte [%s][id: %d] SUPPRIME avec succès.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5149,8 +4988,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] is successfully DELETED.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] is successfully DELETED." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] is successfully DELETED.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5170,8 +5009,8 @@ void parse_fromlogin (int fd) printf ("Le compte [%s] n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec de la modification du mot de passe du compte. Le compte [%s] n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec de la modification du mot de passe du compte. Le compte [%s] n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5180,8 +5019,8 @@ void parse_fromlogin (int fd) printf ("Account [%s] doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account password changing failed. The compte [%s] doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account password changing failed. The compte [%s] doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5192,8 +5031,8 @@ void parse_fromlogin (int fd) ("Modification du mot de passe du compte [%s][id: %d] réussie.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Modification du mot de passe du compte [%s][id: %d] réussie." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Modification du mot de passe du compte [%s][id: %d] réussie.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5201,8 +5040,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] password successfully changed.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] password successfully changed." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] password successfully changed.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5220,8 +5059,8 @@ void parse_fromlogin (int fd) ("Echec du changement du statut du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement du statut du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement du statut du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5229,8 +5068,8 @@ void parse_fromlogin (int fd) ("Account [%s] state changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] state changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] state changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5293,7 +5132,7 @@ void parse_fromlogin (int fd) } strcat (tmpstr, "]"); printf ("%s\n", tmpstr); - ladmin_log ("%s%s", tmpstr, RETCODE); + ladmin_log ("%s%s", tmpstr, "\n"); } bytes_to_read = 0; RFIFOSKIP (fd, 34); @@ -5309,14 +5148,12 @@ void parse_fromlogin (int fd) if (defaultlanguage == 'F') { ladmin_log - (" Réception du nombre de joueurs en ligne." - RETCODE); + (" Réception du nombre de joueurs en ligne.\n"); } else { ladmin_log - (" Receiving of the number of online players." - RETCODE); + (" Receiving of the number of online players.\n"); } // Read information of the servers if (RFIFOW (fd, 2) < 5) @@ -5369,8 +5206,8 @@ void parse_fromlogin (int fd) ("Le compte [%s] n'existe pas ou le mot de passe est incorrect.\n", RFIFOP (fd, 6)); ladmin_log - ("Le compte [%s] n'existe pas ou le mot de passe est incorrect." - RETCODE, RFIFOP (fd, 6)); + ("Le compte [%s] n'existe pas ou le mot de passe est incorrect.\n", + RFIFOP (fd, 6)); } else { @@ -5378,8 +5215,8 @@ void parse_fromlogin (int fd) ("The account [%s] doesn't exist or the password is incorrect.\n", RFIFOP (fd, 6)); ladmin_log - ("The account [%s] doesn't exist or the password is incorrect." - RETCODE, RFIFOP (fd, 6)); + ("The account [%s] doesn't exist or the password is incorrect.\n", + RFIFOP (fd, 6)); } } else @@ -5390,8 +5227,8 @@ void parse_fromlogin (int fd) ("Le mot de passe donné correspond bien au compte [%s][id: %d].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Le mot de passe donné correspond bien au compte [%s][id: %d]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Le mot de passe donné correspond bien au compte [%s][id: %d].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5399,8 +5236,8 @@ void parse_fromlogin (int fd) ("The proposed password is correct for the account [%s][id: %d].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("The proposed password is correct for the account [%s][id: %d]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("The proposed password is correct for the account [%s][id: %d].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5421,8 +5258,8 @@ void parse_fromlogin (int fd) ("Le compte [%s] n'existe pas ou le sexe est déjà celui demandé.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec de la modification du sexe du compte. Le compte [%s] n'existe pas ou le sexe est déjà celui demandé." - RETCODE, RFIFOP (fd, 6)); + ("Echec de la modification du sexe du compte. Le compte [%s] n'existe pas ou le sexe est déjà celui demandé.\n", + RFIFOP (fd, 6)); } else { @@ -5432,8 +5269,8 @@ void parse_fromlogin (int fd) ("Account [%s] doesn't exist or the sex is already the good sex.\n", RFIFOP (fd, 6)); ladmin_log - ("Account sex changing failed. The compte [%s] doesn't exist or the sex is already the good sex." - RETCODE, RFIFOP (fd, 6)); + ("Account sex changing failed. The compte [%s] doesn't exist or the sex is already the good sex.\n", + RFIFOP (fd, 6)); } } else @@ -5444,8 +5281,8 @@ void parse_fromlogin (int fd) ("Sexe du compte [%s][id: %d] changé avec succès.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Sexe du compte [%s][id: %d] changé avec succès." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Sexe du compte [%s][id: %d] changé avec succès.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5453,8 +5290,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] sex successfully changed.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] sex successfully changed." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] sex successfully changed.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5477,8 +5314,8 @@ void parse_fromlogin (int fd) printf ("ou il est impossible de modifier le fichier des comptes GM.\n"); ladmin_log - ("Echec de la modification du niveau de GM du compte. Le compte [%s] n'existe pas, le niveau de GM est déjà celui demandé ou il est impossible de modifier le fichier des comptes GM." - RETCODE, RFIFOP (fd, 6)); + ("Echec de la modification du niveau de GM du compte. Le compte [%s] n'existe pas, le niveau de GM est déjà celui demandé ou il est impossible de modifier le fichier des comptes GM.\n", + RFIFOP (fd, 6)); } else { @@ -5490,8 +5327,8 @@ void parse_fromlogin (int fd) printf ("or it's impossible to modify the GM accounts file.\n"); ladmin_log - ("Account GM level changing failed. The compte [%s] doesn't exist, the GM level is already the good sex or it's impossible to modify the GM accounts file." - RETCODE, RFIFOP (fd, 6)); + ("Account GM level changing failed. The compte [%s] doesn't exist, the GM level is already the good sex or it's impossible to modify the GM accounts file.\n", + RFIFOP (fd, 6)); } } else @@ -5502,8 +5339,8 @@ void parse_fromlogin (int fd) ("Niveau de GM du compte [%s][id: %d] changé avec succès.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Niveau de GM du compte [%s][id: %d] changé avec succès." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Niveau de GM du compte [%s][id: %d] changé avec succès.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5511,8 +5348,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] GM level successfully changed.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] GM level successfully changed." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] GM level successfully changed.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5532,8 +5369,8 @@ void parse_fromlogin (int fd) printf ("Le compte [%s] n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec de la modification de l'e-mail du compte. Le compte [%s] n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec de la modification de l'e-mail du compte. Le compte [%s] n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5542,8 +5379,8 @@ void parse_fromlogin (int fd) printf ("Account [%s] doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account e-mail changing failed. The compte [%s] doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account e-mail changing failed. The compte [%s] doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5554,8 +5391,8 @@ void parse_fromlogin (int fd) ("Modification de l'e-mail du compte [%s][id: %d] réussie.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Modification de l'e-mail du compte [%s][id: %d] réussie." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Modification de l'e-mail du compte [%s][id: %d] réussie.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5563,8 +5400,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] e-mail successfully changed.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] e-mail successfully changed." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] e-mail successfully changed.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5582,8 +5419,8 @@ void parse_fromlogin (int fd) ("Echec du changement du mémo du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement du mémo du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement du mémo du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5591,8 +5428,8 @@ void parse_fromlogin (int fd) ("Account [%s] memo changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] memo changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] memo changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5603,8 +5440,8 @@ void parse_fromlogin (int fd) ("Mémo du compte [%s][id: %d] changé avec succès.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Mémo du compte [%s][id: %d] changé avec succès." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Mémo du compte [%s][id: %d] changé avec succès.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5612,8 +5449,8 @@ void parse_fromlogin (int fd) ("Account [%s][id: %d] memo successfully changed.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Account [%s][id: %d] memo successfully changed." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Account [%s][id: %d] memo successfully changed.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5631,8 +5468,8 @@ void parse_fromlogin (int fd) ("Impossible de trouver l'id du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Impossible de trouver l'id du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Impossible de trouver l'id du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5640,8 +5477,8 @@ void parse_fromlogin (int fd) ("Unable to find the account [%s] id. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Unable to find the account [%s] id. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Unable to find the account [%s] id. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5650,15 +5487,15 @@ void parse_fromlogin (int fd) { printf ("Le compte [%s] a pour id: %d.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); - ladmin_log ("Le compte [%s] a pour id: %d." RETCODE, + ladmin_log ("Le compte [%s] a pour id: %d.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { printf ("The account [%s] have the id: %d.\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); - ladmin_log ("The account [%s] have the id: %d." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ladmin_log ("The account [%s] have the id: %d.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } bytes_to_read = 0; @@ -5676,8 +5513,8 @@ void parse_fromlogin (int fd) ("Impossible de trouver le nom du compte [%d]. Le compte n'existe pas.\n", RFIFOL (fd, 2)); ladmin_log - ("Impossible de trouver le nom du compte [%d]. Le compte n'existe pas." - RETCODE, RFIFOL (fd, 2)); + ("Impossible de trouver le nom du compte [%d]. Le compte n'existe pas.\n", + RFIFOL (fd, 2)); } else { @@ -5685,8 +5522,8 @@ void parse_fromlogin (int fd) ("Unable to find the account [%d] name. Account doesn't exist.\n", RFIFOL (fd, 2)); ladmin_log - ("Unable to find the account [%d] name. Account doesn't exist." - RETCODE, RFIFOL (fd, 2)); + ("Unable to find the account [%d] name. Account doesn't exist.\n", + RFIFOL (fd, 2)); } } else @@ -5695,15 +5532,15 @@ void parse_fromlogin (int fd) { printf ("Le compte [id: %d] a pour nom: %s.\n", RFIFOL (fd, 2), RFIFOP (fd, 6)); - ladmin_log ("Le compte [id: %d] a pour nom: %s." - RETCODE, RFIFOL (fd, 2), RFIFOP (fd, 6)); + ladmin_log ("Le compte [id: %d] a pour nom: %s.\n", + RFIFOL (fd, 2), RFIFOP (fd, 6)); } else { printf ("The account [id: %d] have the name: %s.\n", RFIFOL (fd, 2), RFIFOP (fd, 6)); - ladmin_log ("The account [id: %d] have the name: %s." - RETCODE, RFIFOL (fd, 2), RFIFOP (fd, 6)); + ladmin_log ("The account [id: %d] have the name: %s.\n", + RFIFOL (fd, 2), RFIFOP (fd, 6)); } } bytes_to_read = 0; @@ -5721,8 +5558,8 @@ void parse_fromlogin (int fd) ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5730,8 +5567,8 @@ void parse_fromlogin (int fd) ("Account [%s] validity limit changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] validity limit changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] validity limit changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5745,8 +5582,8 @@ void parse_fromlogin (int fd) ("Limite de validité du compte [%s][id: %d] changée avec succès en [illimité].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Limite de validité du compte [%s][id: %d] changée avec succès en [illimité]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Limite de validité du compte [%s][id: %d] changée avec succès en [illimité].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5754,8 +5591,8 @@ void parse_fromlogin (int fd) ("Validity Limit of the account [%s][id: %d] successfully changed to [unlimited].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Validity Limit of the account [%s][id: %d] successfully changed to [unlimited]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Validity Limit of the account [%s][id: %d] successfully changed to [unlimited].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } else @@ -5769,8 +5606,8 @@ void parse_fromlogin (int fd) ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } else @@ -5779,8 +5616,8 @@ void parse_fromlogin (int fd) ("Validity Limit of the account [%s][id: %d] successfully changed to be until %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Validity Limit of the account [%s][id: %d] successfully changed to be until %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Validity Limit of the account [%s][id: %d] successfully changed to be until %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } } @@ -5800,8 +5637,8 @@ void parse_fromlogin (int fd) ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5809,8 +5646,8 @@ void parse_fromlogin (int fd) ("Account [%s] final date of banishment changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] final date of banishment changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] final date of banishment changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5824,8 +5661,8 @@ void parse_fromlogin (int fd) ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5833,8 +5670,8 @@ void parse_fromlogin (int fd) ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } else @@ -5848,8 +5685,8 @@ void parse_fromlogin (int fd) ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } else @@ -5858,8 +5695,8 @@ void parse_fromlogin (int fd) ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } } @@ -5879,8 +5716,8 @@ void parse_fromlogin (int fd) ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement de la date finale de banissement du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -5888,8 +5725,8 @@ void parse_fromlogin (int fd) ("Account [%s] final date of banishment changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] final date of banishment changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] final date of banishment changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -5903,8 +5740,8 @@ void parse_fromlogin (int fd) ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Date finale de banissement du compte [%s][id: %d] changée avec succès en [dé-bannie].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -5912,8 +5749,8 @@ void parse_fromlogin (int fd) ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished].\n", RFIFOP (fd, 6), RFIFOL (fd, 2)); ladmin_log - ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished]." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Final date of banishment of the account [%s][id: %d] successfully changed to [unbanished].\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } else @@ -5927,8 +5764,8 @@ void parse_fromlogin (int fd) ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Date finale de banissement du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } else @@ -5937,8 +5774,8 @@ void parse_fromlogin (int fd) ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Final date of banishment of the account [%s][id: %d] successfully changed to be until %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } } @@ -5957,16 +5794,14 @@ void parse_fromlogin (int fd) printf ("Echec de l'envoi du message. Aucun server de char en ligne.\n"); ladmin_log - ("Echec de l'envoi du message. Aucun server de char en ligne." - RETCODE); + ("Echec de l'envoi du message. Aucun server de char en ligne.\n"); } else { printf ("Message sending failed. No online char-server.\n"); ladmin_log - ("Message sending failed. No online char-server." - RETCODE); + ("Message sending failed. No online char-server.\n"); } } else @@ -5976,16 +5811,14 @@ void parse_fromlogin (int fd) printf ("Message transmis au server de logins avec succès.\n"); ladmin_log - ("Message transmis au server de logins avec succès." - RETCODE); + ("Message transmis au server de logins avec succès.\n"); } else { printf ("Message successfully sended to login-server.\n"); ladmin_log - ("Message successfully sended to login-server." - RETCODE); + ("Message successfully sended to login-server.\n"); } } bytes_to_read = 0; @@ -6003,8 +5836,8 @@ void parse_fromlogin (int fd) ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas.\n", RFIFOP (fd, 6)); ladmin_log - ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas." - RETCODE, RFIFOP (fd, 6)); + ("Echec du changement de la validité du compte [%s]. Le compte n'existe pas.\n", + RFIFOP (fd, 6)); } else { @@ -6012,8 +5845,8 @@ void parse_fromlogin (int fd) ("Account [%s] validity limit changing failed. Account doesn't exist.\n", RFIFOP (fd, 6)); ladmin_log - ("Account [%s] validity limit changing failed. Account doesn't exist." - RETCODE, RFIFOP (fd, 6)); + ("Account [%s] validity limit changing failed. Account doesn't exist.\n", + RFIFOP (fd, 6)); } } else @@ -6031,8 +5864,8 @@ void parse_fromlogin (int fd) printf ("la modification est impossible avec les ajustements demandés.\n"); ladmin_log - ("Limite de validité du compte [%s][id: %d] inchangée. Le compte a une validité illimitée ou la modification est impossible avec les ajustements demandés." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Limite de validité du compte [%s][id: %d] inchangée. Le compte a une validité illimitée ou la modification est impossible avec les ajustements demandés.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } else { @@ -6044,8 +5877,8 @@ void parse_fromlogin (int fd) printf ("the changing is impossible with the proposed adjustments.\n"); ladmin_log - ("Validity limit of the account [%s][id: %d] unchanged. The account have an unlimited validity limit or the changing is impossible with the proposed adjustments." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2)); + ("Validity limit of the account [%s][id: %d] unchanged. The account have an unlimited validity limit or the changing is impossible with the proposed adjustments.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2)); } } else @@ -6059,8 +5892,8 @@ void parse_fromlogin (int fd) ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Limite de validité du compte [%s][id: %d] changée avec succès pour être jusqu'au %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } else @@ -6069,8 +5902,8 @@ void parse_fromlogin (int fd) ("Validity limit of the account [%s][id: %d] successfully changed to be until %s.\n", RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); ladmin_log - ("Validity limit of the account [%s][id: %d] successfully changed to be until %s." - RETCODE, RFIFOP (fd, 6), RFIFOL (fd, 2), + ("Validity limit of the account [%s][id: %d] successfully changed to be until %s.\n", + RFIFOP (fd, 6), RFIFOL (fd, 2), tmpstr); } } @@ -6111,8 +5944,8 @@ void parse_fromlogin (int fd) ("Impossible de trouver le compte [%s]. Le compte n'existe pas.\n", parameters); ladmin_log - ("Impossible de trouver le compte [%s]. Le compte n'existe pas." - RETCODE, parameters); + ("Impossible de trouver le compte [%s]. Le compte n'existe pas.\n", + parameters); } else { @@ -6120,8 +5953,8 @@ void parse_fromlogin (int fd) ("Unabled to find the account [%s]. Account doesn't exist.\n", parameters); ladmin_log - ("Unabled to find the account [%s]. Account doesn't exist." - RETCODE, parameters); + ("Unabled to find the account [%s]. Account doesn't exist.\n", + parameters); } } else if (strlen (userid) == 0) @@ -6132,8 +5965,8 @@ void parse_fromlogin (int fd) ("Impossible de trouver le compte [id: %s]. Le compte n'existe pas.\n", parameters); ladmin_log - ("Impossible de trouver le compte [id: %s]. Le compte n'existe pas." - RETCODE, parameters); + ("Impossible de trouver le compte [id: %s]. Le compte n'existe pas.\n", + parameters); } else { @@ -6141,8 +5974,8 @@ void parse_fromlogin (int fd) ("Unabled to find the account [id: %s]. Account doesn't exist.\n", parameters); ladmin_log - ("Unabled to find the account [id: %s]. Account doesn't exist." - RETCODE, parameters); + ("Unabled to find the account [id: %s]. Account doesn't exist.\n", + parameters); } } else @@ -6150,16 +5983,14 @@ void parse_fromlogin (int fd) if (defaultlanguage == 'F') { ladmin_log - ("Réception d'information concernant un compte." - RETCODE); + ("Réception d'information concernant un compte.\n"); printf ("Le compte a les caractéristiques suivantes:\n"); } else { ladmin_log - ("Receiving information about an account." - RETCODE); + ("Receiving information about an account.\n"); printf ("The account is set with:\n"); } if (RFIFOB (fd, 6) == 0) @@ -6326,7 +6157,7 @@ void parse_fromlogin (int fd) default: printf ("Remote administration has been disconnected (unknown packet).\n"); - ladmin_log ("'End of connection, unknown packet." RETCODE); + ladmin_log ("'End of connection, unknown packet.\n"); session[fd]->eof = 1; return; } @@ -6339,17 +6170,17 @@ void parse_fromlogin (int fd) //------------------------------------ // Function to connect to login-server //------------------------------------ -int Connect_login_server () +int Connect_login_server (void) { if (defaultlanguage == 'F') { Iprintf ("Essai de connection au server de logins...\n"); - ladmin_log ("Essai de connection au server de logins..." RETCODE); + ladmin_log ("Essai de connection au server de logins...\n"); } else { Iprintf ("Attempt to connect to login-server...\n"); - ladmin_log ("Attempt to connect to login-server..." RETCODE); + ladmin_log ("Attempt to connect to login-server...\n"); } if ((login_fd = make_connection (login_ip, loginserverport)) < 0) @@ -6368,12 +6199,12 @@ int Connect_login_server () if (defaultlanguage == 'F') { Iprintf ("Envoi du mot de passe...\n"); - ladmin_log ("Envoi du mot de passe..." RETCODE); + ladmin_log ("Envoi du mot de passe...\n"); } else { Iprintf ("Sending of the password...\n"); - ladmin_log ("Sending of the password..." RETCODE); + ladmin_log ("Sending of the password...\n"); } #ifdef PASSWORDENC } @@ -6385,12 +6216,12 @@ int Connect_login_server () if (defaultlanguage == 'F') { Iprintf ("Demande de la clef MD5...\n"); - ladmin_log ("Demande de la clef MD5..." RETCODE); + ladmin_log ("Demande de la clef MD5...\n"); } else { Iprintf ("Request about the MD5 key...\n"); - ladmin_log ("Request about the MD5 key..." RETCODE); + ladmin_log ("Request about the MD5 key...\n"); } } #endif @@ -6578,16 +6409,14 @@ void term_func (void) Iprintf ("\033[0m----Fin de Ladmin (fin normale avec fermeture de tous les fichiers).\n"); ladmin_log - ("----Fin de Ladmin (fin normale avec fermeture de tous les fichiers)." - RETCODE); + ("----Fin de Ladmin (fin normale avec fermeture de tous les fichiers).\n"); } else { Iprintf ("\033[0m----End of Ladmin (normal end with closing of all files).\n"); ladmin_log - ("----End of Ladmin (normal end with closing of all files)." - RETCODE); + ("----End of Ladmin (normal end with closing of all files).\n"); } already_exit_function = 1; @@ -6606,11 +6435,11 @@ int do_init (int argc, char **argv) ladmin_log (""); if (defaultlanguage == 'F') { - ladmin_log ("Fichier de configuration lu." RETCODE); + ladmin_log ("Fichier de configuration lu.\n"); } else { - ladmin_log ("Configuration file readed." RETCODE); + ladmin_log ("Configuration file readed.\n"); } srand (time (NULL)); @@ -6632,12 +6461,12 @@ int do_init (int argc, char **argv) if (defaultlanguage == 'F') { - ladmin_log ("Ladmin est prêt." RETCODE); + ladmin_log ("Ladmin est prêt.\n"); Iprintf ("Ladmin est \033[1;32mprêt\033[0m.\n\n"); } else { - ladmin_log ("Ladmin is ready." RETCODE); + ladmin_log ("Ladmin is ready.\n"); Iprintf ("Ladmin is \033[1;32mready\033[0m.\n\n"); } diff --git a/src/login/GNUmakefile b/src/login/GNUmakefile new file mode 100644 index 0000000..912127d --- /dev/null +++ b/src/login/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. login-server +clean: + rm -r ../../obj/login/ +%:: + make -C ../.. obj/login/$@ diff --git a/src/login/Makefile b/src/login/Makefile deleted file mode 100644 index bc1e7c0..0000000 --- a/src/login/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../../make.defs - -all: login - -COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/mt_rand.o ../common/md5calc.o -COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/lock.h ../common/mt_rand.h ../common/md5calc.h - -login: $(COMMON_OBJ) -login.o: login.c login.h $(COMMON_H) - -clean: - rm -f *.o login diff --git a/src/login/login.c b/src/login/login.c index 6788371..898729b 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -148,7 +148,7 @@ int login_log (char *fmt, ...) if (logfp) { if (fmt[0] == '\0') // jump a line if no message - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); else { gettimeofday (&tv, NULL); @@ -170,9 +170,7 @@ int login_log (char *fmt, ...) //---------------------------------------------------------------------- int isGM (int account_id) { - struct gm_account *p; - - p = numdb_search (gm_account_db, account_id); + struct gm_account *p = (struct gm_account*) numdb_search (gm_account_db, account_id); if (p == NULL) return 0; return p->level; @@ -181,7 +179,7 @@ int isGM (int account_id) //------------------------------------------------------- // Reading function of GM accounts file (and their level) //------------------------------------------------------- -int read_gm_account () +int read_gm_account (void) { char line[512]; struct gm_account *p; @@ -205,11 +203,10 @@ int read_gm_account () GM_account_filename); printf (" Actually, there is no GM accounts on the server.\n"); - login_log ("read_gm_account: GM accounts file [%s] not found." - RETCODE, GM_account_filename); + login_log ("read_gm_account: GM accounts file [%s] not found.\n", + GM_account_filename); login_log - (" Actually, there is no GM accounts on the server." - RETCODE); + (" Actually, there is no GM accounts on the server.\n"); return 1; } // limited to 4000, because we send information to char-servers (more than 4000 GM accounts???) @@ -261,8 +258,7 @@ int read_gm_account () printf ("***WARNING: 4000 GM accounts found. Next GM accounts are not readed.\n"); login_log - ("***WARNING: 4000 GM accounts found. Next GM accounts are not readed." - RETCODE); + ("***WARNING: 4000 GM accounts found. Next GM accounts are not readed.\n"); } } } @@ -272,8 +268,8 @@ int read_gm_account () printf ("read_gm_account: file '%s' readed (%d GM accounts found).\n", GM_account_filename, c); - login_log ("read_gm_account: file '%s' readed (%d GM accounts found)." - RETCODE, GM_account_filename, c); + login_log ("read_gm_account: file '%s' readed (%d GM accounts found).\n", + GM_account_filename, c); return 0; } @@ -594,11 +590,11 @@ int mmo_auth_init (void) (" account id #%d -> account not read (saved in log file).\033[0m\n", account_id); login_log - ("mmmo_auth_init: ******Error: an account has an id higher than %d." - RETCODE, END_ACCOUNT_NUM); + ("mmmo_auth_init: ******Error: an account has an id higher than %d.\n", + END_ACCOUNT_NUM); login_log - (" account id #%d -> account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> account not read (saved in next line):\n", + account_id); login_log ("%s", line); continue; } @@ -614,11 +610,10 @@ int mmo_auth_init (void) (" account id #%d -> new account not read (saved in log file).\033[0m\n", account_id); login_log - ("mmmo_auth_init: ******Error: an account has an identical id to another." - RETCODE); + ("mmmo_auth_init: ******Error: an account has an identical id to another.\n"); login_log - (" account id #%d -> new account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> new account not read (saved in next line):\n", + account_id); login_log ("%s", line); break; } @@ -630,11 +625,10 @@ int mmo_auth_init (void) printf (" Account saved in log file.\033[0m\n"); login_log - ("mmmo_auth_init: ******Error: an account has an identical id to another." - RETCODE); + ("mmmo_auth_init: ******Error: an account has an identical id to another.\n"); login_log - (" account id #%d -> new account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> new account not read (saved in next line):\n", + account_id); login_log ("%s", line); break; } @@ -773,11 +767,11 @@ int mmo_auth_init (void) (" account id #%d -> account not read (saved in log file).\033[0m\n", account_id); login_log - ("mmmo_auth_init: ******Error: an account has an id higher than %d." - RETCODE, END_ACCOUNT_NUM); + ("mmmo_auth_init: ******Error: an account has an id higher than %d.\n", + END_ACCOUNT_NUM); login_log - (" account id #%d -> account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> account not read (saved in next line):\n", + account_id); login_log ("%s", line); continue; } @@ -793,11 +787,10 @@ int mmo_auth_init (void) (" account id #%d -> new account not read (saved in log file).\033[0m\n", account_id); login_log - ("mmmo_auth_init: ******Error: an account has an identical id to another." - RETCODE); + ("mmmo_auth_init: ******Error: an account has an identical id to another.\n"); login_log - (" account id #%d -> new account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> new account not read (saved in next line):\n", + account_id); login_log ("%s", line); break; } @@ -809,11 +802,10 @@ int mmo_auth_init (void) printf (" Account saved in log file.\033[0m\n"); login_log - ("mmmo_auth_init: ******Error: an account has an identical id to another." - RETCODE); + ("mmmo_auth_init: ******Error: an account has an identical id to another.\n"); login_log - (" account id #%d -> new account not read (saved in next line):" - RETCODE, account_id); + (" account id #%d -> new account not read (saved in next line):\n", + account_id); login_log ("%s", line); break; } @@ -966,7 +958,7 @@ int mmo_auth_init (void) sprintf (line, "%s %d server accounts ('S').", str, server_count); } } - login_log ("%s" RETCODE, line); + login_log ("%s\n", line); return 0; } @@ -1030,7 +1022,7 @@ void mmo_auth_sync (void) continue; mmo_auth_tostr (line, &auth_dat[k]); - fprintf (fp, "%s" RETCODE, line); + fprintf (fp, "%s\n", line); } fprintf (fp, "%d\t%%newid%%\n", account_id_count); @@ -1101,7 +1093,7 @@ int charif_sendallwos (int sfd, unsigned char *buf, unsigned int len) //----------------------------------------------------- // Send GM accounts to all char-server //----------------------------------------------------- -void send_GM_accounts () +void send_GM_accounts (void) { int i; char buf[32000]; @@ -1273,19 +1265,19 @@ int mmo_auth (struct mmo_account *account, int fd) if (newaccount) { login_log - ("Attempt of creation of an already existant account (account: %s_%c, ip: %s)" - RETCODE, account->userid, account->userid[len + 1], ip); + ("Attempt of creation of an already existant account (account: %s_%c, ip: %s)\n", + account->userid, account->userid[len + 1], ip); return 9; // 9 = Account already exists } - ld = session[fd]->session_data; + ld = (struct login_session_data*) session[fd]->session_data; #ifdef PASSWORDENC if (account->passwdenc > 0) { int j = account->passwdenc; if (!ld) { - login_log ("Md5 key not created (account: %s, ip: %s)" - RETCODE, account->userid, ip); + login_log ("Md5 key not created (account: %s, ip: %s)\n", + account->userid, ip); return 1; // 1 = Incorrect Password } if (j > 2) @@ -1317,8 +1309,8 @@ int mmo_auth (struct mmo_account *account, int fd) { if (account->passwdenc == 0) login_log - ("Invalid password (account: %s, ip: %s)" - RETCODE, account->userid, ip); + ("Invalid password (account: %s, ip: %s)\n", + account->userid, ip); #ifdef PASSWORDENC else @@ -1338,7 +1330,7 @@ int mmo_auth (struct mmo_account *account, int fd) for (j = 0; j < ld->md5keylen; j++) p += sprintf (p, "%02x", ((unsigned char *) ld->md5key)[j]); - p += sprintf (p, "], ip: %s)" RETCODE, ip); + p += sprintf (p, "], ip: %s)\n", ip); login_log (logbuf); } #endif @@ -1348,8 +1340,8 @@ int mmo_auth (struct mmo_account *account, int fd) if (auth_dat[i].state) { login_log - ("Connection refused (account: %s, state: %d, ip: %s)" - RETCODE, account->userid, auth_dat[i].state, + ("Connection refused (account: %s, state: %d, ip: %s)\n", + account->userid, auth_dat[i].state, ip); switch (auth_dat[i].state) { // packet 0x006a value + 1 @@ -1379,15 +1371,15 @@ int mmo_auth (struct mmo_account *account, int fd) if (auth_dat[i].ban_until_time > time (NULL)) { // always banned login_log - ("Connection refused (account: %s, banned until %s, ip: %s)" - RETCODE, account->userid, tmpstr, ip); + ("Connection refused (account: %s, banned until %s, ip: %s)\n", + account->userid, tmpstr, ip); return 6; // 6 = Your are Prohibited to log in until %s } else { // ban is finished login_log - ("End of ban (account: %s, previously banned until %s -> not more banned, ip: %s)" - RETCODE, account->userid, tmpstr, ip); + ("End of ban (account: %s, previously banned until %s -> not more banned, ip: %s)\n", + account->userid, tmpstr, ip); auth_dat[i].ban_until_time = 0; // reset the ban time } } @@ -1396,21 +1388,21 @@ int mmo_auth (struct mmo_account *account, int fd) && auth_dat[i].connect_until_time < time (NULL)) { login_log - ("Connection refused (account: %s, expired ID, ip: %s)" - RETCODE, account->userid, ip); + ("Connection refused (account: %s, expired ID, ip: %s)\n", + account->userid, ip); return 2; // 2 = This ID is expired } - login_log ("Authentification accepted (account: %s (id: %d), ip: %s)" - RETCODE, account->userid, auth_dat[i].account_id, ip); + login_log ("Authentification accepted (account: %s (id: %d), ip: %s)\n", + account->userid, auth_dat[i].account_id, ip); } else { if (newaccount == 0) { login_log - ("Unknown account (account: %s, ip: %s)" - RETCODE, account->userid, ip); + ("Unknown account (account: %s, ip: %s)\n", + account->userid, ip); return 0; // 0 = Unregistered ID } else @@ -1418,8 +1410,8 @@ int mmo_auth (struct mmo_account *account, int fd) int new_id = mmo_auth_new (account, account->userid[len + 1], "a@a.com"); login_log - ("Account creation and authentification accepted (account %s (id: %d), sex: %c, connection with _F/_M, ip: %s)" - RETCODE, account->userid, new_id, + ("Account creation and authentification accepted (account %s (id: %d), sex: %c, connection with _F/_M, ip: %s)\n", + account->userid, new_id, account->userid[len + 1], ip); } } @@ -1459,8 +1451,8 @@ void char_anti_freeze_system (timer_id tid, tick_t tick, custom_id_t id, custom_ ("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection.\n", i, server[i].name); login_log - ("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection." - RETCODE, i, server[i].name); + ("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection.\n", + i, server[i].name); session[server_fd[i]]->eof = 1; } } @@ -1486,7 +1478,7 @@ void parse_fromchar (int fd) if (id < MAX_SERVERS) { printf ("Char-server '%s' has disconnected.\n", server[id].name); - login_log ("Char-server '%s' has disconnected (ip: %s)." RETCODE, + login_log ("Char-server '%s' has disconnected (ip: %s).\n", server[id].name, ip); server_fd[id] = -1; memset (&server[id], 0, sizeof (struct mmo_char_server)); @@ -1508,8 +1500,8 @@ void parse_fromchar (int fd) // request from map-server via char-server to reload GM accounts (by Yor). case 0x2709: login_log - ("Char-server '%s': Request to re-load GM configuration file (ip: %s)." - RETCODE, server[id].name, ip); + ("Char-server '%s': Request to re-load GM configuration file (ip: %s).\n", + server[id].name, ip); read_gm_account (); // send GM accounts to all char-servers send_GM_accounts (); @@ -1537,8 +1529,8 @@ void parse_fromchar (int fd) int p, k; auth_fifo[i].delflag = 1; login_log - ("Char-server '%s': authentification of the account %d accepted (ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': authentification of the account %d accepted (ip: %s).\n", + server[id].name, acc, ip); // printf("%d\n", i); for (k = 0; k < auth_num; k++) { @@ -1578,8 +1570,8 @@ void parse_fromchar (int fd) if (i == AUTH_FIFO_SIZE) { login_log - ("Char-server '%s': authentification of the account %d REFUSED (ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': authentification of the account %d REFUSED (ip: %s).\n", + server[id].name, acc, ip); WFIFOW (fd, 0) = 0x2713; WFIFOL (fd, 2) = acc; WFIFOB (fd, 6) = 1; @@ -1615,8 +1607,8 @@ void parse_fromchar (int fd) //printf("parse_fromchar: an e-mail creation of an account with a default e-mail: server '%s', account: %d, e-mail: '%s'.\n", server[id].name, acc, RFIFOP(fd,6)); if (e_mail_check (email) == 0) login_log - ("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)" - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n", + server[id].name, acc, ip); else { for (i = 0; i < auth_num; i++) @@ -1627,15 +1619,15 @@ void parse_fromchar (int fd) { memcpy (auth_dat[i].email, email, 40); login_log - ("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s)." - RETCODE, server[id].name, acc, email, ip); + ("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n", + server[id].name, acc, email, ip); break; } } if (i == auth_num) login_log - ("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n", + server[id].name, acc, ip); } RFIFOSKIP (fd, 46); break; @@ -1651,8 +1643,8 @@ void parse_fromchar (int fd) if (auth_dat[i].account_id == RFIFOL (fd, 2)) { login_log - ("Char-server '%s': e-mail of the account %d found (ip: %s)." - RETCODE, server[id].name, RFIFOL (fd, 2), ip); + ("Char-server '%s': e-mail of the account %d found (ip: %s).\n", + server[id].name, RFIFOL (fd, 2), ip); WFIFOW (fd, 0) = 0x2717; WFIFOL (fd, 2) = RFIFOL (fd, 2); memcpy (WFIFOP (fd, 6), auth_dat[i].email, 40); @@ -1665,8 +1657,8 @@ void parse_fromchar (int fd) if (i == auth_num) { login_log - ("Char-server '%s': e-mail of the account %d NOT found (ip: %s)." - RETCODE, server[id].name, RFIFOL (fd, 2), ip); + ("Char-server '%s': e-mail of the account %d NOT found (ip: %s).\n", + server[id].name, RFIFOL (fd, 2), ip); } RFIFOSKIP (fd, 6); break; @@ -1702,9 +1694,8 @@ void parse_fromchar (int fd) strftime (tmpstr, 23, date_format, gmtime (&(tv.tv_sec))); fprintf (fp, - RETCODE - "// %s: @GM command on account %d" - RETCODE "%d %d" RETCODE, tmpstr, + "\n// %s: @GM command on account %d\n%d %d\n", + tmpstr, acc, acc, level_new_gm); fclose_ (fp); WBUFL (buf, 6) = level_new_gm; @@ -1714,8 +1705,8 @@ void parse_fromchar (int fd) ("GM Change of the account %d: level 0 -> %d.\n", acc, level_new_gm); login_log - ("Char-server '%s': GM Change of the account %d: level 0 -> %d (ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': GM Change of the account %d: level 0 -> %d (ip: %s).\n", + server[id].name, acc, level_new_gm, ip); } else @@ -1724,8 +1715,8 @@ void parse_fromchar (int fd) ("Error of GM change (suggested account: %d, correct password, unable to add a GM account in GM accounts file)\n", acc); login_log - ("Char-server '%s': Error of GM change (suggested account: %d, correct password, unable to add a GM account in GM accounts file, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of GM change (suggested account: %d, correct password, unable to add a GM account in GM accounts file, ip: %s).\n", + server[id].name, acc, ip); } } else @@ -1734,8 +1725,8 @@ void parse_fromchar (int fd) ("Error of GM change (suggested account: %d, correct password, but GM creation is disable (level_new_gm = 0))\n", acc); login_log - ("Char-server '%s': Error of GM change (suggested account: %d, correct password, but GM creation is disable (level_new_gm = 0), ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of GM change (suggested account: %d, correct password, but GM creation is disable (level_new_gm = 0), ip: %s).\n", + server[id].name, acc, ip); } } else @@ -1744,8 +1735,8 @@ void parse_fromchar (int fd) ("Error of GM change (suggested account: %d (already GM), correct password).\n", acc); login_log - ("Char-server '%s': Error of GM change (suggested account: %d (already GM), correct password, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of GM change (suggested account: %d (already GM), correct password, ip: %s).\n", + server[id].name, acc, ip); } } else @@ -1754,8 +1745,8 @@ void parse_fromchar (int fd) ("Error of GM change (suggested account: %d, invalid password).\n", acc); login_log - ("Char-server '%s': Error of GM change (suggested account: %d, invalid password, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of GM change (suggested account: %d, invalid password, ip: %s).\n", + server[id].name, acc, ip); } charif_sendallwos (-1, buf, 10); } @@ -1778,16 +1769,16 @@ void parse_fromchar (int fd) remove_control_chars (new_email); if (e_mail_check (actual_email) == 0) login_log - ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)" - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n", + server[id].name, acc, ip); else if (e_mail_check (new_email) == 0) login_log - ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)" - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n", + server[id].name, acc, ip); else if (strcasecmp (new_email, "a@a.com") == 0) login_log - ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)" - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n", + server[id].name, acc, ip); else { for (i = 0; i < auth_num; i++) @@ -1799,14 +1790,14 @@ void parse_fromchar (int fd) { memcpy (auth_dat[i].email, new_email, 40); login_log - ("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n", + server[id].name, acc, auth_dat[i].userid, new_email, ip); } else login_log - ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n", + server[id].name, acc, auth_dat[i].userid, auth_dat[i].email, actual_email, ip); break; @@ -1814,8 +1805,8 @@ void parse_fromchar (int fd) } if (i == auth_num) login_log - ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n", + server[id].name, acc, ip); } } RFIFOSKIP (fd, 86); @@ -1836,8 +1827,8 @@ void parse_fromchar (int fd) if (auth_dat[i].state != statut) { login_log - ("Char-server '%s': Status change (account: %d, new status %d, ip: %s)." - RETCODE, server[id].name, acc, statut, + ("Char-server '%s': Status change (account: %d, new status %d, ip: %s).\n", + server[id].name, acc, statut, ip); if (statut != 0) { @@ -1855,8 +1846,8 @@ void parse_fromchar (int fd) } else login_log - ("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %d, ip: %s)." - RETCODE, server[id].name, acc, statut, + ("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %d, ip: %s).\n", + server[id].name, acc, statut, ip); break; } @@ -1864,8 +1855,8 @@ void parse_fromchar (int fd) if (i == auth_num) { login_log - ("Char-server '%s': Error of Status change (account: %d not found, suggested status %d, ip: %s)." - RETCODE, server[id].name, acc, statut, ip); + ("Char-server '%s': Error of Status change (account: %d not found, suggested status %d, ip: %s).\n", + server[id].name, acc, statut, ip); } RFIFOSKIP (fd, 10); } @@ -1915,8 +1906,8 @@ void parse_fromchar (int fd) strftime (tmpstr, 24, date_format, gmtime (×tamp)); login_log - ("Char-server '%s': Ban request (account: %d, new final date of banishment: %d (%s), ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Ban request (account: %d, new final date of banishment: %d (%s), ip: %s).\n", + server[id].name, acc, timestamp, (timestamp == 0 ? "no banishment" : tmpstr), @@ -1935,8 +1926,8 @@ void parse_fromchar (int fd) else { login_log - ("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n", + server[id].name, acc, ip); } auth_dat[i].ban_until_time = timestamp; @@ -1944,15 +1935,15 @@ void parse_fromchar (int fd) else { login_log - ("Char-server '%s': Error of ban request (account: %d, no change for ban date, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of ban request (account: %d, no change for ban date, ip: %s).\n", + server[id].name, acc, ip); } } else { login_log - ("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n", + server[id].name, acc, ip); } break; } @@ -1960,8 +1951,8 @@ void parse_fromchar (int fd) if (i == auth_num) { login_log - ("Char-server '%s': Error of ban request (account: %d not found, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n", + server[id].name, acc, ip); } RFIFOSKIP (fd, 18); } @@ -1980,8 +1971,8 @@ void parse_fromchar (int fd) { if (auth_dat[i].sex == 2) login_log - ("Char-server '%s': Error of sex change - Server account (suggested account: %d, actual sex %d (Server), ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Error of sex change - Server account (suggested account: %d, actual sex %d (Server), ip: %s).\n", + server[id].name, acc, auth_dat[i].sex, ip); else { @@ -1991,8 +1982,8 @@ void parse_fromchar (int fd) else sex = 0; login_log - ("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n", + server[id].name, acc, (sex == 2) ? 'S' : (sex ? 'M' : 'F'), ip); for (j = 0; j < AUTH_FIFO_SIZE; j++) @@ -2010,8 +2001,8 @@ void parse_fromchar (int fd) if (i == auth_num) { login_log - ("Char-server '%s': Error of sex change (account: %d not found, sex would be reversed, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of sex change (account: %d not found, sex would be reversed, ip: %s).\n", + server[id].name, acc, ip); } RFIFOSKIP (fd, 6); } @@ -2029,8 +2020,8 @@ void parse_fromchar (int fd) { unsigned char buf[RFIFOW (fd, 2) + 1]; login_log - ("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d, ip: %s).\n", + server[id].name, acc, ip); for (p = 8, j = 0; p < RFIFOW (fd, 2) && j < ACCOUNT_REG2_NUM; p += 36, j++) @@ -2057,8 +2048,8 @@ void parse_fromchar (int fd) { // printf("parse_fromchar: receiving (from the char-server) of account_reg2 (unknwon account id: %d).\n", acc); login_log - ("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n", + server[id].name, acc, ip); } } RFIFOSKIP (fd, RFIFOW (fd, 2)); @@ -2078,14 +2069,14 @@ void parse_fromchar (int fd) { auth_dat[i].ban_until_time = 0; login_log - ("Char-server '%s': UnBan request (account: %d, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': UnBan request (account: %d, ip: %s).\n", + server[id].name, acc, ip); } else { login_log - ("Char-server '%s': Error of UnBan request (account: %d, no change for unban date, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of UnBan request (account: %d, no change for unban date, ip: %s).\n", + server[id].name, acc, ip); } break; } @@ -2093,8 +2084,8 @@ void parse_fromchar (int fd) if (i == auth_num) { login_log - ("Char-server '%s': Error of UnBan request (account: %d not found, ip: %s)." - RETCODE, server[id].name, acc, ip); + ("Char-server '%s': Error of UnBan request (account: %d not found, ip: %s).\n", + server[id].name, acc, ip); } RFIFOSKIP (fd, 6); } @@ -2130,8 +2121,8 @@ void parse_fromchar (int fd) status = 1; strcpy (auth_dat[i].pass, MD5_saltcrypt(new_pass, make_salt())); login_log - ("Char-server '%s': Change pass success (account: %d (%s), ip: %s." - RETCODE, server[id].name, acc, + ("Char-server '%s': Change pass success (account: %d (%s), ip: %s.\n", + server[id].name, acc, auth_dat[i].userid, ip); } } @@ -2139,8 +2130,8 @@ void parse_fromchar (int fd) { status = 2; login_log - ("Char-server '%s': Attempt to modify a pass failed, wrong password. (account: %d (%s), ip: %s)." - RETCODE, server[id].name, acc, + ("Char-server '%s': Attempt to modify a pass failed, wrong password. (account: %d (%s), ip: %s).\n", + server[id].name, acc, auth_dat[i].userid, ip); } break; @@ -2166,15 +2157,14 @@ void parse_fromchar (int fd) gettimeofday (&tv, NULL); strftime (tmpstr, 23, date_format, gmtime (&(tv.tv_sec))); fprintf (logfp, - "%s.%03d: receiving of an unknown packet -> disconnection" - RETCODE, tmpstr, (int) tv.tv_usec / 1000); + "%s.%03d: receiving of an unknown packet -> disconnection\n", + tmpstr, (int) tv.tv_usec / 1000); fprintf (logfp, - "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." - RETCODE, fd, ip, RFIFOW (fd, 0), RFIFOREST (fd)); - fprintf (logfp, "Detail (in hex):" RETCODE); + "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + fd, ip, RFIFOW (fd, 0), RFIFOREST (fd)); + fprintf (logfp, "Detail (in hex):\n"); fprintf (logfp, - "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F" - RETCODE); + "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"); memset (tmpstr, '\0', sizeof (tmpstr)); for (i = 0; i < RFIFOREST (fd); i++) { @@ -2189,7 +2179,7 @@ void parse_fromchar (int fd) fprintf (logfp, " "); else if ((i + 1) % 16 == 0) { - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); memset (tmpstr, '\0', sizeof (tmpstr)); } } @@ -2201,9 +2191,9 @@ void parse_fromchar (int fd) if ((j - 7) % 16 == 0) // -8 + 1 fprintf (logfp, " "); } - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); } - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); fclose_ (logfp); } } @@ -2250,8 +2240,8 @@ void parse_admin (int fd) switch (RFIFOW (fd, 0)) { case 0x7530: // Request of the server version - login_log ("'ladmin': Sending of the server version (ip: %s)" - RETCODE, ip); + login_log ("'ladmin': Sending of the server version (ip: %s)\n", + ip); WFIFOW (fd, 0) = 0x7531; WFIFOB (fd, 2) = ATHENA_MAJOR_VERSION; WFIFOB (fd, 3) = ATHENA_MINOR_VERSION; @@ -2265,7 +2255,7 @@ void parse_admin (int fd) break; case 0x7532: // Request of end of connection - login_log ("'ladmin': End of connection (ip: %s)" RETCODE, + login_log ("'ladmin': End of connection (ip: %s)\n", ip); RFIFOSKIP (fd, 2); session[fd]->eof = 1; @@ -2286,8 +2276,8 @@ void parse_admin (int fd) if (ed > END_ACCOUNT_NUM || ed < st || ed <= 0) ed = END_ACCOUNT_NUM; login_log - ("'ladmin': Sending an accounts list (ask: from %d to %d, ip: %s)" - RETCODE, st, ed, ip); + ("'ladmin': Sending an accounts list (ask: from %d to %d, ip: %s)\n", + st, ed, ip); // Sort before send for (i = 0; i < auth_num; i++) { @@ -2360,26 +2350,26 @@ void parse_admin (int fd) if (strlen (ma.userid) > 23 || strlen (ma.passwd) > 23) { login_log - ("'ladmin': Attempt to create an invalid account (account or pass is too long, ip: %s)" - RETCODE, ip); + ("'ladmin': Attempt to create an invalid account (account or pass is too long, ip: %s)\n", + ip); } else if (strlen (ma.userid) < 4 || strlen (ma.passwd) < 4) { login_log - ("'ladmin': Attempt to create an invalid account (account or pass is too short, ip: %s)" - RETCODE, ip); + ("'ladmin': Attempt to create an invalid account (account or pass is too short, ip: %s)\n", + ip); } else if (ma.sex != 'F' && ma.sex != 'M') { login_log - ("'ladmin': Attempt to create an invalid account (account: %s, invalid sex, ip: %s)" - RETCODE, ma.userid, ip); + ("'ladmin': Attempt to create an invalid account (account: %s, invalid sex, ip: %s)\n", + ma.userid, ip); } else if (account_id_count > END_ACCOUNT_NUM) { login_log - ("'ladmin': Attempt to create an account, but there is no more available id number (account: %s, sex: %c, ip: %s)" - RETCODE, ma.userid, ma.sex, ip); + ("'ladmin': Attempt to create an account, but there is no more available id number (account: %s, sex: %c, ip: %s)\n", + ma.userid, ma.sex, ip); } else { @@ -2391,8 +2381,8 @@ void parse_admin (int fd) 0) { login_log - ("'ladmin': Attempt to create an already existing account (account: %s ip: %s)" - RETCODE, auth_dat[i].userid, ip); + ("'ladmin': Attempt to create an already existing account (account: %s ip: %s)\n", + auth_dat[i].userid, ip); break; } } @@ -2405,8 +2395,8 @@ void parse_admin (int fd) remove_control_chars (email); new_id = mmo_auth_new (&ma, ma.sex, email); login_log - ("'ladmin': Account creation (account: %s (id: %d), sex: %c, email: %s, ip: %s)" - RETCODE, ma.userid, new_id, + ("'ladmin': Account creation (account: %s (id: %d), sex: %c, email: %s, ip: %s)\n", + ma.userid, new_id, ma.sex, auth_dat[i].email, ip); WFIFOL (fd, 2) = new_id; } @@ -2437,11 +2427,11 @@ void parse_admin (int fd) WFIFOL (fd, 2) = auth_dat[i].account_id; // save deleted account in log file login_log - ("'ladmin': Account deletion (account: %s, id: %d, ip: %s) - saved in next line:" - RETCODE, auth_dat[i].userid, auth_dat[i].account_id, + ("'ladmin': Account deletion (account: %s, id: %d, ip: %s) - saved in next line:\n", + auth_dat[i].userid, auth_dat[i].account_id, ip); mmo_auth_tostr (buf, &auth_dat[i]); - login_log ("%s" RETCODE, buf); + login_log ("%s\n", buf); // delete account memset (auth_dat[i].userid, '\0', sizeof (auth_dat[i].userid)); @@ -2451,8 +2441,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to delete an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to delete an unknown account (account: %s, ip: %s)\n", + account_name, ip); } WFIFOSET (fd, 30); RFIFOSKIP (fd, 26); @@ -2474,15 +2464,15 @@ void parse_admin (int fd) auth_dat[i].pass[39] = '\0'; WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Modification of a password (account: %s, new password: %s, ip: %s)" - RETCODE, auth_dat[i].userid, auth_dat[i].pass, ip); + ("'ladmin': Modification of a password (account: %s, new password: %s, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].pass, ip); } else { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to modify the password of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to modify the password of an unknown account (account: %s, ip: %s)\n", + account_name, ip); } WFIFOSET (fd, 30); RFIFOSKIP (fd, 50); @@ -2516,19 +2506,19 @@ void parse_admin (int fd) && strcmp (auth_dat[i].error_message, error_message) == 0) login_log - ("'ladmin': Modification of a state, but the state of the account is already the good state (account: %s, received state: %d, ip: %s)" - RETCODE, account_name, statut, ip); + ("'ladmin': Modification of a state, but the state of the account is already the good state (account: %s, received state: %d, ip: %s)\n", + account_name, statut, ip); else { if (statut == 7) login_log - ("'ladmin': Modification of a state (account: %s, new state: %d - prohibited to login until '%s', ip: %s)" - RETCODE, auth_dat[i].userid, statut, + ("'ladmin': Modification of a state (account: %s, new state: %d - prohibited to login until '%s', ip: %s)\n", + auth_dat[i].userid, statut, error_message, ip); else login_log - ("'ladmin': Modification of a state (account: %s, new state: %d, ip: %s)" - RETCODE, auth_dat[i].userid, statut, ip); + ("'ladmin': Modification of a state (account: %s, new state: %d, ip: %s)\n", + auth_dat[i].userid, statut, ip); if (auth_dat[i].state == 0) { unsigned char buf[16]; @@ -2551,8 +2541,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to modify the state of an unknown account (account: %s, received state: %d, ip: %s)" - RETCODE, account_name, statut, ip); + ("'ladmin': Attempt to modify the state of an unknown account (account: %s, received state: %d, ip: %s)\n", + account_name, statut, ip); } WFIFOL (fd, 30) = statut; } @@ -2561,8 +2551,7 @@ void parse_admin (int fd) break; case 0x7938: // Request for servers list and # of online players - login_log ("'ladmin': Sending of servers list (ip: %s)" - RETCODE, ip); + login_log ("'ladmin': Sending of servers list (ip: %s)\n", ip); server_num = 0; for (i = 0; i < MAX_SERVERS; i++) { @@ -2576,7 +2565,7 @@ void parse_admin (int fd) server[i].users; WFIFOW (fd, 4 + server_num * 32 + 28) = server[i].maintenance; - WFIFOW (fd, 4 + server_num * 32 + 30) = server[i].new; + WFIFOW (fd, 4 + server_num * 32 + 30) = server[i].is_new; server_num++; } } @@ -2602,8 +2591,8 @@ void parse_admin (int fd) { WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Check of password OK (account: %s, password: %s, ip: %s)" - RETCODE, auth_dat[i].userid, auth_dat[i].pass, + ("'ladmin': Check of password OK (account: %s, password: %s, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].pass, ip); } else @@ -2613,16 +2602,16 @@ void parse_admin (int fd) pass[23] = '\0'; remove_control_chars (pass); login_log - ("'ladmin': Failure of password check (account: %s, proposed pass: %s, ip: %s)" - RETCODE, auth_dat[i].userid, pass, ip); + ("'ladmin': Failure of password check (account: %s, proposed pass: %s, ip: %s)\n", + auth_dat[i].userid, pass, ip); } } else { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to check the password of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to check the password of an unknown account (account: %s, ip: %s)\n", + account_name, ip); } WFIFOSET (fd, 30); RFIFOSKIP (fd, 50); @@ -2644,12 +2633,12 @@ void parse_admin (int fd) { if (sex > 31) login_log - ("'ladmin': Attempt to give an invalid sex (account: %s, received sex: %c, ip: %s)" - RETCODE, account_name, sex, ip); + ("'ladmin': Attempt to give an invalid sex (account: %s, received sex: %c, ip: %s)\n", + account_name, sex, ip); else login_log - ("'ladmin': Attempt to give an invalid sex (account: %s, received sex: 'control char', ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to give an invalid sex (account: %s, received sex: 'control char', ip: %s)\n", + account_name, ip); } else { @@ -2673,8 +2662,8 @@ void parse_admin (int fd) 's') ? 2 : (sex == 'M' || sex == 'm'); login_log - ("'ladmin': Modification of a sex (account: %s, new sex: %c, ip: %s)" - RETCODE, auth_dat[i].userid, sex, ip); + ("'ladmin': Modification of a sex (account: %s, new sex: %c, ip: %s)\n", + auth_dat[i].userid, sex, ip); // send to all char-server the change WBUFW (buf, 0) = 0x2723; WBUFL (buf, 2) = auth_dat[i].account_id; @@ -2684,15 +2673,15 @@ void parse_admin (int fd) else { login_log - ("'ladmin': Modification of a sex, but the sex is already the good sex (account: %s, sex: %c, ip: %s)" - RETCODE, auth_dat[i].userid, sex, ip); + ("'ladmin': Modification of a sex, but the sex is already the good sex (account: %s, sex: %c, ip: %s)\n", + auth_dat[i].userid, sex, ip); } } else { login_log - ("'ladmin': Attempt to modify the sex of an unknown account (account: %s, received sex: %c, ip: %s)" - RETCODE, account_name, sex, ip); + ("'ladmin': Attempt to modify the sex of an unknown account (account: %s, received sex: %c, ip: %s)\n", + account_name, sex, ip); } } } @@ -2715,8 +2704,8 @@ void parse_admin (int fd) if (new_gm_level < 0 || new_gm_level > 99) { login_log - ("'ladmin': Attempt to give an invalid GM level (account: %s, received GM level: %d, ip: %s)" - RETCODE, account_name, (int) new_gm_level, ip); + ("'ladmin': Attempt to give an invalid GM level (account: %s, received GM level: %d, ip: %s)\n", + account_name, (int) new_gm_level, ip); } else { @@ -2761,7 +2750,7 @@ void parse_admin (int fd) if ((line[0] == '/' && line[1] == '/') || line[0] == '\0') - fprintf (fp2, "%s" RETCODE, + fprintf (fp2, "%s\n", line); else { @@ -2774,18 +2763,17 @@ void parse_admin (int fd) &GM_level) != 2) fprintf (fp2, - "%s" RETCODE, + "%s\n", line); else if (GM_account != acc) fprintf (fp2, - "%s" RETCODE, + "%s\n", line); else if (new_gm_level < 1) { fprintf (fp2, - "// %s: 'ladmin' GM level removed on account %d '%s' (previous level: %d)" - RETCODE "//%d %d" - RETCODE, tmpstr, + "// %s: 'ladmin' GM level removed on account %d '%s' (previous level: %d)\n//%d %d\n", + tmpstr, acc, auth_dat [i].userid, @@ -2796,9 +2784,8 @@ void parse_admin (int fd) else { fprintf (fp2, - "// %s: 'ladmin' GM level on account %d '%s' (previous level: %d)" - RETCODE "%d %d" - RETCODE, tmpstr, + "// %s: 'ladmin' GM level on account %d '%s' (previous level: %d)\n%d %d\n", + tmpstr, acc, auth_dat [i].userid, @@ -2810,8 +2797,7 @@ void parse_admin (int fd) } if (modify_flag == 0) fprintf (fp2, - "// %s: 'ladmin' GM level on account %d '%s' (previous level: 0)" - RETCODE "%d %d" RETCODE, + "// %s: 'ladmin' GM level on account %d '%s' (previous level: 0)\n%d %d\n", tmpstr, acc, auth_dat[i].userid, acc, new_gm_level); @@ -2820,15 +2806,15 @@ void parse_admin (int fd) else { login_log - ("'ladmin': Attempt to modify of a GM level - impossible to read GM accounts file (account: %s (%d), received GM level: %d, ip: %s)" - RETCODE, auth_dat[i].userid, acc, + ("'ladmin': Attempt to modify of a GM level - impossible to read GM accounts file (account: %s (%d), received GM level: %d, ip: %s)\n", + auth_dat[i].userid, acc, (int) new_gm_level, ip); } lock_fclose(fp2, GM_account_filename, &lock); WFIFOL (fd, 2) = acc; login_log - ("'ladmin': Modification of a GM level (account: %s (%d), new GM level: %d, ip: %s)" - RETCODE, auth_dat[i].userid, acc, + ("'ladmin': Modification of a GM level (account: %s (%d), new GM level: %d, ip: %s)\n", + auth_dat[i].userid, acc, (int) new_gm_level, ip); // read and send new GM informations read_gm_account (); @@ -2837,24 +2823,24 @@ void parse_admin (int fd) else { login_log - ("'ladmin': Attempt to modify of a GM level - impossible to write GM accounts file (account: %s (%d), received GM level: %d, ip: %s)" - RETCODE, auth_dat[i].userid, acc, + ("'ladmin': Attempt to modify of a GM level - impossible to write GM accounts file (account: %s (%d), received GM level: %d, ip: %s)\n", + auth_dat[i].userid, acc, (int) new_gm_level, ip); } } else { login_log - ("'ladmin': Attempt to modify of a GM level, but the GM level is already the good GM level (account: %s (%d), GM level: %d, ip: %s)" - RETCODE, auth_dat[i].userid, acc, + ("'ladmin': Attempt to modify of a GM level, but the GM level is already the good GM level (account: %s (%d), GM level: %d, ip: %s)\n", + auth_dat[i].userid, acc, (int) new_gm_level, ip); } } else { login_log - ("'ladmin': Attempt to modify the GM level of an unknown account (account: %s, received GM level: %d, ip: %s)" - RETCODE, account_name, (int) new_gm_level, + ("'ladmin': Attempt to modify the GM level of an unknown account (account: %s, received GM level: %d, ip: %s)\n", + account_name, (int) new_gm_level, ip); } } @@ -2878,8 +2864,8 @@ void parse_admin (int fd) if (e_mail_check (email) == 0) { login_log - ("'ladmin': Attempt to give an invalid e-mail (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to give an invalid e-mail (account: %s, ip: %s)\n", + account_name, ip); } else { @@ -2891,14 +2877,14 @@ void parse_admin (int fd) memcpy (auth_dat[i].email, email, 40); WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Modification of an email (account: %s, new e-mail: %s, ip: %s)" - RETCODE, auth_dat[i].userid, email, ip); + ("'ladmin': Modification of an email (account: %s, new e-mail: %s, ip: %s)\n", + auth_dat[i].userid, email, ip); } else { login_log - ("'ladmin': Attempt to modify the e-mail of an unknown account (account: %s, received e-mail: %s, ip: %s)" - RETCODE, account_name, email, ip); + ("'ladmin': Attempt to modify the e-mail of an unknown account (account: %s, received e-mail: %s, ip: %s)\n", + account_name, email, ip); } } } @@ -2939,15 +2925,15 @@ void parse_admin (int fd) remove_control_chars (auth_dat[i].memo); WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Modification of a memo field (account: %s, new memo: %s, ip: %s)" - RETCODE, auth_dat[i].userid, auth_dat[i].memo, ip); + ("'ladmin': Modification of a memo field (account: %s, new memo: %s, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].memo, ip); } else { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to modify the memo field of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to modify the memo field of an unknown account (account: %s, ip: %s)\n", + account_name, ip); } WFIFOSET (fd, 30); RFIFOSKIP (fd, 28 + RFIFOW (fd, 26)); @@ -2967,16 +2953,16 @@ void parse_admin (int fd) memcpy (WFIFOP (fd, 6), auth_dat[i].userid, 24); WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Request (by the name) of an account id (account: %s, id: %d, ip: %s)" - RETCODE, auth_dat[i].userid, auth_dat[i].account_id, + ("'ladmin': Request (by the name) of an account id (account: %s, id: %d, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].account_id, ip); } else { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': ID request (by the name) of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': ID request (by the name) of an unknown account (account: %s, ip: %s)\n", + account_name, ip); } WFIFOSET (fd, 30); RFIFOSKIP (fd, 26); @@ -2994,16 +2980,16 @@ void parse_admin (int fd) { strncpy (WFIFOP (fd, 6), auth_dat[i].userid, 24); login_log - ("'ladmin': Request (by id) of an account name (account: %s, id: %d, ip: %s)" - RETCODE, auth_dat[i].userid, RFIFOL (fd, 2), ip); + ("'ladmin': Request (by id) of an account name (account: %s, id: %d, ip: %s)\n", + auth_dat[i].userid, RFIFOL (fd, 2), ip); break; } } if (i == auth_num) { login_log - ("'ladmin': Name request (by id) of an unknown account (id: %d, ip: %s)" - RETCODE, RFIFOL (fd, 2), ip); + ("'ladmin': Name request (by id) of an unknown account (id: %d, ip: %s)\n", + RFIFOL (fd, 2), ip); strncpy (WFIFOP (fd, 6), "", 24); } WFIFOSET (fd, 30); @@ -3028,8 +3014,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), auth_dat[i].userid, 24); login_log - ("'ladmin': Change of a validity limit (account: %s, new validity: %d (%s), ip: %s)" - RETCODE, auth_dat[i].userid, timestamp, + ("'ladmin': Change of a validity limit (account: %s, new validity: %d (%s), ip: %s)\n", + auth_dat[i].userid, timestamp, (timestamp == 0 ? "unlimited" : tmpstr), ip); auth_dat[i].connect_until_time = timestamp; WFIFOL (fd, 2) = auth_dat[i].account_id; @@ -3038,8 +3024,7 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to change the validity limit of an unknown account (account: %s, received validity: %d (%s), ip: %s)" - RETCODE, account_name, timestamp, + ("'ladmin': Attempt to change the validity limit of an unknown account (account: %s, received validity: %d (%s), ip: %s)\n", account_name, timestamp, (timestamp == 0 ? "unlimited" : tmpstr), ip); } WFIFOL (fd, 30) = timestamp; @@ -3069,8 +3054,8 @@ void parse_admin (int fd) memcpy (WFIFOP (fd, 6), auth_dat[i].userid, 24); WFIFOL (fd, 2) = auth_dat[i].account_id; login_log - ("'ladmin': Change of the final date of a banishment (account: %s, new final date of banishment: %d (%s), ip: %s)" - RETCODE, auth_dat[i].userid, timestamp, + ("'ladmin': Change of the final date of a banishment (account: %s, new final date of banishment: %d (%s), ip: %s)\n", + auth_dat[i].userid, timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); if (auth_dat[i].ban_until_time != timestamp) { @@ -3094,8 +3079,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to change the final date of a banishment of an unknown account (account: %s, received final date of banishment: %d (%s), ip: %s)" - RETCODE, account_name, timestamp, + ("'ladmin': Attempt to change the final date of a banishment of an unknown account (account: %s, received final date of banishment: %d (%s), ip: %s)\n", + account_name, timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); } WFIFOL (fd, 30) = timestamp; @@ -3147,8 +3132,8 @@ void parse_admin (int fd) strftime (tmpstr, 24, date_format, gmtime (×tamp)); login_log - ("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)" - RETCODE, auth_dat[i].userid, + ("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", + auth_dat[i].userid, (short) RFIFOW (fd, 26), (short) RFIFOW (fd, 28), (short) RFIFOW (fd, 30), (short) RFIFOW (fd, @@ -3181,8 +3166,8 @@ void parse_admin (int fd) strftime (tmpstr, 24, date_format, gmtime (&auth_dat[i].ban_until_time)); login_log - ("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)" - RETCODE, auth_dat[i].userid, + ("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].ban_until_time, (auth_dat[i].ban_until_time == 0 ? "no banishment" : tmpstr), @@ -3201,8 +3186,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to adjust the final date of a banishment of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to adjust the final date of a banishment of an unknown account (account: %s, ip: %s)\n", + account_name, ip); WFIFOL (fd, 30) = 0; } } @@ -3219,8 +3204,8 @@ void parse_admin (int fd) if (RFIFOL (fd, 4) < 1) { login_log - ("'ladmin': Receiving a message for broadcast, but message is void (ip: %s)" - RETCODE, ip); + ("'ladmin': Receiving a message for broadcast, but message is void (ip: %s)\n", + ip); } else { @@ -3231,8 +3216,8 @@ void parse_admin (int fd) if (i == MAX_SERVERS) { login_log - ("'ladmin': Receiving a message for broadcast, but no char-server is online (ip: %s)" - RETCODE, ip); + ("'ladmin': Receiving a message for broadcast, but no char-server is online (ip: %s)\n", + ip); } else { @@ -3245,12 +3230,12 @@ void parse_admin (int fd) remove_control_chars (message); if (RFIFOW (fd, 2) == 0) login_log - ("'ladmin': Receiving a message for broadcast (message (in yellow): %s, ip: %s)" - RETCODE, message, ip); + ("'ladmin': Receiving a message for broadcast (message (in yellow): %s, ip: %s)\n", + message, ip); else login_log - ("'ladmin': Receiving a message for broadcast (message (in blue): %s, ip: %s)" - RETCODE, message, ip); + ("'ladmin': Receiving a message for broadcast (message (in blue): %s, ip: %s)\n", + message, ip); // send same message to all char-servers (no answer) memcpy (WBUFP (buf, 0), RFIFOP (fd, 0), 8 + RFIFOL (fd, 4)); @@ -3284,8 +3269,8 @@ void parse_admin (int fd) if (add_to_unlimited_account == 0 && timestamp == 0) { login_log - ("'ladmin': Attempt to adjust the validity limit of an unlimited account (account: %s, ip: %s)" - RETCODE, auth_dat[i].userid, ip); + ("'ladmin': Attempt to adjust the validity limit of an unlimited account (account: %s, ip: %s)\n", + auth_dat[i].userid, ip); WFIFOL (fd, 30) = 0; } else @@ -3314,8 +3299,8 @@ void parse_admin (int fd) strftime (tmpstr2, 24, date_format, gmtime (×tamp)); login_log - ("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)" - RETCODE, auth_dat[i].userid, + ("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", + auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), @@ -3338,8 +3323,8 @@ void parse_admin (int fd) gmtime (&auth_dat [i].connect_until_time)); login_log - ("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)" - RETCODE, auth_dat[i].userid, + ("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), @@ -3357,8 +3342,8 @@ void parse_admin (int fd) { memcpy (WFIFOP (fd, 6), account_name, 24); login_log - ("'ladmin': Attempt to adjust the validity limit of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to adjust the validity limit of an unknown account (account: %s, ip: %s)\n", + account_name, ip); WFIFOL (fd, 30) = 0; } } @@ -3399,8 +3384,8 @@ void parse_admin (int fd) strlen (auth_dat[i].memo)); } login_log - ("'ladmin': Sending information of an account (request by the name; account: %s, id: %d, ip: %s)" - RETCODE, auth_dat[i].userid, auth_dat[i].account_id, + ("'ladmin': Sending information of an account (request by the name; account: %s, id: %d, ip: %s)\n", + auth_dat[i].userid, auth_dat[i].account_id, ip); WFIFOSET (fd, 150 + strlen (auth_dat[i].memo)); } @@ -3409,8 +3394,8 @@ void parse_admin (int fd) memcpy (WFIFOP (fd, 7), account_name, 24); WFIFOW (fd, 148) = 0; login_log - ("'ladmin': Attempt to obtain information (by the name) of an unknown account (account: %s, ip: %s)" - RETCODE, account_name, ip); + ("'ladmin': Attempt to obtain information (by the name) of an unknown account (account: %s, ip: %s)\n", + account_name, ip); WFIFOSET (fd, 150); } RFIFOSKIP (fd, 26); @@ -3427,8 +3412,8 @@ void parse_admin (int fd) if (auth_dat[i].account_id == RFIFOL (fd, 2)) { login_log - ("'ladmin': Sending information of an account (request by the id; account: %s, id: %d, ip: %s)" - RETCODE, auth_dat[i].userid, RFIFOL (fd, 2), ip); + ("'ladmin': Sending information of an account (request by the id; account: %s, id: %d, ip: %s)\n", + auth_dat[i].userid, RFIFOL (fd, 2), ip); WFIFOB (fd, 6) = (unsigned char) isGM (auth_dat[i].account_id); memcpy (WFIFOP (fd, 7), auth_dat[i].userid, 24); @@ -3457,8 +3442,8 @@ void parse_admin (int fd) if (i == auth_num) { login_log - ("'ladmin': Attempt to obtain information (by the id) of an unknown account (id: %d, ip: %s)" - RETCODE, RFIFOL (fd, 2), ip); + ("'ladmin': Attempt to obtain information (by the id) of an unknown account (id: %d, ip: %s)\n", + RFIFOL (fd, 2), ip); strncpy (WFIFOP (fd, 7), "", 24); WFIFOW (fd, 148) = 0; WFIFOSET (fd, 150); @@ -3468,8 +3453,8 @@ void parse_admin (int fd) case 0x7955: // Request to reload GM file (no answer) login_log - ("'ladmin': Request to re-load GM configuration file (ip: %s)." - RETCODE, ip); + ("'ladmin': Request to re-load GM configuration file (ip: %s).\n", + ip); read_gm_account (); // send GM accounts to all char-servers send_GM_accounts (); @@ -3487,15 +3472,14 @@ void parse_admin (int fd) gettimeofday (&tv, NULL); strftime (tmpstr, 23, date_format, gmtime (&(tv.tv_sec))); fprintf (logfp, - "%s.%03d: receiving of an unknown packet -> disconnection" - RETCODE, tmpstr, (int) tv.tv_usec / 1000); + "%s.%03d: receiving of an unknown packet -> disconnection\n", + tmpstr, (int) tv.tv_usec / 1000); fprintf (logfp, - "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." - RETCODE, fd, ip, RFIFOW (fd, 0), RFIFOREST (fd)); - fprintf (logfp, "Detail (in hex):" RETCODE); + "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + fd, ip, RFIFOW (fd, 0), RFIFOREST (fd)); + fprintf (logfp, "Detail (in hex):\n"); fprintf (logfp, - "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F" - RETCODE); + "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"); memset (tmpstr, '\0', sizeof (tmpstr)); for (i = 0; i < RFIFOREST (fd); i++) { @@ -3510,7 +3494,7 @@ void parse_admin (int fd) fprintf (logfp, " "); else if ((i + 1) % 16 == 0) { - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); memset (tmpstr, '\0', sizeof (tmpstr)); } } @@ -3522,15 +3506,15 @@ void parse_admin (int fd) if ((j - 7) % 16 == 0) // -8 + 1 fprintf (logfp, " "); } - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); } - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); fclose_ (logfp); } } login_log - ("'ladmin': End of connection, unknown packet (ip: %s)" - RETCODE, ip); + ("'ladmin': End of connection, unknown packet (ip: %s)\n", + ip); session[fd]->eof = 1; printf ("Remote administration has been disconnected (unknown packet).\n"); @@ -3649,21 +3633,21 @@ void parse_login (int fd) if (RFIFOW (fd, 0) == 0x64) { login_log - ("Request for connection (non encryption mode) of %s (ip: %s)." - RETCODE, account.userid, ip); + ("Request for connection (non encryption mode) of %s (ip: %s).\n", + account.userid, ip); } else { login_log - ("Request for connection (encryption mode) of %s (ip: %s)." - RETCODE, account.userid, ip); + ("Request for connection (encryption mode) of %s (ip: %s).\n", + account.userid, ip); } if (!check_ip (session[fd]->client_addr.sin_addr.s_addr)) { login_log - ("Connection refused: IP isn't authorised (deny/allow, ip: %s)." - RETCODE, ip); + ("Connection refused: IP isn't authorised (deny/allow, ip: %s).\n", + ip); WFIFOW (fd, 0) = 0x6a; WFIFOB (fd, 2) = 0x03; WFIFOSET (fd, 3); @@ -3678,8 +3662,8 @@ void parse_login (int fd) if (min_level_to_connect > gm_level) { login_log - ("Connection refused: the minimum GM level for connection is %d (account: %s, GM level: %d, ip: %s)." - RETCODE, min_level_to_connect, account.userid, + ("Connection refused: the minimum GM level for connection is %d (account: %s, GM level: %d, ip: %s).\n", + min_level_to_connect, account.userid, gm_level, ip); WFIFOW (fd, 0) = 0x81; WFIFOL (fd, 2) = 1; // 01 = Server closed @@ -3744,7 +3728,7 @@ void parse_login (int fd) WFIFOW (fd, 47 + server_num * 32 + 28) = server[i].maintenance; WFIFOW (fd, 47 + server_num * 32 + 30) = - server[i].new; + server[i].is_new; server_num++; } } @@ -3769,7 +3753,7 @@ void parse_login (int fd) WFIFOW (fd, 47 + server_num * 32 + 28) = server[i].maintenance; WFIFOW (fd, 47 + server_num * 32 + 30) = - server[i].new; + server[i].is_new; server_num++; } } @@ -3803,8 +3787,8 @@ void parse_login (int fd) else { login_log - ("Connection refused: there is no char-server online (account: %s, ip: %s)." - RETCODE, account.userid, ip); + ("Connection refused: there is no char-server online (account: %s, ip: %s).\n", + account.userid, ip); WFIFOW (fd, 0) = 0x81; WFIFOL (fd, 2) = 1; // 01 = Server closed WFIFOSET (fd, 3); @@ -3864,14 +3848,14 @@ void parse_login (int fd) } if (RFIFOW (fd, 0) == 0x01db) { - login_log ("Sending request of the coding key (ip: %s)" - RETCODE, ip); + login_log ("Sending request of the coding key (ip: %s)\n", + ip); } else { login_log - ("'ladmin': Sending request of the coding key (ip: %s)" - RETCODE, ip); + ("'ladmin': Sending request of the coding key (ip: %s)\n", + ip); } // Creation of the coding key memset (ld->md5key, '\0', sizeof (ld->md5key)); @@ -3904,9 +3888,8 @@ void parse_login (int fd) server_name[19] = '\0'; remove_control_chars (server_name); login_log - ("Connection request of the char-server '%s' @ %d.%d.%d.%d:%d (ip: %s)" - RETCODE, server_name, RFIFOB (fd, 54), RFIFOB (fd, - 55), + ("Connection request of the char-server '%s' @ %d.%d.%d.%d:%d (ip: %s)\n", + server_name, RFIFOB (fd, 54), RFIFOB (fd, 55), RFIFOB (fd, 56), RFIFOB (fd, 57), RFIFOW (fd, 58), ip); result = mmo_auth (&account, fd); @@ -3938,8 +3921,8 @@ void parse_login (int fd) && server_fd[account.account_id] == -1) { login_log - ("Connection of the char-server '%s' accepted (account: %s, pass: %s, ip: %s)" - RETCODE, server_name, account.userid, + ("Connection of the char-server '%s' accepted (account: %s, pass: %s, ip: %s)\n", + server_name, account.userid, account.passwd, ip); printf ("Connection of the char-server '%s' accepted.\n", @@ -3953,7 +3936,7 @@ void parse_login (int fd) server[account.account_id].users = 0; server[account.account_id].maintenance = RFIFOW (fd, 82); - server[account.account_id].new = RFIFOW (fd, 84); + server[account.account_id].is_new = RFIFOW (fd, 84); server_fd[account.account_id] = fd; if (anti_freeze_enable) server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed @@ -3982,8 +3965,8 @@ void parse_login (int fd) else { login_log - ("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)" - RETCODE, server_name, account.userid, + ("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)\n", + server_name, account.userid, account.passwd, ip); WFIFOW (fd, 0) = 0x2711; WFIFOB (fd, 2) = 3; @@ -3994,7 +3977,7 @@ void parse_login (int fd) return; case 0x7530: // Request of the server version - login_log ("Sending of the server version (ip: %s)" RETCODE, + login_log ("Sending of the server version (ip: %s)\n", ip); WFIFOW (fd, 0) = 0x7531; WFIFOB (fd, 2) = -1; @@ -4007,7 +3990,7 @@ void parse_login (int fd) break; case 0x7532: // Request to end connection - login_log ("End of connection (ip: %s)" RETCODE, ip); + login_log ("End of connection (ip: %s)\n", ip); session[fd]->eof = 1; return; @@ -4021,12 +4004,12 @@ void parse_login (int fd) (session[fd]->client_addr.sin_addr.s_addr)) { login_log - ("'ladmin'-login: Connection in administration mode refused: IP isn't authorised (ladmin_allow, ip: %s)." - RETCODE, ip); + ("'ladmin'-login: Connection in administration mode refused: IP isn't authorised (ladmin_allow, ip: %s).\n", + ip); } else { - struct login_session_data *ld = session[fd]->session_data; + struct login_session_data *ld = (struct login_session_data *)session[fd]->session_data; if (RFIFOW (fd, 2) == 0) { // non encrypted password unsigned char *password; @@ -4038,8 +4021,8 @@ void parse_login (int fd) && (strcmp (password, admin_pass) == 0)) { login_log - ("'ladmin'-login: Connection in administration mode accepted (non encrypted password: %s, ip: %s)" - RETCODE, password, ip); + ("'ladmin'-login: Connection in administration mode accepted (non encrypted password: %s, ip: %s)\n", + password, ip); printf ("Connection of a remote administration accepted (non encrypted password).\n"); WFIFOB (fd, 2) = 0; @@ -4047,12 +4030,12 @@ void parse_login (int fd) } else if (admin_state != 1) login_log - ("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (non encrypted password: %s, ip: %s)" - RETCODE, password, ip); + ("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (non encrypted password: %s, ip: %s)\n", + password, ip); else login_log - ("'ladmin'-login: Connection in administration mode REFUSED - invalid password (non encrypted password: %s, ip: %s)" - RETCODE, password, ip); + ("'ladmin'-login: Connection in administration mode REFUSED - invalid password (non encrypted password: %s, ip: %s)\n", + password, ip); } else { // encrypted password @@ -4078,8 +4061,8 @@ void parse_login (int fd) && (memcmp (md5bin, RFIFOP (fd, 4), 16) == 0)) { login_log - ("'ladmin'-login: Connection in administration mode accepted (encrypted password, ip: %s)" - RETCODE, ip); + ("'ladmin'-login: Connection in administration mode accepted (encrypted password, ip: %s)\n", + ip); printf ("Connection of a remote administration accepted (encrypted password).\n"); WFIFOB (fd, 2) = 0; @@ -4087,12 +4070,12 @@ void parse_login (int fd) } else if (admin_state != 1) login_log - ("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (encrypted password, ip: %s)" - RETCODE, ip); + ("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (encrypted password, ip: %s)\n", + ip); else login_log - ("'ladmin'-login: Connection in administration mode REFUSED - invalid password (encrypted password, ip: %s)" - RETCODE, ip); + ("'ladmin'-login: Connection in administration mode REFUSED - invalid password (encrypted password, ip: %s)\n", + ip); } } } @@ -4113,16 +4096,15 @@ void parse_login (int fd) strftime (tmpstr, 23, date_format, gmtime (&(tv.tv_sec))); fprintf (logfp, - "%s.%03d: receiving of an unknown packet -> disconnection" - RETCODE, tmpstr, (int) tv.tv_usec / 1000); + "%s.%03d: receiving of an unknown packet -> disconnection\n", + tmpstr, (int) tv.tv_usec / 1000); fprintf (logfp, - "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." - RETCODE, fd, ip, RFIFOW (fd, 0), + "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + fd, ip, RFIFOW (fd, 0), RFIFOREST (fd)); - fprintf (logfp, "Detail (in hex):" RETCODE); + fprintf (logfp, "Detail (in hex):\n"); fprintf (logfp, - "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F" - RETCODE); + "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"); memset (tmpstr, '\0', sizeof (tmpstr)); for (i = 0; i < RFIFOREST (fd); i++) { @@ -4137,7 +4119,7 @@ void parse_login (int fd) fprintf (logfp, " "); else if ((i + 1) % 16 == 0) { - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); memset (tmpstr, '\0', sizeof (tmpstr)); } } @@ -4149,14 +4131,13 @@ void parse_login (int fd) if ((j - 7) % 16 == 0) // -8 + 1 fprintf (logfp, " "); } - fprintf (logfp, " %s" RETCODE, tmpstr); + fprintf (logfp, " %s\n", tmpstr); } - fprintf (logfp, RETCODE); + fprintf (logfp, "\n"); fclose_ (logfp); } } - login_log ("End of connection, unknown packet (ip: %s)" - RETCODE, ip); + login_log ("End of connection, unknown packet (ip: %s)\n", ip); session[fd]->eof = 1; return; } @@ -4282,11 +4263,11 @@ int login_lan_config_read (const char *lancfgName) fclose_ (fp); // log the LAN configuration - login_log ("The LAN configuration of the server is set:" RETCODE); - login_log ("- with LAN IP of char-server: %s." RETCODE, lan_char_ip); + login_log ("The LAN configuration of the server is set:\n"); + login_log ("- with LAN IP of char-server: %s.\n", lan_char_ip); login_log - ("- with the sub-network of the char-server: %d.%d.%d.%d/%d.%d.%d.%d." - RETCODE, subneti[0], subneti[1], subneti[2], subneti[3], + ("- with the sub-network of the char-server: %d.%d.%d.%d/%d.%d.%d.%d.\n", + subneti[0], subneti[1], subneti[2], subneti[3], subnetmaski[0], subnetmaski[1], subnetmaski[2], subnetmaski[3]); // sub-network check of the char-server @@ -4304,8 +4285,7 @@ int login_lan_config_read (const char *lancfgName) printf ("\033[1;31m***ERROR: LAN IP of the char-server doesn't belong to the specified Sub-network\033[0m\n"); login_log - ("***ERROR: LAN IP of the char-server doesn't belong to the specified Sub-network." - RETCODE); + ("***ERROR: LAN IP of the char-server doesn't belong to the specified Sub-network.\n"); } } @@ -4798,156 +4778,136 @@ void save_config_in_log (void) // a newline in the log... login_log (""); - login_log ("The login-server starting..." RETCODE); + login_log ("The login-server starting...\n"); // save configuration in log file - login_log ("The configuration of the server is set:" RETCODE); + login_log ("The configuration of the server is set:\n"); if (admin_state != 1) - login_log ("- with no remote administration." RETCODE); + login_log ("- with no remote administration.\n"); else if (admin_pass[0] == '\0') - login_log ("- with a remote administration with a VOID password." - RETCODE); + login_log ("- with a remote administration with a VOID password.\n"); else if (strcmp (admin_pass, "admin") == 0) - login_log ("- with a remote administration with the DEFAULT password." - RETCODE); + login_log ("- with a remote administration with the DEFAULT password.\n"); else login_log - ("- with a remote administration with the password of %d character(s)." - RETCODE, strlen (admin_pass)); + ("- with a remote administration with the password of %d character(s).\n", + strlen (admin_pass)); if (access_ladmin_allownum == 0 || (access_ladmin_allownum == 1 && access_ladmin_allow[0] == '\0')) { - login_log ("- to accept any IP for remote administration" RETCODE); + login_log ("- to accept any IP for remote administration\n"); } else { - login_log ("- to accept following IP for remote administration:" - RETCODE); + login_log ("- to accept following IP for remote administration:\n"); for (i = 0; i < access_ladmin_allownum; i++) - login_log (" %s" RETCODE, + login_log (" %s\n", (char *) (access_ladmin_allow + i * ACO_STRSIZE)); } if (gm_pass[0] == '\0') - login_log ("- with a VOID 'To GM become' password (gm_pass)." - RETCODE); + login_log ("- with a VOID 'To GM become' password (gm_pass).\n"); else if (strcmp (gm_pass, "gm") == 0) - login_log ("- with the DEFAULT 'To GM become' password (gm_pass)." - RETCODE); + login_log ("- with the DEFAULT 'To GM become' password (gm_pass).\n"); else login_log - ("- with a 'To GM become' password (gm_pass) of %d character(s)." - RETCODE, strlen (gm_pass)); + ("- with a 'To GM become' password (gm_pass) of %d character(s).\n", + strlen (gm_pass)); if (level_new_gm == 0) - login_log ("- to refuse any creation of GM with @gm." RETCODE); + login_log ("- to refuse any creation of GM with @gm.\n"); else - login_log ("- to create GM with level '%d' when @gm is used." RETCODE, + login_log ("- to create GM with level '%d' when @gm is used.\n", level_new_gm); if (new_account_flag == 1) - login_log ("- to ALLOW new users (with _F/_M)." RETCODE); + login_log ("- to ALLOW new users (with _F/_M).\n"); else - login_log ("- to NOT ALLOW new users (with _F/_M)." RETCODE); - login_log ("- with port: %d." RETCODE, login_port); - login_log ("- with the accounts file name: '%s'." RETCODE, + login_log ("- to NOT ALLOW new users (with _F/_M).\n"); + login_log ("- with port: %d.\n", login_port); + login_log ("- with the accounts file name: '%s'.\n", account_filename); - login_log ("- with the GM accounts file name: '%s'." RETCODE, + login_log ("- with the GM accounts file name: '%s'.\n", GM_account_filename); if (gm_account_filename_check_timer == 0) - login_log ("- to NOT check GM accounts file modifications." RETCODE); + login_log ("- to NOT check GM accounts file modifications.\n"); else login_log - ("- to check GM accounts file modifications every %d seconds." - RETCODE, gm_account_filename_check_timer); + ("- to check GM accounts file modifications every %d seconds.\n", + gm_account_filename_check_timer); // not necessary to log the 'login_log_filename', we are inside :) - login_log ("- with the unknown packets file name: '%s'." RETCODE, + login_log ("- with the unknown packets file name: '%s'.\n", login_log_unknown_packets_filename); if (save_unknown_packets) - login_log ("- to SAVE all unkown packets." RETCODE); + login_log ("- to SAVE all unkown packets.\n"); else login_log - ("- to SAVE only unkown packets sending by a char-server or a remote administration." - RETCODE); + ("- to SAVE only unkown packets sending by a char-server or a remote administration.\n"); if (display_parse_login) - login_log ("- to display normal parse packets on console." RETCODE); + login_log ("- to display normal parse packets on console.\n"); else - login_log ("- to NOT display normal parse packets on console." - RETCODE); + login_log ("- to NOT display normal parse packets on console.\n"); if (display_parse_admin) - login_log ("- to display administration parse packets on console." - RETCODE); + login_log ("- to display administration parse packets on console.\n"); else - login_log ("- to NOT display administration parse packets on console." - RETCODE); + login_log ("- to NOT display administration parse packets on console.\n"); if (display_parse_fromchar) - login_log ("- to display char-server parse packets on console." - RETCODE); + login_log ("- to display char-server parse packets on console.\n"); else - login_log ("- to NOT display char-server parse packets on console." - RETCODE); + login_log ("- to NOT display char-server parse packets on console.\n"); if (min_level_to_connect == 0) // 0: all players, 1-99 at least gm level x - login_log ("- with no minimum level for connection." RETCODE); + login_log ("- with no minimum level for connection.\n"); else if (min_level_to_connect == 99) - login_log ("- to accept only GM with level 99." RETCODE); + login_log ("- to accept only GM with level 99.\n"); else - login_log ("- to accept only GM with level %d or more." RETCODE, + login_log ("- to accept only GM with level %d or more.\n", min_level_to_connect); if (add_to_unlimited_account) login_log - ("- to authorize adjustment (with timeadd ladmin) on an unlimited account." - RETCODE); + ("- to authorize adjustment (with timeadd ladmin) on an unlimited account.\n"); else login_log - ("- to refuse adjustment (with timeadd ladmin) on an unlimited account. You must use timeset (ladmin command) before." - RETCODE); + ("- to refuse adjustment (with timeadd ladmin) on an unlimited account. You must use timeset (ladmin command) before.\n"); if (start_limited_time < 0) - login_log ("- to create new accounts with an unlimited time." - RETCODE); + login_log ("- to create new accounts with an unlimited time.\n"); else if (start_limited_time == 0) login_log - ("- to create new accounts with a limited time: time of creation." - RETCODE); + ("- to create new accounts with a limited time: time of creation.\n"); else login_log - ("- to create new accounts with a limited time: time of creation + %d second(s)." - RETCODE, start_limited_time); + ("- to create new accounts with a limited time: time of creation + %d second(s).\n", + start_limited_time); if (check_ip_flag) login_log - ("- with control of players IP between login-server and char-server." - RETCODE); + ("- with control of players IP between login-server and char-server.\n"); else login_log - ("- to not check players IP between login-server and char-server." - RETCODE); + ("- to not check players IP between login-server and char-server.\n"); if (access_order == ACO_DENY_ALLOW) { if (access_denynum == 0) { login_log - ("- with the IP security order: 'deny,allow' (allow if not deny). You refuse no IP." - RETCODE); + ("- with the IP security order: 'deny,allow' (allow if not deny). You refuse no IP.\n"); } else if (access_denynum == 1 && access_deny[0] == '\0') { login_log - ("- with the IP security order: 'deny,allow' (allow if not deny). You refuse ALL IP." - RETCODE); + ("- with the IP security order: 'deny,allow' (allow if not deny). You refuse ALL IP.\n"); } else { login_log - ("- with the IP security order: 'deny,allow' (allow if not deny). Refused IP are:" - RETCODE); + ("- with the IP security order: 'deny,allow' (allow if not deny). Refused IP are:\n"); for (i = 0; i < access_denynum; i++) - login_log (" %s" RETCODE, + login_log (" %s\n", (char *) (access_deny + i * ACO_STRSIZE)); } } @@ -4956,54 +4916,50 @@ void save_config_in_log (void) if (access_allownum == 0) { login_log - ("- with the IP security order: 'allow,deny' (deny if not allow). But, NO IP IS AUTHORISED!" - RETCODE); + ("- with the IP security order: 'allow,deny' (deny if not allow). But, NO IP IS AUTHORISED!\n"); } else if (access_allownum == 1 && access_allow[0] == '\0') { login_log - ("- with the IP security order: 'allow,deny' (deny if not allow). You authorise ALL IP." - RETCODE); + ("- with the IP security order: 'allow,deny' (deny if not allow). You authorise ALL IP.\n"); } else { login_log - ("- with the IP security order: 'allow,deny' (deny if not allow). Authorised IP are:" - RETCODE); + ("- with the IP security order: 'allow,deny' (deny if not allow). Authorised IP are:\n"); for (i = 0; i < access_allownum; i++) - login_log (" %s" RETCODE, + login_log (" %s\n", (char *) (access_allow + i * ACO_STRSIZE)); } } else { // ACO_MUTUAL_FAILTURE login_log - ("- with the IP security order: 'mutual-failture' (allow if in the allow list and not in the deny list)." - RETCODE); + ("- with the IP security order: 'mutual-failture' (allow if in the allow list and not in the deny list).\n"); if (access_allownum == 0) { - login_log (" But, NO IP IS AUTHORISED!" RETCODE); + login_log (" But, NO IP IS AUTHORISED!\n"); } else if (access_denynum == 1 && access_deny[0] == '\0') { - login_log (" But, you refuse ALL IP!" RETCODE); + login_log (" But, you refuse ALL IP!\n"); } else { if (access_allownum == 1 && access_allow[0] == '\0') { - login_log (" You authorise ALL IP." RETCODE); + login_log (" You authorise ALL IP.\n"); } else { - login_log (" Authorised IP are:" RETCODE); + login_log (" Authorised IP are:\n"); for (i = 0; i < access_allownum; i++) - login_log (" %s" RETCODE, + login_log (" %s\n", (char *) (access_allow + i * ACO_STRSIZE)); } - login_log (" Refused IP are:" RETCODE); + login_log (" Refused IP are:\n"); for (i = 0; i < access_denynum; i++) - login_log (" %s" RETCODE, + login_log (" %s\n", (char *) (access_deny + i * ACO_STRSIZE)); } } @@ -5028,8 +4984,7 @@ void do_final (void) delete_session (login_fd); login_log - ("----End of login-server (normal end with closing of all files)." - RETCODE); + ("----End of login-server (normal end with closing of all files).\n"); } //------------------------------ @@ -5078,8 +5033,8 @@ int do_init (int argc, char **argv) i = add_timer_interval (gettick () + j * 1000, check_GM_file, 0, 0, j * 1000); // every x sec we check if gm file has been changed login_log - ("The login-server is ready (Server is listening on the port %d)." - RETCODE, login_port); + ("The login-server is ready (Server is listening on the port %d).\n", + login_port); printf ("The login-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", diff --git a/src/login/login.h b/src/login/login.h index 98025f8..a1f8fef 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -35,7 +35,7 @@ struct mmo_char_server short port; int users; int maintenance; - int new; + int is_new; }; #endif diff --git a/src/map/GNUmakefile b/src/map/GNUmakefile new file mode 100644 index 0000000..a02deda --- /dev/null +++ b/src/map/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. map-server +clean: + rm -r ../../obj/map/ +%:: + make -C ../.. obj/map/$@ diff --git a/src/map/Makefile b/src/map/Makefile deleted file mode 100644 index d340015..0000000 --- a/src/map/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -include ../../make.defs - -all: map - -obj: - mkdir obj - -COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/mt_rand.o ../common/md5calc.o -LDLIBS = -lm - -map: obj/tmw.o obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o obj/storage.o obj/skill.o obj/skill-pools.o obj/atcommand.o obj/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) - ${LINK.c} $^ ${LDLIBS} -o $@ -obj/%.o: %.c | obj - ${COMPILE.c} $< -o $@ - -magic-interpreter-lexer.c: magic-interpreter-lexer.l -magic-interpreter-parser.c magic-interpreter-parser.h: magic-interpreter-parser.y -#The builtin yacc rule is insufficient, (but yacc can be used in place of bison) - ${YACC} $^ -d -o magic-interpreter-parser.c - -obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h -obj/clif.o: magic.h clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h tmw.h -obj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h trade.h storage.h chat.h ../common/timer.h ../common/mmo.h ../common/db.h -obj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h -obj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h -obj/path.o: path.c map.h battle.h ../common/mmo.h -obj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h -obj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.h -obj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h battle.h ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h -obj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h -obj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h -obj/skill-pools.o: skill-pools.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h -obj/atcommand.o: atcommand.c atcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h ../common/socket.h ../common/timer.h ../common/mmo.h -obj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h guild.h ../common/timer.h ../common/mmo.h -obj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h ../common/socket.h ../common/mmo.h -obj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h -obj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -obj/tmw.o: tmw.c tmw.h map.h clif.h -obj/guild.o: guild.c guild.h storage.h ../common/mmo.h ../common/utils.h \ - ../common/mt_rand.h ../common/timer.h ../common/socket.h \ - ../common/nullpo.h battle.h npc.h pc.h map.h mob.h intif.h clif.h tmw.h - -clean: - rm -rf *.o map obj magic-interpreter-parser.c magic-interpreter-parser.h magic-interpreter-lexer.c diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6a09970..3c54d5e 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -418,9 +418,9 @@ static AtCommandInfo atcommand_info[] = { * This function return the name of the job (by [Yor]) *---------------------------------------------------- */ -char *job_name (int class) +const char *job_name (int pc_class) { - switch (class) + switch (pc_class) { case 0: return "Novice"; @@ -681,7 +681,7 @@ void gm_log (const char *fmt, ...) if (logfile_nr != last_logfile_nr) { - char *fullname = malloc (strlen (gm_logfile_name) + 10); + char *fullname = (char *)malloc (strlen (gm_logfile_name) + 10); sprintf (fullname, "%s.%04d-%02d", gm_logfile_name, year, month); if (gm_logfile) @@ -1301,7 +1301,7 @@ int atcommand_who (const int fd, struct map_session_data *sd, GM_level = pc_isGM (sd); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_GM_level = pc_isGM (pl_sd); @@ -1377,7 +1377,7 @@ int atcommand_whogroup (const int fd, struct map_session_data *sd, GM_level = pc_isGM (sd); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_GM_level = pc_isGM (pl_sd); @@ -1462,7 +1462,7 @@ int atcommand_whomap (const int fd, struct map_session_data *sd, GM_level = pc_isGM (sd); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_GM_level = pc_isGM (pl_sd); @@ -1540,7 +1540,7 @@ int atcommand_whomapgroup (const int fd, struct map_session_data *sd, GM_level = pc_isGM (sd); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_GM_level = pc_isGM (pl_sd); @@ -1623,7 +1623,7 @@ int atcommand_whogm (const int fd, struct map_session_data *sd, GM_level = pc_isGM (sd); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_GM_level = pc_isGM (pl_sd); @@ -1647,7 +1647,7 @@ int atcommand_whogm (const int fd, struct map_session_data *sd, sprintf (output, " BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.base_level, - job_name (pl_sd->status.class), + job_name (pl_sd->status.pc_class), pl_sd->status.job_level); clif_displaymessage (fd, output); g = guild_search (pl_sd->status.guild_id); @@ -1865,19 +1865,19 @@ int atcommand_option (const int fd, struct map_session_data *sd, } sd->status.option = param3; // fix pecopeco display - if (sd->status.class == 13 || sd->status.class == 21 - || sd->status.class == 4014 || sd->status.class == 4022) + if (sd->status.pc_class == 13 || sd->status.pc_class == 21 + || sd->status.pc_class == 4014 || sd->status.pc_class == 4022) { if (!pc_isriding (sd)) { // sd have the new value... - if (sd->status.class == 13) - sd->status.class = sd->view_class = 7; - else if (sd->status.class == 21) - sd->status.class = sd->view_class = 14; - else if (sd->status.class == 4014) - sd->status.class = sd->view_class = 4008; - else if (sd->status.class == 4022) - sd->status.class = sd->view_class = 4015; + if (sd->status.pc_class == 13) + sd->status.pc_class = sd->view_class = 7; + else if (sd->status.pc_class == 21) + sd->status.pc_class = sd->view_class = 14; + else if (sd->status.pc_class == 4014) + sd->status.pc_class = sd->view_class = 4008; + else if (sd->status.pc_class == 4022) + sd->status.pc_class = sd->view_class = 4015; } } else @@ -1890,14 +1890,14 @@ int atcommand_option (const int fd, struct map_session_data *sd, } else { - if (sd->status.class == 7) - sd->status.class = sd->view_class = 13; - else if (sd->status.class == 14) - sd->status.class = sd->view_class = 21; - else if (sd->status.class == 4008) - sd->status.class = sd->view_class = 4014; - else if (sd->status.class == 4015) - sd->status.class = sd->view_class = 4022; + if (sd->status.pc_class == 7) + sd->status.pc_class = sd->view_class = 13; + else if (sd->status.pc_class == 14) + sd->status.pc_class = sd->view_class = 21; + else if (sd->status.pc_class == 4008) + sd->status.pc_class = sd->view_class = 4014; + else if (sd->status.pc_class == 4015) + sd->status.pc_class = sd->view_class = 4022; else sd->status.option &= ~0x0020; } @@ -2255,10 +2255,10 @@ int atcommand_joblevelup (const int fd, struct map_session_data *sd, return -1; } - if (sd->status.class == 0 || sd->status.class == 4001) + if (sd->status.pc_class == 0 || sd->status.pc_class == 4001) up_level -= 40; - else if ((sd->status.class > 4007 && sd->status.class < 4024) - || sd->status.class == 23) + else if ((sd->status.pc_class > 4007 && sd->status.pc_class < 4024) + || sd->status.pc_class == 23) up_level += 20; if (level > 0) @@ -2402,7 +2402,7 @@ int atcommand_pvpoff (const int fd, struct map_session_data *sd, clif_send0199 (sd->bl.m, 0); for (i = 0; i < fd_max; i++) { //人数分ループ - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (sd->bl.m == pl_sd->bl.m) @@ -2450,7 +2450,7 @@ int atcommand_pvpon (const int fd, struct map_session_data *sd, clif_send0199 (sd->bl.m, 1); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (sd->bl.m == pl_sd->bl.m && pl_sd->pvp_timer == -1) @@ -2549,7 +2549,7 @@ int atcommand_model (const int fd, struct map_session_data *sd, { //服の色変更 if (cloth_color != 0 && sd->status.sex == 1 - && (sd->status.class == 12 || sd->status.class == 17)) + && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) { //服の色未実装職の判定 clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class. @@ -2596,7 +2596,7 @@ int atcommand_dye (const int fd, struct map_session_data *sd, if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { if (cloth_color != 0 && sd->status.sex == 1 - && (sd->status.class == 12 || sd->status.class == 17)) + && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) { clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class. return -1; @@ -2651,7 +2651,7 @@ int atcommand_hair_style (const int fd, struct map_session_data *sd, if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) { if (hair_style != 0 && sd->status.sex == 1 - && (sd->status.class == 12 || sd->status.class == 17)) + && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) { clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class. return -1; @@ -2706,7 +2706,7 @@ int atcommand_hair_color (const int fd, struct map_session_data *sd, if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) { if (hair_color != 0 && sd->status.sex == 1 - && (sd->status.class == 12 || sd->status.class == 17)) + && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) { clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class. return -1; @@ -3810,7 +3810,7 @@ int atcommand_character_stats (const int fd, struct map_session_data *sd, { NULL, 0} }; - sprintf (job_jobname, "Job - %s %s", job_name (pl_sd->status.class), + sprintf (job_jobname, "Job - %s %s", job_name (pl_sd->status.pc_class), "(level %d)"); sprintf (output, msg_table[53], pl_sd->status.name); // '%s' stats: clif_displaymessage (fd, output); @@ -3848,7 +3848,7 @@ int atcommand_character_stats_all (const int fd, struct map_session_data *sd, count = 0; for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { @@ -3860,7 +3860,7 @@ int atcommand_character_stats_all (const int fd, struct map_session_data *sd, sprintf (output, "Name: %s | BLvl: %d | Job: %s (Lvl: %d) | HP: %d/%d | SP: %d/%d", pl_sd->status.name, pl_sd->status.base_level, - job_name (pl_sd->status.class), pl_sd->status.job_level, + job_name (pl_sd->status.pc_class), pl_sd->status.job_level, pl_sd->status.hp, pl_sd->status.max_hp, pl_sd->status.sp, pl_sd->status.max_sp); clif_displaymessage (fd, output); @@ -3918,19 +3918,19 @@ int atcommand_character_option (const int fd, struct map_session_data *sd, pl_sd->opt2 = opt2; pl_sd->status.option = opt3; // fix pecopeco display - if (pl_sd->status.class == 13 || pl_sd->status.class == 21 - || pl_sd->status.class == 4014 || pl_sd->status.class == 4022) + if (pl_sd->status.pc_class == 13 || pl_sd->status.pc_class == 21 + || pl_sd->status.pc_class == 4014 || pl_sd->status.pc_class == 4022) { if (!pc_isriding (pl_sd)) { // pl_sd have the new value... - if (pl_sd->status.class == 13) - pl_sd->status.class = pl_sd->view_class = 7; - else if (pl_sd->status.class == 21) - pl_sd->status.class = pl_sd->view_class = 14; - else if (pl_sd->status.class == 4014) - pl_sd->status.class = pl_sd->view_class = 4008; - else if (pl_sd->status.class == 4022) - pl_sd->status.class = pl_sd->view_class = 4015; + if (pl_sd->status.pc_class == 13) + pl_sd->status.pc_class = pl_sd->view_class = 7; + else if (pl_sd->status.pc_class == 21) + pl_sd->status.pc_class = pl_sd->view_class = 14; + else if (pl_sd->status.pc_class == 4014) + pl_sd->status.pc_class = pl_sd->view_class = 4008; + else if (pl_sd->status.pc_class == 4022) + pl_sd->status.pc_class = pl_sd->view_class = 4015; } } else @@ -3943,14 +3943,14 @@ int atcommand_character_option (const int fd, struct map_session_data *sd, } else { - if (pl_sd->status.class == 7) - pl_sd->status.class = pl_sd->view_class = 13; - else if (pl_sd->status.class == 14) - pl_sd->status.class = pl_sd->view_class = 21; - else if (pl_sd->status.class == 4008) - pl_sd->status.class = pl_sd->view_class = 4014; - else if (pl_sd->status.class == 4015) - pl_sd->status.class = pl_sd->view_class = 4022; + if (pl_sd->status.pc_class == 7) + pl_sd->status.pc_class = pl_sd->view_class = 13; + else if (pl_sd->status.pc_class == 14) + pl_sd->status.pc_class = pl_sd->view_class = 21; + else if (pl_sd->status.pc_class == 4008) + pl_sd->status.pc_class = pl_sd->view_class = 4014; + else if (pl_sd->status.pc_class == 4015) + pl_sd->status.pc_class = pl_sd->view_class = 4022; else pl_sd->status.option &= ~0x0020; } @@ -4324,7 +4324,7 @@ int atcommand_night (const int fd, struct map_session_data *sd, night_flag = 1; // 0=day, 1=night [Yor] for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_sd->opt2 |= STATE_BLIND; @@ -4357,7 +4357,7 @@ int atcommand_day (const int fd, struct map_session_data *sd, night_flag = 0; // 0=day, 1=night [Yor] for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_sd->opt2 &= ~STATE_BLIND; @@ -4387,7 +4387,7 @@ int atcommand_doom (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && i != fd && pc_isGM (sd) >= pc_isGM (pl_sd)) { // you can doom only lower or same gm level @@ -4412,7 +4412,7 @@ int atcommand_doommap (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && i != fd && sd->bl.m == pl_sd->bl.m && pc_isGM (sd) >= pc_isGM (pl_sd)) { // you can doom only lower or same gm level @@ -4455,7 +4455,7 @@ int atcommand_raise (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { if (session[i]) - atcommand_raise_sub (session[i]->session_data); + atcommand_raise_sub ((struct map_session_data *)session[i]->session_data); } clif_displaymessage (fd, msg_table[64]); // Mercy has been granted. @@ -4474,7 +4474,7 @@ int atcommand_raisemap (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && sd->bl.m == pl_sd->bl.m) atcommand_raise_sub (pl_sd); } @@ -4603,7 +4603,7 @@ int atcommand_character_joblevel (const int fd, struct map_session_data *sd, if ((pl_sd = map_nick2sd (character)) != NULL) { - pl_s_class = pc_calc_base_job (pl_sd->status.class); + pl_s_class = pc_calc_base_job (pl_sd->status.pc_class); if (pc_isGM (sd) >= pc_isGM (pl_sd)) { // you can change job level only lower or same gm level if (pl_s_class.job == 0) @@ -4717,7 +4717,7 @@ int atcommand_kickall (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && pc_isGM (sd) >= pc_isGM (pl_sd)) { // you can kick only lower or same gm level if (sd->status.account_id != pl_sd->status.account_id) @@ -5063,7 +5063,7 @@ int atcommand_mapexit (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (sd->status.account_id != pl_sd->status.account_id) @@ -5380,7 +5380,7 @@ int atcommand_charmodel (const int fd, struct map_session_data *sd, if (cloth_color != 0 && pl_sd->status.sex == 1 && - (pl_sd->status.class == 12 || pl_sd->status.class == 17)) + (pl_sd->status.pc_class == 12 || pl_sd->status.pc_class == 17)) { clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class. return -1; @@ -5593,7 +5593,7 @@ int atcommand_recallall (const int fd, struct map_session_data *sd, count = 0; for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && sd->status.account_id != pl_sd->status.account_id && pc_isGM (sd) >= pc_isGM (pl_sd)) @@ -5656,7 +5656,7 @@ int atcommand_guildrecall (const int fd, struct map_session_data *sd, count = 0; for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && sd->status.account_id != pl_sd->status.account_id && pl_sd->status.guild_id == g->guild_id) @@ -5725,7 +5725,7 @@ int atcommand_partyrecall (const int fd, struct map_session_data *sd, count = 0; for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party_id) @@ -5880,7 +5880,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd, chat_num = 0; for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && (cd = (struct chat_data *) map_id2bl (pl_sd->chatID))) { @@ -5933,7 +5933,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd, clif_displaymessage (fd, "----- Players in Map -----"); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && strcmp (pl_sd->mapname, map_name) == 0) { @@ -5984,7 +5984,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd, } sprintf (output, "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d", - ++i, nd->name, direction, nd->class, nd->bl.x, + ++i, nd->name, direction, nd->npc_class, nd->bl.x, nd->bl.y); clif_displaymessage (fd, output); } @@ -5993,7 +5993,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd, clif_displaymessage (fd, "----- Chats in Map -----"); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth && (cd = (struct chat_data *) map_id2bl (pl_sd->chatID)) && strcmp (pl_sd->mapname, map_name) == 0 @@ -6037,17 +6037,17 @@ int atcommand_mount_peco (const int fd, struct map_session_data *sd, if (!pc_isriding (sd)) { // if actually no peco - if (sd->status.class == 7 || sd->status.class == 14 - || sd->status.class == 4008 || sd->status.class == 4015) - { - if (sd->status.class == 7) - sd->status.class = sd->view_class = 13; - else if (sd->status.class == 14) - sd->status.class = sd->view_class = 21; - else if (sd->status.class == 4008) - sd->status.class = sd->view_class = 4014; - else if (sd->status.class == 4015) - sd->status.class = sd->view_class = 4022; + if (sd->status.pc_class == 7 || sd->status.pc_class == 14 + || sd->status.pc_class == 4008 || sd->status.pc_class == 4015) + { + if (sd->status.pc_class == 7) + sd->status.pc_class = sd->view_class = 13; + else if (sd->status.pc_class == 14) + sd->status.pc_class = sd->view_class = 21; + else if (sd->status.pc_class == 4008) + sd->status.pc_class = sd->view_class = 4014; + else if (sd->status.pc_class == 4015) + sd->status.pc_class = sd->view_class = 4022; pc_setoption (sd, sd->status.option | 0x0020); clif_displaymessage (fd, msg_table[102]); // Mounted Peco. } @@ -6059,14 +6059,14 @@ int atcommand_mount_peco (const int fd, struct map_session_data *sd, } else { - if (sd->status.class == 13) - sd->status.class = sd->view_class = 7; - else if (sd->status.class == 21) - sd->status.class = sd->view_class = 14; - else if (sd->status.class == 4014) - sd->status.class = sd->view_class = 4008; - else if (sd->status.class == 4022) - sd->status.class = sd->view_class = 4015; + if (sd->status.pc_class == 13) + sd->status.pc_class = sd->view_class = 7; + else if (sd->status.pc_class == 21) + sd->status.pc_class = sd->view_class = 14; + else if (sd->status.pc_class == 4014) + sd->status.pc_class = sd->view_class = 4008; + else if (sd->status.pc_class == 4022) + sd->status.pc_class = sd->view_class = 4015; pc_setoption (sd, sd->status.option & ~0x0020); clif_displaymessage (fd, msg_table[214]); // Unmounted Peco. } @@ -6103,17 +6103,17 @@ int atcommand_char_mount_peco (const int fd, struct map_session_data *sd, if (!pc_isriding (pl_sd)) { // if actually no peco - if (pl_sd->status.class == 7 || pl_sd->status.class == 14 - || pl_sd->status.class == 4008 || pl_sd->status.class == 4015) + if (pl_sd->status.pc_class == 7 || pl_sd->status.pc_class == 14 + || pl_sd->status.pc_class == 4008 || pl_sd->status.pc_class == 4015) { - if (pl_sd->status.class == 7) - pl_sd->status.class = pl_sd->view_class = 13; - else if (pl_sd->status.class == 14) - pl_sd->status.class = pl_sd->view_class = 21; - else if (pl_sd->status.class == 4008) - pl_sd->status.class = pl_sd->view_class = 4014; - else if (pl_sd->status.class == 4015) - pl_sd->status.class = pl_sd->view_class = 4022; + if (pl_sd->status.pc_class == 7) + pl_sd->status.pc_class = pl_sd->view_class = 13; + else if (pl_sd->status.pc_class == 14) + pl_sd->status.pc_class = pl_sd->view_class = 21; + else if (pl_sd->status.pc_class == 4008) + pl_sd->status.pc_class = pl_sd->view_class = 4014; + else if (pl_sd->status.pc_class == 4015) + pl_sd->status.pc_class = pl_sd->view_class = 4022; pc_setoption (pl_sd, pl_sd->status.option | 0x0020); clif_displaymessage (fd, msg_table[216]); // Now, this player mounts a peco. } @@ -6125,14 +6125,14 @@ int atcommand_char_mount_peco (const int fd, struct map_session_data *sd, } else { - if (pl_sd->status.class == 13) - pl_sd->status.class = pl_sd->view_class = 7; - else if (pl_sd->status.class == 21) - pl_sd->status.class = pl_sd->view_class = 14; - else if (pl_sd->status.class == 4014) - pl_sd->status.class = pl_sd->view_class = 4008; - else if (pl_sd->status.class == 4022) - pl_sd->status.class = pl_sd->view_class = 4015; + if (pl_sd->status.pc_class == 13) + pl_sd->status.pc_class = pl_sd->view_class = 7; + else if (pl_sd->status.pc_class == 21) + pl_sd->status.pc_class = pl_sd->view_class = 14; + else if (pl_sd->status.pc_class == 4014) + pl_sd->status.pc_class = pl_sd->view_class = 4008; + else if (pl_sd->status.pc_class == 4022) + pl_sd->status.pc_class = pl_sd->view_class = 4015; pc_setoption (pl_sd, pl_sd->status.option & ~0x0020); clif_displaymessage (fd, msg_table[218]); // Now, this player has not more peco. } @@ -7176,7 +7176,7 @@ int atcommand_effect (const int fd, struct map_session_data *sd, { for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { clif_specialeffect (&pl_sd->bl, type, flag); @@ -8151,7 +8151,7 @@ int atcommand_summon (const int fd, struct map_session_data *sd, { md->master_id = sd->bl.id; md->state.special_mob_ai = 1; - md->mode = mob_db[md->class].mode | 0x04; + md->mode = mob_db[md->mob_class].mode | 0x04; md->deletetimer = add_timer (tick + 60000, mob_timer_delete, id, 0); clif_misceffect (&md->bl, 344); } @@ -8400,7 +8400,7 @@ int atcommand_tee (const int fd, struct map_session_data *sd, const char *command, const char *message) { - char *data = malloc (strlen (message) + 28); + char *data = (char *)malloc (strlen (message) + 28); strcpy (data, sd->status.name); strcat (data, " : "); strcat (data, message); @@ -8426,7 +8426,7 @@ atcommand_visible (const int fd, struct map_session_data *sd, int atcommand_jump_iterate (const int fd, struct map_session_data *sd, const char *command, const char *message, - struct map_session_data *(*get_start) (), + struct map_session_data *(*get_start) (void), struct map_session_data *(*get_next) (struct map_session_data * current)) @@ -8679,7 +8679,7 @@ int atcommand_ipcheck (const int fd, struct map_session_data *sd, for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (getpeername (pl_sd->fd, (struct sockaddr *)&sai, &sa_len)) diff --git a/src/map/battle.c b/src/map/battle.c index a6a803a..6edf996 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -67,9 +67,9 @@ int battle_get_class (struct block_list *bl) { nullpo_retr (0, bl); if (bl->type == BL_MOB && (struct mob_data *) bl) - return ((struct mob_data *) bl)->class; + return ((struct mob_data *) bl)->mob_class; else if (bl->type == BL_PC && (struct map_session_data *) bl) - return ((struct map_session_data *) bl)->status.class; + return ((struct map_session_data *) bl)->status.pc_class; else return 0; } @@ -115,7 +115,7 @@ int battle_get_range (struct block_list *bl) { nullpo_retr (0, bl); if (bl->type == BL_MOB && (struct mob_data *) bl) - return mob_db[((struct mob_data *) bl)->class].range; + return mob_db[((struct mob_data *) bl)->mob_class].range; else if (bl->type == BL_PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->attackrange; else @@ -155,7 +155,7 @@ int battle_get_max_hp (struct block_list *bl) if (bl->type == BL_MOB && ((struct mob_data *) bl)) { max_hp = ((struct mob_data *) bl)->stats[MOB_MAX_HP]; - if (mob_db[((struct mob_data *) bl)->class].mexp > 0) + if (mob_db[((struct mob_data *) bl)->mob_class].mexp > 0) { if (battle_config.mvp_hp_rate != 100) max_hp = (max_hp * battle_config.mvp_hp_rate) / 100; @@ -1076,7 +1076,7 @@ int battle_get_amotion (struct block_list *bl) struct status_change *sc_data = battle_get_sc_data (bl); int amotion = 2000, aspd_rate = 100, i; if (bl->type == BL_MOB && (struct mob_data *) bl) - amotion = mob_db[((struct mob_data *) bl)->class].amotion; + amotion = mob_db[((struct mob_data *) bl)->mob_class].amotion; if (sc_data) { @@ -1138,7 +1138,7 @@ int battle_get_dmotion (struct block_list *bl) sc_data = battle_get_sc_data (bl); if (bl->type == BL_MOB && (struct mob_data *) bl) { - ret = mob_db[((struct mob_data *) bl)->class].dmotion; + ret = mob_db[((struct mob_data *) bl)->mob_class].dmotion; if (battle_config.monster_damage_delay_rate != 100) ret = ret * battle_config.monster_damage_delay_rate / 400; } @@ -1267,7 +1267,7 @@ int battle_get_guild_id (struct block_list *bl) if (bl->type == BL_PC && (struct map_session_data *) bl) return ((struct map_session_data *) bl)->status.guild_id; else if (bl->type == BL_MOB && (struct mob_data *) bl) - return ((struct mob_data *) bl)->class; + return ((struct mob_data *) bl)->mob_class; else if (bl->type == BL_SKILL && (struct skill_unit *) bl) return ((struct skill_unit *) bl)->group->guild_id; else @@ -1278,7 +1278,7 @@ int battle_get_race (struct block_list *bl) { nullpo_retr (0, bl); if (bl->type == BL_MOB && (struct mob_data *) bl) - return mob_db[((struct mob_data *) bl)->class].race; + return mob_db[((struct mob_data *) bl)->mob_class].race; else if (bl->type == BL_PC && (struct map_session_data *) bl) return 7; else @@ -1289,7 +1289,7 @@ int battle_get_size (struct block_list *bl) { nullpo_retr (1, bl); if (bl->type == BL_MOB && (struct mob_data *) bl) - return mob_db[((struct mob_data *) bl)->class].size; + return mob_db[((struct mob_data *) bl)->mob_class].size; else if (bl->type == BL_PC && (struct map_session_data *) bl) return 1; else @@ -1300,7 +1300,7 @@ int battle_get_mode (struct block_list *bl) { nullpo_retr (0x01, bl); if (bl->type == BL_MOB && (struct mob_data *) bl) - return mob_db[((struct mob_data *) bl)->class].mode; + return mob_db[((struct mob_data *) bl)->mob_class].mode; else return 0x01; // とりあえず動くということで1 } @@ -1312,7 +1312,7 @@ int battle_get_mexp (struct block_list *bl) { const struct mob_data *mob = (struct mob_data *) bl; const int retval = - (mob_db[mob->class].mexp * + (mob_db[mob->mob_class].mexp * (int) (mob->stats[MOB_XP_BONUS])) >> MOB_XP_BONUS_SHIFT; fprintf (stderr, "Modifier of %x: -> %d\n", mob->stats[MOB_XP_BONUS], retval); @@ -1614,11 +1614,11 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl, struct mob_data *md = NULL; struct status_change *sc_data, *sc; short *sc_count; - int class; + int class_; nullpo_retr (0, bl); - class = battle_get_class (bl); + class_ = battle_get_class (bl); if (bl->type == BL_MOB) md = (struct mob_data *) bl; else @@ -1785,10 +1785,10 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl, } } - if (class == 1288 || class == 1287 || class == 1286 || class == 1285) + if (class_ == 1288 || class_ == 1287 || class_ == 1286 || class_ == 1285) { // if(class == 1288) { - if (class == 1288 && flag & BF_SKILL) + if (class_ == 1288 && flag & BF_SKILL) damage = 0; if (src->type == BL_PC) { @@ -1798,7 +1798,7 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl, struct guild_castle *gc = guild_mapname2gc (map[bl->m].name); if (!((struct map_session_data *) src)->status.guild_id) damage = 0; - if (gc && agit_flag == 0 && class != 1288) // guardians cannot be damaged during non-woe [Valaris] + if (gc && agit_flag == 0 && class_ != 1288) // guardians cannot be damaged during non-woe [Valaris] damage = 0; // end woe check [Valaris] if (g == NULL) damage = 0; //ギルド未加入ならダメージ無し @@ -2136,7 +2136,7 @@ static struct Damage battle_calc_mob_weapon_attack (struct block_list *src, atkmin = battle_get_atk (src); atkmax = battle_get_atk2 (src); } - if (mob_db[md->class].range > 3) + if (mob_db[md->mob_class].range > 3) flag = (flag & ~BF_RANGEMASK) | BF_LONG; if (atkmin > atkmax) @@ -2536,13 +2536,13 @@ static struct Damage battle_calc_mob_weapon_attack (struct block_list *src, int cardfix = 100, i; cardfix = cardfix * (100 - tsd->subele[s_ele]) / 100; // 属 性によるダメージ耐性 cardfix = cardfix * (100 - tsd->subrace[s_race]) / 100; // 種族によるダメージ耐性 - if (mob_db[md->class].mode & 0x20) + if (mob_db[md->mob_class].mode & 0x20) cardfix = cardfix * (100 - tsd->subrace[10]) / 100; else cardfix = cardfix * (100 - tsd->subrace[11]) / 100; for (i = 0; i < tsd->add_def_class_count; i++) { - if (tsd->add_def_classid[i] == md->class) + if (tsd->add_def_classid[i] == md->mob_class) { cardfix = cardfix * (100 - tsd->add_def_classrate[i]) / 100; break; @@ -3868,7 +3868,7 @@ static struct Damage battle_calc_pc_weapon_attack (struct block_list *src, //特定Class用補正処理左手(少女の日記→ボンゴン用?) for (i = 0; i < tsd->add_def_class_count; i++) { - if (tsd->add_def_classid[i] == sd->status.class) + if (tsd->add_def_classid[i] == sd->status.pc_class) { cardfix = cardfix * (100 - tsd->add_def_classrate[i]) / 100; break; @@ -4875,7 +4875,7 @@ int battle_weapon_attack (struct block_list *src, struct block_list *target, BL_PC) ? ((struct map_session_data *) target)-> status.char_id : target->id, (target->type == - BL_PC) ? 0 : ((struct mob_data *) target)->class, + BL_PC) ? 0 : ((struct mob_data *) target)->mob_class, wd.damage + wd.damage2, weapon); } @@ -4889,7 +4889,7 @@ int battle_weapon_attack (struct block_list *src, struct block_list *target, BL_PC) ? ((struct map_session_data *) src)-> status.char_id : src->id, (src->type == - BL_PC) ? 0 : ((struct mob_data *) src)->class, + BL_PC) ? 0 : ((struct mob_data *) src)->mob_class, wd.damage + wd.damage2); } @@ -5332,9 +5332,9 @@ int battle_check_target (struct block_list *src, struct block_list *target, if (su && su->group->target_flag == BCT_NOENEMY) return 1; else if (battle_config.pk_mode - && (((struct map_session_data *) ss)->status.class == 0 + && (((struct map_session_data *) ss)->status.pc_class == 0 || ((struct map_session_data *) target)-> - status.class == 0)) + status.pc_class == 0)) return 1; // prevent novice engagement in pk_mode [Valaris] else if (map[ss->m].flag.pvp_noparty && s_p > 0 && t_p > 0 && s_p == t_p) diff --git a/src/map/chat.c b/src/map/chat.c index 00aadea..ccb75df 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -28,7 +28,7 @@ int chat_createchat (struct map_session_data *sd, int limit, int pub, nullpo_retr (0, sd); - cd = calloc (1, sizeof (struct chat_data)); + CREATE(cd, struct chat_data, 1); cd->limit = limit; cd->pub = pub; @@ -279,7 +279,7 @@ int chat_createnpcchat (struct npc_data *nd, int limit, int pub, int trigger, nullpo_retr (1, nd); - cd = calloc (1, sizeof (struct chat_data)); + CREATE (cd, struct chat_data, 1); cd->limit = cd->trigger = limit; if (trigger > 0) diff --git a/src/map/chrif.c b/src/map/chrif.c index b80b4fd..5e2cd4c 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -65,7 +65,7 @@ void chrif_setpasswd (char *pwd) passwd[sizeof(passwd)-1] = '\0'; } -char *chrif_getpasswd () +char *chrif_getpasswd (void) { return passwd; } @@ -651,7 +651,7 @@ int chrif_changedsex (int fd) { if (sd != NULL && sd->status.sex != sex) { - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); if (sd->status.sex == 0) { sd->status.sex = 1; @@ -679,10 +679,10 @@ int chrif_changedsex (int fd) // change job if necessary if (s_class.job == 20 || s_class.job == 4021 || s_class.job == 4043) - sd->status.class -= 1; + sd->status.pc_class -= 1; else if (s_class.job == 19 || s_class.job == 4020 || s_class.job == 4042) - sd->status.class += 1; + sd->status.pc_class += 1; } // save character chrif_save (sd); @@ -1257,7 +1257,7 @@ void send_users_tochar (timer_id tid, tick_t tick, custom_id_t id, custom_data_t WFIFOW (char_fd, 0) = 0x2aff; for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth && + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth && !((battle_config.hide_GM_session || sd->state.shroud_active || (sd->status.option & OPTION_HIDE)) && pc_isGM (sd))) diff --git a/src/map/chrif.h b/src/map/chrif.h index 3515463..e891be7 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -4,7 +4,7 @@ void chrif_setuserid (char *); void chrif_setpasswd (char *); -char *chrif_getpasswd (); +char *chrif_getpasswd (void); void chrif_setip (char *); void chrif_setport (int); diff --git a/src/map/clif.c b/src/map/clif.c index b0dd487..11b1f83 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -185,7 +185,7 @@ int clif_countusers (void) for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd && sd->state.auth && !(battle_config.hide_GM_session && pc_isGM (sd))) users++; @@ -206,7 +206,7 @@ int clif_foreachclient (int (*func) (struct map_session_data *, va_list), ...) va_start (ap, func); for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd && sd->state.auth) func (sd, ap); } @@ -348,7 +348,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) case ALL_CLIENT: // 全クライアントに送信 for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) != NULL + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL && sd->state.auth) { if (packet_len_table[RBUFW (buf, 0)]) @@ -362,7 +362,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) case ALL_SAMEMAP: // 同じマップの全クライアントに送信 for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) != NULL + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) { if (packet_len_table[RBUFW (buf, 0)]) @@ -462,7 +462,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) } for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) != NULL + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL && sd->state.auth) { if (sd->partyspy == p->party_id) @@ -526,7 +526,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) } for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) != NULL + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL && sd->state.auth) { if (sd->guildspy == g->guild_id) @@ -766,12 +766,9 @@ static void clif_clearchar_delay_sub (timer_id tid, tick_t tick, custom_id_t id, int clif_clearchar_delay (unsigned int tick, struct block_list *bl, int type) { - struct block_list *tmpbl = calloc (sizeof (struct block_list), 1); - if (tmpbl == NULL) - { - printf ("clif_clearchar_delay: out of memory !\n"); - exit (1); - } + struct block_list *tmpbl; + CREATE (tmpbl, struct block_list, 1); + memcpy (tmpbl, bl, sizeof (struct block_list)); add_timer (tick, clif_clearchar_delay_sub, (custom_id_t) tmpbl, type); @@ -982,18 +979,18 @@ static int clif_set007b (struct map_session_data *sd, unsigned char *buf) * クラスチェンジ typeはMobの場合は1で他は0? *------------------------------------------ */ -int clif_class_change (struct block_list *bl, int class, int type) +int clif_npc_class_change (struct block_list *bl, int npc_class, int type) { char buf[16]; nullpo_retr (0, bl); - if (class >= MAX_PC_CLASS) + if (npc_class >= MAX_PC_CLASS) { WBUFW (buf, 0) = 0x1b0; WBUFL (buf, 2) = bl->id; WBUFB (buf, 6) = type; - WBUFL (buf, 7) = class; + WBUFL (buf, 7) = npc_class; clif_send (buf, packet_len_table[0x1b0], bl, AREA); } @@ -1004,10 +1001,10 @@ int clif_class_change (struct block_list *bl, int class, int type) * *------------------------------------------ */ -int clif_mob_class_change (struct mob_data *md, int class) +int clif_mob_class_change (struct mob_data *md, int class_) { char buf[16]; - int view = mob_get_viewclass (class); + int view = mob_get_viewclass (class_); nullpo_retr (0, md); @@ -1061,24 +1058,24 @@ static int clif_mob0078 (struct mob_data *md, unsigned char *buf) WBUFW (buf, 8) = md->opt1; WBUFW (buf, 10) = md->opt2; WBUFW (buf, 12) = md->option; - WBUFW (buf, 14) = mob_get_viewclass (md->class); - if ((mob_get_viewclass (md->class) <= 23) - || (mob_get_viewclass (md->class) == 812) - || (mob_get_viewclass (md->class) >= 4001)) - { - WBUFW (buf, 12) |= mob_db[md->class].option; - WBUFW (buf, 16) = mob_get_hair (md->class); - WBUFW (buf, 18) = mob_get_weapon (md->class); - WBUFW (buf, 20) = mob_get_head_buttom (md->class); - WBUFW (buf, 22) = mob_get_shield (md->class); - WBUFW (buf, 24) = mob_get_head_top (md->class); - WBUFW (buf, 26) = mob_get_head_mid (md->class); - WBUFW (buf, 28) = mob_get_hair_color (md->class); - WBUFW (buf, 30) = mob_get_clothes_color (md->class); //Add for player monster dye - Valaris - WBUFB (buf, 45) = mob_get_sex (md->class); - } - - if (md->class >= 1285 && md->class <= 1287) + WBUFW (buf, 14) = mob_get_viewclass (md->mob_class); + if ((mob_get_viewclass (md->mob_class) <= 23) + || (mob_get_viewclass (md->mob_class) == 812) + || (mob_get_viewclass (md->mob_class) >= 4001)) + { + WBUFW (buf, 12) |= mob_db[md->mob_class].option; + WBUFW (buf, 16) = mob_get_hair (md->mob_class); + WBUFW (buf, 18) = mob_get_weapon (md->mob_class); + WBUFW (buf, 20) = mob_get_head_buttom (md->mob_class); + WBUFW (buf, 22) = mob_get_shield (md->mob_class); + WBUFW (buf, 24) = mob_get_head_top (md->mob_class); + WBUFW (buf, 26) = mob_get_head_mid (md->mob_class); + WBUFW (buf, 28) = mob_get_hair_color (md->mob_class); + WBUFW (buf, 30) = mob_get_clothes_color (md->mob_class); //Add for player monster dye - Valaris + WBUFB (buf, 45) = mob_get_sex (md->mob_class); + } + + if (md->mob_class >= 1285 && md->mob_class <= 1287) { // Added guardian emblems [Valaris] struct guild *g; struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); @@ -1123,26 +1120,26 @@ static int clif_mob007b (struct mob_data *md, unsigned char *buf) WBUFW (buf, 8) = md->opt1; WBUFW (buf, 10) = md->opt2; WBUFW (buf, 12) = md->option; - WBUFW (buf, 14) = mob_get_viewclass (md->class); - if ((mob_get_viewclass (md->class) < 24) - || (mob_get_viewclass (md->class) > 4000)) - { - WBUFW (buf, 12) |= mob_db[md->class].option; - WBUFW (buf, 16) = mob_get_hair (md->class); - WBUFW (buf, 18) = mob_get_weapon (md->class); - WBUFW (buf, 20) = mob_get_head_buttom (md->class); + WBUFW (buf, 14) = mob_get_viewclass (md->mob_class); + if ((mob_get_viewclass (md->mob_class) < 24) + || (mob_get_viewclass (md->mob_class) > 4000)) + { + WBUFW (buf, 12) |= mob_db[md->mob_class].option; + WBUFW (buf, 16) = mob_get_hair (md->mob_class); + WBUFW (buf, 18) = mob_get_weapon (md->mob_class); + WBUFW (buf, 20) = mob_get_head_buttom (md->mob_class); WBUFL (buf, 22) = gettick (); - WBUFW (buf, 26) = mob_get_shield (md->class); - WBUFW (buf, 28) = mob_get_head_top (md->class); - WBUFW (buf, 30) = mob_get_head_mid (md->class); - WBUFW (buf, 32) = mob_get_hair_color (md->class); - WBUFW (buf, 34) = mob_get_clothes_color (md->class); //Add for player monster dye - Valaris - WBUFB (buf, 49) = mob_get_sex (md->class); + WBUFW (buf, 26) = mob_get_shield (md->mob_class); + WBUFW (buf, 28) = mob_get_head_top (md->mob_class); + WBUFW (buf, 30) = mob_get_head_mid (md->mob_class); + WBUFW (buf, 32) = mob_get_hair_color (md->mob_class); + WBUFW (buf, 34) = mob_get_clothes_color (md->mob_class); //Add for player monster dye - Valaris + WBUFB (buf, 49) = mob_get_sex (md->mob_class); } else WBUFL (buf, 22) = gettick (); - if (md->class >= 1285 && md->class <= 1287) + if (md->mob_class >= 1285 && md->mob_class <= 1287) { // Added guardian emblems [Valaris] struct guild *g; struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); @@ -1183,8 +1180,8 @@ static int clif_npc0078 (struct npc_data *nd, unsigned char *buf) WBUFW (buf, 0) = 0x78; WBUFL (buf, 2) = nd->bl.id; WBUFW (buf, 6) = nd->speed; - WBUFW (buf, 14) = nd->class; - if ((nd->class == 722) && (nd->u.scr.guild_id > 0) + WBUFW (buf, 14) = nd->npc_class; + if ((nd->npc_class == 722) && (nd->u.scr.guild_id > 0) && ((g = guild_search (nd->u.scr.guild_id)) != NULL)) { WBUFL (buf, 22) = g->emblem_id; @@ -1301,13 +1298,13 @@ int clif_spawnpc (struct map_session_data *sd) clif_guild_emblem (sd, g); } // end addition [Valaris] - if (sd->status.class == 13 || sd->status.class == 21 - || sd->status.class == 4014 || sd->status.class == 4022) + if (sd->status.pc_class == 13 || sd->status.pc_class == 21 + || sd->status.pc_class == 4014 || sd->status.pc_class == 4022) pc_setoption (sd, sd->status.option | 0x0020); // [Valaris] if ((pc_isriding (sd) && pc_checkskill (sd, KN_RIDING) > 0) - && (sd->status.class == 7 || sd->status.class == 14 - || sd->status.class == 4008 || sd->status.class == 4015)) + && (sd->status.pc_class == 7 || sd->status.pc_class == 14 + || sd->status.pc_class == 4008 || sd->status.pc_class == 4015)) pc_setriding (sd); // update peco riders for people upgrading athena [Valaris] if (map[sd->bl.m].flag.snow) @@ -1337,7 +1334,7 @@ int clif_spawnnpc (struct npc_data *nd) nullpo_retr (0, nd); - if (nd->class < 0 || nd->flag & 1 || nd->class == INVISIBLE_CLASS) + if (nd->npc_class < 0 || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS) return 0; memset (buf, 0, packet_len_table[0x7c]); @@ -1345,7 +1342,7 @@ int clif_spawnnpc (struct npc_data *nd) WBUFW (buf, 0) = 0x7c; WBUFL (buf, 2) = nd->bl.id; WBUFW (buf, 6) = nd->speed; - WBUFW (buf, 20) = nd->class; + WBUFW (buf, 20) = nd->npc_class; WBUFPOS (buf, 36, nd->bl.x, nd->bl.y); clif_send (buf, packet_len_table[0x7c], &nd->bl, AREA); @@ -1405,7 +1402,7 @@ int clif_spawnmob (struct mob_data *md) nullpo_retr (0, md); - if (mob_get_viewclass (md->class) > 23) + if (mob_get_viewclass (md->mob_class) > 23) { memset (buf, 0, packet_len_table[0x7c]); @@ -1415,7 +1412,7 @@ int clif_spawnmob (struct mob_data *md) WBUFW (buf, 8) = md->opt1; WBUFW (buf, 10) = md->opt2; WBUFW (buf, 12) = md->option; - WBUFW (buf, 20) = mob_get_viewclass (md->class); + WBUFW (buf, 20) = mob_get_viewclass (md->mob_class); WBUFPOS (buf, 36, md->bl.x, md->bl.y); clif_send (buf, packet_len_table[0x7c], &md->bl, AREA); } @@ -1423,8 +1420,8 @@ int clif_spawnmob (struct mob_data *md) len = clif_mob0078 (md, buf); clif_send (buf, len, &md->bl, AREA); - if (mob_get_equip (md->class) > 0) // mob equipment [Valaris] - clif_mob_equip (md, mob_get_equip (md->class)); + if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris] + clif_mob_equip (md, mob_get_equip (md->mob_class)); return 0; } @@ -3634,7 +3631,7 @@ void clif_getareachar_npc (struct map_session_data *sd, struct npc_data *nd) nullpo_retv (sd); nullpo_retv (nd); - if (nd->class < 0 || nd->flag & 1 || nd->class == INVISIBLE_CLASS) + if (nd->npc_class < 0 || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS) return; len = clif_npc0078 (nd, WFIFOP (sd->fd, 0)); @@ -3661,8 +3658,8 @@ int clif_movemob (struct mob_data *md) len = clif_mob007b (md, buf); clif_send (buf, len, &md->bl, AREA); - if (mob_get_equip (md->class) > 0) // mob equipment [Valaris] - clif_mob_equip (md, mob_get_equip (md->class)); + if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris] + clif_mob_equip (md, mob_get_equip (md->mob_class)); return 0; } @@ -3790,8 +3787,8 @@ void clif_getareachar_mob (struct map_session_data *sd, struct mob_data *md) WFIFOSET (sd->fd, len); } - if (mob_get_equip (md->class) > 0) // mob equipment [Valaris] - clif_mob_equip (md, mob_get_equip (md->class)); + if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris] + clif_mob_equip (md, mob_get_equip (md->mob_class)); } /*========================================== @@ -3989,7 +3986,7 @@ int clif_pcoutsight (struct block_list *bl, va_list ap) } break; case BL_NPC: - if (((struct npc_data *) bl)->class != INVISIBLE_CLASS) + if (((struct npc_data *) bl)->npc_class != INVISIBLE_CLASS) clif_clearchar_id (bl->id, 0, sd->fd); break; case BL_MOB: @@ -4546,14 +4543,14 @@ int clif_skill_estimation (struct map_session_data *sd, return 0; WBUFW (buf, 0) = 0x18c; - WBUFW (buf, 2) = mob_get_viewclass (md->class); - WBUFW (buf, 4) = mob_db[md->class].lv; - WBUFW (buf, 6) = mob_db[md->class].size; + WBUFW (buf, 2) = mob_get_viewclass (md->mob_class); + WBUFW (buf, 4) = mob_db[md->mob_class].lv; + WBUFW (buf, 6) = mob_db[md->mob_class].size; WBUFL (buf, 8) = md->hp; WBUFW (buf, 12) = battle_get_def2 (&md->bl); - WBUFW (buf, 14) = mob_db[md->class].race; + WBUFW (buf, 14) = mob_db[md->mob_class].race; WBUFW (buf, 16) = - battle_get_mdef2 (&md->bl) - (mob_db[md->class].vit >> 1); + battle_get_mdef2 (&md->bl) - (mob_db[md->mob_class].vit >> 1); WBUFW (buf, 18) = battle_get_elem_type (&md->bl); for (i = 0; i < 9; i++) WBUFB (buf, 20 + i) = battle_attr_fix (100, i + 1, md->def_ele); @@ -4613,7 +4610,7 @@ int clif_GMmessage (struct block_list *bl, char *mes, int len, int flag) { unsigned char lbuf[255]; unsigned char *buf = - ((len + 16) >= sizeof (lbuf)) ? malloc (len + 16) : lbuf; + ((len + 16) >= sizeof (lbuf)) ? (unsigned char*)malloc (len + 16) : lbuf; int lp = (flag & 0x10) ? 8 : 4; WBUFW (buf, 0) = 0x9a; @@ -6000,7 +5997,7 @@ int clif_guild_memberlist (struct map_session_data *sd) WFIFOW (fd, c * 104 + 12) = m->hair; WFIFOW (fd, c * 104 + 14) = m->hair_color; WFIFOW (fd, c * 104 + 16) = m->gender; - WFIFOW (fd, c * 104 + 18) = m->class; + WFIFOW (fd, c * 104 + 18) = m->pc_class; WFIFOW (fd, c * 104 + 20) = m->lv; WFIFOL (fd, c * 104 + 22) = m->exp; WFIFOL (fd, c * 104 + 26) = m->online; @@ -6315,7 +6312,7 @@ int clif_guild_message (struct guild *g, int account_id, const char *mes, unsigned char lbuf[255]; unsigned char *buf = lbuf; if (len + 32 >= sizeof (lbuf)) - buf = malloc (len + 32); + buf = (unsigned char *)malloc (len + 32); WBUFW (buf, 0) = 0x17f; WBUFW (buf, 2) = len + 4; memcpy (WBUFP (buf, 4), mes, len); @@ -6570,7 +6567,7 @@ int clif_disp_onlyself (struct map_session_data *sd, char *mes, int len) { unsigned char lbuf[255]; unsigned char *buf = - (len + 32 >= sizeof (lbuf)) ? malloc (len + 32) : lbuf; + (len + 32 >= sizeof (lbuf)) ? (unsigned char *)malloc (len + 32) : lbuf; nullpo_retr (0, sd); @@ -6699,7 +6696,7 @@ int clif_specialeffect (struct block_list *bl, int type, int flag) int i; for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) != NULL + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) clif_specialeffect (&sd->bl, type, 1); } @@ -6755,12 +6752,8 @@ void clif_parse_WantToConnection (int fd, struct map_session_data *sd) } else { - sd = session[fd]->session_data = calloc (sizeof (*sd), 1); - if (sd == NULL) - { - printf ("out of memory : clif_parse_WantToConnection\n"); - exit (1); - } + CREATE (sd, struct map_session_data, 1); + session[fd]->session_data = sd; sd->fd = fd; pc_setnewpc (sd, account_id, RFIFOL (fd, 6), RFIFOL (fd, 10), @@ -6864,7 +6857,7 @@ void clif_parse_LoadEndAck (int fd, struct map_session_data *sd) if (sd->state.connect_new) { sd->state.connect_new = 0; - if (sd->status.class != sd->view_class) + if (sd->status.pc_class != sd->view_class) clif_changelook (&sd->bl, LOOK_BASE, sd->view_class); /* Stop players from spawning inside castles [Valaris] */ @@ -7957,17 +7950,17 @@ void clif_parse_RemoveOption (int fd, struct map_session_data *sd) { if (pc_isriding (sd)) { // jobchange when removing peco [Valaris] - if (sd->status.class == 13) - sd->status.class = sd->view_class = 7; + if (sd->status.pc_class == 13) + sd->status.pc_class = sd->view_class = 7; - if (sd->status.class == 21) - sd->status.class = sd->view_class = 14; + if (sd->status.pc_class == 21) + sd->status.pc_class = sd->view_class = 14; - if (sd->status.class == 4014) - sd->status.class = sd->view_class = 4008; + if (sd->status.pc_class == 4014) + sd->status.pc_class = sd->view_class = 4008; - if (sd->status.class == 4022) - sd->status.class = sd->view_class = 4015; + if (sd->status.pc_class == 4022) + sd->status.pc_class = sd->view_class = 4015; } pc_setoption (sd, 0); @@ -9316,7 +9309,7 @@ void clif_parse_sn_explosionspirits (int fd, struct map_session_data *sd) if (sd) { int nextbaseexp = pc_nextbaseexp (sd); - struct pc_base_job s_class = pc_calc_base_job (sd->status.class); + struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class); if (battle_config.etc_log) { if (nextbaseexp != 0) @@ -9349,7 +9342,7 @@ void clif_parse_sn_explosionspirits (int fd, struct map_session_data *sd) // rate -1 is unlimited typedef struct func_table { - void (*func)(); + void (*func)(int fd, struct map_session_data *sd); int rate; } func_table; // *INDENT-OFF* @@ -9905,7 +9898,7 @@ func_table clif_parse_func_table[0x220] = // Checks for packet flooding int clif_check_packet_flood(int fd, int cmd) { - struct map_session_data *sd = session[fd]->session_data; + struct map_session_data *sd = (struct map_session_data *)session[fd]->session_data; unsigned int rate, tick = gettick(); // sd will not be set if the client hasn't requested @@ -10117,9 +10110,7 @@ static char *clif_validate_chat (struct map_session_data *sd, int type, static void clif_parse (int fd) { int packet_len = 0, cmd = 0; - struct map_session_data *sd = NULL; - - sd = session[fd]->session_data; + struct map_session_data *sd = (struct map_session_data *)session[fd]->session_data; if (!sd || (sd && !sd->state.auth)) { diff --git a/src/map/clif.h b/src/map/clif.h index d947f95..a1914e3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -131,8 +131,8 @@ int clif_pcoutsight (struct block_list *, va_list); // map_forallinmovearea int clif_mobinsight (struct block_list *, va_list); // map_forallinmovearea callback int clif_moboutsight (struct block_list *, va_list); // map_forallinmovearea callback -int clif_class_change (struct block_list *bl, int class, int type); -int clif_mob_class_change (struct mob_data *md, int class); +int clif_npc_class_change (struct block_list *bl, int npc_class, int type); +int clif_mob_class_change (struct mob_data *md, int mob_class); int clif_mob_equip (struct mob_data *md, int nameid); // [Valaris] int clif_skillinfo (struct map_session_data *sd, int skillid, int type, diff --git a/src/map/guild.c b/src/map/guild.c index 6017b8e..e4e0ca8 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -162,7 +162,7 @@ void do_init_guild (void) // 検索 struct guild *guild_search (int guild_id) { - return numdb_search (guild_db, guild_id); + return (struct guild *)numdb_search (guild_db, guild_id); } void guild_searchname_sub (db_key_t key, db_val_t data, va_list ap) @@ -185,7 +185,7 @@ struct guild *guild_searchname (char *str) struct guild_castle *guild_castle_search (int gcid) { - return numdb_search (castle_db, gcid); + return (struct guild_castle *)numdb_search (castle_db, gcid); } // mapnameに対応したアジトのgcを返す @@ -255,7 +255,7 @@ void guild_makemember (struct guild_member *m, struct map_session_data *sd) m->hair = sd->status.hair; m->hair_color = sd->status.hair_color; m->gender = sd->sex; - m->class = sd->status.class; + m->pc_class = sd->status.pc_class; m->lv = sd->status.base_level; m->exp = 0; m->exp_payper = 0; @@ -372,7 +372,7 @@ int guild_created (int account_id, int guild_id) sd->status.guild_id = guild_id; sd->guild_sended = 0; - if ((g = numdb_search (guild_db, guild_id)) != NULL) + if ((g = (struct guild *)numdb_search (guild_db, guild_id)) != NULL) { printf ("guild_created(): ID already exists!\n"); exit (1); @@ -434,7 +434,7 @@ int guild_check_member (const struct guild *g) for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth) + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) { if (sd->status.guild_id == g->guild_id) { @@ -466,7 +466,7 @@ int guild_recv_noinfo (int guild_id) struct map_session_data *sd; for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth) + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) { if (sd->status.guild_id == guild_id) sd->status.guild_id = 0; @@ -484,7 +484,7 @@ int guild_recv_info (struct guild *sg) nullpo_retr (0, sg); - if ((g = numdb_search (guild_db, sg->guild_id)) == NULL) + if ((g = (struct guild *)numdb_search (guild_db, sg->guild_id)) == NULL) { CREATE (g, struct guild, 1); numdb_insert (guild_db, sg->guild_id, g); @@ -544,7 +544,7 @@ int guild_recv_info (struct guild *sg) } // イベントの発生 - if ((ev = numdb_search (guild_infoevent_db, sg->guild_id)) != NULL) + if ((ev = (struct eventlist *)numdb_search (guild_infoevent_db, sg->guild_id)) != NULL) { numdb_erase (guild_infoevent_db, sg->guild_id); for (; ev; ev2 = ev->next, free (ev), ev = ev2) @@ -820,7 +820,7 @@ int guild_send_memberinfoshort (struct map_session_data *sd, int online) intif_guild_memberinfoshort (g->guild_id, sd->status.account_id, 0 /*char_id*/, online, sd->status.base_level, - sd->status.class); + sd->status.pc_class); if (!online) { // ログアウトするならsdをクリアして終了 @@ -854,7 +854,7 @@ int guild_send_memberinfoshort (struct map_session_data *sd, int online) // ギルドメンバのオンライン状態/Lv更新通知 int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int class) + int online, int lv, int pc_class) { int i, alv, c, idx = 0, om = 0, oldonline = -1; struct guild *g = guild_search (guild_id); @@ -868,7 +868,7 @@ int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, oldonline = m->online; m->online = online; m->lv = lv; - m->class = class; + m->pc_class = pc_class; idx = i; } if (m->account_id > 0) @@ -1084,7 +1084,7 @@ int guild_payexp (struct map_session_data *sd, int exp) if ((exp2 = exp * per / 100) <= 0) return 0; - if ((c = numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL) + if ((c = (struct guild_expcache *)numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL) { CREATE (c, struct guild_expcache, 1); c->guild_id = sd->status.guild_id; @@ -1539,7 +1539,7 @@ int guild_addcastleinfoevent (int castle_id, int index, const char *name) CREATE (ev, struct eventlist, 1); memcpy (ev->name, name, sizeof (ev->name)); - ev->next = numdb_search (guild_castleinfoevent_db, code); + ev->next = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code); numdb_insert (guild_castleinfoevent_db, code, ev); return 0; } @@ -1637,7 +1637,7 @@ int guild_castledataloadack (int castle_id, int index, int value) index); return 0; } - if ((ev = numdb_search (guild_castleinfoevent_db, code)) != NULL) + if ((ev = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code)) != NULL) { numdb_erase (guild_castleinfoevent_db, code); for (; ev; ev2 = ev->next, free (ev), ev = ev2) @@ -1882,30 +1882,22 @@ int guild_isallied (struct guild *g, struct guild_castle *gc) static void guild_db_final (db_key_t key, db_val_t data, va_list ap) { - struct guild *g = data; - - free (g); + free (data); } static void castle_db_final (db_key_t key, db_val_t data, va_list ap) { - struct guild_castle *gc = data; - - free (gc); + free (data); } static void guild_expcache_db_final (db_key_t key, db_val_t data, va_list ap) { - struct guild_expcache *c = data; - - free (c); + free (data); } static void guild_infoevent_db_final (db_key_t key, db_val_t data, va_list ap) { - struct eventlist *ev = data; - - free (ev); + free (data); } void do_final_guild (void) diff --git a/src/map/guild.h b/src/map/guild.h index 6ac13f9..8e7c32e 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -59,7 +59,7 @@ int guild_opposition (struct map_session_data *sd, int char_id); int guild_send_memberinfoshort (struct map_session_data *sd, int online); int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int class); + int online, int lv, int class_); int guild_change_memberposition (int guild_id, int account_id, int char_id, int idx); int guild_memberposition_changed (struct guild *g, int idx, int pos); diff --git a/src/map/intif.c b/src/map/intif.c index 629eade..7069e3a 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -366,7 +366,7 @@ int intif_guild_leave (int guild_id, int account_id, int char_id, int flag, // ギルドメンバのオンライン状況/Lv更新要求 int intif_guild_memberinfoshort (int guild_id, int account_id, int char_id, int online, - int lv, int class) + int lv, int class_) { WFIFOW (inter_fd, 0) = 0x3035; WFIFOL (inter_fd, 2) = guild_id; @@ -374,7 +374,7 @@ int intif_guild_memberinfoshort (int guild_id, WFIFOL (inter_fd, 10) = char_id; WFIFOB (inter_fd, 14) = online; WFIFOW (inter_fd, 15) = lv; - WFIFOW (inter_fd, 17) = class; + WFIFOW (inter_fd, 17) = class_; WFIFOSET (inter_fd, 19); return 0; } @@ -603,7 +603,7 @@ int mapif_parse_WisToGM (int fd) message[len - 1] = '\0'; // information is sended to all online GM for (i = 0; i < fd_max; i++) - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) if (pc_isGM (pl_sd) >= min_gm_level) clif_wis_message (i, Wisp_name, message, diff --git a/src/map/intif.h b/src/map/intif.h index b6abd78..374c95a 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -36,7 +36,7 @@ int intif_guild_addmember (int guild_id, struct guild_member *m); int intif_guild_leave (int guild_id, int account_id, int char_id, int flag, const char *mes); int intif_guild_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int class); + int online, int lv, int class_); int intif_guild_break (int guild_id); int intif_guild_message (int guild_id, int account_id, char *mes, int len); int intif_guild_checkconflict (int guild_id, int account_id, int char_id); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 6557d43..f89446b 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -38,7 +38,7 @@ static int blue_box_default = 0, violet_box_default = 0, card_album_default = static void itemdb_read (void); static int itemdb_readdb (void); -static int itemdb_read_randomitem (); +static int itemdb_read_randomitem (void); static int itemdb_read_itemavail (void); static int itemdb_read_itemnametable (void); static int itemdb_read_noequip (void); @@ -143,7 +143,7 @@ int itemdb_searchrandomid (int flags) */ struct item_data *itemdb_exists (int nameid) { - return numdb_search (item_db, nameid); + return (struct item_data *)numdb_search (item_db, nameid); } /*========================================== @@ -152,9 +152,7 @@ struct item_data *itemdb_exists (int nameid) */ struct item_data *itemdb_search (int nameid) { - struct item_data *id; - - id = numdb_search (item_db, nameid); + struct item_data *id = (struct item_data *)numdb_search (item_db, nameid); if (id) return id; @@ -263,7 +261,7 @@ static int itemdb_read_itemslottable (void) char *buf, *p; int s; - buf = grfio_reads ("data\\itemslottable.txt", &s); + buf = (char *)grfio_reads ("data\\itemslottable.txt", &s); if (buf == NULL) return -1; buf[s] = 0; @@ -397,7 +395,7 @@ static int itemdb_readdb (void) * ランダムアイテム出現データの読み込み *------------------------------------------ */ -static int itemdb_read_randomitem () +static int itemdb_read_randomitem (void) { FILE *fp; char line[1024]; @@ -546,7 +544,7 @@ static int itemdb_read_itemnametable (void) char *buf, *p; int s; - buf = grfio_reads ("data\\idnum2itemdisplaynametable.txt", &s); + buf = (char *)grfio_reads ("data\\idnum2itemdisplaynametable.txt", &s); if (buf == NULL) return -1; @@ -592,7 +590,7 @@ static int itemdb_read_cardillustnametable (void) char *buf, *p; int s; - buf = grfio_reads ("data\\num2cardillustnametable.txt", &s); + buf = (char *)grfio_reads ("data\\num2cardillustnametable.txt", &s); if (buf == NULL) return -1; @@ -676,7 +674,7 @@ static void itemdb_final (db_key_t key, db_val_t data, va_list ap) { struct item_data *id; - nullpo_retv (id = data); + nullpo_retv (id = (struct item_data *)data); if (id->use_script) free (id->use_script); diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index c3846e2..a0a4935 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -34,7 +34,7 @@ static void free_area (area_t * area) static area_t *dup_area (area_t * area) { - area_t *retval = malloc (sizeof (area_t)); + area_t *retval = (area_t *)malloc (sizeof (area_t)); *retval = *area; switch (area->ty) @@ -122,7 +122,7 @@ static void stringify (val_t * v, int within_op) break; case TY_INT: - buf = malloc (32); + buf = (char *)malloc (32); sprintf (buf, "%i", v->v.v_int); break; @@ -138,7 +138,7 @@ static void stringify (val_t * v, int within_op) break; case TY_LOCATION: - buf = malloc (128); + buf = (char *) malloc (128); sprintf (buf, "<\"%s\", %d, %d>", map[v->v.v_location.m].name, v->v.v_location.x, v->v.v_location.y); break; @@ -204,7 +204,7 @@ static void make_area (val_t * v) { if (v->ty == TY_LOCATION) { - area_t *a = malloc (sizeof (area_t)); + area_t *a = (char *)malloc (sizeof (area_t)); v->ty = TY_AREA; a->ty = AREA_LOCATION; a->a.a_loc = v->v.v_location; @@ -617,7 +617,7 @@ static int fun_mob_id (env_t * env, int args_nr, val_t * result, val_t * args) { if (ETY (0) != BL_MOB) return 1; - RESULTINT = ((struct mob_data *) (ARGENTITY(0)))->class; + RESULTINT = ((struct mob_data *) (ARGENTITY(0)))->mob_class; return 0; } @@ -1243,7 +1243,7 @@ int compare_fun (const void *lhs, const void *rhs) return strcmp (((fun_t *) lhs)->name, ((fun_t *) rhs)->name); } -fun_t *magic_get_fun (char *name, int *index) +fun_t *magic_get_fun (const char *name, int *index) { static int functions_nr; fun_t *result; @@ -1302,7 +1302,7 @@ eval_location (env_t * env, location_t * dest, e_location_t * expr) static area_t *eval_area (env_t * env, e_area_t * expr) { - area_t *area = malloc (sizeof (area_t)); + area_t *area = (area_t *)malloc (sizeof (area_t)); area->ty = expr->ty; switch (expr->ty) diff --git a/src/map/magic-expr.h b/src/map/magic-expr.h index 657dcb7..e912d14 100644 --- a/src/map/magic-expr.h +++ b/src/map/magic-expr.h @@ -47,7 +47,7 @@ typedef struct op * @param name The name to look up * @return A function of that name, or NULL, and a function index */ -fun_t *magic_get_fun (char *name, int *index); +fun_t *magic_get_fun (const char *name, int *index); /** * Retrieves an operation by name diff --git a/src/map/magic-interpreter-parser.y b/src/map/magic-interpreter-parser.y index c5ee41d..9df0f3e 100644 --- a/src/map/magic-interpreter-parser.y +++ b/src/map/magic-interpreter-parser.y @@ -6,11 +6,11 @@ magic_conf_t magic_conf; static int -intern_id(char *id_name); +intern_id(const char *id_name); static expr_t * -fun_expr(char *name, int args_nr, expr_t **args, int line, int column); +fun_expr(const char *name, int args_nr, expr_t **args, int line, int column); static expr_t * dot_expr(expr_t *lhs, int id); @@ -23,7 +23,7 @@ static void magic_frontend_error(const char *msg); static void -fail(int line, int column, char *fmt, ...); +fail(int line, int column, const char *fmt, ...); static spell_t * new_spell(spellguard_t *guard); @@ -50,7 +50,7 @@ static effect_t * op_effect(char *name, int args_nr, expr_t **args, int line, int column); int -magic_frontend_lex(); +magic_frontend_lex(void); static void install_proc(proc_t *proc); @@ -232,12 +232,12 @@ proc_formals_list : /* empty */ proc_formals_list_ne : ID { CREATE ($$, proc_t, 1); $$->args_nr = 1; - $$->args = malloc(sizeof(int)); + $$->args = (int*)malloc(sizeof(int)); $$->args[0] = intern_id($1); } | proc_formals_list_ne ',' ID { $$ = $1; - $$->args = realloc($$->args, sizeof(int) * (1 + $$->args_nr)); + $$->args = (int*)realloc($$->args, sizeof(int) * (1 + $$->args_nr)); $$->args[$$->args_nr++] = intern_id($3); } ; @@ -261,7 +261,8 @@ spellconf_option : ID '=' expr } | TELEPORT_ANCHOR ID ':' expr '=' expr { - teleport_anchor_t *anchor = calloc(sizeof(teleport_anchor_t), 1); + teleport_anchor_t *anchor; + CREATE (anchor, teleport_anchor_t, 1); anchor->name = $2; anchor->invocation = magic_eval_str(&magic_default_env, $4); anchor->location = $6; @@ -419,7 +420,7 @@ arg_list_ne : expr $$.args[0] = $1; } | arg_list_ne ',' expr - { $$.args = realloc($$.args, (1 + $$.args_nr) * sizeof(expr_t *)); + { RECREATE($$.args, expr_t *, 1 + $$.args_nr); $$.args[$$.args_nr++] = $3; } ; @@ -462,12 +463,12 @@ spelldef : spellbody_list defs : semicolons { $$.letdefs_nr = 0; - $$.letdefs = (letdef_t *) malloc(1); + CREATE($$.letdefs, letdef_t, 1); } | defs def semicolons { $$ = $1; $$.letdefs_nr++; - $$.letdefs = realloc($$.letdefs, sizeof(letdef_t) * $$.letdefs_nr); + RECREATE ($$.letdefs, letdef_t, $$.letdefs_nr); $$.letdefs[$1.letdefs_nr] = $2; } ; @@ -701,21 +702,21 @@ effect_list : /* empty */ * during startup for a relatively manageable set of configs, it should be fine. */ static int -intern_id(char *id_name) +intern_id(const char *id_name) { int i; for (i = 0; i < magic_conf.vars_nr; i++) if (!strcmp(id_name, magic_conf.var_name[i])) { - free(id_name); + free((char*)id_name); return i; } /* Must add new */ i = magic_conf.vars_nr++; - magic_conf.var_name = realloc(magic_conf.var_name, magic_conf.vars_nr * sizeof(char *)); + RECREATE(magic_conf.var_name, const char *, magic_conf.vars_nr); magic_conf.var_name[i] = id_name; - magic_conf.vars = realloc(magic_conf.vars, magic_conf.vars_nr * sizeof(val_t)); + RECREATE(magic_conf.vars, val_t, magic_conf.vars_nr); magic_conf.vars[i].ty = TY_UNDEF; return i; @@ -740,7 +741,7 @@ add_spell(spell_t *spell, int line_nr) } magic_conf.spells_nr++; - magic_conf.spells = realloc(magic_conf.spells, magic_conf.spells_nr * sizeof (spell_t*)); + RECREATE(magic_conf.spells, spell_t *, magic_conf.spells_nr); magic_conf.spells[index] = spell; @@ -765,13 +766,13 @@ add_teleport_anchor(teleport_anchor_t *anchor, int line_nr) } magic_conf.anchors_nr++; - magic_conf.anchors = realloc(magic_conf.anchors, magic_conf.anchors_nr * sizeof (teleport_anchor_t*)); + RECREATE(magic_conf.anchors, teleport_anchor_t *, magic_conf.anchors_nr); magic_conf.anchors[index] = anchor; } static void -fail(int line, int column, char *fmt, ...) +fail(int line, int column, const char *fmt, ...) { va_list ap; fprintf(stderr, "[magic-init] L%d:%d: ", line, column); @@ -791,7 +792,7 @@ dot_expr(expr_t *expr, int id) } static expr_t * -fun_expr(char *name, int args_nr, expr_t **args, int line, int column) +fun_expr(const char *name, int args_nr, expr_t **args, int line, int column) { int id; expr_t *expr; @@ -828,7 +829,7 @@ new_spell(spellguard_t *guard) { static int spell_counter = 0; - spell_t *retval = calloc(1, sizeof(spell_t)); + spell_t *retval = (spell_t*)calloc(1, sizeof(spell_t)); retval->index = ++spell_counter; retval->spellguard = guard; return retval; @@ -837,7 +838,7 @@ new_spell(spellguard_t *guard) static spellguard_t * new_spellguard(int ty) { - spellguard_t *retval = calloc(1, sizeof(spellguard_t)); + spellguard_t *retval = (spellguard_t *)calloc(1, sizeof(spellguard_t)); retval->ty = ty; return retval; } @@ -938,7 +939,7 @@ op_effect(char *name, int args_nr, expr_t **args, int line, int column) proc_t *procs = NULL; int procs_nr = 0; - +// I think this is a memory leak, or undefined behavior static void install_proc(proc_t *proc) { @@ -946,7 +947,7 @@ install_proc(proc_t *proc) procs = proc; procs_nr = 1; } else { - procs = realloc(procs, sizeof(proc_t) * (1 + procs_nr)); + RECREATE (procs, proc_t, 1 + procs_nr); procs[procs_nr++] = *proc; } } @@ -1042,10 +1043,10 @@ magic_init(char *conffile) // must be called after itemdb initialisation magic_conf.min_casttime = 100; magic_conf.spells_nr = 0; - magic_conf.spells = (spell_t **)malloc(1); + CREATE(magic_conf.spells, spell_t *, 1); magic_conf.anchors_nr = 0; - magic_conf.anchors = (teleport_anchor_t **)malloc(1); + CREATE(magic_conf.anchors, teleport_anchor_t *, 1); INTERN_ASSERT("min_casttime", VAR_MIN_CASTTIME); INTERN_ASSERT("obscure_chance", VAR_OBSCURE_CHANCE); diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h index e9232bd..0b4b73c 100644 --- a/src/map/magic-interpreter.h +++ b/src/map/magic-interpreter.h @@ -335,7 +335,7 @@ typedef struct teleport_anchor typedef struct { int vars_nr; - char **var_name; + const char **var_name; val_t *vars; /* Initial assignments, if any, or NULL */ int obscure_chance; diff --git a/src/map/magic-stmt.c b/src/map/magic-stmt.c index 4ae7e5d..5569217 100644 --- a/src/map/magic-stmt.c +++ b/src/map/magic-stmt.c @@ -473,14 +473,7 @@ record_status_change (invocation_t * invocation, int bl_id, int sc_id) int index = invocation->status_change_refs_nr++; status_change_ref_t *cr; - if (invocation->status_change_refs) - invocation->status_change_refs = - realloc (invocation->status_change_refs, - sizeof (status_change_ref_t) * - invocation->status_change_refs_nr); - else - invocation->status_change_refs = - malloc (sizeof (status_change_ref_t)); + RECREATE (invocation->status_change_refs, status_change_ref_t, invocation->status_change_refs_nr); cr = &invocation->status_change_refs[index]; @@ -739,7 +732,7 @@ static int op_injure (env_t * env, int args_nr, val_t * args) struct mob_data *mob = (struct mob_data *) target; MAP_LOG_PC (caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s", - mob->bl.id, mob->class, damage_caused, + mob->bl.id, mob->mob_class, damage_caused, get_invocation_name (env)); } } @@ -884,7 +877,7 @@ op_t *magic_get_op (char *name, int *index) } key.name = name; - op_t *op = bsearch (&key, operations, operation_count, sizeof (op_t), + op_t *op = (op_t *)bsearch (&key, operations, operation_count, sizeof (op_t), compare_operations); if (op && index) @@ -1048,7 +1041,7 @@ static int find_entities_in_area_c (entity_t * target, va_list va) if (*entities_nr_p == *entities_allocd_p) { \ /* Need more space */ \ (*entities_allocd_p) += 32; \ - *entities_p = realloc(*entities_p, sizeof(int) * (*entities_allocd_p)); \ + RECREATE (*entities_p, int, *entities_allocd_p); \ } \ (*entities_p)[(*entities_nr_p)++] = e; @@ -1169,14 +1162,14 @@ static effect_t *run_foreach (invocation_t * invocation, effect_t * foreach, if (!ar) return return_location; - entities_collect = malloc (entities_allocd * sizeof (int)); + CREATE (entities_collect, int, entities_allocd); find_entities_in_area (area.v.v_area, &entities_allocd, &entities_nr, &entities_collect, filter); /* Now shuffle */ - shuffle_board = malloc ((sizeof (int) * (1 + entities_nr))); // +1: to avoid spurious warnings in memory profilers - entities = malloc ((sizeof (int) * (1 + entities_nr))); // +1: to avoid spurious warnings in memory profilers + CREATE (shuffle_board, int, entities_nr); + CREATE (entities, int, entities_nr); for (i = 0; i < entities_nr; i++) shuffle_board[i] = i; diff --git a/src/map/magic.c b/src/map/magic.c index b67aaca..797dc16 100644 --- a/src/map/magic.c +++ b/src/map/magic.c @@ -124,7 +124,7 @@ int magic_message (character_t * caster, char *spell_, size_t spell_len) int magic_init (char *conffile); // must be called after itemdb initialisation -void do_init_magic () +void do_init_magic (void) { magic_init (MAGIC_CONFIG_FILE); } diff --git a/src/map/magic.h b/src/map/magic.h index 99ae647..1979914 100644 --- a/src/map/magic.h +++ b/src/map/magic.h @@ -46,7 +46,7 @@ spell_effect_report_termination (int invocation, int bl_id, int sc_id, /** * Initialise all spells, read config data */ -void do_init_magic (); +void do_init_magic (void); /** * Identifies the invocation used to trigger a spell diff --git a/src/map/map.c b/src/map/map.c index 7730b94..fdc97e7 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1021,10 +1021,7 @@ int map_addflooritem (struct item *item_data, int amount, int m, int x, int y, */ void map_addchariddb (int charid, char *name) { - struct charid2nick *p = NULL; - int req = 0; - - p = numdb_search (charid_db, charid); + struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, charid); if (p == NULL) { // データベースにない CREATE (p, struct charid2nick, 1); @@ -1033,7 +1030,7 @@ void map_addchariddb (int charid, char *name) else numdb_erase (charid_db, charid); - req = p->req_id; + int req = p->req_id; memcpy (p->nick, name, 24); p->req_id = 0; numdb_insert (charid_db, charid, p); @@ -1051,11 +1048,9 @@ void map_addchariddb (int charid, char *name) */ int map_reqchariddb (struct map_session_data *sd, int charid) { - struct charid2nick *p = NULL; - nullpo_retr (0, sd); - p = numdb_search (charid_db, charid); + struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, charid); if (p != NULL) // データベースにすでにある return 0; CREATE (p, struct charid2nick, 1); @@ -1195,7 +1190,7 @@ struct map_session_data *map_id2sd (int id) struct map_session_data *sd = NULL; for (i = 0; i < fd_max; i++) - if (session[i] && (sd = session[i]->session_data) && sd->bl.id == id) + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->bl.id == id) return sd; return NULL; @@ -1207,7 +1202,7 @@ struct map_session_data *map_id2sd (int id) */ char *map_charid2nick (int id) { - struct charid2nick *p = numdb_search (charid_db, id); + struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, id); if (p == NULL) return NULL; @@ -1224,7 +1219,7 @@ static struct map_session_data *map_get_session (int i) struct map_session_data *d; if (i >= 0 && i < fd_max - && session[i] && (d = session[i]->session_data) && d->state.auth) + && session[i] && (d = (struct map_session_data *)session[i]->session_data) && d->state.auth) return d; return NULL; @@ -1256,7 +1251,7 @@ static struct map_session_data *map_get_session_backward (int start) return NULL; } -struct map_session_data *map_get_first_session () +struct map_session_data *map_get_first_session (void) { return map_get_session_forward (0); } @@ -1266,7 +1261,7 @@ struct map_session_data *map_get_next_session (struct map_session_data *d) return map_get_session_forward (d->fd + 1); } -struct map_session_data *map_get_last_session () +struct map_session_data *map_get_last_session (void) { return map_get_session_backward (fd_max); } @@ -1295,7 +1290,7 @@ struct map_session_data *map_nick2sd (char *nick) for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { // Without case sensitive check (increase the number of similar character names found) @@ -1329,7 +1324,7 @@ struct block_list *map_id2bl (int id) if (id < sizeof (object) / sizeof (object[0])) bl = object[id]; else - bl = numdb_search (id_db, id); + bl = (struct block_list *)numdb_search (id_db, id); return bl; } @@ -1413,9 +1408,7 @@ void map_removenpc (void) */ int map_mapname2mapid (char *name) { - struct map_data *md = NULL; - - md = strdb_search (map_db, name); + struct map_data *md = (struct map_data *)strdb_search (map_db, name); if (md == NULL || md->gat == NULL) return -1; return md->m; @@ -1427,9 +1420,7 @@ int map_mapname2mapid (char *name) */ int map_mapname2ipport (char *name, int *ip, int *port) { - struct map_data_other_server *mdos = NULL; - - mdos = strdb_search (map_db, name); + struct map_data_other_server *mdos = (struct map_data_other_server *)strdb_search (map_db, name); if (mdos == NULL || mdos->gat) return -1; *ip = mdos->ip; @@ -1564,10 +1555,9 @@ int map_setcell (int m, int x, int y, int t) */ int map_setipport (char *name, unsigned long ip, int port) { - struct map_data *md = NULL; struct map_data_other_server *mdos = NULL; - md = strdb_search (map_db, name); + struct map_data *md = (struct map_data *)strdb_search (map_db, name); if (md == NULL) { // not exist -> add new data CREATE (mdos, struct map_data_other_server, 1); @@ -1664,7 +1654,6 @@ static void map_readwater (char *watertxt) */ static int map_readmap (int m, char *fn, char *alias) { - unsigned char *gat = ""; int s; int x, y, xs, ys; struct gat_1cell @@ -1675,7 +1664,7 @@ static int map_readmap (int m, char *fn, char *alias) size_t size; // read & convert fn - gat = grfio_read (fn); + uint8_t gat = (uint8_t *)grfio_read (fn); if (gat == NULL) return -1; @@ -1686,7 +1675,7 @@ static int map_readmap (int m, char *fn, char *alias) xs = map[m].xs = *(short *) (gat); ys = map[m].ys = *(short *) (gat + 2); printf ("\n%i %i\n", xs, ys); - map[m].gat = calloc (s = map[m].xs * map[m].ys, 1); + map[m].gat = (uint8_t *)calloc (s = map[m].xs * map[m].ys, 1); if (map[m].gat == NULL) { printf ("out of memory : map_readmap gat\n"); @@ -1717,39 +1706,15 @@ static int map_readmap (int m, char *fn, char *alias) map[m].bxs = (xs + BLOCK_SIZE - 1) / BLOCK_SIZE; map[m].bys = (ys + BLOCK_SIZE - 1) / BLOCK_SIZE; - size = map[m].bxs * map[m].bys * sizeof (struct block_list *); - - map[m].block = calloc (size, 1); - if (map[m].block == NULL) - { - printf ("out of memory : map_readmap block\n"); - exit (1); - } + size = map[m].bxs * map[m].bys; - map[m].block_mob = calloc (size, 1); - if (map[m].block_mob == NULL) - { - printf ("out of memory : map_readmap block_mob\n"); - exit (1); - } + CREATE (map[m].block, struct block_list *, size); - size = map[m].bxs * map[m].bys * sizeof (int); + CREATE (map[m].block_mob, struct block_list *, size); - map[m].block_count = calloc (size, 1); - if (map[m].block_count == NULL) - { - printf ("out of memory : map_readmap block\n"); - exit (1); - } - memset (map[m].block_count, 0, size); + CREATE (map[m].block_count, int, size); - map[m].block_mob_count = calloc (size, 1); - if (map[m].block_mob_count == NULL) - { - printf ("out of memory : map_readmap block_mob\n"); - exit (1); - } - memset (map[m].block_mob_count, 0, size); + CREATE (map[m].block_mob_count, int, size); strdb_insert (map_db, map[m].name, &map[m]); @@ -1873,11 +1838,11 @@ FILE *map_logfile = NULL; char *map_logfile_name = NULL; static long map_logfile_index; -static void map_close_logfile () +static void map_close_logfile (void) { if (map_logfile) { - char *filenameop_buf = malloc (strlen (map_logfile_name) + 50); + char *filenameop_buf = (char*)malloc (strlen (map_logfile_name) + 50); sprintf (filenameop_buf, "gzip -f %s.%ld", map_logfile_name, map_logfile_index); @@ -1892,7 +1857,7 @@ static void map_close_logfile () static void map_start_logfile (long suffix) { - char *filename_buf = malloc (strlen (map_logfile_name) + 50); + char *filename_buf = (char*)malloc (strlen (map_logfile_name) + 50); map_logfile_index = suffix >> LOGFILE_SECONDS_PER_CHUNK_SHIFT; sprintf (filename_buf, "%s.%ld", map_logfile_name, map_logfile_index); @@ -2138,7 +2103,9 @@ void do_final (void) do_final_guild (); } -void map_helpscreen () +/// --help was passed +// FIXME this should produce output +void map_helpscreen (void) { exit (1); } diff --git a/src/map/map.h b/src/map/map.h index 5955418..a480cd0 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -424,7 +424,7 @@ struct npc_data { struct block_list bl; short n; - short class, dir; + short npc_class, dir; short speed; char name[24]; char exname[24]; @@ -487,7 +487,7 @@ struct mob_data { struct block_list bl; short n; - short base_class, class, dir, mode; + short base_class, mob_class, dir, mode; short m, x0, y0, xs, ys; char name[24]; int spawndelay1, spawndelay2; @@ -795,8 +795,8 @@ int map_scriptcont (struct map_session_data *sd, int id); /* Continues a scrip struct map_session_data *map_nick2sd (char *); int compare_item (struct item *a, struct item *b); -struct map_session_data *map_get_first_session (); -struct map_session_data *map_get_last_session (); +struct map_session_data *map_get_first_session (void); +struct map_session_data *map_get_last_session (void); struct map_session_data *map_get_next_session (struct map_session_data *current); struct map_session_data *map_get_prev_session (struct map_session_data @@ -816,7 +816,7 @@ int path_blownpos (int m, int x0, int y0, int dx, int dy, int count); int map_who (int fd); -void map_helpscreen (); // [Valaris] +void map_helpscreen (void); // [Valaris] int map_delmap (char *mapname); #endif diff --git a/src/map/mob.c b/src/map/mob.c index 3e3297d..2402245 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -46,7 +46,7 @@ static int mob_makedummymobdb (int); static void mob_timer (timer_id, tick_t, custom_id_t, custom_data_t); int mobskill_use (struct mob_data *md, unsigned int tick, int event); int mobskill_deltimer (struct mob_data *md); -int mob_skillid2skillidx (int class, int skillid); +int mob_skillid2skillidx (int mob_class, int skillid); int mobskill_use_id (struct mob_data *md, struct block_list *target, int skill_idx); static int mob_unlocktarget (struct mob_data *md, int tick); @@ -90,21 +90,21 @@ static void mob_init (struct mob_data *md); * The minimum data set for MOB spawning *------------------------------------------ */ -int mob_spawn_dataset (struct mob_data *md, const char *mobname, int class) +int mob_spawn_dataset (struct mob_data *md, const char *mobname, int mob_class) { nullpo_retr (0, md); if (strcmp (mobname, "--en--") == 0) - memcpy (md->name, mob_db[class].name, 24); + memcpy (md->name, mob_db[mob_class].name, 24); else if (strcmp (mobname, "--ja--") == 0) - memcpy (md->name, mob_db[class].jname, 24); + memcpy (md->name, mob_db[mob_class].jname, 24); else memcpy (md->name, mobname, 24); md->bl.prev = NULL; md->bl.next = NULL; md->n = 0; - md->base_class = md->class = class; + md->base_class = md->mob_class = mob_class; md->bl.id = npc_get_new_npc_id (); memset (&md->state, 0, sizeof (md->state)); @@ -292,24 +292,24 @@ int mob_gen_exp (struct mob_db *mob) static void mob_init (struct mob_data *md) { int i; - const int class = md->class; - const int mutations_nr = mob_db[class].mutations_nr; - const int mutation_power = mob_db[class].mutation_power; - - md->stats[MOB_LV] = mob_db[class].lv; - md->stats[MOB_MAX_HP] = mob_db[class].max_hp; - md->stats[MOB_STR] = mob_db[class].str; - md->stats[MOB_AGI] = mob_db[class].agi; - md->stats[MOB_VIT] = mob_db[class].vit; - md->stats[MOB_INT] = mob_db[class].int_; - md->stats[MOB_DEX] = mob_db[class].dex; - md->stats[MOB_LUK] = mob_db[class].luk; - md->stats[MOB_ATK1] = mob_db[class].atk1; - md->stats[MOB_ATK2] = mob_db[class].atk2; - md->stats[MOB_ADELAY] = mob_db[class].adelay; - md->stats[MOB_DEF] = mob_db[class].def; - md->stats[MOB_MDEF] = mob_db[class].mdef; - md->stats[MOB_SPEED] = mob_db[class].speed; + const int mob_class = md->mob_class; + const int mutations_nr = mob_db[mob_class].mutations_nr; + const int mutation_power = mob_db[mob_class].mutation_power; + + md->stats[MOB_LV] = mob_db[mob_class].lv; + md->stats[MOB_MAX_HP] = mob_db[mob_class].max_hp; + md->stats[MOB_STR] = mob_db[mob_class].str; + md->stats[MOB_AGI] = mob_db[mob_class].agi; + md->stats[MOB_VIT] = mob_db[mob_class].vit; + md->stats[MOB_INT] = mob_db[mob_class].int_; + md->stats[MOB_DEX] = mob_db[mob_class].dex; + md->stats[MOB_LUK] = mob_db[mob_class].luk; + md->stats[MOB_ATK1] = mob_db[mob_class].atk1; + md->stats[MOB_ATK2] = mob_db[mob_class].atk2; + md->stats[MOB_ADELAY] = mob_db[mob_class].adelay; + md->stats[MOB_DEF] = mob_db[mob_class].def; + md->stats[MOB_MDEF] = mob_db[mob_class].mdef; + md->stats[MOB_SPEED] = mob_db[mob_class].speed; md->stats[MOB_XP_BONUS] = MOB_XP_BONUS_BASE; for (i = 0; i < mutations_nr; i++) @@ -339,11 +339,11 @@ static void mob_init (struct mob_data *md) *------------------------------------------ */ int mob_once_spawn (struct map_session_data *sd, char *mapname, - int x, int y, const char *mobname, int class, int amount, + int x, int y, const char *mobname, int mob_class, int amount, const char *event) { struct mob_data *md = NULL; - int m, count, lv = 255, r = class; + int m, count, lv = 255, r = mob_class; if (sd) lv = sd->status.base_level; @@ -353,29 +353,29 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, else m = map_mapname2mapid (mapname); - if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // 値が異常なら召喚を止める + if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // 値が異常なら召喚を止める return 0; - if (class < 0) + if (mob_class < 0) { // ランダムに召喚 int i = 0; - int j = -class - 1; + int j = -mob_class - 1; int k; if (j >= 0 && j < MAX_RANDOMMONSTER) { do { - class = MPRAND (1001, 1000); + mob_class = MPRAND (1001, 1000); k = MRAND (1000000); } - while ((mob_db[class].max_hp <= 0 - || mob_db[class].summonper[j] <= k - || (lv < mob_db[class].lv + while ((mob_db[mob_class].max_hp <= 0 + || mob_db[mob_class].summonper[j] <= k + || (lv < mob_db[mob_class].lv && battle_config.random_monster_checklv == 1)) && (i++) < 2000); if (i >= 2000) { - class = mob_db[0].summonper[j]; + mob_class = mob_db[0].summonper[j]; } } else @@ -383,7 +383,7 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, return 0; } // if(battle_config.etc_log==1) -// printf("mobclass=%d try=%d\n",class,i); +// printf("mobmob_class=%d try=%d\n",mob_class,i); } if (sd) { @@ -400,13 +400,13 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, for (count = 0; count < amount; count++) { md = (struct mob_data *) calloc (1, sizeof (struct mob_data)); - if (mob_db[class].mode & 0x02) + if (mob_db[mob_class].mode & 0x02) md->lootitem = (struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item)); else md->lootitem = NULL; - mob_spawn_dataset (md, mobname, class); + mob_spawn_dataset (md, mobname, mob_class); md->bl.m = m; md->bl.x = x; md->bl.y = y; @@ -426,13 +426,13 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, map_addiddb (&md->bl); mob_spawn (md->bl.id); - if (class == 1288) + if (mob_class == 1288) { // emperium hp based on defense level [Valaris] struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); if (gc) { - mob_db[class].max_hp += 2000 * gc->defense; - md->hp = mob_db[class].max_hp; + mob_db[mob_class].max_hp += 2000 * gc->defense; + md->hp = mob_db[mob_class].max_hp; } } // end addition [Valaris] @@ -446,7 +446,7 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, */ int mob_once_spawn_area (struct map_session_data *sd, char *mapname, int x0, int y0, int x1, int y1, - const char *mobname, int class, int amount, + const char *mobname, int mob_class, int amount, const char *event) { int x, y, i, c, max, lx = -1, ly = -1, id = 0; @@ -461,7 +461,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname, if (max > 1000) max = 1000; - if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // A summon is stopped if a value is unusual + if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // A summon is stopped if a value is unusual return 0; for (i = 0; i < amount; i++) @@ -483,7 +483,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname, else return 0; // Since reference of the place which boils first went wrong, it stops. } - id = mob_once_spawn (sd, mapname, x, y, mobname, class, 1, event); + id = mob_once_spawn (sd, mapname, x, y, mobname, mob_class, 1, event); lx = x; ly = y; } @@ -495,7 +495,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname, *------------------------------------------ */ int mob_spawn_guardian (struct map_session_data *sd, char *mapname, - int x, int y, const char *mobname, int class, + int x, int y, const char *mobname, int mob_class, int amount, const char *event, int guardian) { struct mob_data *md = NULL; @@ -509,10 +509,10 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname, else m = map_mapname2mapid (mapname); - if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // 値が異常なら召喚を止める + if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // 値が異常なら召喚を止める return 0; - if (class < 0) + if (mob_class < 0) return 0; if (sd) @@ -529,15 +529,9 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname, for (count = 0; count < amount; count++) { struct guild_castle *gc; - md = calloc (sizeof (struct mob_data), 1); - if (md == NULL) - { - printf ("mob_spawn_guardian: out of memory !\n"); - exit (1); - } - memset (md, '\0', sizeof *md); + CREATE (md, struct mob_data, 1); - mob_spawn_dataset (md, mobname, class); + mob_spawn_dataset (md, mobname, mob_class); md->bl.m = m; md->bl.x = x; md->bl.y = y; @@ -558,7 +552,7 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname, gc = guild_mapname2gc (map[md->bl.m].name); if (gc) { - mob_db[class].max_hp += 2000 * gc->defense; + mob_db[mob_class].max_hp += 2000 * gc->defense; if (guardian == 0) { md->hp = gc->Ghp0; @@ -610,59 +604,59 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname, * Appearance income of mob *------------------------------------------ */ -int mob_get_viewclass (int class) +int mob_get_viewclass (int mob_class) { - return mob_db[class].view_class; + return mob_db[mob_class].view_class; } -int mob_get_sex (int class) +int mob_get_sex (int mob_class) { - return mob_db[class].sex; + return mob_db[mob_class].sex; } -short mob_get_hair (int class) +short mob_get_hair (int mob_class) { - return mob_db[class].hair; + return mob_db[mob_class].hair; } -short mob_get_hair_color (int class) +short mob_get_hair_color (int mob_class) { - return mob_db[class].hair_color; + return mob_db[mob_class].hair_color; } -short mob_get_weapon (int class) +short mob_get_weapon (int mob_class) { - return mob_db[class].weapon; + return mob_db[mob_class].weapon; } -short mob_get_shield (int class) +short mob_get_shield (int mob_class) { - return mob_db[class].shield; + return mob_db[mob_class].shield; } -short mob_get_head_top (int class) +short mob_get_head_top (int mob_class) { - return mob_db[class].head_top; + return mob_db[mob_class].head_top; } -short mob_get_head_mid (int class) +short mob_get_head_mid (int mob_class) { - return mob_db[class].head_mid; + return mob_db[mob_class].head_mid; } -short mob_get_head_buttom (int class) +short mob_get_head_buttom (int mob_class) { - return mob_db[class].head_buttom; + return mob_db[mob_class].head_buttom; } -short mob_get_clothes_color (int class) // Add for player monster dye - Valaris +short mob_get_clothes_color (int mob_class) // Add for player monster dye - Valaris { - return mob_db[class].clothes_color; // End + return mob_db[mob_class].clothes_color; // End } -int mob_get_equip (int class) // mob equip [Valaris] +int mob_get_equip (int mob_class) // mob equip [Valaris] { - return mob_db[class].equip; + return mob_db[mob_class].equip; } /*========================================== @@ -869,11 +863,11 @@ static int mob_check_attack (struct mob_data *md) } if (!md->mode) - mode = mob_db[md->class].mode; + mode = mob_db[md->mob_class].mode; else mode = md->mode; - race = mob_db[md->class].race; + race = mob_db[md->mob_class].race; if (!(mode & 0x80)) { md->target_id = 0; @@ -890,7 +884,7 @@ static int mob_check_attack (struct mob_data *md) return 0; } - range = mob_db[md->class].range; + range = mob_db[md->mob_class].range; if (mode & 1) range++; if (distance (md->bl.x, md->bl.y, tbl->x, tbl->y) > range) @@ -1229,7 +1223,7 @@ int mob_spawn (int id) map_delblock (&md->bl); } else - md->class = md->base_class; + md->mob_class = md->base_class; md->bl.m = md->m; do @@ -1269,8 +1263,8 @@ int mob_spawn (int id) mob_init (md); if (!md->stats[MOB_SPEED]) - md->stats[MOB_SPEED] = mob_db[md->class].speed; - md->def_ele = mob_db[md->class].element; + md->stats[MOB_SPEED] = mob_db[md->mob_class].speed; + md->def_ele = mob_db[md->mob_class].element; md->master_id = 0; md->master_dist = 0; @@ -1314,7 +1308,7 @@ int mob_spawn (int id) md->hp = battle_get_max_hp (&md->bl); if (md->hp <= 0) { - mob_makedummymobdb (md->class); + mob_makedummymobdb (md->mob_class); md->hp = battle_get_max_hp (&md->bl); } @@ -1414,7 +1408,7 @@ int mob_can_reach (struct mob_data *md, struct block_list *bl, int range) //=========== guildcastle guardian no search start=========== //when players are the guild castle member not attack them ! - if (md->class == 1285 || md->class == 1286 || md->class == 1287) + if (md->mob_class == 1285 || md->mob_class == 1286 || md->mob_class == 1287) { struct map_session_data *sd; struct guild *g = NULL; @@ -1503,11 +1497,11 @@ int mob_target (struct mob_data *md, struct block_list *bl, int dist) sc_data = battle_get_sc_data (bl); option = battle_get_option (bl); - race = mob_db[md->class].race; + race = mob_db[md->mob_class].race; if (!md->mode) { - mode = mob_db[md->class].mode; + mode = mob_db[md->mob_class].mode; } else { @@ -1576,14 +1570,14 @@ static int mob_ai_sub_hard_activesearch (struct block_list *bl, va_list ap) return 0; if (!smd->mode) - mode = mob_db[smd->class].mode; + mode = mob_db[smd->mob_class].mode; else mode = smd->mode; // アクティブでターゲット射程内にいるなら、ロックする if (mode & 0x04) { - race = mob_db[smd->class].race; + race = mob_db[smd->mob_class].race; //対象がPCの場合 if (tsd && !pc_isdead (tsd) && @@ -1641,7 +1635,7 @@ static int mob_ai_sub_hard_lootsearch (struct block_list *bl, va_list ap) if (!md->mode) { - mode = mob_db[md->class].mode; + mode = mob_db[md->mob_class].mode; } else { @@ -1686,8 +1680,8 @@ static int mob_ai_sub_hard_linksearch (struct block_list *bl, va_list ap) nullpo_retr (0, target = va_arg (ap, struct block_list *)); // same family free in a range at a link monster -- it will be made to lock if MOB is -/* if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && mob_db[md->class].mode&0x08){ - if( tmd->class==md->class && (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE) && tmd->bl.m == md->bl.m){ +/* if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && mob_db[md->mob_class].mode&0x08){ + if( tmd->mob_class==md->mob_class && (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE) && tmd->bl.m == md->bl.m){ if( mob_can_reach(tmd,target,12) ){ // Reachability judging tmd->target_id=md->target_id; tmd->state.targettype = ATTACKABLE; @@ -1695,9 +1689,9 @@ static int mob_ai_sub_hard_linksearch (struct block_list *bl, va_list ap) } } }*/ - if (md->attacked_id > 0 && mob_db[md->class].mode & 0x08) + if (md->attacked_id > 0 && mob_db[md->mob_class].mode & 0x08) { - if (tmd->class == md->class && tmd->bl.m == md->bl.m + if (tmd->mob_class == md->mob_class && tmd->bl.m == md->bl.m && (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE)) { if (mob_can_reach (tmd, target, 12)) @@ -1727,7 +1721,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick) if ((bl = map_id2bl (md->master_id)) != NULL) mmd = (struct mob_data *) bl; - mode = mob_db[md->class].mode; + mode = mob_db[md->mob_class].mode; // It is not main monster/leader. if (!mmd || mmd->bl.type != BL_MOB || mmd->bl.id != md->master_id) @@ -1821,7 +1815,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick) && !pc_isinvisible (sd)) { - race = mob_db[md->class].race; + race = mob_db[md->mob_class].race; if (mode & 0x20 || (sd->sc_data[SC_TRICKDEAD].timer == -1 && ((!pc_ishiding (sd) && !sd->state.gangsterparadise) @@ -1842,7 +1836,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick) struct map_session_data *sd=map_id2sd(md->target_id); if(sd!=NULL && !pc_isdead(sd) && sd->invincible_timer == -1 && !pc_isinvisible(sd)){ - race=mob_db[mmd->class].race; + race=mob_db[mmd->mob_class].race; if(mode&0x20 || (sd->sc_data[SC_TRICKDEAD].timer == -1 && (!(sd->status.option&0x06) || race==4 || race==6) @@ -1908,8 +1902,8 @@ static int mob_randomwalk (struct mob_data *md, int tick) { if (battle_config.error_log == 1) printf - ("MOB cant move. random spawn %d, class = %d\n", - md->bl.id, md->class); + ("MOB cant move. random spawn %d, mob_class = %d\n", + md->bl.id, md->mob_class); md->move_fail_count = 0; mob_spawn (md->bl.id); } @@ -1962,11 +1956,11 @@ static int mob_ai_sub_hard (struct block_list *bl, va_list ap) } if (!md->mode) - mode = mob_db[md->class].mode; + mode = mob_db[md->mob_class].mode; else mode = md->mode; - race = mob_db[md->class].race; + race = mob_db[md->mob_class].race; // Abnormalities if ((md->opt1 > 0 && md->opt1 != 6) || md->state.state == MS_DELAY @@ -2084,7 +2078,7 @@ static int mob_ai_sub_hard (struct block_list *bl, va_list ap) && race != 6))) mob_unlocktarget (md, tick); // スキルなどによる策敵妨害 else if (!battle_check_range - (&md->bl, tbl, mob_db[md->class].range)) + (&md->bl, tbl, mob_db[md->mob_class].range)) { // 攻撃範囲外なので移動 if (!(mode & 1)) @@ -2320,7 +2314,7 @@ static void mob_ai_hard (timer_id tid, tick_t tick, custom_id_t id, custom_data_ */ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app) { - struct mob_data *md = data; + struct mob_data *md = (struct mob_data *)data; unsigned int tick; va_list ap; @@ -2348,7 +2342,7 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app) } if (DIFF_TICK (md->next_walktime, tick) < 0 && - (mob_db[md->class].mode & 1) && mob_can_move (md)) + (mob_db[md->mob_class].mode & 1) && mob_can_move (md)) { if (map[md->bl.m].users > 0) @@ -2361,8 +2355,8 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app) // MOB which is not not the summons MOB but BOSS, either sometimes reboils. else if (MRAND (1000) < MOB_LAZYWARPPERC && md->x0 <= 0 - && md->master_id != 0 && mob_db[md->class].mexp <= 0 - && !(mob_db[md->class].mode & 0x20)) + && md->master_id != 0 && mob_db[md->mob_class].mexp <= 0 + && !(mob_db[md->mob_class].mode & 0x20)) mob_spawn (md->bl.id); } @@ -2372,8 +2366,8 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app) // MOB which is not BOSS which is not Summons MOB, either -- a case -- sometimes -- leaping if (MRAND (1000) < MOB_LAZYWARPPERC && md->x0 <= 0 - && md->master_id != 0 && mob_db[md->class].mexp <= 0 - && !(mob_db[md->class].mode & 0x20)) + && md->master_id != 0 && mob_db[md->mob_class].mexp <= 0 + && !(mob_db[md->mob_class].mode & 0x20)) mob_warp (md, -1, -1, -1, -1); } @@ -2495,7 +2489,7 @@ int mob_delete (struct mob_data *md) mob_changestate (md, MS_DEAD, 0); clif_clearchar_area (&md->bl, 1); map_delblock (&md->bl); - if (mob_get_viewclass (md->class) <= 1000) + if (mob_get_viewclass (md->mob_class) <= 1000) clif_clearchar_delay (gettick () + 3000, &md->bl, 0); mob_deleteslave (md); mob_setdelayspawn (md->bl.id); @@ -2683,7 +2677,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, { MAP_LOG_PC (((struct map_session_data *) master_bl), "MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d", - md2->bl.id, md2->class, md->bl.id, md->class, + md2->bl.id, md2->mob_class, md->bl.id, md->mob_class, damage); } @@ -2720,7 +2714,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, md->hp -= damage; - if (md->class >= 1285 && md->class <= 1287) + if (md->mob_class >= 1285 && md->mob_class <= 1287) { // guardian hp update [Valaris] struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); if (gc) @@ -2812,7 +2806,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, int skillidx = 0; if ((skillidx = - mob_skillid2skillidx (md->class, NPC_SELFDESTRUCTION2)) >= 0) + mob_skillid2skillidx (md->mob_class, NPC_SELFDESTRUCTION2)) >= 0) { md->mode |= 0x1; md->next_walktime = tick; @@ -2898,13 +2892,13 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, continue; /* jAthena's exp formula per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; - temp = ((double)mob_db[md->class].base_exp * (double)battle_config.base_exp_rate / 100. * per); + temp = ((double)mob_db[md->mob_class].base_exp * (double)battle_config.base_exp_rate / 100. * per); base_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; - if(mob_db[md->class].base_exp > 0 && base_exp < 1) base_exp = 1; + if(mob_db[md->mob_class].base_exp > 0 && base_exp < 1) base_exp = 1; if(base_exp < 0) base_exp = 0; - temp = ((double)mob_db[md->class].job_exp * (double)battle_config.job_exp_rate / 100. * per); + temp = ((double)mob_db[md->mob_class].job_exp * (double)battle_config.job_exp_rate / 100. * per); job_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; - if(mob_db[md->class].job_exp > 0 && job_exp < 1) job_exp = 1; + if(mob_db[md->mob_class].job_exp > 0 && job_exp < 1) job_exp = 1; if(job_exp < 0) job_exp = 0; */ //eAthena's exp formula rather than jAthena's @@ -2918,23 +2912,23 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, per = 1; base_exp = - ((mob_db[md->class].base_exp * + ((mob_db[md->mob_class].base_exp * md->stats[MOB_XP_BONUS]) >> MOB_XP_BONUS_SHIFT) * per / 256; if (base_exp < 1) base_exp = 1; if (sd && md && battle_config.pk_mode == 1 - && (mob_db[md->class].lv - sd->status.base_level >= 20)) + && (mob_db[md->mob_class].lv - sd->status.base_level >= 20)) { base_exp *= 1.15; // pk_mode additional exp if monster >20 levels [Valaris] } if (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1) base_exp = 0; // Added [Valaris] - job_exp = mob_db[md->class].job_exp * per / 256; + job_exp = mob_db[md->mob_class].job_exp * per / 256; if (job_exp < 1) job_exp = 1; if (sd && md && battle_config.pk_mode == 1 - && (mob_db[md->class].lv - sd->status.base_level >= 20)) + && (mob_db[md->mob_class].lv - sd->status.base_level >= 20)) { job_exp *= 1.15; // pk_mode additional exp if monster >20 levels [Valaris] } @@ -2986,22 +2980,22 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, if (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1) // Added [Valaris] break; // End - if (mob_db[md->class].dropitem[i].nameid <= 0) + if (mob_db[md->mob_class].dropitem[i].nameid <= 0) continue; - drop_rate = mob_db[md->class].dropitem[i].p; + drop_rate = mob_db[md->mob_class].dropitem[i].p; if (drop_rate <= 0 && battle_config.drop_rate0item == 1) drop_rate = 1; if (battle_config.drops_by_luk > 0 && sd && md) drop_rate += (sd->status.luk * battle_config.drops_by_luk) / 100; // drops affected by luk [Valaris] if (sd && md && battle_config.pk_mode == 1 - && (mob_db[md->class].lv - sd->status.base_level >= 20)) + && (mob_db[md->mob_class].lv - sd->status.base_level >= 20)) drop_rate *= 1.25; // pk_mode increase drops if 20 level difference [Valaris] if (drop_rate <= MRAND (10000)) continue; ditem = (struct delay_item_drop *) calloc (1, sizeof (struct delay_item_drop)); - ditem->nameid = mob_db[md->class].dropitem[i].nameid; + ditem->nameid = mob_db[md->mob_class].dropitem[i].nameid; ditem->amount = 1; ditem->m = md->bl.m; ditem->x = md->bl.x; @@ -3020,9 +3014,9 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, if (sd->monster_drop_itemid[i] <= 0) continue; if (sd->monster_drop_race[i] & (1 << race) || - (mob_db[md->class].mode & 0x20 + (mob_db[md->mob_class].mode & 0x20 && sd->monster_drop_race[i] & 1 << 10) - || (!(mob_db[md->class].mode & 0x20) + || (!(mob_db[md->mob_class].mode & 0x20) && sd->monster_drop_race[i] & 1 << 11)) { if (sd->monster_drop_itemrate[i] <= MRAND (10000)) @@ -3044,7 +3038,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, } if (sd->get_zeny_num > 0) pc_getzeny (sd, - mob_db[md->class].lv * 10 + + mob_db[md->mob_class].lv * 10 + MRAND ((sd->get_zeny_num + 1))); } if (md->lootitem) @@ -3070,7 +3064,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, } // mvp処理 - if (mvp_sd && mob_db[md->class].mexp > 0) + if (mvp_sd && mob_db[md->mob_class].mexp > 0) { int j; int mexp = battle_get_mexp (&md->bl); @@ -3086,9 +3080,9 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, for (j = 0; j < 3; j++) { i = MRAND (3); - if (mob_db[md->class].mvpitem[i].nameid <= 0) + if (mob_db[md->mob_class].mvpitem[i].nameid <= 0) continue; - drop_rate = mob_db[md->class].mvpitem[i].p; + drop_rate = mob_db[md->mob_class].mvpitem[i].p; if (drop_rate <= 0 && battle_config.drop_rate0item == 1) drop_rate = 1; if (drop_rate < battle_config.item_drop_mvp_min) @@ -3098,7 +3092,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, if (drop_rate <= MRAND (10000)) continue; memset (&item, 0, sizeof (item)); - item.nameid = mob_db[md->class].mvpitem[i].nameid; + item.nameid = mob_db[md->mob_class].mvpitem[i].nameid; item.identify = !itemdb_isequip3 (item.nameid); clif_mvp_item (mvp_sd, item.nameid); if (mvp_sd->weight * 2 > mvp_sd->max_weight) @@ -3141,7 +3135,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, int i; for (i = 0; i < fd_max; i++) { - if (session[i] && (tmpsd = session[i]->session_data) + if (session[i] && (tmpsd = (struct map_session_data *)session[i]->session_data) && tmpsd->state.auth) { if (md->bl.m == tmpsd->bl.m) @@ -3159,7 +3153,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, clif_clearchar_area (&md->bl, 1); map_delblock (&md->bl); - if (mob_get_viewclass (md->class) <= 1000) + if (mob_get_viewclass (md->mob_class) <= 1000) clif_clearchar_delay (tick + 3000, &md->bl, 0); mob_deleteslave (md); mob_setdelayspawn (md->bl.id); @@ -3175,7 +3169,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, int mob_class_change (struct mob_data *md, int *value) { unsigned int tick = gettick (); - int i, c, hp_rate, max_hp, class, count = 0; + int i, c, hp_rate, max_hp, mob_class, count = 0; nullpo_retr (0, md); nullpo_retr (0, value); @@ -3190,14 +3184,14 @@ int mob_class_change (struct mob_data *md, int *value) if (count < 1) return 0; - class = value[MRAND (count)]; - if (class <= 1000 || class > 2000) + mob_class = value[MRAND (count)]; + if (mob_class <= 1000 || mob_class > 2000) return 0; max_hp = battle_get_max_hp (&md->bl); hp_rate = md->hp * 100 / max_hp; - clif_mob_class_change (md, class); - md->class = class; + clif_mob_class_change (md, mob_class); + md->mob_class = mob_class; max_hp = battle_get_max_hp (&md->bl); if (battle_config.monster_class_change_full_recover == 1) { @@ -3211,14 +3205,14 @@ int mob_class_change (struct mob_data *md, int *value) else if (md->hp < 1) md->hp = 1; - memcpy (md->name, mob_db[class].jname, 24); + memcpy (md->name, mob_db[mob_class].jname, 24); memset (&md->state, 0, sizeof (md->state)); md->attacked_id = 0; md->target_id = 0; md->move_fail_count = 0; - md->stats[MOB_SPEED] = mob_db[md->class].speed; - md->def_ele = mob_db[md->class].element; + md->stats[MOB_SPEED] = mob_db[md->mob_class].speed; + md->def_ele = mob_db[md->mob_class].element; mob_changestate (md, MS_IDLE, 0); skill_castcancel (&md->bl, 0); @@ -3234,7 +3228,7 @@ int mob_class_change (struct mob_data *md, int *value) md->skillid = 0; md->skilllv = 0; - if (md->lootitem == NULL && mob_db[class].mode & 0x02) + if (md->lootitem == NULL && mob_db[mob_class].mode & 0x02) md->lootitem = (struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item)); @@ -3261,7 +3255,7 @@ int mob_heal (struct mob_data *md, int heal) if (max_hp < md->hp) md->hp = max_hp; - if (md->class >= 1285 && md->class <= 1287) + if (md->mob_class >= 1285 && md->mob_class <= 1287) { // guardian hp update [Valaris] struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); if (gc) @@ -3375,7 +3369,7 @@ int mob_warp (struct mob_data *md, int m, int x, int y, int type) { m = md->bl.m; if (battle_config.error_log == 1) - printf ("MOB %d warp failed, class = %d\n", md->bl.id, md->class); + printf ("MOB %d warp failed, mob_class = %d\n", md->bl.id, md->mob_class); } md->target_id = 0; // タゲを解除する @@ -3387,8 +3381,8 @@ int mob_warp (struct mob_data *md, int m, int x, int y, int type) if (type > 0 && i == 1000) { if (battle_config.battle_log == 1) - printf ("MOB %d warp to (%d,%d), class = %d\n", md->bl.id, x, y, - md->class); + printf ("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl.id, x, y, + md->mob_class); } map_addblock (&md->bl); @@ -3445,7 +3439,7 @@ int mob_countslave (struct mob_data *md) int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag) { struct mob_data *md; - int bx, by, m, count = 0, class, k, a = amount; + int bx, by, m, count = 0, mob_class, k, a = amount; nullpo_retr (0, md2); nullpo_retr (0, value); @@ -3464,14 +3458,14 @@ int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag) for (k = 0; k < count; k++) { amount = a; - class = value[k]; - if (class <= 1000 || class > 2000) + mob_class = value[k]; + if (mob_class <= 1000 || mob_class > 2000) continue; for (; amount > 0; amount--) { int x = 0, y = 0, c = 0, i = 0; md = (struct mob_data *) calloc (1, sizeof (struct mob_data)); - if (mob_db[class].mode & 0x02) + if (mob_db[mob_class].mode & 0x02) md->lootitem = (struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item)); else @@ -3489,7 +3483,7 @@ int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag) y = by; } - mob_spawn_dataset (md, "--ja--", class); + mob_spawn_dataset (md, "--ja--", mob_class); md->bl.prev = NULL; md->bl.next = NULL; md->bl.m = m; @@ -3577,15 +3571,15 @@ int mob_counttargeted (struct mob_data *md, struct block_list *src, *MOBskillから該当skillidのskillidxを返す *------------------------------------------ */ -int mob_skillid2skillidx (int class, int skillid) +int mob_skillid2skillidx (int mob_class, int skillid) { int i; - struct mob_skill *ms = mob_db[class].skill; + struct mob_skill *ms = mob_db[mob_class].skill; if (ms == NULL) return -1; - for (i = 0; i < mob_db[class].maxskill; i++) + for (i = 0; i < mob_db[mob_class].maxskill; i++) { if (ms[i].skill_id == skillid) return i; @@ -3677,8 +3671,8 @@ void mobskill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data md->skilldelay[md->skillidx] = tick; if (battle_config.mob_skill_log == 1) - printf ("MOB skill castend skill=%d, class = %d\n", md->skillid, - md->class); + printf ("MOB skill castend skill=%d, mob_class = %d\n", md->skillid, + md->mob_class); mob_stop_walking (md, 0); switch (skill_get_nk (md->skillid)) @@ -3690,7 +3684,7 @@ void mobskill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data tick, 0); break; case 1: // 支援系 - if (!mob_db[md->class].skill[md->skillidx].val[0] && + if (!mob_db[md->mob_class].skill[md->skillidx].val[0] && (md->skillid == AL_HEAL || (md->skillid == ALL_RESURRECTION && bl->type != BL_PC)) && battle_check_undead (battle_get_race (bl), @@ -3829,8 +3823,8 @@ void mobskill_castend_pos (timer_id tid, tick_t tick, custom_id_t id, custom_dat md->skilldelay[md->skillidx] = tick; if (battle_config.mob_skill_log == 1) - printf ("MOB skill castend skill=%d, class = %d\n", md->skillid, - md->class); + printf ("MOB skill castend skill=%d, mob_class = %d\n", md->skillid, + md->mob_class); mob_stop_walking (md, 0); skill_castend_pos2 (&md->bl, md->skillx, md->skilly, md->skillid, @@ -3851,7 +3845,7 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target, int skill_id, skill_lv, forcecast = 0; nullpo_retr (0, md); - nullpo_retr (0, ms = &mob_db[md->class].skill[skill_idx]); + nullpo_retr (0, ms = &mob_db[md->mob_class].skill[skill_idx]); if (target == NULL && (target = map_id2bl (md->target_id)) == NULL) return 0; @@ -3928,8 +3922,8 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target, if (battle_config.mob_skill_log == 1) printf - ("MOB skill use target_id=%d skill=%d lv=%d cast=%d, class = %d\n", - target->id, skill_id, skill_lv, casttime, md->class); + ("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n", + target->id, skill_id, skill_lv, casttime, md->mob_class); if (casttime > 0 || forcecast) { // 詠唱が必要 @@ -3938,7 +3932,7 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target, md->bl.id, target->id, 0, 0, skill_id, casttime); // 詠唱反応モンスター -/* if( target->type==BL_MOB && mob_db[(md2=(struct mob_data *)target)->class].mode&0x10 && +/* if( target->type==BL_MOB && mob_db[(md2=(struct mob_data *)target)->mob_class].mode&0x10 && md2->state.state!=MS_ATTACK){ md2->target_id=md->bl.id; md->state.targettype = ATTACKABLE; @@ -3988,7 +3982,7 @@ int mobskill_use_pos (struct mob_data *md, int skill_id, skill_lv; nullpo_retr (0, md); - nullpo_retr (0, ms = &mob_db[md->class].skill[skill_idx]); + nullpo_retr (0, ms = &mob_db[md->mob_class].skill[skill_idx]); if (md->bl.prev == NULL) return 0; @@ -4038,8 +4032,8 @@ int mobskill_use_pos (struct mob_data *md, if (battle_config.mob_skill_log == 1) printf - ("MOB skill use target_pos=(%d,%d) skill=%d lv=%d cast=%d, class = %d\n", - skill_x, skill_y, skill_id, skill_lv, casttime, md->class); + ("MOB skill use target_pos=(%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n", + skill_x, skill_y, skill_id, skill_lv, casttime, md->mob_class); if (casttime > 0) // A cast time is required. clif_skillcasting (&md->bl, @@ -4092,7 +4086,7 @@ int mob_getfriendhpltmaxrate_sub (struct block_list *bl, va_list ap) return 0; rate = va_arg (ap, int); fr = va_arg (ap, struct mob_data **); - if (md->hp < mob_db[md->class].max_hp * rate / 100) + if (md->hp < mob_db[md->mob_class].max_hp * rate / 100) (*fr) = md; return 0; } @@ -4171,7 +4165,7 @@ int mobskill_use (struct mob_data *md, unsigned int tick, int event) int i, max_hp; nullpo_retr (0, md); - nullpo_retr (0, ms = mob_db[md->class].skill); + nullpo_retr (0, ms = mob_db[md->mob_class].skill); max_hp = battle_get_max_hp (&md->bl); @@ -4184,7 +4178,7 @@ int mobskill_use (struct mob_data *md, unsigned int tick, int event) if (md->sc_data[SC_SELFDESTRUCTION].timer != -1) //自爆中はスキルを使わない return 0; - for (i = 0; i < mob_db[md->class].maxskill; i++) + for (i = 0; i < mob_db[md->mob_class].maxskill; i++) { int c2 = ms[i].cond2, flag = 0; struct mob_data *fmd = NULL; @@ -4402,20 +4396,20 @@ int mob_gvmobcheck (struct map_session_data *sd, struct block_list *bl) nullpo_retr (0, bl); if (bl->type == BL_MOB && (md = (struct mob_data *) bl) && - (md->class == 1288 || md->class == 1287 || md->class == 1286 - || md->class == 1285)) + (md->mob_class == 1288 || md->mob_class == 1287 || md->mob_class == 1286 + || md->mob_class == 1285)) { struct guild_castle *gc = guild_mapname2gc (map[sd->bl.m].name); struct guild *g = guild_search (sd->status.guild_id); - if (g == NULL && md->class == 1288) + if (g == NULL && md->mob_class == 1288) return 0; //ギルド未加入ならダメージ無し else if (gc != NULL && !map[sd->bl.m].flag.gvg) return 0; //砦内でGvじゃないときはダメージなし else if (g && gc != NULL && g->guild_id == gc->guild_id) return 0; //自占領ギルドのエンペならダメージ無し else if (g && guild_checkskill (g, GD_APPROVAL) <= 0 - && md->class == 1288) + && md->mob_class == 1288) return 0; //正規ギルド承認がないとダメージ無し } @@ -4449,55 +4443,55 @@ int mobskill_deltimer (struct mob_data *md) * Since un-setting [ mob ] up was used, it is an initial provisional value setup. *------------------------------------------ */ -static int mob_makedummymobdb (int class) +static int mob_makedummymobdb (int mob_class) { int i; - sprintf (mob_db[class].name, "mob%d", class); - sprintf (mob_db[class].jname, "mob%d", class); - mob_db[class].lv = 1; - mob_db[class].max_hp = 1000; - mob_db[class].max_sp = 1; - mob_db[class].base_exp = 2; - mob_db[class].job_exp = 1; - mob_db[class].range = 1; - mob_db[class].atk1 = 7; - mob_db[class].atk2 = 10; - mob_db[class].def = 0; - mob_db[class].mdef = 0; - mob_db[class].str = 1; - mob_db[class].agi = 1; - mob_db[class].vit = 1; - mob_db[class].int_ = 1; - mob_db[class].dex = 6; - mob_db[class].luk = 2; - mob_db[class].range2 = 10; - mob_db[class].range3 = 10; - mob_db[class].size = 0; - mob_db[class].race = 0; - mob_db[class].element = 0; - mob_db[class].mode = 0; - mob_db[class].speed = 300; - mob_db[class].adelay = 1000; - mob_db[class].amotion = 500; - mob_db[class].dmotion = 500; - mob_db[class].dropitem[0].nameid = 909; // Jellopy - mob_db[class].dropitem[0].p = 1000; + sprintf (mob_db[mob_class].name, "mob%d", mob_class); + sprintf (mob_db[mob_class].jname, "mob%d", mob_class); + mob_db[mob_class].lv = 1; + mob_db[mob_class].max_hp = 1000; + mob_db[mob_class].max_sp = 1; + mob_db[mob_class].base_exp = 2; + mob_db[mob_class].job_exp = 1; + mob_db[mob_class].range = 1; + mob_db[mob_class].atk1 = 7; + mob_db[mob_class].atk2 = 10; + mob_db[mob_class].def = 0; + mob_db[mob_class].mdef = 0; + mob_db[mob_class].str = 1; + mob_db[mob_class].agi = 1; + mob_db[mob_class].vit = 1; + mob_db[mob_class].int_ = 1; + mob_db[mob_class].dex = 6; + mob_db[mob_class].luk = 2; + mob_db[mob_class].range2 = 10; + mob_db[mob_class].range3 = 10; + mob_db[mob_class].size = 0; + mob_db[mob_class].race = 0; + mob_db[mob_class].element = 0; + mob_db[mob_class].mode = 0; + mob_db[mob_class].speed = 300; + mob_db[mob_class].adelay = 1000; + mob_db[mob_class].amotion = 500; + mob_db[mob_class].dmotion = 500; + mob_db[mob_class].dropitem[0].nameid = 909; // Jellopy + mob_db[mob_class].dropitem[0].p = 1000; for (i = 1; i < 8; i++) { - mob_db[class].dropitem[i].nameid = 0; - mob_db[class].dropitem[i].p = 0; + mob_db[mob_class].dropitem[i].nameid = 0; + mob_db[mob_class].dropitem[i].p = 0; } // Item1,Item2 - mob_db[class].mexp = 0; - mob_db[class].mexpper = 0; + mob_db[mob_class].mexp = 0; + mob_db[mob_class].mexpper = 0; for (i = 0; i < 3; i++) { - mob_db[class].mvpitem[i].nameid = 0; - mob_db[class].mvpitem[i].p = 0; + mob_db[mob_class].mvpitem[i].nameid = 0; + mob_db[mob_class].mvpitem[i].p = 0; } for (i = 0; i < MAX_RANDOMMONSTER; i++) - mob_db[class].summonper[i] = 0; + mob_db[mob_class].summonper[i] = 0; return 0; } @@ -4526,7 +4520,7 @@ static int mob_readdb (void) } while (fgets (line, 1020, fp)) { - int class, i; + int mob_class, i; char *str[57], *p, *np; if (line[0] == '/' && line[1] == '/') @@ -4546,68 +4540,68 @@ static int mob_readdb (void) str[i] = p; } - class = atoi (str[0]); - if (class <= 1000 || class > 2000) + mob_class = atoi (str[0]); + if (mob_class <= 1000 || mob_class > 2000) continue; - mob_db[class].view_class = class; - memcpy (mob_db[class].name, str[1], 24); - memcpy (mob_db[class].jname, str[2], 24); - mob_db[class].lv = atoi (str[3]); - mob_db[class].max_hp = atoi (str[4]); - mob_db[class].max_sp = atoi (str[5]); - - mob_db[class].base_exp = atoi (str[6]); - if (mob_db[class].base_exp < 0) - mob_db[class].base_exp = 0; - else if (mob_db[class].base_exp > 0 - && (mob_db[class].base_exp * + mob_db[mob_class].view_class = mob_class; + memcpy (mob_db[mob_class].name, str[1], 24); + memcpy (mob_db[mob_class].jname, str[2], 24); + mob_db[mob_class].lv = atoi (str[3]); + mob_db[mob_class].max_hp = atoi (str[4]); + mob_db[mob_class].max_sp = atoi (str[5]); + + mob_db[mob_class].base_exp = atoi (str[6]); + if (mob_db[mob_class].base_exp < 0) + mob_db[mob_class].base_exp = 0; + else if (mob_db[mob_class].base_exp > 0 + && (mob_db[mob_class].base_exp * battle_config.base_exp_rate / 100 > 1000000000 - || mob_db[class].base_exp * + || mob_db[mob_class].base_exp * battle_config.base_exp_rate / 100 < 0)) - mob_db[class].base_exp = 1000000000; + mob_db[mob_class].base_exp = 1000000000; else - mob_db[class].base_exp *= battle_config.base_exp_rate / 100; + mob_db[mob_class].base_exp *= battle_config.base_exp_rate / 100; - mob_db[class].job_exp = atoi (str[7]); - if (mob_db[class].job_exp < 0) - mob_db[class].job_exp = 0; - else if (mob_db[class].job_exp > 0 - && (mob_db[class].job_exp * battle_config.job_exp_rate / + mob_db[mob_class].job_exp = atoi (str[7]); + if (mob_db[mob_class].job_exp < 0) + mob_db[mob_class].job_exp = 0; + else if (mob_db[mob_class].job_exp > 0 + && (mob_db[mob_class].job_exp * battle_config.job_exp_rate / 100 > 1000000000 - || mob_db[class].job_exp * + || mob_db[mob_class].job_exp * battle_config.job_exp_rate / 100 < 0)) - mob_db[class].job_exp = 1000000000; + mob_db[mob_class].job_exp = 1000000000; else - mob_db[class].job_exp *= battle_config.job_exp_rate / 100; - - mob_db[class].range = atoi (str[8]); - mob_db[class].atk1 = atoi (str[9]); - mob_db[class].atk2 = atoi (str[10]); - mob_db[class].def = atoi (str[11]); - mob_db[class].mdef = atoi (str[12]); - mob_db[class].str = atoi (str[13]); - mob_db[class].agi = atoi (str[14]); - mob_db[class].vit = atoi (str[15]); - mob_db[class].int_ = atoi (str[16]); - mob_db[class].dex = atoi (str[17]); - mob_db[class].luk = atoi (str[18]); - mob_db[class].range2 = atoi (str[19]); - mob_db[class].range3 = atoi (str[20]); - mob_db[class].size = atoi (str[21]); - mob_db[class].race = atoi (str[22]); - mob_db[class].element = atoi (str[23]); - mob_db[class].mode = atoi (str[24]); - mob_db[class].speed = atoi (str[25]); - mob_db[class].adelay = atoi (str[26]); - mob_db[class].amotion = atoi (str[27]); - mob_db[class].dmotion = atoi (str[28]); + mob_db[mob_class].job_exp *= battle_config.job_exp_rate / 100; + + mob_db[mob_class].range = atoi (str[8]); + mob_db[mob_class].atk1 = atoi (str[9]); + mob_db[mob_class].atk2 = atoi (str[10]); + mob_db[mob_class].def = atoi (str[11]); + mob_db[mob_class].mdef = atoi (str[12]); + mob_db[mob_class].str = atoi (str[13]); + mob_db[mob_class].agi = atoi (str[14]); + mob_db[mob_class].vit = atoi (str[15]); + mob_db[mob_class].int_ = atoi (str[16]); + mob_db[mob_class].dex = atoi (str[17]); + mob_db[mob_class].luk = atoi (str[18]); + mob_db[mob_class].range2 = atoi (str[19]); + mob_db[mob_class].range3 = atoi (str[20]); + mob_db[mob_class].size = atoi (str[21]); + mob_db[mob_class].race = atoi (str[22]); + mob_db[mob_class].element = atoi (str[23]); + mob_db[mob_class].mode = atoi (str[24]); + mob_db[mob_class].speed = atoi (str[25]); + mob_db[mob_class].adelay = atoi (str[26]); + mob_db[mob_class].amotion = atoi (str[27]); + mob_db[mob_class].dmotion = atoi (str[28]); for (i = 0; i < 8; i++) { int rate = 0, type, ratemin, ratemax; - mob_db[class].dropitem[i].nameid = atoi (str[29 + i * 2]); - type = itemdb_type (mob_db[class].dropitem[i].nameid); + mob_db[mob_class].dropitem[i].nameid = atoi (str[29 + i * 2]); + type = itemdb_type (mob_db[mob_class].dropitem[i].nameid); if (type == 0) { // Added [Valaris] rate = battle_config.item_rate_heal; @@ -4642,38 +4636,38 @@ static int mob_readdb (void) rate = (rate < ratemin) ? ratemin : (rate > ratemax) ? ratemax : rate; - mob_db[class].dropitem[i].p = rate; + mob_db[mob_class].dropitem[i].p = rate; } // Item1,Item2 - mob_db[class].mexp = + mob_db[mob_class].mexp = atoi (str[45]) * battle_config.mvp_exp_rate / 100; - mob_db[class].mexpper = atoi (str[46]); + mob_db[mob_class].mexpper = atoi (str[46]); for (i = 0; i < 3; i++) { - mob_db[class].mvpitem[i].nameid = atoi (str[47 + i * 2]); - mob_db[class].mvpitem[i].p = + mob_db[mob_class].mvpitem[i].nameid = atoi (str[47 + i * 2]); + mob_db[mob_class].mvpitem[i].p = atoi (str[48 + i * 2]) * battle_config.mvp_item_rate / 100; } - mob_db[class].mutations_nr = atoi (str[55]); - mob_db[class].mutation_power = atoi (str[56]); + mob_db[mob_class].mutations_nr = atoi (str[55]); + mob_db[mob_class].mutation_power = atoi (str[56]); for (i = 0; i < MAX_RANDOMMONSTER; i++) - mob_db[class].summonper[i] = 0; - mob_db[class].maxskill = 0; - - mob_db[class].sex = 0; - mob_db[class].hair = 0; - mob_db[class].hair_color = 0; - mob_db[class].weapon = 0; - mob_db[class].shield = 0; - mob_db[class].head_top = 0; - mob_db[class].head_mid = 0; - mob_db[class].head_buttom = 0; - mob_db[class].clothes_color = 0; //Add for player monster dye - Valaris - - if (mob_db[class].base_exp == 0) - mob_db[class].base_exp = mob_gen_exp (&mob_db[class]); + mob_db[mob_class].summonper[i] = 0; + mob_db[mob_class].maxskill = 0; + + mob_db[mob_class].sex = 0; + mob_db[mob_class].hair = 0; + mob_db[mob_class].hair_color = 0; + mob_db[mob_class].weapon = 0; + mob_db[mob_class].shield = 0; + mob_db[mob_class].head_top = 0; + mob_db[mob_class].head_mid = 0; + mob_db[mob_class].head_buttom = 0; + mob_db[mob_class].clothes_color = 0; //Add for player monster dye - Valaris + + if (mob_db[mob_class].base_exp == 0) + mob_db[mob_class].base_exp = mob_gen_exp (&mob_db[mob_class]); } fclose_ (fp); printf ("read %s done\n", filename[i]); @@ -4690,7 +4684,7 @@ static int mob_readdb_mobavail (void) FILE *fp; char line[1024]; int ln = 0; - int class, j, k; + int mob_class, j, k; char *str[20], *p, *np; if ((fp = fopen_ ("db/mob_avail.txt", "r")) == NULL) @@ -4720,31 +4714,31 @@ static int mob_readdb_mobavail (void) if (str[0] == NULL) continue; - class = atoi (str[0]); + mob_class = atoi (str[0]); - if (class <= 1000 || class > 2000) // 値が異常なら処理しない。 + if (mob_class <= 1000 || mob_class > 2000) // 値が異常なら処理しない。 continue; k = atoi (str[1]); if (k >= 0) - mob_db[class].view_class = k; + mob_db[mob_class].view_class = k; - if ((mob_db[class].view_class < 24) - || (mob_db[class].view_class > 4000)) + if ((mob_db[mob_class].view_class < 24) + || (mob_db[mob_class].view_class > 4000)) { - mob_db[class].sex = atoi (str[2]); - mob_db[class].hair = atoi (str[3]); - mob_db[class].hair_color = atoi (str[4]); - mob_db[class].weapon = atoi (str[5]); - mob_db[class].shield = atoi (str[6]); - mob_db[class].head_top = atoi (str[7]); - mob_db[class].head_mid = atoi (str[8]); - mob_db[class].head_buttom = atoi (str[9]); - mob_db[class].option = atoi (str[10]) & ~0x46; - mob_db[class].clothes_color = atoi (str[11]); // Monster player dye option - Valaris + mob_db[mob_class].sex = atoi (str[2]); + mob_db[mob_class].hair = atoi (str[3]); + mob_db[mob_class].hair_color = atoi (str[4]); + mob_db[mob_class].weapon = atoi (str[5]); + mob_db[mob_class].shield = atoi (str[6]); + mob_db[mob_class].head_top = atoi (str[7]); + mob_db[mob_class].head_mid = atoi (str[8]); + mob_db[mob_class].head_buttom = atoi (str[9]); + mob_db[mob_class].option = atoi (str[10]) & ~0x46; + mob_db[mob_class].clothes_color = atoi (str[11]); // Monster player dye option - Valaris } else if (atoi (str[2]) > 0) - mob_db[class].equip = atoi (str[2]); // mob equipment [Valaris] + mob_db[mob_class].equip = atoi (str[2]); // mob equipment [Valaris] ln++; } @@ -4781,7 +4775,7 @@ static int mob_read_randommonster (void) } while (fgets (line, 1020, fp)) { - int class, per; + int mob_class, per; if (line[0] == '/' && line[1] == '/') continue; memset (str, 0, sizeof (str)); @@ -4796,10 +4790,10 @@ static int mob_read_randommonster (void) if (str[0] == NULL || str[2] == NULL) continue; - class = atoi (str[0]); + mob_class = atoi (str[0]); per = atoi (str[2]); - if ((class > 1000 && class <= 2000) || class == 0) - mob_db[class].summonper[i] = per; + if ((mob_class > 1000 && mob_class <= 2000) || mob_class == 0) + mob_db[mob_class].summonper[i] = per; } fclose_ (fp); printf ("read %s done\n", mobfile[i]); diff --git a/src/map/mob.h b/src/map/mob.h index aff305b..b5d642a 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -96,14 +96,14 @@ enum int mobdb_searchname (const char *str); int mobdb_checkid (const int id); int mob_once_spawn (struct map_session_data *sd, char *mapname, - int x, int y, const char *mobname, int class, int amount, + int x, int y, const char *mobname, int class_, int amount, const char *event); int mob_once_spawn_area (struct map_session_data *sd, char *mapname, int x0, int y0, int x1, int y1, const char *mobname, - int class, int amount, const char *event); + int class_, int amount, const char *event); int mob_spawn_guardian (struct map_session_data *sd, char *mapname, // Spawning Guardians [Valaris] - int x, int y, const char *mobname, int class, int amount, const char *event, int guardian); // Spawning Guardians [Valaris] + int x, int y, const char *mobname, int class_, int amount, const char *event, int guardian); // Spawning Guardians [Valaris] int mob_walktoxy (struct mob_data *md, int x, int y, int easy); diff --git a/src/map/npc.c b/src/map/npc.c index a4e1cf1..a925430 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -85,7 +85,7 @@ int npc_enable_sub (struct block_list *bl, va_list ap) int npc_enable (const char *name, int flag) { - struct npc_data *nd = strdb_search (npcname_db, name); + struct npc_data *nd = (struct npc_data *)strdb_search (npcname_db, name); if (nd == NULL) return 0; @@ -125,7 +125,7 @@ int npc_enable (const char *name, int flag) */ struct npc_data *npc_name2id (const char *name) { - return strdb_search (npcname_db, name); + return (struct npc_data *)strdb_search (npcname_db, name); } /*========================================== @@ -184,7 +184,7 @@ void npc_event_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t d int npc_timer_event (const char *eventname) // Added by RoVeRT { - struct event_data *ev = strdb_search (ev_db, eventname); + struct event_data *ev = (struct event_data *)strdb_search (ev_db, eventname); struct npc_data *nd; // int xs,ys; @@ -261,14 +261,9 @@ int npc_event_export (void *key, void *data, va_list ap) char *buf; char *p = strchr (lname, ':'); // エクスポートされる - ev = calloc (sizeof (struct event_data), 1); - buf = calloc (50, 1); - if (ev == NULL || buf == NULL) - { - printf ("npc_event_export: out of memory !\n"); - exit (1); - } - else if (p == NULL || (p - lname) > 24) + CREATE (ev, struct event_data, 1); + CREATE (buf, char, 50); + if (p == NULL || (p - lname) > 24) { printf ("npc_event_export: label name error !\n"); exit (1); @@ -428,12 +423,8 @@ int npc_addeventtimer (struct npc_data *nd, int tick, const char *name) break; if (i < MAX_EVENTTIMER) { - char *evname = malloc (24); - if (evname == NULL) - { - printf ("npc_addeventtimer: out of memory !\n"); - exit (1); - } + char *evname; + CREATE (evname, char, 24); memcpy (evname, name, 24); nd->eventtimer[i] = add_timer (gettick () + tick, npc_event_timer, nd->bl.id, @@ -529,15 +520,7 @@ int npc_timerevent_import (void *key, void *data, va_list ap) // タイマーイベント struct npc_timerevent_list *te = nd->u.scr.timer_event; int j, i = nd->u.scr.timeramount; - if (te == NULL) - te = malloc (sizeof (struct npc_timerevent_list)); - else - te = realloc (te, sizeof (struct npc_timerevent_list) * (i + 1)); - if (te == NULL) - { - printf ("npc_timerevent_import: out of memory !\n"); - exit (1); - } + RECREATE (te, struct npc_timerevent_list, i+1); for (j = 0; j < i; j++) { if (te[j].timer > t) @@ -677,7 +660,7 @@ int npc_settimerevent_tick (struct npc_data *nd, int newtimer) int npc_event (struct map_session_data *sd, const char *eventname, int mob_kill) { - struct event_data *ev = strdb_search (ev_db, eventname); + struct event_data *ev = (struct event_data *)strdb_search (ev_db, eventname); struct npc_data *nd; int xs, ys; char mobevent[100]; @@ -697,7 +680,7 @@ int npc_event (struct map_session_data *sd, const char *eventname, { strcpy (mobevent, eventname); strcat (mobevent, "::OnMyMobDead"); - ev = strdb_search (ev_db, mobevent); + ev = (struct event_data *)strdb_search (ev_db, mobevent); if (ev == NULL || (nd = ev->nd) == NULL) { if (strncasecmp (eventname, "GM_MONSTER", 10) != 0) @@ -847,7 +830,7 @@ int npc_touch_areanpc (struct map_session_data *sd, int m, int x, int y) case MESSAGE: case SCRIPT: { - char *name = calloc (50, 1); + char *name = (char *)malloc (50); memcpy (name, map[m].npc[i]->name, 50); if (sd->areanpc_id == map[m].npc[i]->bl.id) @@ -880,7 +863,7 @@ int npc_checknear (struct map_session_data *sd, int id) return 1; } - if (nd->class < 0) // イベント系は常にOK + if (nd->npc_class < 0) // イベント系は常にOK return 0; // エリア判定 @@ -1019,7 +1002,7 @@ int npc_buylist (struct map_session_data *sd, int n, { struct npc_data *nd; double z; - int i, j, w, skill, itemamount = 0, new = 0; + int i, j, w, skill, itemamount = 0, new_stacks = 0; nullpo_retr (3, sd); nullpo_retr (3, item_list); @@ -1055,9 +1038,9 @@ int npc_buylist (struct map_session_data *sd, int n, break; case ADDITEM_NEW: if (itemdb_isequip (item_list[i * 2 + 1])) - new += item_list[i * 2]; + new_stacks += item_list[i * 2]; else - new++; + new_stacks++; break; case ADDITEM_OVERAMOUNT: return 2; @@ -1070,7 +1053,7 @@ int npc_buylist (struct map_session_data *sd, int n, return 1; // zeny不足 if (w + sd->weight > sd->max_weight) return 2; // 重量超過 - if (pc_inventoryblank (sd) < new) + if (pc_inventoryblank (sd) < new_stacks) return 3; // 種類数超過 if (sd->trade_partner != 0) return 4; // cant buy while trading @@ -1201,7 +1184,7 @@ int npc_selllist (struct map_session_data *sd, int n, * 読み込むnpcファイルのクリア *------------------------------------------ */ -void npc_clearsrcfile () +void npc_clearsrcfile (void) { struct npc_src_list *p = npc_src_first; @@ -1221,7 +1204,7 @@ void npc_clearsrcfile () */ void npc_addsrcfile (char *name) { - struct npc_src_list *new; + struct npc_src_list *new_src; size_t len; if (strcasecmp (name, "clear") == 0) @@ -1230,16 +1213,16 @@ void npc_addsrcfile (char *name) return; } - len = sizeof (*new) + strlen (name); - new = (struct npc_src_list *) calloc (1, len); - new->next = NULL; - strncpy (new->name, name, strlen (name) + 1); + len = sizeof (*new_src) + strlen (name); + new_src = (struct npc_src_list *) calloc (1, len); + new_src->next = NULL; + strncpy (new_src->name, name, strlen (name) + 1); if (npc_src_first == NULL) - npc_src_first = new; + npc_src_first = new_src; if (npc_src_last) - npc_src_last->next = new; + npc_src_last->next = new_src; - npc_src_last = new; + npc_src_last = new_src; } /*========================================== @@ -1306,9 +1289,9 @@ int npc_parse_warp (char *w1, char *w2, char *w3, char *w4) nd->chat_id = 0; if (!battle_config.warp_point_debug) - nd->class = WARP_CLASS; + nd->npc_class = WARP_CLASS; else - nd->class = WARP_DEBUG_CLASS; + nd->npc_class = WARP_DEBUG_CLASS; nd->speed = 200; nd->option = 0; nd->opt1 = 0; @@ -1421,7 +1404,7 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4) nd->dir = dir; nd->flag = 0; memcpy (nd->name, w3, 24); - nd->class = atoi (w4); + nd->npc_class = atoi (w4); nd->speed = 200; nd->chat_id = 0; nd->option = 0; @@ -1488,7 +1471,7 @@ void npc_convertlabel_db (db_key_t key, db_val_t data, va_list ap) static int npc_parse_script (char *w1, char *w2, char *w3, char *w4, char *first_line, FILE * fp, int *lines) { - int x, y, dir = 0, m, xs = 0, ys = 0, class = 0; // [Valaris] thanks to fov + int x, y, dir = 0, m, xs = 0, ys = 0, npc_class = 0; // [Valaris] thanks to fov char mapname[24]; unsigned char *srcbuf = NULL, *script; int srcsize = 65536; @@ -1598,7 +1581,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4, // スクリプトコピー用のダミーNPC } - else if (sscanf (w4, "%d,%d,%d", &class, &xs, &ys) == 3) + else if (sscanf (w4, "%d,%d,%d", &npc_class, &xs, &ys) == 3) { // 接触型NPC int i, j; @@ -1608,7 +1591,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4, if (ys >= 0) ys = ys * 2 + 1; - if (class >= 0) + if (npc_class >= 0) { for (i = 0; i < ys; i++) @@ -1629,12 +1612,12 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4, } else { // クリック型NPC - class = atoi (w4); + npc_class = atoi (w4); nd->u.scr.xs = 0; nd->u.scr.ys = 0; } - if (class < 0 && m >= 0) + if (npc_class < 0 && m >= 0) { // イベント型NPC evflag = 1; } @@ -1663,7 +1646,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4, nd->bl.id = npc_get_new_npc_id (); nd->dir = dir; nd->flag = 0; - nd->class = class; + nd->npc_class = npc_class; nd->speed = 200; nd->u.scr.script = script; nd->u.scr.src_id = src_id; @@ -1873,7 +1856,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, */ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4) { - int m, x, y, xs, ys, class, num, delay1, delay2; + int m, x, y, xs, ys, mob_class, num, delay1, delay2; int i; char mapname[24]; char eventname[24] = ""; @@ -1883,7 +1866,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4) delay1 = delay2 = 0; // 引数の個数チェック if (sscanf (w1, "%[^,],%d,%d,%d,%d", mapname, &x, &y, &xs, &ys) < 3 || - sscanf (w4, "%d,%d,%d,%d,%s", &class, &num, &delay1, &delay2, + sscanf (w4, "%d,%d,%d,%d,%s", &mob_class, &num, &delay1, &delay2, eventname) < 2) { printf ("bad monster line : %s\n", w3); @@ -1908,14 +1891,14 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4) md->bl.x = x; md->bl.y = y; if (strcmp (w3, "--en--") == 0) - memcpy (md->name, mob_db[class].name, 24); + memcpy (md->name, mob_db[mob_class].name, 24); else if (strcmp (w3, "--ja--") == 0) - memcpy (md->name, mob_db[class].jname, 24); + memcpy (md->name, mob_db[mob_class].jname, 24); else memcpy (md->name, w3, 24); md->n = i; - md->base_class = md->class = class; + md->base_class = md->mob_class = mob_class; md->bl.id = npc_get_new_npc_id (); md->m = m; md->x0 = x; @@ -1930,7 +1913,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4) md->target_id = 0; md->attacked_id = 0; - if (mob_db[class].mode & 0x02) + if (mob_db[mob_class].mode & 0x02) md->lootitem = (struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item)); else @@ -2142,7 +2125,7 @@ static void ev_db_final (db_key_t key, db_val_t data, va_list ap) } struct npc_data *npc_spawn_text (int m, int x, int y, - int class, char *name, char *message) + int npc_class, char *name, char *message) { struct npc_data *retval = (struct npc_data *) calloc (1, sizeof (struct npc_data)); @@ -2159,7 +2142,7 @@ struct npc_data *npc_spawn_text (int m, int x, int y, retval->exname[15] = 0; retval->u.message = message ? strdup (message) : NULL; - retval->class = class; + retval->npc_class = npc_class; retval->speed = 200; clif_spawnnpc (retval); diff --git a/src/map/npc.h b/src/map/npc.h index 248bad7..757c7ab 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -33,7 +33,7 @@ int npc_get_new_npc_id (void); * * \param message The message to speak. If message is NULL, the NPC will not do anything at all. */ -struct npc_data *npc_spawn_text (int m, int x, int y, int class, char *name, char *message); // message is strdup'd within +struct npc_data *npc_spawn_text (int m, int x, int y, int class_, char *name, char *message); // message is strdup'd within /** * Uninstalls and frees an NPC diff --git a/src/map/party.c b/src/map/party.c index cc35d2a..6c2e627 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -52,7 +52,7 @@ void do_init_party (void) // 検索 struct party *party_search (int party_id) { - return numdb_search (party_db, party_id); + return (struct party *)numdb_search (party_db, party_id); } void party_searchname_sub (db_key_t key, db_val_t data, va_list ap) @@ -110,7 +110,7 @@ int party_created (int account_id, int fail, int party_id, char *name) struct party *p; sd->status.party_id = party_id; - if ((p = numdb_search (party_db, party_id)) != NULL) + if ((p = (struct party *)numdb_search (party_db, party_id)) != NULL) { printf ("party_created(): ID already exists!\n"); exit (1); @@ -147,7 +147,7 @@ int party_check_member (struct party *p) for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth) + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) { if (sd->status.party_id == p->party_id) { @@ -182,7 +182,7 @@ int party_recv_noinfo (int party_id) struct map_session_data *sd; for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth) + if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) { if (sd->status.party_id == party_id) sd->status.party_id = 0; @@ -199,7 +199,7 @@ int party_recv_info (struct party *sp) nullpo_retr (0, sp); - if ((p = numdb_search (party_db, sp->party_id)) == NULL) + if ((p = (struct party *)numdb_search (party_db, sp->party_id)) == NULL) { CREATE (p, struct party, 1); numdb_insert (party_db, sp->party_id, p); diff --git a/src/map/pc.c b/src/map/pc.c index aea9cb5..b76116b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -149,7 +149,7 @@ int pc_set_gm_level (int account_id, int level) } GM_num++; - gm_account = realloc (gm_account, sizeof (struct gm_account) * GM_num); + RECREATE (gm_account, struct gm_account, GM_num); gm_account[GM_num - 1].account_id = account_id; gm_account[GM_num - 1].level = level; return 0; @@ -317,7 +317,7 @@ int pc_setrestartvalue (struct map_session_data *sd, int type) nullpo_retr (0, sd); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); //----------------------- // 死亡した @@ -358,7 +358,7 @@ int pc_setrestartvalue (struct map_session_data *sd, int type) /* removed exp penalty on spawn [Valaris] */ - if (type & 2 && sd->status.class != 0 && battle_config.zeny_penalty > 0 + if (type & 2 && sd->status.pc_class != 0 && battle_config.zeny_penalty > 0 && !map[sd->bl.m].flag.nozenypenalty) { int zeny = @@ -511,7 +511,7 @@ int pc_equippoint (struct map_session_data *sd, int n) if (!sd->inventory_data[n]) return 0; - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); ep = sd->inventory_data[n]->equip; if ((sd->inventory_data[n]->look == 1 || sd->inventory_data[n]->look == 2 @@ -788,7 +788,7 @@ int pc_authok (int id, int login_id2, time_t connect_until_time, sd->bl.prev = sd->bl.next = NULL; sd->weapontype1 = sd->weapontype2 = 0; - sd->view_class = sd->status.class; + sd->view_class = sd->status.pc_class; sd->speed = DEFAULT_WALK_SPEED; sd->state.dead_sit = 0; sd->dir = 0; @@ -1026,7 +1026,7 @@ int pc_calc_skilltree (struct map_session_data *sd) nullpo_retr (0, sd); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); c = s_class.job; s = (s_class.upper == 1) ? 1 : 0; //ソ転生以外は通常のスキル? @@ -1257,7 +1257,7 @@ int pc_calcstatus (struct map_session_data *sd, int first) nullpo_retr (0, sd); //転生や養子の場合の元の職業を算出する - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); b_speed = sd->speed; b_max_hp = sd->status.max_hp; @@ -1284,7 +1284,7 @@ int pc_calcstatus (struct map_session_data *sd, int first) b_mdef = sd->mdef; b_mdef2 = sd->mdef2; b_class = sd->view_class; - sd->view_class = sd->status.class; + sd->view_class = sd->status.pc_class; b_base_atk = sd->base_atk; pc_calc_skilltree (sd); // スキルツリーの計算 @@ -2026,15 +2026,15 @@ int pc_calcstatus (struct map_session_data *sd, int first) //Flee上昇 if ((skill = pc_checkskill (sd, TF_MISS)) > 0) { // 回避率増加 - if (sd->status.class == 6 || sd->status.class == 4007 - || sd->status.class == 23) + if (sd->status.pc_class == 6 || sd->status.pc_class == 4007 + || sd->status.pc_class == 23) { sd->flee += skill * 3; } - if (sd->status.class == 12 || sd->status.class == 17 - || sd->status.class == 4013 || sd->status.class == 4018) + if (sd->status.pc_class == 12 || sd->status.pc_class == 17 + || sd->status.pc_class == 4013 || sd->status.pc_class == 4018) sd->flee += skill * 4; - if (sd->status.class == 12 || sd->status.class == 4013) + if (sd->status.pc_class == 12 || sd->status.pc_class == 4013) sd->speed -= sd->speed * (skill * .5) / 100; } if ((skill = pc_checkskill (sd, MO_DODGE)) > 0) // 見切り @@ -3960,24 +3960,26 @@ int pc_steal_item (struct map_session_data *sd, struct block_list *bl) int i, skill, rate, itemid, flag, count; struct mob_data *md; md = (struct mob_data *) bl; - if (!md->state.steal_flag && mob_db[md->class].mexp <= 0 && !(mob_db[md->class].mode & 0x20) && md->sc_data[SC_STONE].timer == -1 && md->sc_data[SC_FREEZE].timer == -1 && (!(md->class > 1324 && md->class < 1364))) // prevent stealing from treasure boxes [Valaris] + if (!md->state.steal_flag && mob_db[md->mob_class].mexp <= 0 && + !(mob_db[md->mob_class].mode & 0x20) && + md->sc_data[SC_STONE].timer == -1 && + md->sc_data[SC_FREEZE].timer == -1 && + (!(md->mob_class > 1324 && md->mob_class < 1364))) // prevent stealing from treasure boxes [Valaris] { - skill = - sd->paramc[4] - mob_db[md->class].dex + pc_checkskill (sd, - TF_STEAL) - + 10; + skill = sd->paramc[4] - mob_db[md->mob_class].dex + + pc_checkskill (sd, TF_STEAL) + 10; if (0 < skill) { for (count = 8; count <= 8 && count != 0; count--) { i = rand () % 8; - itemid = mob_db[md->class].dropitem[i].nameid; + itemid = mob_db[md->mob_class].dropitem[i].nameid; if (itemid > 0 && itemdb_type (itemid) != 6) { rate = - (mob_db[md->class].dropitem[i].p / + (mob_db[md->mob_class].dropitem[i].p / battle_config.item_rate_common * 100 * skill) / 100; @@ -4033,11 +4035,11 @@ int pc_steal_coin (struct map_session_data *sd, struct block_list *bl) { skill = pc_checkskill (sd, RG_STEALCOIN) * 10; rate = - skill + (sd->status.base_level - mob_db[md->class].lv) * 3 + + skill + (sd->status.base_level - mob_db[md->mob_class].lv) * 3 + sd->paramc[4] * 2 + sd->paramc[5] * 2; if (MRAND (1000) < rate) { - pc_getzeny (sd, mob_db[md->class].lv * 10 + MRAND (100)); + pc_getzeny (sd, mob_db[md->mob_class].lv * 10 + MRAND (100)); md->state.steal_coin_flag = 1; return 1; } @@ -5078,7 +5080,7 @@ int pc_checkbaselevelup (struct map_session_data *sd) if (sd->status.base_exp >= next && next > 0) { - struct pc_base_job s_class = pc_calc_base_job (sd->status.class); + struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class); // base側レベルアップ処理 sd->status.base_exp -= next; @@ -5306,17 +5308,17 @@ int pc_nextbaseexp (struct map_session_data *sd) if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; - if (sd->status.class == 0) + if (sd->status.pc_class == 0) i = 0; - else if (sd->status.class <= 6) + else if (sd->status.pc_class <= 6) i = 1; - else if (sd->status.class <= 22) + else if (sd->status.pc_class <= 22) i = 2; - else if (sd->status.class == 23) + else if (sd->status.pc_class == 23) i = 3; - else if (sd->status.class == 4001) + else if (sd->status.pc_class == 4001) i = 4; - else if (sd->status.class <= 4007) + else if (sd->status.pc_class <= 4007) i = 5; else i = 6; @@ -5351,17 +5353,17 @@ int pc_nextbaseafter (struct map_session_data *sd) if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; - if (sd->status.class == 0) + if (sd->status.pc_class == 0) i = 0; - else if (sd->status.class <= 6) + else if (sd->status.pc_class <= 6) i = 1; - else if (sd->status.class <= 22) + else if (sd->status.pc_class <= 22) i = 2; - else if (sd->status.class == 23) + else if (sd->status.pc_class == 23) i = 3; - else if (sd->status.class == 4001) + else if (sd->status.pc_class == 4001) i = 4; - else if (sd->status.class <= 4007) + else if (sd->status.pc_class <= 4007) i = 5; else i = 6; @@ -5382,17 +5384,17 @@ int pc_nextjobafter (struct map_session_data *sd) if (sd->status.job_level >= MAX_LEVEL || sd->status.job_level <= 0) return 0; - if (sd->status.class == 0) + if (sd->status.pc_class == 0) i = 7; - else if (sd->status.class <= 6) + else if (sd->status.pc_class <= 6) i = 8; - else if (sd->status.class <= 22) + else if (sd->status.pc_class <= 22) i = 9; - else if (sd->status.class == 23) + else if (sd->status.pc_class == 23) i = 10; - else if (sd->status.class == 4001) + else if (sd->status.pc_class == 4001) i = 11; - else if (sd->status.class <= 4007) + else if (sd->status.pc_class <= 4007) i = 12; else i = 13; @@ -5617,7 +5619,7 @@ int pc_allskillup (struct map_session_data *sd) nullpo_retr (0, sd); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); c = s_class.job; s = (s_class.upper == 1) ? 1 : 0; //転生以外は通常のスキル? @@ -5679,7 +5681,7 @@ int pc_resetlvl (struct map_session_data *sd, int type) sd->status.int_ = 1; sd->status.dex = 1; sd->status.luk = 1; - if (sd->status.class == 4001) + if (sd->status.pc_class == 4001) sd->status.status_point = 100; } @@ -5832,7 +5834,7 @@ int pc_damage (struct block_list *src, struct map_session_data *sd, nullpo_retr (0, sd); //転生や養子の場合の元の職業を算出する - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); // 既に死んでいたら無効 if (pc_isdead (sd)) return 0; @@ -6117,7 +6119,7 @@ int pc_readparam (struct map_session_data *sd, int type) int val = 0; struct pc_base_job s_class; - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); nullpo_retr (0, sd); @@ -6142,7 +6144,7 @@ int pc_readparam (struct map_session_data *sd, int type) if (val >= 24 && val < 45) val += 3978; else - val = sd->status.class; + val = sd->status.pc_class; break; case SP_UPPER: val = s_class.upper; @@ -6217,7 +6219,7 @@ int pc_setparam (struct map_session_data *sd, int type, int val) nullpo_retr (0, sd); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); switch (type) { @@ -6238,10 +6240,10 @@ int pc_setparam (struct map_session_data *sd, int type, int val) pc_heal (sd, sd->status.max_hp, sd->status.max_sp); break; case SP_JOBLEVEL: - if (sd->status.class == 0) + if (sd->status.pc_class == 0) up_level -= 40; - if ((sd->status.class == 23) - || (sd->status.class >= 4001 && sd->status.class <= 4022)) + if ((sd->status.pc_class == 23) + || (sd->status.pc_class >= 4001 && sd->status.pc_class <= 4022)) up_level += 20; if (val >= sd->status.job_level) { @@ -6627,7 +6629,7 @@ int pc_jobchange (struct map_session_data *sd, int job, int upper) int i; int b_class = 0; //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class = pc_calc_base_job (sd->status.class); + struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class); nullpo_retr (0, sd); @@ -6666,10 +6668,10 @@ int pc_jobchange (struct map_session_data *sd, int job, int upper) if ((sd->status.sex == 0 && job == 19) || (sd->status.sex == 1 && job == 20) || (sd->status.sex == 0 && job == 4020) || (sd->status.sex == 1 && job == 4021) || - job == 22 || sd->status.class == b_class) //♀はバードになれない、♂はダンサーになれない、結婚衣裳もお断り + job == 22 || sd->status.pc_class == b_class) //♀はバードになれない、♂はダンサーになれない、結婚衣裳もお断り return 1; - sd->status.class = sd->view_class = b_class; + sd->status.pc_class = sd->view_class = b_class; sd->status.job_level = 1; sd->status.job_exp = 0; @@ -6843,17 +6845,17 @@ int pc_setriding (struct map_session_data *sd) { // ライディングスキル所持 pc_setoption (sd, sd->status.option | 0x0020); - if (sd->status.class == 7) - sd->status.class = sd->view_class = 13; + if (sd->status.pc_class == 7) + sd->status.pc_class = sd->view_class = 13; - if (sd->status.class == 14) - sd->status.class = sd->view_class = 21; + if (sd->status.pc_class == 14) + sd->status.pc_class = sd->view_class = 21; - if (sd->status.class == 4008) - sd->status.class = sd->view_class = 4014; + if (sd->status.pc_class == 4008) + sd->status.pc_class = sd->view_class = 4014; - if (sd->status.class == 4015) - sd->status.class = sd->view_class = 4022; + if (sd->status.pc_class == 4015) + sd->status.pc_class = sd->view_class = 4022; } return 0; @@ -6895,15 +6897,7 @@ int pc_setreg (struct map_session_data *sd, int reg, int val) } } sd->reg_num++; - sd->reg = realloc (sd->reg, sizeof (*(sd->reg)) * sd->reg_num); - if (sd->reg == NULL) - { - printf ("out of memory : pc_setreg\n"); - exit (1); - } -/* memset(sd->reg + (sd->reg_num - 1) * sizeof(*(sd->reg)), 0, - sizeof(*(sd->reg))); -*/ + RECREATE (sd->reg, struct script_reg, sd->reg_num); sd->reg[i].index = reg; sd->reg[i].data = val; @@ -6950,16 +6944,7 @@ int pc_setregstr (struct map_session_data *sd, int reg, char *str) return 0; } sd->regstr_num++; - sd->regstr = - realloc (sd->regstr, sizeof (sd->regstr[0]) * sd->regstr_num); - if (sd->regstr == NULL) - { - printf ("out of memory : pc_setreg\n"); - exit (1); - } -/* memset(sd->reg + (sd->reg_num - 1) * sizeof(*(sd->reg)), 0, - sizeof(*(sd->reg))); -*/ + RECREATE (sd->regstr, struct script_regstr, sd->regstr_num); sd->regstr[i].index = reg; strcpy (sd->regstr[i].data, str); @@ -7395,7 +7380,7 @@ int pc_equipitem (struct map_session_data *sd, int n, int pos) // 二刀流処理 if ((pos == 0x22) // 一応、装備要求箇所が二刀流武器かチェックする && (id->equip == 2) // 単 手武器 - && (pc_checkskill (sd, AS_LEFT) > 0 || sd->status.class == 12)) // 左手修錬有 + && (pc_checkskill (sd, AS_LEFT) > 0 || sd->status.pc_class == 12)) // 左手修錬有 { int tpos = 0; if (sd->equip_index[8] >= 0) @@ -8137,7 +8122,7 @@ static int pc_natural_heal_sp (struct map_session_data *sd) if (sd->inchealsptick >= battle_config.natural_heal_skill_interval && sd->status.sp < sd->status.max_sp) { - struct pc_base_job s_class = pc_calc_base_job (sd->status.class); + struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class); if (sd->doridori_counter && s_class.job == 23) bonus = sd->nshealsp * 2; else @@ -8474,8 +8459,7 @@ int pc_read_gm_account (int fd) free (gm_account); GM_num = 0; - gm_account = - calloc (sizeof (struct gm_account) * ((RFIFOW (fd, 2) - 4) / 5), 1); + CREATE (gm_account, struct gm_account, (RFIFOW (fd, 2) - 4) / 5); for (i = 4; i < RFIFOW (fd, 2); i = i + 5) { gm_account[GM_num].account_id = RFIFOL (fd, i); @@ -8504,7 +8488,7 @@ void map_day_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t dat night_flag = 0; // 0=day, 1=night [Yor] for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_sd->opt2 &= ~STATE_BLIND; @@ -8535,7 +8519,7 @@ void map_night_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t d night_flag = 1; // 0=day, 1=night [Yor] for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { pl_sd->opt2 |= STATE_BLIND; diff --git a/src/map/script.c b/src/map/script.c index 626babf..533c436 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -51,13 +51,13 @@ static int script_pos, script_size; char *str_buf; int str_pos, str_size; -static struct +static struct str_data_t { int type; int str; int backpatch; int label; - int (*func) (); + int (*func) (struct script_state *); int val; int next; } *str_data; @@ -73,12 +73,12 @@ char mapreg_txt[256] = "save/mapreg.txt"; static struct dbt *scriptlabel_db = NULL; static struct dbt *userfunc_db = NULL; -struct dbt *script_get_label_db () +struct dbt *script_get_label_db (void) { return scriptlabel_db; } -struct dbt *script_get_userfunc_db () +struct dbt *script_get_userfunc_db (void) { if (!userfunc_db) userfunc_db = strdb_init (50); @@ -323,7 +323,7 @@ int mapreg_setregstr (int num, const char *str); struct { - int (*func) (); + int (*func) (struct script_state *); char *name; char *arg; } buildin_func[] = @@ -833,7 +833,7 @@ static int add_str (const unsigned char *p) if (str_num >= str_data_size) { str_data_size += 128; - str_data = realloc (str_data, sizeof (str_data[0]) * str_data_size); + RECREATE (str_data, struct str_data_t, str_data_size); memset (str_data + (str_data_size - 128), '\0', 128); } while (str_pos + strlen (p) + 1 >= str_size) @@ -1939,7 +1939,7 @@ int buildin_callfunc (struct script_state *st) char *scr; char *str = conv_str (st, &(st->stack->stack_data[st->start + 2])); - if ((scr = strdb_search (script_get_userfunc_db (), str))) + if ((scr = (char*)strdb_search (script_get_userfunc_db (), str))) { int i, j; for (i = st->start + 3, j = 0; i < st->end; i++, j++) @@ -3922,14 +3922,14 @@ int buildin_getopt2 (struct script_state *st) int buildin_setopt2 (struct script_state *st) { - int new; + int new_opt2; struct map_session_data *sd; - new = conv_num (st, &(st->stack->stack_data[st->start + 2])); + new_opt2 = conv_num (st, &(st->stack->stack_data[st->start + 2])); sd = script_rid2sd (st); - if (!(new ^ sd->opt2)) + if (new_opt2 == sd->opt2) return 0; - sd->opt2 = new; + sd->opt2 = new_opt2; clif_changeoption (&sd->bl); pc_calcstatus (sd, 0); @@ -4292,19 +4292,19 @@ int buildin_getexp (struct script_state *st) */ int buildin_monster (struct script_state *st) { - int class, amount, x, y; + int mob_class, amount, x, y; char *str, *map, *event = ""; map = conv_str (st, &(st->stack->stack_data[st->start + 2])); x = conv_num (st, &(st->stack->stack_data[st->start + 3])); y = conv_num (st, &(st->stack->stack_data[st->start + 4])); str = conv_str (st, &(st->stack->stack_data[st->start + 5])); - class = conv_num (st, &(st->stack->stack_data[st->start + 6])); + mob_class = conv_num (st, &(st->stack->stack_data[st->start + 6])); amount = conv_num (st, &(st->stack->stack_data[st->start + 7])); if (st->end > st->start + 8) event = conv_str (st, &(st->stack->stack_data[st->start + 8])); - mob_once_spawn (map_id2sd (st->rid), map, x, y, str, class, amount, + mob_once_spawn (map_id2sd (st->rid), map, x, y, str, mob_class, amount, event); return 0; } @@ -4315,7 +4315,7 @@ int buildin_monster (struct script_state *st) */ int buildin_areamonster (struct script_state *st) { - int class, amount, x0, y0, x1, y1; + int mob_class, amount, x0, y0, x1, y1; char *str, *map, *event = ""; map = conv_str (st, &(st->stack->stack_data[st->start + 2])); @@ -4324,12 +4324,12 @@ int buildin_areamonster (struct script_state *st) x1 = conv_num (st, &(st->stack->stack_data[st->start + 5])); y1 = conv_num (st, &(st->stack->stack_data[st->start + 6])); str = conv_str (st, &(st->stack->stack_data[st->start + 7])); - class = conv_num (st, &(st->stack->stack_data[st->start + 8])); + mob_class = conv_num (st, &(st->stack->stack_data[st->start + 8])); amount = conv_num (st, &(st->stack->stack_data[st->start + 9])); if (st->end > st->start + 10) event = conv_str (st, &(st->stack->stack_data[st->start + 10])); - mob_once_spawn_area (map_id2sd (st->rid), map, x0, y0, x1, y1, str, class, + mob_once_spawn_area (map_id2sd (st->rid), map, x0, y0, x1, y1, str, mob_class, amount, event); return 0; } @@ -5077,15 +5077,15 @@ int buildin_changesex (struct script_state *st) { sd->status.sex = 1; sd->sex = 1; - if (sd->status.class == 20 || sd->status.class == 4021) - sd->status.class -= 1; + if (sd->status.pc_class == 20 || sd->status.pc_class == 4021) + sd->status.pc_class -= 1; } else if (sd->status.sex == 1) { sd->status.sex = 0; sd->sex = 0; - if (sd->status.class == 19 || sd->status.class == 4020) - sd->status.class += 1; + if (sd->status.pc_class == 19 || sd->status.pc_class == 4020) + sd->status.pc_class += 1; } chrif_char_ask_name (-1, sd->status.name, 5, 0, 0, 0, 0, 0, 0); // type: 5 - changesex chrif_save (sd); @@ -5549,7 +5549,7 @@ int buildin_pvpon (struct script_state *st) for (i = 0; i < fd_max; i++) { //人数分ループ - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (m == pl_sd->bl.m && pl_sd->pvp_timer == -1) @@ -5586,7 +5586,7 @@ int buildin_pvpoff (struct script_state *st) for (i = 0; i < fd_max; i++) { //人数分ループ - if (session[i] && (pl_sd = session[i]->session_data) + if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) && pl_sd->state.auth) { if (m == pl_sd->bl.m) @@ -5678,7 +5678,7 @@ int buildin_maprespawnguildid_sub (struct block_list *bl, va_list ap) } if (md && flag & 4) { - if (md->class < 1285 || md->class > 1288) + if (md->mob_class < 1285 || md->mob_class > 1288) mob_delete (md); } return 0; @@ -6337,35 +6337,35 @@ int buildin_strmobinfo (struct script_state *st) { int num = conv_num (st, &(st->stack->stack_data[st->start + 2])); - int class = conv_num (st, &(st->stack->stack_data[st->start + 3])); + int mob_class = conv_num (st, &(st->stack->stack_data[st->start + 3])); - if (num <= 0 || num >= 8 || (class >= 0 && class <= 1000) || class > 2000) + if (num <= 0 || num >= 8 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) return 0; if (num == 1) { char *buf; - buf = mob_db[class].name; + buf = mob_db[mob_class].name; push_str (st->stack, C_STR, buf); return 0; } else if (num == 2) { char *buf; - buf = mob_db[class].jname; + buf = mob_db[mob_class].jname; push_str (st->stack, C_STR, buf); return 0; } else if (num == 3) - push_val (st->stack, C_INT, mob_db[class].lv); + push_val (st->stack, C_INT, mob_db[mob_class].lv); else if (num == 4) - push_val (st->stack, C_INT, mob_db[class].max_hp); + push_val (st->stack, C_INT, mob_db[mob_class].max_hp); else if (num == 5) - push_val (st->stack, C_INT, mob_db[class].max_sp); + push_val (st->stack, C_INT, mob_db[mob_class].max_sp); else if (num == 6) - push_val (st->stack, C_INT, mob_db[class].base_exp); + push_val (st->stack, C_INT, mob_db[mob_class].base_exp); else if (num == 7) - push_val (st->stack, C_INT, mob_db[class].job_exp); + push_val (st->stack, C_INT, mob_db[mob_class].job_exp); return 0; } @@ -6375,20 +6375,20 @@ int buildin_strmobinfo (struct script_state *st) */ int buildin_guardian (struct script_state *st) { - int class = 0, amount = 1, x = 0, y = 0, guardian = 0; + int mob_class = 0, amount = 1, x = 0, y = 0, guardian = 0; char *str, *map, *event = ""; map = conv_str (st, &(st->stack->stack_data[st->start + 2])); x = conv_num (st, &(st->stack->stack_data[st->start + 3])); y = conv_num (st, &(st->stack->stack_data[st->start + 4])); str = conv_str (st, &(st->stack->stack_data[st->start + 5])); - class = conv_num (st, &(st->stack->stack_data[st->start + 6])); + mob_class = conv_num (st, &(st->stack->stack_data[st->start + 6])); amount = conv_num (st, &(st->stack->stack_data[st->start + 7])); event = conv_str (st, &(st->stack->stack_data[st->start + 8])); if (st->end > st->start + 9) guardian = conv_num (st, &(st->stack->stack_data[st->start + 9])); - mob_spawn_guardian (map_id2sd (st->rid), map, x, y, str, class, amount, + mob_spawn_guardian (map_id2sd (st->rid), map, x, y, str, mob_class, amount, event, guardian); return 0; @@ -6712,15 +6712,15 @@ int buildin_clearitem (struct script_state *st) */ int buildin_classchange (struct script_state *st) { - int class, type; + int npc_class, type; struct block_list *bl = map_id2bl (st->oid); if (bl == NULL) return 0; - class = conv_num (st, &(st->stack->stack_data[st->start + 2])); + npc_class = conv_num (st, &(st->stack->stack_data[st->start + 2])); type = conv_num (st, &(st->stack->stack_data[st->start + 3])); - clif_class_change (bl, class, type); + clif_npc_class_change (bl, npc_class, type); return 0; } @@ -7113,7 +7113,7 @@ int buildin_getsavepoint (struct script_state *st) switch (type) { case 0: - mapname = calloc (24, 1); + mapname = (char*)calloc (24, 1); strncpy (mapname, sd->status.save_point.map, 23); push_str (st->stack, C_STR, mapname); break; @@ -7239,7 +7239,7 @@ int buildin_fakenpcname (struct script_state *st) return 1; strncpy (nd->name, newname, sizeof(nd->name)-1); nd->name[sizeof(nd->name)-1] = '\0'; - nd->class = newsprite; + nd->npc_class = newsprite; // Refresh this npc npc_enable (name, 0); @@ -7890,7 +7890,7 @@ int mapreg_setregstr (int num, const char *str) { char *p; - if ((p = numdb_search (mapregstr_db, num)) != NULL) + if ((p = (char *)numdb_search (mapregstr_db, num)) != NULL) free (p); if (str == NULL || *str == 0) @@ -7910,7 +7910,7 @@ int mapreg_setregstr (int num, const char *str) * 永続的マップ変数の読み込み *------------------------------------------ */ -static int script_load_mapreg () +static int script_load_mapreg (void) { FILE *fp; char line[1024]; @@ -7985,7 +7985,7 @@ static void script_save_mapreg_strsub (db_key_t key, db_val_t data, va_list ap) } } -static int script_save_mapreg () +static int script_save_mapreg (void) { FILE *fp; int lock; @@ -8089,7 +8089,7 @@ static void userfunc_db_final (db_key_t key, db_val_t data, va_list ap) free (data); } -int do_final_script () +int do_final_script (void) { if (mapreg_dirty >= 0) script_save_mapreg (); @@ -8117,7 +8117,7 @@ int do_final_script () * 初期化 *------------------------------------------ */ -int do_init_script () +int do_init_script (void) { mapreg_db = numdb_init (); mapregstr_db = numdb_init (); diff --git a/src/map/script.h b/src/map/script.h index b70aba3..62d3ee1 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -40,12 +40,12 @@ typedef struct argrec int run_script_l (unsigned char *, int, int, int, int, argrec_t * args); int run_script (unsigned char *, int, int, int); -struct dbt *script_get_label_db (); -struct dbt *script_get_userfunc_db (); +struct dbt *script_get_label_db (void); +struct dbt *script_get_userfunc_db (void); int script_config_read (char *cfgName); -int do_init_script (); -int do_final_script (); +int do_init_script (void); +int do_final_script (void); extern char mapreg_txt[]; diff --git a/src/map/skill.c b/src/map/skill.c index d8b64e8..e232820 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3242,7 +3242,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, heal = 0; /* 黄金蟲カード(ヒール量0) */ if (sd) { - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); if ((skill = pc_checkskill (sd, HP_MEDITATIO)) > 0) // メディテイティオ heal += heal * (skill * 2 / 100); if (sd && dstsd && sd->status.partner_id == dstsd->status.char_id && s_class.job == 23 && sd->status.sex == 0) //自分も対象もPC、対象が自分のパートナー、自分がスパノビ、自分が♀なら @@ -3719,9 +3719,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, || (!sd->status.party_id && !sd->status.guild_id) // PTにもギルドにも所属無しはだめ || ((sd->status.party_id != dstsd->status.party_id) // 同じパーティーか、 || (sd->status.guild_id != dstsd->status.guild_id)) // 同じギルドじゃないとだめ - || (dstsd->status.class == 14 || dstsd->status.class == 21 - || dstsd->status.class == 4015 - || dstsd->status.class == 4022)) + || (dstsd->status.pc_class == 14 || dstsd->status.pc_class == 21 + || dstsd->status.pc_class == 4015 + || dstsd->status.pc_class == 4022)) { // クルセだめ clif_skill_fail (sd, skillid, 0, 0); map_freeblock_unlock (); @@ -3799,7 +3799,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, //20%の確率で対象のLv*2のSPを回復する。成功したときはターゲット(σ゚Д゚)σゲッツ!! if (MRAND (100) < 20) { - i = 2 * mob_db[dstmd->class].lv; + i = 2 * mob_db[dstmd->mob_class].lv; mob_target (dstmd, src, 0); } } @@ -4870,7 +4870,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, if (md && !md->master_id) { mob_summonslave (md, - mob_db[md->class].skill[md->skillidx].val, + mob_db[md->mob_class].skill[md->skillidx].val, skilllv, (skillid == NPC_SUMMONSLAVE) ? 1 : 0); } @@ -4880,13 +4880,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, case NPC_METAMORPHOSIS: if (md) mob_class_change (md, - mob_db[md->class].skill[md->skillidx].val); + mob_db[md->mob_class].skill[md->skillidx].val); break; case NPC_EMOTION: /* エモーション */ if (md) clif_emotion (&md->bl, - mob_db[md->class].skill[md->skillidx].val[0]); + mob_db[md->mob_class].skill[md->skillidx].val[0]); break; case NPC_DEFENDER: @@ -5992,12 +5992,7 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, group->range = range; if (skillid == HT_TALKIEBOX || skillid == RG_GRAFFITI) { - group->valstr = calloc (80, 1); - if (group->valstr == NULL) - { - printf ("skill_castend_map: out of memory !\n"); - exit (1); - } + CREATE (group->valstr, char, 80); memcpy (group->valstr, talkie_mes, 80); } for (i = 0; i < count; i++) @@ -6929,12 +6924,7 @@ int skill_unit_onlimit (struct skill_unit *src, unsigned int tick) src->bl.x, src->bl.y, 1); if (group == NULL) return 0; - group->valstr = calloc (24, 1); - if (group->valstr == NULL) - { - printf ("skill_unit_onlimit: out of memory !\n"); - exit (1); - } + CREATE (group->valstr, char, 24); memcpy (group->valstr, sg->valstr, 24); group->val2 = sg->val2; } @@ -7185,7 +7175,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) nullpo_retr (0, c = va_arg (ap, int *)); nullpo_retr (0, ssd = (struct map_session_data *) src); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); //チェックしない設定ならcにありえない大きな数字を返して終了 if (!battle_config.player_skill_partner_check) { //本当はforeachの前にやりたいけど設定適用箇所をまとめるためにここへ @@ -7194,15 +7184,15 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) } ; - ss_class = pc_calc_base_job (ssd->status.class); + ss_class = pc_calc_base_job (ssd->status.pc_class); switch (ssd->skillid) { case PR_BENEDICTIO: /* 聖体降福 */ if (sd != ssd - && (sd->status.class == 4 || sd->status.class == 8 - || sd->status.class == 15 || sd->status.class == 4005 - || sd->status.class == 4009 || sd->status.class == 4016) + && (sd->status.pc_class == 4 || sd->status.pc_class == 8 + || sd->status.pc_class == 15 || sd->status.pc_class == 4005 + || sd->status.pc_class == 4009 || sd->status.pc_class == 4016) && (sd->bl.x == ssd->bl.x - 1 || sd->bl.x == ssd->bl.x + 1) && sd->status.sp >= 10) (*c)++; @@ -7218,12 +7208,12 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) case BD_RAGNAROK: /* 神々の黄昏 */ case CG_MOONLIT: /* 月明りの泉に落ちる花びら */ if (sd != ssd && - ((ssd->status.class == 19 && sd->status.class == 20) || - (ssd->status.class == 20 && sd->status.class == 19) || - (ssd->status.class == 4020 && sd->status.class == 4021) || - (ssd->status.class == 4021 && sd->status.class == 4020) || - (ssd->status.class == 20 && sd->status.class == 4020) || - (ssd->status.class == 19 && sd->status.class == 4021)) && + ((ssd->status.pc_class == 19 && sd->status.pc_class == 20) || + (ssd->status.pc_class == 20 && sd->status.pc_class == 19) || + (ssd->status.pc_class == 4020 && sd->status.pc_class == 4021) || + (ssd->status.pc_class == 4021 && sd->status.pc_class == 4020) || + (ssd->status.pc_class == 20 && sd->status.pc_class == 4020) || + (ssd->status.pc_class == 19 && sd->status.pc_class == 4021)) && pc_checkskill (sd, ssd->skillid) > 0 && (*c) == 0 && sd->status.party_id == ssd->status.party_id && @@ -7256,7 +7246,7 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap) nullpo_retr (0, c = va_arg (ap, int *)); nullpo_retr (0, ssd = (struct map_session_data *) src); - s_class = pc_calc_base_job (sd->status.class); + s_class = pc_calc_base_job (sd->status.pc_class); //チェックしない設定ならcにありえない大きな数字を返して終了 if (!battle_config.player_skill_partner_check) @@ -7265,16 +7255,16 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap) return 0; } - ss_class = pc_calc_base_job (ssd->status.class); + ss_class = pc_calc_base_job (ssd->status.pc_class); skillid = ssd->skillid; skilllv = ssd->skilllv; switch (skillid) { case PR_BENEDICTIO: /* 聖体降福 */ if (sd != ssd - && (sd->status.class == 4 || sd->status.class == 8 - || sd->status.class == 15 || sd->status.class == 4005 - || sd->status.class == 4009 || sd->status.class == 4016) + && (sd->status.pc_class == 4 || sd->status.pc_class == 8 + || sd->status.pc_class == 15 || sd->status.pc_class == 4005 + || sd->status.pc_class == 4009 || sd->status.pc_class == 4016) && (sd->bl.x == ssd->bl.x - 1 || sd->bl.x == ssd->bl.x + 1) && sd->status.sp >= 10) { @@ -7294,7 +7284,12 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap) case BD_RAGNAROK: /* 神々の黄昏 */ case CG_MOONLIT: /* 月明りの泉に落ちる花びら */ if (sd != ssd && //本人以外で - ((ssd->status.class == 19 && sd->status.class == 20) || (ssd->status.class == 20 && sd->status.class == 19) || (ssd->status.class == 4020 && sd->status.class == 4021) || (ssd->status.class == 4021 && sd->status.class == 4020) || (ssd->status.class == 20 && sd->status.class == 4020) || (ssd->status.class == 19 && sd->status.class == 4021)) && //自分がダンサーならバードで + ((ssd->status.pc_class == 19 && sd->status.pc_class == 20) || + (ssd->status.pc_class == 20 && sd->status.pc_class == 19) || + (ssd->status.pc_class == 4020 && sd->status.pc_class == 4021) || + (ssd->status.pc_class == 4021 && sd->status.pc_class == 4020) || + (ssd->status.pc_class == 20 && sd->status.pc_class == 4020) || + (ssd->status.pc_class == 19 && sd->status.pc_class == 4021)) && //自分がダンサーならバードで pc_checkskill (sd, skillid) > 0 && //スキルを持っていて (*c) == 0 && //最初の一人で sd->status.party_id == ssd->status.party_id && //パーティーが同じで @@ -7339,7 +7334,7 @@ static int skill_check_condition_mob_master_sub (struct block_list *bl, return 0; nullpo_retr (0, c = va_arg (ap, int *)); - if (md->class == mob_class && md->master_id == src_id) + if (md->mob_class == mob_class && md->master_id == src_id) (*c)++; return 0; } @@ -8235,7 +8230,7 @@ int skill_use_id (struct map_session_data *sd, int target_id, /* 詠唱反応モンスター */ if (bl->type == BL_MOB && (md = (struct mob_data *) bl) - && mob_db[md->class].mode & 0x10 && md->state.state != MS_ATTACK + && mob_db[md->mob_class].mode & 0x10 && md->state.state != MS_ATTACK && sd->invincible_timer == -1) { md->target_id = sd->bl.id; diff --git a/src/map/skill.h b/src/map/skill.h index d0a698c..6c8795a 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -38,8 +38,8 @@ extern struct skill_db skill_db[MAX_SKILL_DB]; struct skill_name_db { int id; // skill id - char *name; // search strings - char *desc; // description that shows up for search's + const char *name; // search strings + const char *desc; // description that shows up for search's }; extern struct skill_name_db skill_names[]; diff --git a/src/tool/GNUmakefile b/src/tool/GNUmakefile new file mode 100644 index 0000000..2efc93b --- /dev/null +++ b/src/tool/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. tools +clean: + rm -r ../../obj/tool/ +%:: + make -C ../.. obj/tool/$@ diff --git a/src/tool/Makefile b/src/tool/Makefile deleted file mode 100644 index 8d51c25..0000000 --- a/src/tool/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../../make.defs - -OBJS =../common/timer.o ../common/socket.o ../common/db.o ../common/lock.o ../char/inter.o ../char/int_guild.o ../char/int_party.o ../char/int_storage.o -all: adduser itemfrob mapfrob marriage-info eathena-monitor -adduser: adduser.o ../common/socket.o - -itemfrob: itemfrob.o ${OBJS} -mapfrob: mapfrob.o ${OBJS} -marriage-info: marriage-info.o ${OBJS} -eathena-monitor: eathena-monitor.c - -clean: - rm -f adduser itemfrob mapfrob marriage-info eathena-monitor - rm -f *.exe - rm -f *.o diff --git a/src/tool/convert.c b/src/tool/convert.c index 8436ebb..e256fc9 100644 --- a/src/tool/convert.c +++ b/src/tool/convert.c @@ -1,8 +1,6 @@ #include <stdio.h> #include <stdlib.h> -#define RETCODE "\r\n" - #define MAX_INVENTORY 100 #define MAX_CART 100 #define MAX_SKILL 350 @@ -284,7 +282,7 @@ int mmo_char_convert (char *fname1, char *fname2) if (ret) { mmo_char_tostr (line, &char_dat); - fprintf (ofp, "%s" RETCODE, line); + fprintf (ofp, "%s\n", line); } } fcloseall (); diff --git a/src/tool/eathena-monitor.c b/src/tool/eathena-monitor.c index 6e26706..1b1abd5 100644 --- a/src/tool/eathena-monitor.c +++ b/src/tool/eathena-monitor.c @@ -76,7 +76,7 @@ pid_t pid_login, pid_map, pid_char; const char* make_path (const char* base, const char* path) { size_t base_len = strlen(base); size_t path_len = strlen(path); - char* out = malloc(base_len + 1 + path_len + 1); + char* out = (char *)malloc(base_len + 1 + path_len + 1); memcpy(out, base, base_len); out[base_len] = '/'; memcpy(out + base_len + 1, path, path_len); diff --git a/src/tool/itemfrob.c b/src/tool/itemfrob.c index 646ec73..4651452 100644 --- a/src/tool/itemfrob.c +++ b/src/tool/itemfrob.c @@ -35,7 +35,7 @@ int mmo_char_convert () { transform_char (&char_dat); mmo_char_tostr (line, &char_dat); - fprintf (ofp, "%s" RETCODE, line); + fprintf (ofp, "%s\n", line); } } return 0; diff --git a/src/tool/mapfrob.c b/src/tool/mapfrob.c index 11983eb..9dc1a5b 100644 --- a/src/tool/mapfrob.c +++ b/src/tool/mapfrob.c @@ -61,7 +61,7 @@ int mmo_char_convert () { transform_char (&char_dat); mmo_char_tostr (line, &char_dat); - fprintf (ofp, "%s" RETCODE, line); + fprintf (ofp, "%s\n", line); } } return 0; diff --git a/src/tool/moneycount/Makefile b/src/tool/moneycount/Makefile deleted file mode 100644 index e7b7022..0000000 --- a/src/tool/moneycount/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -all: moneycount - -OBJECTS = main.o athena_text.o inf.o portability_fixes.o -CPP = g++ - -moneycount: $(OBJECTS) - $(CPP) -o $@ $(OBJECTS) $(COMMON_OBJS) $(LIBS) -main.o: main.cpp -athena_text.o: athena_text.cpp athena_text.h -inf.o: inf.cpp inf.hpp -portability_fixes.o: portability_fixes.cpp portability_fixes.hpp portability_exceptions.hpp - -clean: - rm -f *.o moneycount diff --git a/src/tool/moneycount/mmo.h b/src/tool/moneycount/mmo.h index c7ab21f..bd62b49 100644 --- a/src/tool/moneycount/mmo.h +++ b/src/tool/moneycount/mmo.h @@ -5,11 +5,6 @@ #define _MMO_H_ #include <time.h> -#ifdef CYGWIN -#define RETCODE "\r\n" // (CR/LF?FWindows?n) -#else -#define RETCODE "\n" // (LF?FUnix?n?j -#endif #define FIFOSIZE_SERVERLINK 256*1024 diff --git a/src/tool/skillfrob.c b/src/tool/skillfrob.c index c7b6bb6..44855ac 100644 --- a/src/tool/skillfrob.c +++ b/src/tool/skillfrob.c @@ -39,7 +39,7 @@ int mmo_char_convert () { transform_char (&char_dat); mmo_char_tostr (line, &char_dat); - fprintf (ofp, "%s" RETCODE, line); + fprintf (ofp, "%s\n", line); } } fcloseall (); diff --git a/src/webserver/GNUmakefile b/src/webserver/GNUmakefile new file mode 100644 index 0000000..9635381 --- /dev/null +++ b/src/webserver/GNUmakefile @@ -0,0 +1,7 @@ +.SUFFIXES: +all: + make -C ../.. webserver +clean: + rm -r ../../obj/webserver/ +%:: + make -C ../.. obj/webserver/$@ diff --git a/src/webserver/Makefile b/src/webserver/Makefile deleted file mode 100644 index 5bfa83f..0000000 --- a/src/webserver/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../../make.defs - -OBJ = main.o parse.o generate.o htmlstyle.o logs.o pages/about.o pages/sample.o pages/notdone.o -all: webserver -webserver: ${OBJ} - ${CC} ${CFLAGS} -o $@ ${OBJ} - - - - -clean: - rm -f *.o - rm -f pages/*.o - rm -f webserver - diff --git a/warnings b/warnings new file mode 100644 index 0000000..68be903 --- /dev/null +++ b/warnings @@ -0,0 +1,29 @@ +-Werror=all +-Werror=implicit-function-declaration +-Wextra +-Werror=c++-compat +-Werror=write-strings +-Wunused +-Wshadow +-Wbad-function-cast +-Werror=strict-prototypes +-Werror=old-style-definition +-Wno-missing-declarations +-Wvla +-Wstack-protector +-Wno-conversion +-Wlogical-op +-Wformat=2 +-Winit-self +-Wmissing-include-dirs +-Wsuggest-attribute=pure +-Wsuggest-attribute=const +-Wsuggest-attribute=noreturn +-Wtrampolines +-Wfloat-equal +-Wmissing-format-attribute +-Wno-redundant-decls +-Wnested-externs +-Wno-sign-compare + +-Wno-switch |