summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--3rdparty/libconfig/Makefile.in7
-rw-r--r--3rdparty/mt19937ar/Makefile.in6
-rw-r--r--Makefile.in136
-rw-r--r--conf/inter-server.conf1
-rw-r--r--src/char/Makefile.in81
-rw-r--r--src/char/char.c46
-rw-r--r--src/char/char.h1
-rw-r--r--src/char/int_elemental.c26
-rw-r--r--src/char/inter.c13
-rw-r--r--src/common/HPMi.h2
-rw-r--r--src/common/Makefile.in82
-rw-r--r--src/common/console.c4
-rw-r--r--src/common/console.h2
-rw-r--r--src/common/mmo.h7
-rw-r--r--src/common/strlib.c54
-rw-r--r--src/common/strlib.h4
-rw-r--r--src/common/thread.c14
-rw-r--r--src/config/const.h51
-rw-r--r--src/login/Makefile.in71
-rw-r--r--src/login/ipban_sql.c2
-rw-r--r--src/map/Makefile.in110
-rw-r--r--src/map/atcommand.c172
-rw-r--r--src/map/battle.c130
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/battleground.c91
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/chat.c8
-rw-r--r--src/map/chrif.c20
-rw-r--r--src/map/clif.c356
-rw-r--r--src/map/clif.h19
-rw-r--r--src/map/duel.c110
-rw-r--r--src/map/duel.h14
-rw-r--r--src/map/homunculus.c16
-rw-r--r--src/map/homunculus.h17
-rw-r--r--src/map/instance.c2
-rw-r--r--src/map/intif.c5
-rw-r--r--src/map/itemdb.c68
-rw-r--r--src/map/map.c123
-rw-r--r--src/map/map.h12
-rw-r--r--src/map/mob.c80
-rw-r--r--src/map/npc.c72
-rw-r--r--src/map/npc.h4
-rw-r--r--src/map/packets.h2
-rw-r--r--src/map/pc.c109
-rw-r--r--src/map/pc.h4
-rw-r--r--src/map/pet.c14
-rw-r--r--src/map/pet.h4
-rw-r--r--src/map/quest.c17
-rw-r--r--src/map/quest.h2
-rw-r--r--src/map/script.c83
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/skill.c471
-rw-r--r--src/map/skill.h6
-rw-r--r--src/map/status.c241
-rw-r--r--src/map/status.h2
-rw-r--r--src/map/unit.c4
-rw-r--r--src/map/vending.h2
-rw-r--r--src/plugins/Makefile.in7
-rw-r--r--src/test/Makefile.in41
-rw-r--r--src/tool/Makefile.in49
60 files changed, 1551 insertions, 1552 deletions
diff --git a/3rdparty/libconfig/Makefile.in b/3rdparty/libconfig/Makefile.in
index f3c6e986d..048a1b3b7 100644
--- a/3rdparty/libconfig/Makefile.in
+++ b/3rdparty/libconfig/Makefile.in
@@ -8,7 +8,7 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all clean help
+.PHONY: all clean help
all: $(LIBCONFIG_OBJ)
@@ -24,6 +24,9 @@ help:
#####################################################################
-%.o: %.c $(LIBCONFIG_H)
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. 3rdparty/libconfig/Makefile
+
+%.o: %.c $(LIBCONFIG_H) Makefile
@echo " CC $<"
@$(CC) @CFLAGS@ @DEFS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
diff --git a/3rdparty/mt19937ar/Makefile.in b/3rdparty/mt19937ar/Makefile.in
index b899c413f..c48848c8d 100644
--- a/3rdparty/mt19937ar/Makefile.in
+++ b/3rdparty/mt19937ar/Makefile.in
@@ -8,7 +8,7 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all clean help
+.PHONY: all clean help
all: $(MT19937AR_OBJ)
@@ -24,6 +24,10 @@ help:
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. 3rdparty/mt19937ar/Makefile
+
+%.o: %.c $(LIBCONFIG_H) Makefile
%.o: %.c $(MT19937AR_H)
@echo " CC $<"
@$(CC) @CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
diff --git a/Makefile.in b/Makefile.in
index 5d59a7144..7dfb138f9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,14 +2,13 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=common_sql login_sql char_sql map_sql tools import
- SQL_DEPENDS=common_sql login_sql char_sql map_sql import
+ ALL_DEPENDS=common_sql login_sql char_sql map_sql tools | import
+ SQL_DEPENDS=common_sql login_sql char_sql map_sql | import
COMMON_SQL_DEPENDS=mt19937ar libconfig
LOGIN_SQL_DEPENDS=mt19937ar libconfig common_sql
CHAR_SQL_DEPENDS=mt19937ar libconfig common_sql
MAP_SQL_DEPENDS=mt19937ar libconfig common_sql
TOOLS_DEPENDS=mt19937ar libconfig common_sql
- CONVERTERS_DEPENDS=common_sql
else
ALL_DEPENDS=needs_mysql
SQL_DEPENDS=needs_mysql
@@ -28,6 +27,10 @@ else
PLUGIN_DEPENDS=no_plugins
endif
+MF_TARGETS = Makefile $(addsuffix /Makefile, src/common 3rdparty/mt19937ar \
+ 3rdparty/libconfig src/char src/login src/map src/plugins \
+ src/tool src/test)
+
CC = @CC@
export CC
@@ -42,47 +45,73 @@ export CC
plugins \
import \
test \
- clean help
+ clean \
+ help
all: $(ALL_DEPENDS)
sql: $(SQL_DEPENDS)
-common_sql: $(COMMON_SQL_DEPENDS)
+$(MF_TARGETS): %: %.in
+ @echo " CONFIGURE"
+ @if [ -x config.status ]; then \
+ echo "Reconfiguring with options: $$(./config.status --config)"; \
+ ./config.status; \
+ else \
+ echo "Unable to find a previous config.status. ./configure will be re-run with the default options."; \
+ echo "If you want to use custom options, please press CTRL-C and run ./configure yourself"; \
+ for i in 1 2 3 4 5 6 7 8 9 10; do \
+ printf "\a. "; \
+ sleep 1; \
+ done; \
+ echo ""; \
+ ./configure; \
+ fi;
+
+common_sql: $(COMMON_SQL_DEPENDS) src/common/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/common sql
-mt19937ar:
+mt19937ar: 3rdparty/mt19937ar/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C 3rdparty/mt19937ar
-libconfig:
+libconfig: 3rdparty/libconfig/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C 3rdparty/libconfig
-login_sql: $(LOGIN_SQL_DEPENDS)
+login_sql: $(LOGIN_SQL_DEPENDS) src/login/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/login sql
-char_sql: $(CHAR_SQL_DEPENDS)
+char_sql: $(CHAR_SQL_DEPENDS) src/char/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/char
-map_sql: $(MAP_SQL_DEPENDS)
+map_sql: $(MAP_SQL_DEPENDS) src/map/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/map sql
-tools: $(TOOLS_DEPENDS)
+tools: $(TOOLS_DEPENDS) src/tool/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/tool
-test:
+test: src/test/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/test
-plugins: $(PLUGIN_DEPENDS)
+plugins: $(PLUGIN_DEPENDS) src/plugins/Makefile
+ @echo " MAKE $@"
@$(MAKE) -C src/plugins
-import:
+import: Makefile
@# 1) create conf/import folder
@# 2) add missing files
@echo "building conf/import folder..."
@if test ! -d conf/import ; then mkdir conf/import ; fi
@for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
-clean:
+clean: $(MF_TARGETS)
@$(MAKE) -C src/common $@
@$(MAKE) -C 3rdparty/mt19937ar $@
@$(MAKE) -C 3rdparty/libconfig $@
@@ -93,15 +122,18 @@ clean:
@$(MAKE) -C src/tool $@
@$(MAKE) -C src/test $@
-help:
- @echo "most common targets are 'all' 'sql' 'conf' 'clean' 'help'"
+distclean: clean
+ @-rm -f $(MF_TARGETS) config.status config.log
+
+help: Makefile
+ @echo "most common targets are 'all' 'sql' 'clean' 'plugins' 'help'"
@echo "possible targets are:"
@echo "'common_sql' - builds object files used in SQL servers"
@echo "'mt19937ar' - builds object file of Mersenne Twister MT19937"
@echo "'libconfig' - builds object files of libconfig"
- @echo "'login_sql' - builds login server (SQL version)"
- @echo "'char_sql' - builds char server (SQL version)"
- @echo "'map_sql' - builds map server (SQL version)"
+ @echo "'login_sql' - builds login server"
+ @echo "'char_sql' - builds char server"
+ @echo "'map_sql' - builds map server"
@echo "'tools' - builds all the tools in src/tools"
@echo "'import' - builds conf/import folder from the template conf/import-tmpl"
@echo "'all' - builds all the above targets"
@@ -109,6 +141,7 @@ help:
@echo " 'map_sql' and 'import')"
@echo "'test' - builds tests"
@echo "'clean' - cleans builds and objects"
+ @echo "'distclean' - cleans files generated by ./configure"
@echo "'help' - outputs this message"
#####################################################################
@@ -124,35 +157,34 @@ no_plugins:
#####################################################################
# TODO
-install: conf/%.conf conf/%.txt
- $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
- $(shell mkdir -p /opt/rathena/bin/)
- $(shell mkdir -p /opt/rathena/etc/rathena/)
- $(shell mkdir -p /opt/rathena/var/log/rathena/)
- $(shell mv save /opt/rathena/etc/rathena/save)
- $(shell mv db /opt/rathena/etc/rathena/db)
- $(shell mv conf /opt/rathena/etc/rathena/conf)
- $(shell mv npc /opt/rathena/etc/rathena/npc)
- $(shell mv log/* /opt/rathena/var/log/rathena/)
- $(shell cp *-server* /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/save/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/db/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/conf/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/npc/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/var/log/rathena/ /opt/rathena/bin/log)
-
-bin-clean:
- $(shell rm /opt/rathena/bin/login-server*)
- $(shell rm /opt/rathena/bin/char-server*)
- $(shell rm /opt/rathena/bin/map-server*)
-
-uninstall:
- $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
- bin-clean
- $(shell rm /opt/rathena/bin/save)
- $(shell rm /opt/rathena/bin/db)
- $(shell rm /opt/rathena/bin/conf)
- $(shell rm /opt/rathena/bin/npc)
- $(shell rm /opt/rathena/bin/log)
- $(shell rm -rf /opt/rathena/etc/rathena)
- $(shell rm -rf /opt/rathena/var/log/rathena)
+#install: conf/%.conf conf/%.txt
+# @read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue."
+# @mkdir -p /opt/hercules/bin/
+# @mkdir -p /opt/hercules/etc/hercules/
+# @mkdir -p /opt/hercules/var/log/hercules/
+# @mv save /opt/hercules/etc/hercules/save
+# @mv db /opt/hercules/etc/hercules/db
+# @mv conf /opt/hercules/etc/hercules/conf
+# @mv npc /opt/hercules/etc/hercules/npc
+# @mv log/* /opt/hercules/var/log/hercules/
+# @cp *-server /opt/hercules/bin/
+# @ln -s /opt/hercules/etc/hercules/save/ /opt/hercules/bin/
+# @ln -s /opt/hercules/etc/hercules/db/ /opt/hercules/bin/
+# @ln -s /opt/hercules/etc/hercules/conf/ /opt/hercules/bin/
+# @ln -s /opt/hercules/etc/hercules/npc/ /opt/hercules/bin/
+# @ln -s /opt/hercules/var/log/hercules/ /opt/hercules/bin/log
+
+#bin-clean:
+# @rm /opt/hercules/bin/login-server
+# @rm /opt/hercules/bin/char-server
+# @rm /opt/hercules/bin/map-server
+
+#uninstall: bin-clean
+# @read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue."
+# @rm /opt/hercules/bin/save
+# @rm /opt/hercules/bin/db
+# @rm /opt/hercules/bin/conf
+# @rm /opt/hercules/bin/npc
+# @rm /opt/hercules/bin/log
+# @rm -rf /opt/hercules/etc/hercules
+# @rm -rf /opt/hercules/var/log/hercules
diff --git a/conf/inter-server.conf b/conf/inter-server.conf
index 468cf5a26..09ac15f82 100644
--- a/conf/inter-server.conf
+++ b/conf/inter-server.conf
@@ -108,6 +108,7 @@ skill_homunculus_db: skill_homunculus
mercenary_db: mercenary
mercenary_owner_db: mercenary_owner
ragsrvinfo_db: ragsrvinfo
+elemental_db: elemental
// Map Database Tables
item_db_db: item_db
diff --git a/src/char/Makefile.in b/src/char/Makefile.in
index 0c4034a53..02759b32e 100644
--- a/src/char/Makefile.in
+++ b/src/char/Makefile.in
@@ -1,27 +1,29 @@
COMMON_H = $(shell ls ../common/*.h)
-
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
-COMMON_SQL_OBJ = ../common/obj_sql/sql.o
-COMMON_H = ../common/sql.h
-
-CHAR_OBJ = obj_sql/char.o obj_sql/inter.o obj_sql/int_party.o obj_sql/int_guild.o \
- obj_sql/int_storage.o obj_sql/int_pet.o obj_sql/int_homun.o obj_sql/int_mail.o obj_sql/int_auction.o obj_sql/int_quest.o obj_sql/int_mercenary.o obj_sql/int_elemental.o obj_sql/pincode.o
-CHAR_H = char.h inter.h int_party.h int_guild.h int_storage.h int_pet.h int_homun.h int_mail.h int_auction.h int_quest.h int_mercenary.h int_elemental.h pincode.h
+CONFIG_H = $(shell ls ../config/*.h ../config/*/*.h)
+
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+CHAR_OBJ = $(addprefix obj_sql/, char.o inter.o int_auction.o int_elemental.o \
+ int_guild.o int_homun.o int_mail.o int_mercenary.o int_party.o \
+ int_pet.o int_quest.o int_storage.o pincode.o)
+CHAR_H = char.h inter.h int_auction.h int_elemental.h int_guild.h int_homun.h \
+ int_mail.h int_mercenary.h int_party.h int_pet.h int_quest.h \
+ int_storage.h pincode.h
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- CHAR_SERVER_SQL_DEPENDS=obj_sql $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+ CHAR_SERVER_SQL_DEPENDS=$(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ)
else
CHAR_SERVER_SQL_DEPENDS=needs_mysql
endif
@@ -32,13 +34,11 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all char-server clean help
+.PHONY: all sql char-server clean help
-all: char-server
+all: sql
-char-server: $(CHAR_SERVER_SQL_DEPENDS)
- @echo " LD $@"
- @$(CC) @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
+sql: char-server
clean:
@echo " CLEAN char"
@@ -46,10 +46,10 @@ clean:
help:
@echo "possible targets are 'char-server' 'all' 'clean' 'help'"
- @echo "'char-server' - char server (SQL version)"
- @echo "'all' - builds all above targets"
- @echo "'clean' - cleans builds and objects"
- @echo "'help' - outputs this message"
+ @echo "'char-server' - char server"
+ @echo "'all' - builds all above targets"
+ @echo "'clean' - cleans builds and objects"
+ @echo "'help' - outputs this message"
#####################################################################
@@ -57,23 +57,42 @@ needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/char/Makefile
+
+# object directories
+
obj_sql:
@echo " MKDIR obj_sql"
@-mkdir obj_sql
-obj_sql/%.o: %.c $(CHAR_H) $(COMMON_H) $(COMMON_SQL_H) $(MT19937AR_H) $(LIBCONFIG_H)
+# executables
+
+char-server: ../../char-server@EXEEXT@
+
+../../char-server@EXEEXT@: $(CHAR_SERVER_SQL_DEPENDS) Makefile
+ @echo " LD $(notdir $@)"
+ @$(CC) @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
+
+# char object files
+
+obj_sql/%.o: %.c $(CHAR_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
../common/obj_all/common.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
../common/obj_sql/common_sql.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)
diff --git a/src/char/char.c b/src/char/char.c
index f618320e1..7a948398c 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -68,6 +68,7 @@ char skill_homunculus_db[256] = "skill_homunculus";
char mercenary_db[256] = "mercenary";
char mercenary_owner_db[256] = "mercenary_owner";
char ragsrvinfo_db[256] = "ragsrvinfo";
+char elemental_db[256] = "elemental";
char interreg_db[32] = "interreg";
// show loading/saving messages
@@ -136,7 +137,7 @@ int guild_exp_rate = 100;
//Custom limits for the fame lists. [Skotlex]
int fame_list_size_chemist = MAX_FAME_LIST;
-int fame_list_size_smith = MAX_FAME_LIST;
+int fame_list_size_smith = MAX_FAME_LIST;
int fame_list_size_taekwon = MAX_FAME_LIST;
// Char-server-side stored fame lists [DracoRPG]
@@ -2517,8 +2518,7 @@ int save_accreg2(unsigned char* buf, int len)
return 0;
}
-void char_read_fame_list(void)
-{
+void char_read_fame_list(void) {
int i;
char* data;
size_t len;
@@ -2576,8 +2576,7 @@ void char_read_fame_list(void)
}
// Send map-servers the fame ranking lists
-int char_send_fame_list(int fd)
-{
+int char_send_fame_list(int fd) {
int i, len = 8;
unsigned char buf[32000];
@@ -2612,8 +2611,7 @@ int char_send_fame_list(int fd)
return 0;
}
-void char_update_fame_list(int type, int index, int fame)
-{
+void char_update_fame_list(int type, int index, int fame) {
unsigned char buf[8];
WBUFW(buf,0) = 0x2b22;
WBUFB(buf,2) = type;
@@ -2822,7 +2820,8 @@ int parse_frommap(int fd)
int aid, cid;
aid = RFIFOL(fd,2);
cid = RFIFOL(fd,6);
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT type, tick, val1, val2, val3, val4 from `%s` WHERE `account_id` = '%d' AND `char_id`='%d'",
+ if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` "
+ "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'",
scdata_db, aid, cid) )
{
Sql_ShowDebug(sql_handle);
@@ -3210,12 +3209,11 @@ int parse_frommap(int fd)
int player_pos;
int fame_pos;
- switch(type)
- {
- case 1: size = fame_list_size_smith; list = smith_fame_list; break;
- case 2: size = fame_list_size_chemist; list = chemist_fame_list; break;
- case 3: size = fame_list_size_taekwon; list = taekwon_fame_list; break;
- default: size = 0; list = NULL; break;
+ switch(type) {
+ case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break;
+ case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break;
+ case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break;
+ default: size = 0; list = NULL; break;
}
ARR_FIND(0, size, player_pos, list[player_pos].id == cid);// position of the player
@@ -3223,22 +3221,20 @@ int parse_frommap(int fd)
if( player_pos == size && fame_pos == size )
;// not on list and not enough fame to get on it
- else if( fame_pos == player_pos )
- {// same position
+ else if( fame_pos == player_pos ) {
+ // same position
list[player_pos].fame = fame;
char_update_fame_list(type, player_pos, fame);
- }
- else
- {// move in the list
- if( player_pos == size )
- {// new ranker - not in the list
+ } else {
+ // move in the list
+ if( player_pos == size ) {
+ // new ranker - not in the list
ARR_MOVE(size - 1, fame_pos, list, struct fame_list);
list[fame_pos].id = cid;
list[fame_pos].fame = fame;
char_loadName(cid, list[fame_pos].name);
- }
- else
- {// already in the list
+ } else {
+ // already in the list
if( fame_pos == size )
--fame_pos;// move to the end of the list
ARR_MOVE(player_pos, fame_pos, list, struct fame_list);
@@ -4721,6 +4717,8 @@ void sql_config_read(const char* cfgName)
safestrncpy(mercenary_owner_db,w2,sizeof(mercenary_owner_db));
else if(!strcmpi(w1,"ragsrvinfo_db"))
safestrncpy(ragsrvinfo_db,w2,sizeof(ragsrvinfo_db));
+ else if(!strcmpi(w1,"elemental_db"))
+ safestrncpy(elemental_db,w2,sizeof(elemental_db));
else if(!strcmpi(w1,"interreg_db"))
safestrncpy(interreg_db,w2,sizeof(interreg_db));
//support the import command, just like any other config
diff --git a/src/char/char.h b/src/char/char.h
index d98ce9004..a3bbdd904 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -103,6 +103,7 @@ extern char skill_homunculus_db[256];
extern char mercenary_db[256];
extern char mercenary_owner_db[256];
extern char ragsrvinfo_db[256];
+extern char elemental_db[256];
extern char interreg_db[32];
extern int db_use_sql_item_db;
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index 53a63a212..ed0c2a9ed 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -21,9 +21,9 @@ bool mapif_elemental_save(struct s_elemental* ele) {
if( ele->elemental_id == 0 ) { // Create new DB entry
if( SQL_ERROR == SQL->Query(sql_handle,
- "INSERT INTO `elemental` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
- "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
- ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
+ "INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
+ "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
+ elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
{
Sql_ShowDebug(sql_handle);
flag = false;
@@ -31,11 +31,11 @@ bool mapif_elemental_save(struct s_elemental* ele) {
else
ele->elemental_id = (int)SQL->LastInsertId(sql_handle);
} else if( SQL_ERROR == SQL->Query(sql_handle,
- "UPDATE `elemental` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
- "`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
- "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'",
- ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
- ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
+ "UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
+ "`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
+ "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'",
+ elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
+ ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
{ // Update DB entry
Sql_ShowDebug(sql_handle);
flag = false;
@@ -50,9 +50,11 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) {
ele->elemental_id = ele_id;
ele->char_id = char_id;
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `class`, `mode`, `hp`, `sp`, `max_hp`, `max_sp`, `atk1`, `atk2`, `matk`, `aspd`,"
- "`def`, `mdef`, `flee`, `hit`, `life_time` FROM `elemental` WHERE `ele_id` = '%d' AND `char_id` = '%d'",
- ele_id, char_id) ) {
+ if( SQL_ERROR == SQL->Query(sql_handle,
+ "SELECT `class`, `mode`, `hp`, `sp`, `max_hp`, `max_sp`, `atk1`, `atk2`, `matk`, `aspd`,"
+ "`def`, `mdef`, `flee`, `hit`, `life_time` FROM `%s` WHERE `ele_id` = '%d' AND `char_id` = '%d'",
+ elemental_db, ele_id, char_id) )
+ {
Sql_ShowDebug(sql_handle);
return false;
}
@@ -85,7 +87,7 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) {
}
bool mapif_elemental_delete(int ele_id) {
- if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `elemental` WHERE `ele_id` = '%d'", ele_id) ) {
+ if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) {
Sql_ShowDebug(sql_handle);
return false;
}
diff --git a/src/char/inter.c b/src/char/inter.c
index 23f400ee9..353d3e009 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -451,7 +451,7 @@ void mapif_parse_accinfo(int fd) {
account_id = atoi(query);
if (account_id < START_ACCOUNT_NUM) { // is string
- if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `char` WHERE `name` LIKE '%s' LIMIT 10", query_esq)
+ if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `%s` WHERE `name` LIKE '%s' LIMIT 10", char_db, query_esq)
|| SQL->NumRows(sql_handle) == 0 ) {
if( SQL->NumRows(sql_handle) == 0 ) {
inter_to_fd(fd, u_fd, aid, "No matches were found for your criteria, '%s'",query);
@@ -490,9 +490,10 @@ void mapif_parse_accinfo(int fd) {
/* it will only get here if we have a single match */
if( account_id ) {
- char userid[NAME_LENGTH], user_pass[NAME_LENGTH], email[40], last_ip[20], lastlogin[30], pincode[5], birthdate[11];
+ char userid[NAME_LENGTH], user_pass[NAME_LENGTH], email[40], last_ip[20], lastlogin[30], pin_code[5], birthdate[11];
short level = -1;
int logincount = 0,state = 0;
+ // FIXME: No, this doesn't really look right. We can't, and shouldn't, access the login table from the char server.
if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `userid`, `user_pass`, `email`, `last_ip`, `group_id`, `lastlogin`, `logincount`, `state`,`pincode`,`birthdate` FROM `login` WHERE `account_id` = '%d' LIMIT 1", account_id)
|| SQL->NumRows(sql_handle) == 0 ) {
if( SQL->NumRows(sql_handle) == 0 ) {
@@ -511,7 +512,7 @@ void mapif_parse_accinfo(int fd) {
SQL->GetData(sql_handle, 5, &data, NULL); safestrncpy(lastlogin, data, sizeof(lastlogin));
SQL->GetData(sql_handle, 6, &data, NULL); logincount = atoi(data);
SQL->GetData(sql_handle, 7, &data, NULL); state = atoi(data);
- SQL->GetData(sql_handle, 8, &data, NULL); safestrncpy(pincode, data, sizeof(pincode));
+ SQL->GetData(sql_handle, 8, &data, NULL); safestrncpy(pin_code, data, sizeof(pin_code));
SQL->GetData(sql_handle, 9, &data, NULL); safestrncpy(birthdate, data, sizeof(birthdate));
}
@@ -524,8 +525,8 @@ void mapif_parse_accinfo(int fd) {
inter_to_fd(fd, u_fd, aid, "User: %s | GM Group: %d | State: %d", userid, level, state );
if (level < castergroup) { /* only show pass if your gm level is greater than the one you're searching for */
- if( strlen(pincode) )
- inter_to_fd(fd, u_fd, aid, "Password: %s (PIN:%s)", user_pass, pincode );
+ if( strlen(pin_code) )
+ inter_to_fd(fd, u_fd, aid, "Password: %s (PIN:%s)", user_pass, pin_code );
else
inter_to_fd(fd, u_fd, aid, "Password: %s", user_pass );
}
@@ -536,7 +537,7 @@ void mapif_parse_accinfo(int fd) {
inter_to_fd(fd, u_fd, aid, "-- Character Details --" );
- if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`, `name`, `char_num`, `class`, `base_level`, `job_level`, `online` FROM `char` WHERE `account_id` = '%d' ORDER BY `char_num` LIMIT %d", account_id, MAX_CHARS)
+ if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`, `name`, `char_num`, `class`, `base_level`, `job_level`, `online` FROM `%s` WHERE `account_id` = '%d' ORDER BY `char_num` LIMIT %d", char_db, account_id, MAX_CHARS)
|| SQL->NumRows(sql_handle) == 0 ) {
if( SQL->NumRows(sql_handle) == 0 )
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index 5e44b80c7..c8bce8ee8 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -91,7 +91,7 @@ HPExport struct HPMi_interface {
bool (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID);
} HPMi_s;
#ifndef _HPM_H_
- HPExport struct HPMi_interface *HPMi;
+HPExport struct HPMi_interface *HPMi;
#endif
#endif /* _HPMi_H_ */
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 313db8ccc..78f9cd0d1 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -1,31 +1,35 @@
-COMMON_OBJ = obj_all/core.o obj_all/socket.o obj_all/timer.o obj_all/db.o obj_all/HPM.o \
- obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \
- obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \
- obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o obj_all/des.o \
- obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o obj_all/console.o \
- obj_all/miniconsole.o
-
-COMMON_H = $(shell ls ../common/*.h)
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+COMMON_SHARED_OBJ = conf.o db.o des.o ers.o grfio.o HPM.o mapindex.o \
+ md5calc.o mempool.o mutex.o nullpo.o raconf.o random.o \
+ showmsg.o strlib.o thread.o timer.o utils.o
+COMMON_OBJ = $(addprefix obj_all/, $(COMMON_SHARED_OBJ) \
+ console.o core.o malloc.o socket.o)
+COMMON_MINI_OBJ = $(addprefix obj_all/, $(COMMON_SHARED_OBJ) \
+ miniconsole.o minicore.o minimalloc.o minisocket.o)
+COMMON_H = atomic.h cbasetypes.h conf.h console.h core.h db.h des.h ers.h \
+ evdp.h grfio.h HPM.h HPMi.h malloc.h mapindex.h md5calc.h \
+ mempool.h mmo.h mutex.h netbuffer.h network.h nullpo.h raconf.h \
+ random.h showmsg.h socket.h spinlock.h sql.h strlib.h thread.h \
+ timer.h utils.h winapi.h
COMMON_SQL_OBJ = obj_sql/sql.o
COMMON_SQL_H = sql.h
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=sql
- SQL_DEPENDS=common common_sql
+ SQL_DEPENDS=common common_sql common_mini
else
SQL_DEPENDS=needs_mysql
endif
@@ -36,9 +40,9 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all sql clean help
+.PHONY: all sql common common_sql common_mini clean help
-all: $(ALL_DEPENDS)
+all: sql
sql: $(SQL_DEPENDS)
@@ -55,10 +59,15 @@ help:
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/common/Makefile
+
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
+# object directories
+
obj_all:
@echo " MKDIR obj_all"
@-mkdir obj_all
@@ -67,35 +76,42 @@ obj_sql:
@echo " MKDIR obj_sql"
@-mkdir obj_sql
-obj_all/common.a: $(COMMON_OBJ)
+obj_all/common.a: $(COMMON_OBJ) Makefile
@echo " AR $@"
@@AR@ rcs obj_all/common.a $(COMMON_OBJ)
-obj_sql/common_sql.a: $(COMMON_SQL_OBJ)
+obj_all/common_mini.a: $(COMMON_MINI_OBJ) Makefile
+ @echo " AR $@"
+ @@AR@ rcs obj_all/common_mini.a $(COMMON_MINI_OBJ)
+
+obj_sql/common_sql.a: $(COMMON_SQL_OBJ) Makefile
@echo " AR $@"
@@AR@ rcs obj_sql/common_sql.a $(COMMON_SQL_OBJ)
-
-common: obj_all $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a
+common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a Makefile
+
+common_mini: $(COMMON_MINI_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common_mini.a Makefile
-common_sql: obj_sql $(COMMON_SQL_OBJ) obj_sql/common_sql.a
+common_sql: $(COMMON_SQL_OBJ) obj_sql/common_sql.a Makefile
-obj_all/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
-obj_all/mini%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_all/mini%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
-obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(LIBCONFIG_H)
+obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)
diff --git a/src/common/console.c b/src/common/console.c
index 75b6eaea4..b25de84b3 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -386,8 +386,8 @@ void console_parse_init(void) {
timer->add_interval(timer->gettick() + 1000, console->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
}
-void console_setSQL(Sql *SQL) {
- console->SQL = SQL;
+void console_setSQL(Sql *SQL_handle) {
+ console->SQL = SQL_handle;
}
#endif /* CONSOLE_INPUT */
diff --git a/src/common/console.h b/src/common/console.h
index 214a41175..cef898f17 100644
--- a/src/common/console.h
+++ b/src/common/console.h
@@ -64,7 +64,7 @@ struct console_interface {
void (*load_defaults) (void);
void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth);
void (*addCommand) (char *name, CParseFunc func);
- void (*setSQL) (Sql *SQL);
+ void (*setSQL) (Sql *SQL_handle);
#endif
};
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 17a01ff95..b51d0ec4a 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -575,6 +575,13 @@ struct fame_list {
char name[NAME_LENGTH];
};
+enum fame_list_type {
+ RANKTYPE_BLACKSMITH = 0,
+ RANKTYPE_ALCHEMIST = 1,
+ RANKTYPE_TAEKWON = 2,
+ RANKTYPE_PK = 3, //Not supported yet
+};
+
enum { //Change Guild Infos
GBI_EXP =1, // Guild Experience (EXP)
GBI_GUILDLV, // Guild level
diff --git a/src/common/strlib.c b/src/common/strlib.c
index 686b2e47d..e45cb0789 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -444,9 +444,9 @@ bool bin2hex(char* output, unsigned char* input, size_t count)
/// Parses a single field in a delim-separated string.
/// The delimiter after the field is skipped.
///
-/// @param sv Parse state
+/// @param svstate Parse state
/// @return 1 if a field was parsed, 0 if already done, -1 on error.
-int sv_parse_next(struct s_svstate* sv)
+int sv_parse_next(struct s_svstate* svstate)
{
enum {
START_OF_FIELD,
@@ -462,13 +462,13 @@ int sv_parse_next(struct s_svstate* sv)
char delim;
int i;
- if( sv == NULL )
+ if( svstate == NULL )
return -1;// error
- str = sv->str;
- len = sv->len;
- opt = sv->opt;
- delim = sv->delim;
+ str = svstate->str;
+ len = svstate->len;
+ opt = svstate->opt;
+ delim = svstate->delim;
// check opt
if( delim == '\n' && (opt&(SV_TERMINATE_CRLF|SV_TERMINATE_LF)) )
@@ -482,9 +482,9 @@ int sv_parse_next(struct s_svstate* sv)
return -1;// error
}
- if( sv->done || str == NULL )
+ if( svstate->done || str == NULL )
{
- sv->done = true;
+ svstate->done = true;
return 0;// nothing to parse
}
@@ -495,10 +495,10 @@ int sv_parse_next(struct s_svstate* sv)
((opt&SV_TERMINATE_CR) && str[i] == '\r') || \
((opt&SV_TERMINATE_CRLF) && i+1 < len && str[i] == '\r' && str[i+1] == '\n') )
#define IS_C_ESCAPE() ( (opt&SV_ESCAPE_C) && str[i] == '\\' )
-#define SET_FIELD_START() sv->start = i
-#define SET_FIELD_END() sv->end = i
+#define SET_FIELD_START() svstate->start = i
+#define SET_FIELD_END() svstate->end = i
- i = sv->off;
+ i = svstate->off;
state = START_OF_FIELD;
while( state != END )
{
@@ -578,14 +578,14 @@ int sv_parse_next(struct s_svstate* sv)
else
++i;// CR or LF
#endif
- sv->done = true;
+ svstate->done = true;
state = END;
break;
}
}
if( IS_END() )
- sv->done = true;
- sv->off = i;
+ svstate->done = true;
+ svstate->off = i;
#undef IS_END
#undef IS_DELIM
@@ -619,31 +619,31 @@ int sv_parse_next(struct s_svstate* sv)
/// @param opt Options that determine the parsing behaviour
/// @return Number of fields found in the string or -1 if an error occured
int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt) {
- struct s_svstate sv;
+ struct s_svstate svstate;
int count;
// initialize
if( out_pos == NULL ) npos = 0;
for( count = 0; count < npos; ++count )
out_pos[count] = -1;
- sv.str = str;
- sv.len = len;
- sv.off = startoff;
- sv.opt = opt;
- sv.delim = delim;
- sv.done = false;
+ svstate.str = str;
+ svstate.len = len;
+ svstate.off = startoff;
+ svstate.opt = opt;
+ svstate.delim = delim;
+ svstate.done = false;
// parse
count = 0;
if( npos > 0 ) out_pos[0] = startoff;
- while( !sv.done ) {
+ while( !svstate.done ) {
++count;
- if( sv_parse_next(&sv) <= 0 )
+ if( sv_parse_next(&svstate) <= 0 )
return -1;// error
- if( npos > count*2 ) out_pos[count*2] = sv.start;
- if( npos > count*2+1 ) out_pos[count*2+1] = sv.end;
+ if( npos > count*2 ) out_pos[count*2] = svstate.start;
+ if( npos > count*2+1 ) out_pos[count*2+1] = svstate.end;
}
- if( npos > 1 ) out_pos[1] = sv.off;
+ if( npos > 1 ) out_pos[1] = svstate.off;
return count;
}
diff --git a/src/common/strlib.h b/src/common/strlib.h
index 9b1875d45..5ef455a0e 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -124,9 +124,9 @@ struct sv_interface {
/// Parses a single field in a delim-separated string.
/// The delimiter after the field is skipped.
///
- /// @param sv Parse state
+ /// @param svstate Parse state
/// @return 1 if a field was parsed, 0 if done, -1 on error.
- int (*parse_next) (struct s_svstate* sv);
+ int (*parse_next) (struct s_svstate* svstate);
/// Parses a delim-separated string.
/// Starts parsing at startoff and fills the pos array with position pairs.
diff --git a/src/common/thread.c b/src/common/thread.c
index 315b310b2..4d110f2dd 100644
--- a/src/common/thread.c
+++ b/src/common/thread.c
@@ -96,15 +96,11 @@ void rathread_final(){
// gets called whenever a thread terminated ..
-static void rat_thread_terminated( rAthread handle ){
-
- int id_backup = handle->myID;
-
- // Simply set all members to 0 (except the id)
- memset(handle, 0x00, sizeof(struct rAthread));
-
- handle->myID = id_backup; // done ;)
-
+static void rat_thread_terminated(rAthread handle) {
+ // Preserve handle->myID and handle->hThread, set everything else to its default value
+ handle->param = NULL;
+ handle->proc = NULL;
+ handle->prio = RAT_PRIO_NORMAL;
}//end: rat_thread_terminated()
#ifdef WIN32
diff --git a/src/config/const.h b/src/config/const.h
index f0902759d..7badb1071 100644
--- a/src/config/const.h
+++ b/src/config/const.h
@@ -53,39 +53,42 @@
/* pointer size fix which fixes several gcc warnings */
#ifdef __64BIT__
- #define __64BPTRSIZE(y) (intptr)y
+ #define __64BPTRSIZE(y) ((intptr)(y))
#else
- #define __64BPTRSIZE(y) y
+ #define __64BPTRSIZE(y) (y)
#endif
/* ATCMD_FUNC(mobinfo) HIT and FLEE calculations */
#ifdef RENEWAL
- #define MOB_FLEE(mob) ( mob->lv + mob->status.agi + 100 )
- #define MOB_HIT(mob) ( mob->lv + mob->status.dex + 150 )
- #define RE_SKILL_REDUCTION(){ \
- wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 0, wd.flag), nk, n_ele, s_ele, s_ele_, false, flag.arrow); \
- if( flag.lh ) \
- wd.damage2 = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 1, wd.flag), nk, n_ele, s_ele, s_ele_, true, flag.arrow); \
- }
+ #define MOB_FLEE(mobdata) ( (mobdata)->lv + (mobdata)->status.agi + 100 )
+ #define MOB_HIT(mobdata) ( (mobdata)->lv + (mobdata)->status.dex + 150 )
+ #define RE_SKILL_REDUCTION() do { \
+ wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 0, wd.flag), nk, n_ele, s_ele, s_ele_, false, flag.arrow); \
+ if( flag.lh ) \
+ wd.damage2 = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 1, wd.flag), nk, n_ele, s_ele, s_ele_, true, flag.arrow); \
+ } while(0)
#else
- #define MOB_FLEE(mob) ( mob->lv + mob->status.agi )
- #define MOB_HIT(mob) ( mob->lv + mob->status.dex )
+ #define MOB_FLEE(mobdata) ( (mobdata)->lv + (mobdata)->status.agi )
+ #define MOB_HIT(mobdata) ( (mobdata)->lv + (mobdata)->status.dex )
#endif
/* Renewal's dmg level modifier, used as a macro for a easy way to turn off. */
#ifdef RENEWAL_LVDMG
- #define RE_LVL_DMOD(val) \
- if( iStatus->get_lv(src) > 100 && val > 0 ) \
- skillratio = skillratio * iStatus->get_lv(src) / val;
- #define RE_LVL_MDMOD(val) \
- if( iStatus->get_lv(src) > 100 && val > 0) \
- md.damage = md.damage * iStatus->get_lv(src) / val;
+ #define RE_LVL_DMOD(val) do { \
+ if( iStatus->get_lv(src) > 100 && (val) > 0 ) \
+ skillratio = skillratio * iStatus->get_lv(src) / (val); \
+ } while(0)
+ #define RE_LVL_MDMOD(val) do { \
+ if( iStatus->get_lv(src) > 100 && (val) > 0) \
+ md.damage = md.damage * iStatus->get_lv(src) / (val); \
+ } while(0)
/* ranger traps special */
- #define RE_LVL_TMDMOD() \
+ #define RE_LVL_TMDMOD() do { \
if( iStatus->get_lv(src) > 100 ) \
- md.damage = md.damage * 150 / 100 + md.damage * iStatus->get_lv(src) / 100;
+ md.damage = md.damage * 150 / 100 + md.damage * iStatus->get_lv(src) / 100; \
+ } while(0)
#else
- #define RE_LVL_DMOD(val)
+ #define RE_LVL_DMOD(val)
#define RE_LVL_MDMOD(val)
#define RE_LVL_TMDMOD()
#endif
@@ -100,10 +103,10 @@
// Renewal variable cast time reduction
#ifdef RENEWAL_CAST
- #define VARCAST_REDUCTION(val){ \
- if( (varcast_r += val) != 0 && varcast_r >= 0 ) \
- time = time * (1 - (float)min(val, 100) / 100); \
- }
+ #define VARCAST_REDUCTION(val) do { \
+ if( (varcast_r += (val)) != 0 && varcast_r >= 0 ) \
+ time = time * (1 - (float)min((val), 100) / 100); \
+ } while(0)
#endif
/* console_input doesn't go well with minicore */
diff --git a/src/login/Makefile.in b/src/login/Makefile.in
index 5014d667a..b6b70a495 100644
--- a/src/login/Makefile.in
+++ b/src/login/Makefile.in
@@ -1,25 +1,26 @@
COMMON_H = $(shell ls ../common/*.h)
-
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
-LOGIN_OBJ = login.o
-LOGIN_SQL_OBJ = $(LOGIN_OBJ:%=obj_sql/%) \
- obj_sql/account_sql.o obj_sql/ipban_sql.o obj_sql/loginlog_sql.o
+CONFIG_H = $(shell ls ../config/*.h ../config/*/*.h)
+
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+LOGIN_OBJ = $(addprefix obj_sql/, account_sql.o ipban_sql.o login.o \
+ loginlog_sql.o)
LOGIN_H = login.h account.h ipban.h loginlog.h
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- LOGIN_SERVER_SQL_DEPENDS=obj_sql $(LOGIN_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+ LOGIN_SERVER_SQL_DEPENDS=$(LOGIN_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ)
else
LOGIN_SERVER_SQL_DEPENDS=needs_mysql
endif
@@ -30,25 +31,28 @@ CC = @CC@
export CC
#####################################################################
-.PHONY :all sql clean help
+.PHONY: all sql login-server clean help
all: sql
-sql: obj_sql login-server
+sql: login-server
clean:
@echo " CLEAN login"
@rm -rf *.o obj_sql ../../login-server@EXEEXT@
help:
- @echo "possible targets are 'sql' 'all' 'clean' 'help'"
- @echo "'sql' - login server (SQL version)"
- @echo "'all' - builds all above targets"
- @echo "'clean' - cleans builds and objects"
- @echo "'help' - outputs this message"
+ @echo "possible targets are 'login-server' 'all' 'clean' 'help'"
+ @echo "'login-server' - login server"
+ @echo "'all' - builds all above targets"
+ @echo "'clean' - cleans builds and objects"
+ @echo "'help' - outputs this message"
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/login/Makefile
+
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
@@ -59,28 +63,33 @@ obj_sql:
@echo " MKDIR obj_sql"
@-mkdir obj_sql
-#executables
+# executables
+
+login-server: ../../login-server@EXEEXT@
-login-server: $(LOGIN_SERVER_SQL_DEPENDS)
- @echo " LD $@"
- @$(CC) @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
-
+../../login-server@EXEEXT@: $(LOGIN_SERVER_SQL_DEPENDS) Makefile
+ @echo " LD $(notdir $@)"
+ @$(CC) @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
# login object files
-obj_sql/%.o: %.c $(LOGIN_H) $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_sql/%.o: %.c $(LOGIN_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DWITH_SQL @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
../common/obj_all/common.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
../common/obj_sql/common_sql.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index df516a3f6..9b074b368 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -252,7 +252,7 @@ int ipban_cleanup(int tid, unsigned int tick, int id, intptr_t data)
if( !login_config.ipban )
return 0;// ipban disabled
- if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `ipbanlist` WHERE `rtime` <= NOW()") )
+ if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `rtime` <= NOW()", ipban_table) )
Sql_ShowDebug(sql_handle);
return 0;
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index 588d19eae..fb78d51a1 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -1,43 +1,38 @@
COMMON_H = $(shell ls ../common/*.h)
-
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
-MAP_OBJ = map.o chrif.o clif.o pc.o status.o npc.o \
- npc_chat.o chat.o path.o itemdb.o mob.o script.o \
- storage.o skill.o atcommand.o battle.o battleground.o \
- intif.o trade.o party.o vending.o guild.o pet.o \
- log.o mail.o date.o unit.o homunculus.o mercenary.o quest.o instance.o \
- buyingstore.o searchstore.o duel.o pc_groups.o elemental.o irc-bot.o HPMmap.o
-MAP_SQL_OBJ = $(MAP_OBJ:%=obj_sql/%) \
- obj_sql/mapreg_sql.o
-MAP_H = map.h chrif.h clif.h pc.h status.h npc.h \
- chat.h itemdb.h mob.h script.h path.h \
- storage.h skill.h atcommand.h battle.h battleground.h \
- intif.h trade.h party.h vending.h guild.h pet.h \
- log.h mail.h date.h unit.h homunculus.h mercenary.h quest.h instance.h mapreg.h \
- buyingstore.h searchstore.h duel.h pc_groups.h \
- ../config/core.h ../config/renewal.h ../config/secure.h ../config/const.h \
- ../config/classes/general.h elemental.h packets.h packets_struct.h irc-bot.h HPMmap.h
+CONFIG_H = $(shell ls ../config/*.h ../config/*/*.h)
+
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+MAP_OBJ = $(addprefix obj_sql/, atcommand.o battle.o battleground.o \
+ buyingstore.o chat.o chrif.o clif.o date.o duel.o elemental.o \
+ guild.o homunculus.o HPMmap.o instance.o intif.o irc-bot.o itemdb.o \
+ log.o mail.o map.o mapreg_sql.o mercenary.o mob.o npc.o npc_chat.o \
+ party.o path.o pc.o pc_groups.o pet.o quest.o script.o \
+ searchstore.o skill.o status.o storage.o trade.o unit.o vending.o)
+MAP_H = atcommand.h battle.h battleground.h buyingstore.h chat.h chrif.h \
+ clif.h date.h duel.h elemental.h guild.h homunculus.h HPMmap.h \
+ instance.h intif.h irc-bot.h itemdb.h log.h mail.h map.h mapreg.h \
+ mercenary.h mob.h npc.h packets.h packets_struct.h party.h path.h \
+ pc.h pc_groups.h pet.h quest.h script.h searchstore.h skill.h \
+ status.h storage.h trade.h unit.h vending.h
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=txt sql
- SQL_DEPENDS=map-server
+ MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ)
else
- ALL_TARGET=txt
- SQL_DEPENDS=needs_mysql
+ MAP_SERVER_SQL_DEPENDS=needs_mysql
endif
-TXT_DEPENDS=map-server
HAVE_PCRE=@HAVE_PCRE@
ifeq ($(HAVE_PCRE),yes)
@@ -52,40 +47,33 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all txt sql clean help
-
-all: $(ALL_DEPENDS)
+.PHONY: all sql map-server clean help
-txt: $(TXT_DEPENDS)
+all: sql
-sql: $(SQL_DEPENDS)
+sql: map-server
clean:
@echo " CLEAN map"
- @rm -rf *.o obj_txt obj_sql ../../map-server@EXEEXT@
+ @rm -rf *.o obj_sql ../../map-server@EXEEXT@
help:
-ifeq ($(HAVE_MYSQL),yes)
- @echo "possible targets are 'sql' 'txt' 'all' 'clean' 'help'"
- @echo "'sql' - map server (SQL version)"
-else
- @echo "possible targets are 'txt' 'all' 'clean' 'help'"
-endif
- @echo "'txt' - map server (TXT version)"
- @echo "'all' - builds all above targets"
- @echo "'clean' - cleans builds and objects"
- @echo "'help' - outputs this message"
+ @echo "possible targets are 'map-server' 'all' 'clean' 'help'"
+ @echo "'map-server' - map server"
+ @echo "'all' - builds all above targets"
+ @echo "'clean' - cleans builds and objects"
+ @echo "'help' - outputs this message"
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/map/Makefile
+
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
# object directories
-obj_txt:
- @echo " MKDIR obj_txt"
- @-mkdir obj_txt
obj_sql:
@echo " MKDIR obj_sql"
@@ -93,25 +81,31 @@ obj_sql:
# executables
-map-server: obj_sql $(MAP_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a
- @echo " LD $@"
- @$(CC) @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@
+map-server: ../../map-server@EXEEXT@
+
+../../map-server@EXEEXT@: $(MAP_SERVER_SQL_DEPENDS) Makefile
+ @echo " LD $(notdir $@)"
+ @$(CC) @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@
# map object files
-obj_sql/%.o: %.c $(MAP_H) $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_sql/%.o: %.c $(MAP_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(PCRE_CFLAGS) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
../common/obj_all/common.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
../common/obj_sql/common_sql.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 23653f803..41d93fa4d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -60,7 +60,7 @@ static char atcmd_player_name[NAME_LENGTH];
static AtCommandInfo* get_atcommandinfo_byname(const char *name); // @help
static const char* atcommand_checkalias(const char *aliasname); // @help
-static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool atcommand); // @help
+static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool is_atcmd_cmd); // @help
// @commands (script-based)
struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {
@@ -4223,8 +4223,7 @@ ACMD(nuke)
/*==========================================
* @tonpc
*------------------------------------------*/
-ACMD(tonpc)
-{
+ACMD(tonpc) {
char npcname[NAME_LENGTH+1];
struct npc_data *nd;
@@ -4238,7 +4237,7 @@ ACMD(tonpc)
}
if ((nd = npc->name2id(npcname)) != NULL) {
- if (pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
+ if (nd->bl.m != -1 && pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif->message(fd, msg_txt(0)); // Warped.
else
return false;
@@ -6839,27 +6838,26 @@ ACMD(showmobs)
/*==========================================
* homunculus level up [orn]
*------------------------------------------*/
-ACMD(homlevel)
-{
+ACMD(homlevel) {
TBL_HOM * hd;
int level = 0;
enum homun_type htype;
nullpo_retr(-1, sd);
- if ( !message || !*message || ( level = atoi(message) ) < 1 ) {
+ if( !message || !*message || ( level = atoi(message) ) < 1 ) {
clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>).
return false;
}
- if ( !homun_alive(sd->hd) ) {
+ if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
hd = sd->hd;
- if((htype = homun->class2type(hd->homunculus.class_)) == -1) {
+ if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) {
ShowError("atcommand_homlevel: invalid homun class %d (player %s)\n", hd->homunculus.class_,sd->status.name);
return false;
}
@@ -6921,12 +6919,12 @@ ACMD(hommutate) {
enum homun_type m_class, m_id;
nullpo_retr(-1, sd);
- if (!homun_alive(sd->hd)) {
+ if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
- if (!message || !*message) {
+ if( !message || !*message ) {
homun_id = 6048 + (rnd() % 4);
} else {
homun_id = atoi(message);
@@ -6935,7 +6933,7 @@ ACMD(hommutate) {
m_class = homun->class2type(sd->hd->homunculus.class_);
m_id = homun->class2type(homun_id);
- if (m_class != -1 && m_id != -1 && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99) {
+ if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 ) {
homun->mutate(sd->hd, homun_id);
} else {
clif->emotion(&sd->hd->bl, E_SWT);
@@ -7637,7 +7635,7 @@ return true;\
clif->message(sd->fd," ");
clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif->message(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags.
- return 1;
+ return true;
}
for (i = 0; flag_name[i]; i++) flag_name[i] = TOLOWER(flag_name[i]); //lowercase
@@ -7741,8 +7739,7 @@ ACMD(showdelay)
* @reject - reject invitation
* @leave - leave duel
*------------------------------------------*/
-ACMD(invite)
-{
+ACMD(invite) {
unsigned int did = sd->duel_group;
struct map_session_data *target_sd = iMap->nick2sd((char *)message);
@@ -7752,8 +7749,8 @@ ACMD(invite)
return true;
}
- if(iDuel->duel_list[did].max_players_limit > 0 &&
- iDuel->duel_list[did].members_count >= iDuel->duel_list[did].max_players_limit) {
+ if(duel->list[did].max_players_limit > 0 &&
+ duel->list[did].members_count >= duel->list[did].max_players_limit) {
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
@@ -7779,18 +7776,17 @@ ACMD(invite)
return true;
}
- iDuel->invite(did, sd, target_sd);
+ duel->invite(did, sd, target_sd);
// "Duel: Invitation has been sent."
clif->message(fd, msg_txt(354));
return true;
}
-ACMD(duel)
-{
+ACMD(duel) {
unsigned int maxpl = 0;
if(sd->duel_group > 0) {
- iDuel->showinfo(sd->duel_group, sd);
+ duel->showinfo(sd->duel_group, sd);
return true;
}
@@ -7800,7 +7796,7 @@ ACMD(duel)
return true;
}
- if(!iDuel->checktime(sd)) {
+ if(!duel->checktime(sd)) {
char output[CHAT_SIZE_MAX];
// "Duel: You can take part in duel only one time per %d minutes."
sprintf(output, msg_txt(356), battle_config.duel_time_interval);
@@ -7814,18 +7810,18 @@ ACMD(duel)
clif->message(fd, msg_txt(357)); // "Duel: Invalid value."
return true;
}
- iDuel->create(sd, maxpl);
+ duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
target_sd = iMap->nick2sd((char *)message);
if(target_sd != NULL) {
unsigned int newduel;
- if((newduel = iDuel->create(sd, 2)) != -1) {
+ if((newduel = duel->create(sd, 2)) != -1) {
if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
clif->message(fd, msg_txt(353)); // "Duel: Player already in duel."
return true;
}
- iDuel->invite(newduel, sd, target_sd);
+ duel->invite(newduel, sd, target_sd);
clif->message(fd, msg_txt(354)); // "Duel: Invitation has been sent."
}
} else {
@@ -7835,28 +7831,26 @@ ACMD(duel)
}
}
} else
- iDuel->create(sd, 0);
+ duel->create(sd, 0);
return true;
}
-ACMD(leave)
-{
+ACMD(leave) {
if(sd->duel_group <= 0) {
// "Duel: @leave without @duel."
clif->message(fd, msg_txt(358));
return true;
}
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
clif->message(fd, msg_txt(359)); // "Duel: You left the duel."
return true;
}
-ACMD(accept)
-{
- if(!iDuel->checktime(sd)) {
+ACMD(accept) {
+ if(!duel->checktime(sd)) {
char output[CHAT_SIZE_MAX];
// "Duel: You can take part in duel only one time per %d minutes."
sprintf(output, msg_txt(356), battle_config.duel_time_interval);
@@ -7870,28 +7864,27 @@ ACMD(accept)
return true;
}
- if( iDuel->duel_list[sd->duel_invite].max_players_limit > 0 && iDuel->duel_list[sd->duel_invite].members_count >= iDuel->duel_list[sd->duel_invite].max_players_limit )
- {
+ if( duel->list[sd->duel_invite].max_players_limit > 0
+ && duel->list[sd->duel_invite].members_count >= duel->list[sd->duel_invite].max_players_limit ) {
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
return true;
}
- iDuel->accept(sd->duel_invite, sd);
+ duel->accept(sd->duel_invite, sd);
// "Duel: Invitation has been accepted."
clif->message(fd, msg_txt(361));
return true;
}
-ACMD(reject)
-{
+ACMD(reject) {
if(sd->duel_invite <= 0) {
// "Duel: @reject without invititation."
clif->message(fd, msg_txt(362));
return true;
}
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
// "Duel: Invitation has been rejected."
clif->message(fd, msg_txt(363));
return true;
@@ -8146,28 +8139,20 @@ ACMD(itemlist)
nullpo_retr(-1, sd);
- if( strcmp(command+1, "storagelist") == 0 )
- {
+ if( strcmp(command+1, "storagelist") == 0 ) {
location = "storage";
items = sd->status.storage.items;
size = MAX_STORAGE;
- }
- else
- if( strcmp(command+1, "cartlist") == 0 )
- {
- location = "cart";
- items = sd->status.cart;
- size = MAX_CART;
- }
- else
- if( strcmp(command+1, "itemlist") == 0 )
- {
- location = "inventory";
- items = sd->status.inventory;
- size = MAX_INVENTORY;
- }
- else
- return 1;
+ } else if( strcmp(command+1, "cartlist") == 0 ) {
+ location = "cart";
+ items = sd->status.cart;
+ size = MAX_CART;
+ } else if( strcmp(command+1, "itemlist") == 0 ) {
+ location = "inventory";
+ items = sd->status.inventory;
+ size = MAX_INVENTORY;
+ } else
+ return false;
StrBuf->Init(&buf);
@@ -8196,8 +8181,7 @@ ACMD(itemlist)
else
StrBuf->Printf(&buf, "%d %s (%s, id: %d)", it->amount, itd->jname, itd->name, it->nameid);
- if( it->equip )
- {
+ if( it->equip ) {
char equipstr[CHAT_SIZE_MAX];
strcpy(equipstr, msg_txt(1333)); // | equipped:
if( it->equip & EQP_GARMENT )
@@ -8236,52 +8220,46 @@ ACMD(itemlist)
clif->message(fd, StrBuf->Value(&buf));
StrBuf->Clear(&buf);
- if( it->card[0] == CARD0_PET )
- {// pet egg
+ if( it->card[0] == CARD0_PET ) {
+ // pet egg
if (it->card[3])
StrBuf->Printf(&buf, msg_txt(1348), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, named)
else
StrBuf->Printf(&buf, msg_txt(1349), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, unnamed)
- }
- else
- if(it->card[0] == CARD0_FORGE)
- {// forged item
- StrBuf->Printf(&buf, msg_txt(1350), (unsigned int)MakeDWord(it->card[2], it->card[3]), it->card[1]>>8, it->card[1]&0x0f); // -> (crafted item, creator id: %u, star crumbs %d, element %d)
+ } else if(it->card[0] == CARD0_FORGE) {
+ // forged item
+ StrBuf->Printf(&buf, msg_txt(1350), (unsigned int)MakeDWord(it->card[2], it->card[3]), it->card[1]>>8, it->card[1]&0x0f); // -> (crafted item, creator id: %u, star crumbs %d, element %d)
+ } else if(it->card[0] == CARD0_CREATE) {
+ // created item
+ StrBuf->Printf(&buf, msg_txt(1351), (unsigned int)MakeDWord(it->card[2], it->card[3])); // -> (produced item, creator id: %u)
+ } else {
+ // normal item
+ int counter2 = 0;
+
+ for( j = 0; j < itd->slot; ++j ) {
+ struct item_data* card;
+
+ if( it->card[j] == 0 || (card = itemdb->exists(it->card[j])) == NULL )
+ continue;
+
+ counter2++;
+
+ if( counter2 == 1 )
+ StrBuf->AppendStr(&buf, msg_txt(1352)); // -> (card(s):
+
+ if( counter2 != 1 )
+ StrBuf->AppendStr(&buf, ", ");
+
+ StrBuf->Printf(&buf, "#%d %s (id: %d)", counter2, card->jname, card->nameid);
}
- else
- if(it->card[0] == CARD0_CREATE)
- {// created item
- StrBuf->Printf(&buf, msg_txt(1351), (unsigned int)MakeDWord(it->card[2], it->card[3])); // -> (produced item, creator id: %u)
- }
- else
- {// normal item
- int counter2 = 0;
-
- for( j = 0; j < itd->slot; ++j )
- {
- struct item_data* card;
-
- if( it->card[j] == 0 || (card = itemdb->exists(it->card[j])) == NULL )
- continue;
-
- counter2++;
-
- if( counter2 == 1 )
- StrBuf->AppendStr(&buf, msg_txt(1352)); // -> (card(s):
-
- if( counter2 != 1 )
- StrBuf->AppendStr(&buf, ", ");
-
- StrBuf->Printf(&buf, "#%d %s (id: %d)", counter2, card->jname, card->nameid);
- }
-
- if( counter2 > 0 )
- StrBuf->AppendStr(&buf, ")");
- }
+
+ if( counter2 > 0 )
+ StrBuf->AppendStr(&buf, ")");
+ }
if( StrBuf->Length(&buf) > 0 )
clif->message(fd, StrBuf->Value(&buf));
-
+
StrBuf->Clear(&buf);
}
diff --git a/src/map/battle.c b/src/map/battle.c
index a8022ea84..7900581c6 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -604,32 +604,31 @@ int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, i
/*==========================================
* Passive skill damages increases
*------------------------------------------*/
-int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type)
-{
- int64 damage,skill;
+int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type) {
+ int64 damage;
struct status_data *status = iStatus->get_status_data(target);
- int weapon;
+ int weapon, skill_lv;
damage = dmg;
nullpo_ret(sd);
- if((skill = pc->checkskill(sd,AL_DEMONBANE)) > 0 &&
+ if((skill_lv = pc->checkskill(sd,AL_DEMONBANE)) > 0 &&
target->type == BL_MOB && //This bonus doesnt work against players.
(battle->check_undead(status->race,status->def_ele) || status->race==RC_DEMON) )
- damage += (int)(skill*(3+sd->status.base_level/20.0));
- //damage += (skill * 3);
- if( (skill = pc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
- damage += (skill * 5);
- if( (skill = pc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
- damage += (skill * 10);
+ damage += (int)(skill_lv*(3+sd->status.base_level/20.0));
+ //damage += (skill_lv * 3);
+ if( (skill_lv = pc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
+ damage += (skill_lv * 5);
+ if( (skill_lv = pc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
+ damage += (skill_lv * 10);
if( pc_ismadogear(sd) )
damage += 20 + 20 * pc->checkskill(sd, NC_MADOLICENCE);
#ifdef RENEWAL
- if( (skill = pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0 )
- damage += (skill * 2);
+ if( (skill_lv = pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0 )
+ damage += (skill_lv * 2);
#endif
- if((skill = pc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
- damage += (skill * 4);
+ if((skill_lv = pc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
+ damage += (skill_lv * 4);
if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_HUNTER)
damage += sd->status.str;
}
@@ -638,75 +637,74 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
weapon = sd->weapontype1;
else
weapon = sd->weapontype2;
- switch(weapon)
- {
+ switch(weapon) {
case W_1HSWORD:
#ifdef RENEWAL
- if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ damage += (skill_lv * 3);
#endif
case W_DAGGER:
- if((skill = pc->checkskill(sd,SM_SWORD)) > 0)
- damage += (skill * 4);
- if((skill = pc->checkskill(sd,GN_TRAINING_SWORD)) > 0)
- damage += skill * 10;
+ if((skill_lv = pc->checkskill(sd,SM_SWORD)) > 0)
+ damage += (skill_lv * 4);
+ if((skill_lv = pc->checkskill(sd,GN_TRAINING_SWORD)) > 0)
+ damage += skill_lv * 10;
break;
case W_2HSWORD:
#ifdef RENEWAL
- if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ damage += (skill_lv * 3);
#endif
- if((skill = pc->checkskill(sd,SM_TWOHAND)) > 0)
- damage += (skill * 4);
+ if((skill_lv = pc->checkskill(sd,SM_TWOHAND)) > 0)
+ damage += (skill_lv * 4);
break;
case W_1HSPEAR:
case W_2HSPEAR:
- if((skill = pc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
+ if((skill_lv = pc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
if(pc_isridingdragon(sd))
- damage += (skill * 10);
+ damage += (skill_lv * 10);
else if(pc_isriding(sd))
- damage += (skill * 5);
+ damage += (skill_lv * 5);
else
- damage += (skill * 4);
+ damage += (skill_lv * 4);
}
break;
case W_1HAXE:
case W_2HAXE:
- if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
- damage += (skill * 3);
- if((skill = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
- damage += (skill * 5);
+ if((skill_lv = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ damage += (skill_lv * 3);
+ if((skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
+ damage += (skill_lv * 5);
break;
case W_MACE:
case W_2HMACE:
- if((skill = pc->checkskill(sd,PR_MACEMASTERY)) > 0)
- damage += (skill * 3);
- if((skill = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
- damage += (skill * 5);
+ if((skill_lv = pc->checkskill(sd,PR_MACEMASTERY)) > 0)
+ damage += (skill_lv * 3);
+ if((skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
+ damage += (skill_lv * 5);
break;
case W_FIST:
- if((skill = pc->checkskill(sd,TK_RUN)) > 0)
- damage += (skill * 10);
+ if((skill_lv = pc->checkskill(sd,TK_RUN)) > 0)
+ damage += (skill_lv * 10);
// No break, fallthrough to Knuckles
case W_KNUCKLE:
- if((skill = pc->checkskill(sd,MO_IRONHAND)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,MO_IRONHAND)) > 0)
+ damage += (skill_lv * 3);
break;
case W_MUSICAL:
- if((skill = pc->checkskill(sd,BA_MUSICALLESSON)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,BA_MUSICALLESSON)) > 0)
+ damage += (skill_lv * 3);
break;
case W_WHIP:
- if((skill = pc->checkskill(sd,DC_DANCINGLESSON)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,DC_DANCINGLESSON)) > 0)
+ damage += (skill_lv * 3);
break;
case W_BOOK:
- if((skill = pc->checkskill(sd,SA_ADVANCEDBOOK)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,SA_ADVANCEDBOOK)) > 0)
+ damage += (skill_lv * 3);
break;
case W_KATAR:
- if((skill = pc->checkskill(sd,AS_KATAR)) > 0)
- damage += (skill * 3);
+ if((skill_lv = pc->checkskill(sd,AS_KATAR)) > 0)
+ damage += (skill_lv * 3);
break;
}
@@ -716,8 +714,8 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
/*==========================================
* Calculates ATK masteries.
*------------------------------------------*/
-int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon){
- int skill, i;
+int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon) {
+ int skill2_lv, i;
struct status_change *sc;
struct map_session_data *sd;
struct status_data *tstatus;
@@ -742,12 +740,12 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
case CR_ACIDDEMONSTRATION:
return damage;
case NJ_SYURIKEN:
- if( (skill = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0
+ if( (skill2_lv = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0
#ifndef RENEWAL
&& weapon
#endif
)
- damage += 3 * skill;
+ damage += 3 * skill2_lv;
break;
#ifndef RENEWAL
case NJ_KUNAI:
@@ -807,17 +805,17 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
damage += div * sd->spiritball * 3;
if( skill_id != CR_SHIELDBOOMERANG ) // Only Shield boomerang doesn't takes the Star Crumbs bonus.
damage += div * (left ? sd->left_weapon.star : sd->right_weapon.star);
- if( skill_id != MC_CARTREVOLUTION && (skill=pc->checkskill(sd,BS_HILTBINDING)) > 0 )
+ if( skill_id != MC_CARTREVOLUTION && (skill2_lv=pc->checkskill(sd,BS_HILTBINDING)) > 0 )
damage += 4;
- if(sd->status.party_id && (skill=pc->checkskill(sd,TK_POWER)) > 0){
+ if(sd->status.party_id && (skill2_lv=pc->checkskill(sd,TK_POWER)) > 0) {
if( (i = party_foreachsamemap(party->sub_count, sd, 0)) > 1 )
- damage += 2 * skill * i * (damage /*+ unknown value*/) / 100 /*+ unknown value*/;
+ damage += 2 * skill2_lv * i * (damage /*+ unknown value*/) / 100 /*+ unknown value*/;
}
#else
if( skill_id != ASC_BREAKER && weapon ) // Adv Katar Mastery is does not applies to ASC_BREAKER, but other masteries DO apply >_>
- if( sd->status.weapon == W_KATAR && (skill=pc->checkskill(sd,ASC_KATAR)) > 0 )
- damage += damage * (10 + 2 * skill) / 100;
+ if( sd->status.weapon == W_KATAR && (skill2_lv=pc->checkskill(sd,ASC_KATAR)) > 0 )
+ damage += damage * (10 + 2 * skill2_lv) / 100;
#endif
// percentage factor masteries
@@ -825,18 +823,18 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
i = 2; //Star anger
else
ARR_FIND(0, MAX_PC_FEELHATE, i, iStatus->get_class(target) == sd->hate_mob[i]);
- if ( i < MAX_PC_FEELHATE && (skill=pc->checkskill(sd,sg_info[i].anger_id)) && weapon ){
+ if ( i < MAX_PC_FEELHATE && (skill2_lv=pc->checkskill(sd,sg_info[i].anger_id)) && weapon ) {
int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src);
if ( i == 2 ) ratio += status_get_str(src); //Star Anger
- if (skill < 4 )
- ratio /= (12 - 3 * skill);
+ if (skill2_lv < 4 )
+ ratio /= (12 - 3 * skill2_lv);
damage += damage * ratio / 100;
}
if( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ){
- if((skill = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 &&
+ if((skill2_lv = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 &&
(tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) )
- damage += damage * skill / 100;
+ damage += damage * skill2_lv / 100;
}
return damage;
@@ -3176,7 +3174,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill_id, int lv) {
if (!battle_config.arrow_decrement)
return;
- if (skill) {
+ if (skill_id) {
qty = skill->get_ammo_qty(skill_id, lv);
if (!qty) qty = 1;
}
diff --git a/src/map/battle.h b/src/map/battle.h
index bbba415f5..f56bff3be 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -534,7 +534,7 @@ struct battle_interface {
/* is src and bl within range? */
bool (*check_range) (struct block_list *src,struct block_list *bl,int range);
/* consume amo for this skill and lv */
- void (*consume_ammo) (struct map_session_data* sd, int skill, int lv);
+ void (*consume_ammo) (struct map_session_data* sd, int skill_id, int lv);
int (*get_targeted_sub) (struct block_list *bl, va_list ap);
int (*get_enemy_sub) (struct block_list *bl, va_list ap);
int (*get_enemy_area_sub) (struct block_list *bl, va_list ap);
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 1bc142b7f..981264774 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -28,27 +28,27 @@
struct battleground_interface bg_s;
-struct battleground_data* bg_team_search(int bg_id) { // Search a BG Team using bg_id
+/// Search a BG Team using bg_id
+struct battleground_data* bg_team_search(int bg_id) {
if( !bg_id ) return NULL;
return (struct battleground_data *)idb_get(bg->team_db, bg_id);
}
-struct map_session_data* bg_getavailablesd(struct battleground_data *bg) {
+struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) {
int i;
- nullpo_retr(NULL, bg);
- ARR_FIND(0, MAX_BG_MEMBERS, i, bg->members[i].sd != NULL);
- return( i < MAX_BG_MEMBERS ) ? bg->members[i].sd : NULL;
+ nullpo_retr(NULL, bgd);
+ ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd != NULL);
+ return( i < MAX_BG_MEMBERS ) ? bgd->members[i].sd : NULL;
}
-int bg_team_delete(int bg_id)
-{ // Deletes BG Team from db
+/// Deletes BG Team from db
+int bg_team_delete(int bg_id) {
int i;
struct map_session_data *sd;
struct battleground_data *bgd = bg->team_search(bg_id);
- if( bg == NULL ) return 0;
- for( i = 0; i < MAX_BG_MEMBERS; i++ )
- {
+ if( bgd == NULL ) return 0;
+ for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
if( (sd = bgd->members[i].sd) == NULL )
continue;
@@ -59,30 +59,29 @@ int bg_team_delete(int bg_id)
return 1;
}
-int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
-{ // Warps a Team
+/// Warps a Team
+int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y) {
int i;
struct battleground_data *bgd = bg->team_search(bg_id);
- if( bg == NULL ) return 0;
+ if( bgd == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
if( bgd->members[i].sd != NULL ) pc->setpos(bgd->members[i].sd, mapindex, x, y, CLR_TELEPORT);
return 1;
}
-int bg_send_dot_remove(struct map_session_data *sd)
-{
+int bg_send_dot_remove(struct map_session_data *sd) {
if( sd && sd->bg_id )
clif->bg_xy_remove(sd);
return 0;
}
-int bg_team_join(int bg_id, struct map_session_data *sd)
-{ // Player joins team
+/// Player joins team
+int bg_team_join(int bg_id, struct map_session_data *sd) {
int i;
struct battleground_data *bgd = bg->team_search(bg_id);
struct map_session_data *pl_sd;
- if( bg == NULL || sd == NULL || sd->bg_id ) return 0;
+ if( bgd == NULL || sd == NULL || sd->bg_id ) return 0;
ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == NULL);
if( i == MAX_BG_MEMBERS ) return 0; // No free slots
@@ -92,7 +91,7 @@ int bg_team_join(int bg_id, struct map_session_data *sd)
bgd->members[i].x = sd->bl.x;
bgd->members[i].y = sd->bl.y;
/* populate 'where i came from' */
- if(map[sd->bl.m].flag.nosave || map[sd->bl.m].instance_id >= 0){
+ if(map[sd->bl.m].flag.nosave || map[sd->bl.m].instance_id >= 0) {
struct map_data *m=&map[sd->bl.m];
if(m->save.map)
memcpy(&bgd->members[i].source,&m->save,sizeof(struct point));
@@ -114,10 +113,10 @@ int bg_team_join(int bg_id, struct map_session_data *sd)
return 1;
}
-int bg_team_leave(struct map_session_data *sd, int flag)
-{ // Single Player leaves team
+/// Single Player leaves team
+int bg_team_leave(struct map_session_data *sd, int flag) {
int i, bg_id;
- struct battleground_data *bg_data;
+ struct battleground_data *bgd;
char output[128];
if( sd == NULL || !sd->bg_id )
@@ -126,38 +125,38 @@ int bg_team_leave(struct map_session_data *sd, int flag)
bg_id = sd->bg_id;
sd->bg_id = 0;
- if( (bg_data = bg->team_search(bg_id)) == NULL )
+ if( (bgd = bg->team_search(bg_id)) == NULL )
return 0;
- ARR_FIND(0, MAX_BG_MEMBERS, i, bg_data->members[i].sd == sd);
+ ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == sd);
if( i < MAX_BG_MEMBERS ) { // Removes member from BG
if( sd->bg_queue.arena ) {
bg->queue_pc_cleanup(sd);
- pc->setpos(sd,bg_data->members[i].source.map, bg_data->members[i].source.x, bg_data->members[i].source.y, CLR_OUTSIGHT);
+ pc->setpos(sd,bgd->members[i].source.map, bgd->members[i].source.x, bgd->members[i].source.y, CLR_OUTSIGHT);
}
- memset(&bg_data->members[i], 0, sizeof(bg_data->members[0]));
+ memset(&bgd->members[i], 0, sizeof(bgd->members[0]));
}
- if( --bg_data->count != 0 ) {
+ if( --bgd->count != 0 ) {
if( flag )
sprintf(output, "Server : %s has quit the game...", sd->status.name);
else
sprintf(output, "Server : %s is leaving the battlefield...", sd->status.name);
- clif->bg_message(bg_data, 0, "Server", output, strlen(output) + 1);
+ clif->bg_message(bgd, 0, "Server", output, strlen(output) + 1);
}
- if( bg_data->logout_event[0] && flag )
- npc->event(sd, bg_data->logout_event, 0);
+ if( bgd->logout_event[0] && flag )
+ npc->event(sd, bgd->logout_event, 0);
if( sd->bg_queue.arena ) {
bg->queue_pc_cleanup(sd);
}
- return bg_data->count;
+ return bgd->count;
}
-int bg_member_respawn(struct map_session_data *sd)
-{ // Respawn after killed
+/// Respawn after killed
+int bg_member_respawn(struct map_session_data *sd) {
struct battleground_data *bgd;
if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bgd = bg->team_search(sd->bg_id)) == NULL )
return 0;
@@ -183,16 +182,14 @@ int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const
safestrncpy(bgd->die_event, dev, sizeof(bgd->die_event));
memset(&bgd->members, 0, sizeof(bgd->members));
- idb_put(bg->team_db, bg->team_counter, bg);
+ idb_put(bg->team_db, bg->team_counter, bgd);
return bgd->bg_id;
}
-int bg_team_get_id(struct block_list *bl)
-{
+int bg_team_get_id(struct block_list *bl) {
nullpo_ret(bl);
- switch( bl->type )
- {
+ switch( bl->type ) {
case BL_PC:
return ((TBL_PC*)bl)->bg_id;
case BL_PET:
@@ -222,8 +219,7 @@ int bg_team_get_id(struct block_list *bl)
return 0;
}
-int bg_send_message(struct map_session_data *sd, const char *mes, int len)
-{
+int bg_send_message(struct map_session_data *sd, const char *mes, int len) {
struct battleground_data *bgd;
nullpo_ret(sd);
@@ -236,18 +232,17 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
/**
* @see DBApply
*/
-int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
-{
- struct battleground_data *bg = DB->data2ptr(data);
+int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
+ struct battleground_data *bgd = DB->data2ptr(data);
struct map_session_data *sd;
int i;
- nullpo_ret(bg);
+ nullpo_ret(bgd);
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
- if( (sd = bg->members[i].sd) == NULL )
+ if( (sd = bgd->members[i].sd) == NULL )
continue;
- if( sd->bl.x != bg->members[i].x || sd->bl.y != bg->members[i].y ) { // xy update
- bg->members[i].x = sd->bl.x;
- bg->members[i].y = sd->bl.y;
+ if( sd->bl.x != bgd->members[i].x || sd->bl.y != bgd->members[i].y ) { // xy update
+ bgd->members[i].x = sd->bl.x;
+ bgd->members[i].y = sd->bl.y;
clif->bg_xy(sd);
}
}
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 3edecf902..1c224e1c2 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -91,7 +91,7 @@ struct battleground_interface {
void (*match_over) (struct bg_arena *arena, bool canceled);
void (*queue_check) (struct bg_arena *arena);
struct battleground_data* (*team_search) (int bg_id);
- struct map_session_data* (*getavailablesd) (struct battleground_data *bg);
+ struct map_session_data* (*getavailablesd) (struct battleground_data *bgd);
int (*team_delete) (int bg_id);
int (*team_warp) (int bg_id, unsigned short mapindex, short x, short y);
int (*send_dot_remove) (struct map_session_data *sd);
diff --git a/src/map/chat.c b/src/map/chat.c
index 28de86fe1..b7e561116 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -202,7 +202,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
- struct skill_unit* unit;
+ struct skill_unit* su;
struct skill_unit_group* group;
clif->clearchat(cd, 0);
@@ -211,10 +211,10 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
iMap->delblock(&cd->bl);
iMap->freeblock(&cd->bl);
- unit = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
- group = (unit != NULL) ? unit->group : NULL;
+ su = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
+ group = (su != NULL) ? su->group : NULL;
if (group != NULL)
- skill->unit_onplace(unit, &sd->bl, group->tick);
+ skill->unit_onplace(su, &sd->bl, group->tick);
return 1;
}
diff --git a/src/map/chrif.c b/src/map/chrif.c
index dcca72cc8..87fa0fc0b 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -348,7 +348,7 @@ int chrif_sendmap(int fd) {
WFIFOHEAD(fd, 4 + instance->start_id * 4);
WFIFOW(fd,0) = 0x2afa;
for(i = 0; i < instance->start_id; i++)
- WFIFOW(fd,4+i*4) = map[i].index;
+ WFIFOW(fd,4+i*4) = map_id2index(i);
WFIFOW(fd,2) = 4 + i * 4;
WFIFOSET(fd,WFIFOW(fd,2));
@@ -1073,9 +1073,9 @@ int chrif_updatefamelist(struct map_session_data* sd) {
chrif_check(-1);
switch(sd->class_ & MAPID_UPPERMASK) {
- case MAPID_BLACKSMITH: type = 1; break;
- case MAPID_ALCHEMIST: type = 2; break;
- case MAPID_TAEKWON: type = 3; break;
+ case MAPID_BLACKSMITH: type = RANKTYPE_BLACKSMITH; break;
+ case MAPID_ALCHEMIST: type = RANKTYPE_ALCHEMIST; break;
+ case MAPID_TAEKWON: type = RANKTYPE_TAEKWON; break;
default:
return 0;
}
@@ -1104,9 +1104,9 @@ int chrif_recvfamelist(int fd) {
int num, size;
int total = 0, len = 8;
- memset (smith_fame_list, 0, sizeof(smith_fame_list));
- memset (chemist_fame_list, 0, sizeof(chemist_fame_list));
- memset (taekwon_fame_list, 0, sizeof(taekwon_fame_list));
+ memset(smith_fame_list, 0, sizeof(smith_fame_list));
+ memset(chemist_fame_list, 0, sizeof(chemist_fame_list));
+ memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list));
size = RFIFOW(fd, 6); //Blacksmith block size
@@ -1147,9 +1147,9 @@ int chrif_updatefamelist_ack(int fd) {
uint8 index;
switch (RFIFOB(fd,2)) {
- case 1: list = smith_fame_list; break;
- case 2: list = chemist_fame_list; break;
- case 3: list = taekwon_fame_list; break;
+ case RANKTYPE_BLACKSMITH: list = smith_fame_list; break;
+ case RANKTYPE_ALCHEMIST: list = chemist_fame_list; break;
+ case RANKTYPE_TAEKWON: list = taekwon_fame_list; break;
default: return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 74d827847..7bc808eed 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4631,31 +4631,32 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
/// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2)
/// 08c7 <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.B <range>.W <visible>.B (ZC_SKILL_ENTRY3)
/// 099f <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.W <visible>.B (ZC_SKILL_ENTRY4)
-void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *unit) {
+void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *su) {
int fd = sd->fd, header = 0x11f, pos=0;
- if( unit->group->state.guildaura )
+ if( su->group->state.guildaura )
return;
#if PACKETVER >= 20130320
- if(unit->group->unit_id > UCHAR_MAX){
+ if(su->group->unit_id > UCHAR_MAX) {
header = 0x99f;
pos = 2;
}
#endif
#if PACKETVER >= 3
- if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
+ if(su->group->unit_id==UNT_GRAFFITI) {
+ // Graffiti [Valaris]
WFIFOHEAD(fd,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
- WFIFOL(fd, 2)=unit->bl.id;
- WFIFOL(fd, 6)=unit->group->src_id;
- WFIFOW(fd,10)=unit->bl.x;
- WFIFOW(fd,12)=unit->bl.y;
- WFIFOB(fd,14)=unit->group->unit_id;
+ WFIFOL(fd, 2)=su->bl.id;
+ WFIFOL(fd, 6)=su->group->src_id;
+ WFIFOW(fd,10)=su->bl.x;
+ WFIFOW(fd,12)=su->bl.y;
+ WFIFOB(fd,14)=su->group->unit_id;
WFIFOB(fd,15)=1;
WFIFOB(fd,16)=1;
- safestrncpy((char*)WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE);
+ safestrncpy((char*)WFIFOP(fd,17),su->group->valstr,MESSAGE_SIZE);
WFIFOSET(fd,packet_len(0x1c9));
return;
}
@@ -4664,55 +4665,54 @@ void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *
WFIFOW(fd, 0)=header;
if(pos > 0)
WFIFOL(fd, pos)=packet_len(header);
- WFIFOL(fd, 2 + pos)=unit->bl.id;
- WFIFOL(fd, 6 + pos)=unit->group->src_id;
- WFIFOW(fd,10 + pos)=unit->bl.x;
- WFIFOW(fd,12 + pos)=unit->bl.y;
- if (battle_config.traps_setting&1 && skill->get_inf2(unit->group->skill_id)&INF2_TRAP)
+ WFIFOL(fd, 2 + pos)=su->bl.id;
+ WFIFOL(fd, 6 + pos)=su->group->src_id;
+ WFIFOW(fd,10 + pos)=su->bl.x;
+ WFIFOW(fd,12 + pos)=su->bl.y;
+ if (battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP)
WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps.
- else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT))
+ else if (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))
WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps.
else if(pos > 0){
- WFIFOL(fd,16)=unit->group->unit_id;
- WFIFOW(fd,20)=unit->range;
+ WFIFOL(fd,16)=su->group->unit_id;
+ WFIFOW(fd,20)=su->range;
pos += 5;
}else
- WFIFOB(fd,14)=unit->group->unit_id;
+ WFIFOB(fd,14)=su->group->unit_id;
WFIFOB(fd,15 + pos)=1; // ignored by client (always gets set to 1)
WFIFOSET(fd,packet_len(header));
- if(unit->group->skill_id == WZ_ICEWALL)
- clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5,SELF);
+ if(su->group->skill_id == WZ_ICEWALL)
+ clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,5,SELF);
}
/*==========================================
* Server tells client to remove unit of id 'unit->bl.id'
*------------------------------------------*/
-void clif_clearchar_skillunit(struct skill_unit *unit, int fd) {
- nullpo_retv(unit);
+void clif_clearchar_skillunit(struct skill_unit *su, int fd) {
+ nullpo_retv(su);
WFIFOHEAD(fd,packet_len(0x120));
WFIFOW(fd, 0)=0x120;
- WFIFOL(fd, 2)=unit->bl.id;
+ WFIFOL(fd, 2)=su->bl.id;
WFIFOSET(fd,packet_len(0x120));
- if(unit->group && unit->group->skill_id == WZ_ICEWALL)
- clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,SELF);
+ if(su->group && su->group->skill_id == WZ_ICEWALL)
+ clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF);
}
/// Removes a skill unit (ZC_SKILL_DISAPPEAR).
/// 0120 <id>.L
-void clif_skill_delunit(struct skill_unit *unit)
-{
+void clif_skill_delunit(struct skill_unit *su) {
unsigned char buf[16];
- nullpo_retv(unit);
+ nullpo_retv(su);
WBUFW(buf, 0)=0x120;
- WBUFL(buf, 2)=unit->bl.id;
- clif->send(buf,packet_len(0x120),&unit->bl,AREA);
+ WBUFL(buf, 2)=su->bl.id;
+ clif->send(buf,packet_len(0x120),&su->bl,AREA);
}
@@ -5330,57 +5330,57 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i
* Tells all client's nearby 'unit' sight range that it spawned
*------------------------------------------*/
//FIXME: this is just an AREA version of clif_getareachar_skillunit()
-void clif_skill_setunit(struct skill_unit *unit)
-{
+void clif_skill_setunit(struct skill_unit *su) {
unsigned char buf[128];
int header = 0x11f, pos = 0;
- nullpo_retv(unit);
+ nullpo_retv(su);
- if( unit->group->state.guildaura )
+ if( su->group->state.guildaura )
return;
#if PACKETVER >= 20130320
- if(unit->group->unit_id > UCHAR_MAX){
+ if(su->group->unit_id > UCHAR_MAX) {
header = 0x99f;
pos = 2;
}
#endif
#if PACKETVER >= 3
- if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
+ if(su->group->unit_id==UNT_GRAFFITI) {
+ // Graffiti [Valaris]
WBUFW(buf, 0)=0x1c9;
- WBUFL(buf, 2)=unit->bl.id;
- WBUFL(buf, 6)=unit->group->src_id;
- WBUFW(buf,10)=unit->bl.x;
- WBUFW(buf,12)=unit->bl.y;
- WBUFB(buf,14)=unit->group->unit_id;
+ WBUFL(buf, 2)=su->bl.id;
+ WBUFL(buf, 6)=su->group->src_id;
+ WBUFW(buf,10)=su->bl.x;
+ WBUFW(buf,12)=su->bl.y;
+ WBUFB(buf,14)=su->group->unit_id;
WBUFB(buf,15)=1;
WBUFB(buf,16)=1;
- safestrncpy((char*)WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE);
- clif->send(buf,packet_len(0x1c9),&unit->bl,AREA);
+ safestrncpy((char*)WBUFP(buf,17),su->group->valstr,MESSAGE_SIZE);
+ clif->send(buf,packet_len(0x1c9),&su->bl,AREA);
return;
}
#endif
WBUFW(buf, 0)=header;
if(pos > 0)
WBUFW(buf, pos)=packet_len(header);
- WBUFL(buf, 2 + pos)=unit->bl.id;
- WBUFL(buf, 6 + pos)=unit->group->src_id;
- WBUFW(buf,10 + pos)=unit->bl.x;
- WBUFW(buf,12 + pos)=unit->bl.y;
- if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE)
- WBUFB(buf,14)=unit->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE;
- else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT))
- WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center.
- else if(pos > 0){
- WBUFL(buf,16)=unit->group->unit_id;
- WBUFW(buf,20)=unit->range;
+ WBUFL(buf, 2 + pos)=su->bl.id;
+ WBUFL(buf, 6 + pos)=su->group->src_id;
+ WBUFW(buf,10 + pos)=su->bl.x;
+ WBUFW(buf,12 + pos)=su->bl.y;
+ if (su->group->state.song_dance&0x1 && su->val2&UF_ENSEMBLE)
+ WBUFB(buf,14)=su->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE;
+ else if (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))
+ WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center.
+ else if(pos > 0) {
+ WBUFL(buf,16)=su->group->unit_id;
+ WBUFW(buf,20)=su->range;
pos += 5;
}else
- WBUFB(buf,14)=unit->group->unit_id;
+ WBUFB(buf,14)=su->group->unit_id;
WBUFB(buf,15 + pos)=1; // ignored by client (always gets set to 1)
- clif->send(buf,packet_len(header),&unit->bl,AREA);
+ clif->send(buf,packet_len(header),&su->bl,AREA);
}
@@ -6370,8 +6370,7 @@ void clif_closevendingboard(struct block_list* bl, int fd)
/// Sends a list of items in a shop.
/// R 0133 <packet len>.W <owner id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC)
/// R 0800 <packet len>.W <owner id>.L <unique id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC2)
-void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending)
-{
+void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) {
int i,fd;
int count;
struct map_session_data* vsd;
@@ -6384,7 +6383,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven
#endif
nullpo_retv(sd);
- nullpo_retv(vending);
+ nullpo_retv(vending_items);
nullpo_retv(vsd=iMap->id2sd(id));
fd = sd->fd;
@@ -6398,13 +6397,12 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven
WFIFOL(fd,8) = vsd->vender_id;
#endif
- for( i = 0; i < count; i++ )
- {
- int index = vending[i].index;
+ for( i = 0; i < count; i++ ) {
+ int index = vending_items[i].index;
struct item_data* data = itemdb->search(vsd->status.cart[index].nameid);
- WFIFOL(fd,offset+ 0+i*22) = vending[i].value;
- WFIFOW(fd,offset+ 4+i*22) = vending[i].amount;
- WFIFOW(fd,offset+ 6+i*22) = vending[i].index + 2;
+ WFIFOL(fd,offset+ 0+i*22) = vending_items[i].value;
+ WFIFOW(fd,offset+ 4+i*22) = vending_items[i].amount;
+ WFIFOW(fd,offset+ 6+i*22) = vending_items[i].index + 2;
WFIFOB(fd,offset+ 8+i*22) = itemtype(data->type);
WFIFOW(fd,offset+ 9+i*22) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid;
WFIFOB(fd,offset+11+i*22) = vsd->status.cart[index].identify;
@@ -6444,8 +6442,7 @@ void clif_buyvending(struct map_session_data* sd, int index, int amount, int fai
/// Shop creation success (ZC_PC_PURCHASE_MYITEMLIST).
/// 0136 <packet len>.W <owner id>.L { <price>.L <index>.W <amount>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }*
-void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending)
-{
+void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) {
int i,fd;
int count;
@@ -6459,11 +6456,11 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven
WFIFOW(fd,2) = 8+count*22;
WFIFOL(fd,4) = id;
for( i = 0; i < count; i++ ) {
- int index = vending[i].index;
+ int index = vending_items[i].index;
struct item_data* data = itemdb->search(sd->status.cart[index].nameid);
- WFIFOL(fd, 8+i*22) = vending[i].value;
- WFIFOW(fd,12+i*22) = vending[i].index + 2;
- WFIFOW(fd,14+i*22) = vending[i].amount;
+ WFIFOL(fd, 8+i*22) = vending_items[i].value;
+ WFIFOW(fd,12+i*22) = vending_items[i].index + 2;
+ WFIFOW(fd,14+i*22) = vending_items[i].amount;
WFIFOB(fd,16+i*22) = itemtype(data->type);
WFIFOW(fd,17+i*22) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid;
WFIFOB(fd,19+i*22) = sd->status.cart[index].identify;
@@ -7022,23 +7019,23 @@ void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int typ
void clif_send_petstatus(struct map_session_data *sd)
{
int fd;
- struct s_pet *pet;
+ struct s_pet *p;
nullpo_retv(sd);
nullpo_retv(sd->pd);
fd=sd->fd;
- pet = &sd->pd->pet;
+ p = &sd->pd->pet;
WFIFOHEAD(fd,packet_len(0x1a2));
WFIFOW(fd,0)=0x1a2;
- memcpy(WFIFOP(fd,2),pet->name,NAME_LENGTH);
- WFIFOB(fd,26)=battle_config.pet_rename?0:pet->rename_flag;
- WFIFOW(fd,27)=pet->level;
- WFIFOW(fd,29)=pet->hungry;
- WFIFOW(fd,31)=pet->intimate;
- WFIFOW(fd,33)=pet->equip;
+ memcpy(WFIFOP(fd,2),p->name,NAME_LENGTH);
+ WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag;
+ WFIFOW(fd,27)=p->level;
+ WFIFOW(fd,29)=p->hungry;
+ WFIFOW(fd,31)=p->intimate;
+ WFIFOW(fd,33)=p->equip;
#if PACKETVER >= 20081126
- WFIFOW(fd,35)=pet->class_;
+ WFIFOW(fd,35)=p->class_;
#endif
WFIFOSET(fd,packet_len(0x1a2));
}
@@ -14037,50 +14034,118 @@ void clif_parse_PVPInfo(int fd,struct map_session_data *sd)
clif->PVPInfo(sd);
}
+/// Ranking list
-/// /blacksmith list (ZC_BLACKSMITH_RANK).
-/// 0219 { <name>.24B }*10 { <point>.L }*10
-void clif_blacksmith(struct map_session_data* sd)
-{
- int i, fd = sd->fd;
+/// ranking pointlist { <name>.24B <point>.L }*10
+void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) {
const char* name;
+ struct fame_list* list;
+ int i;
- WFIFOHEAD(fd,packet_len(0x219));
- WFIFOW(fd,0) = 0x219;
- //Packet size limits this list to 10 elements. [Skotlex]
- for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
- if (smith_fame_list[i].id > 0) {
- if (strcmp(smith_fame_list[i].name, "-") == 0 &&
- (name = iMap->charid2nick(smith_fame_list[i].id)) != NULL)
- {
- strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), name, NAME_LENGTH);
- } else
- strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), smith_fame_list[i].name, NAME_LENGTH);
- } else
- strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "None", 5);
- WFIFOL(fd, 242 + i * 4) = smith_fame_list[i].fame;
+ switch( type ) {
+ case RANKTYPE_BLACKSMITH: list = smith_fame_list; break;
+ case RANKTYPE_ALCHEMIST: list = chemist_fame_list; break;
+ case RANKTYPE_TAEKWON: list = taekwon_fame_list; break;
+ default: return; // Unsupported
}
- for(;i < 10; i++) { //In case the MAX is less than 10.
- strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "Unavailable", 12);
- WFIFOL(fd, 242 + i * 4) = 0;
+
+ // Packet size limits this list to 10 elements. [Skotlex]
+ for( i = 0; i < 10 && i < MAX_FAME_LIST; i++ ) {
+ if( list[i].id > 0 ) {
+ if( strcmp(list[i].name, "-") == 0 && (name = iMap->charid2nick(list[i].id)) != NULL ) {
+ strncpy((char *)(WBUFP(buf, 24 * i)), name, NAME_LENGTH);
+ } else {
+ strncpy((char *)(WBUFP(buf, 24 * i)), list[i].name, NAME_LENGTH);
+ }
+ } else {
+ strncpy((char *)(WBUFP(buf, 24 * i)), "None", 5);
+ }
+ WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; //points
+ }
+ for( ;i < 10; i++ ) { // In case the MAX is less than 10.
+ strncpy((char *)(WBUFP(buf, 24 * i)), "Unavailable", 12);
+ WBUFL(buf, 24 * 10 + i * 4) = 0;
}
+}
- WFIFOSET(fd, packet_len(0x219));
+/// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING)
+void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) {
+ int fd = sd->fd;
+ int mypoint = 0;
+ int upperMask = sd->class_&MAPID_UPPERMASK;
+
+ WFIFOHEAD(fd, 288);
+ WFIFOW(fd, 0) = 0x97d;
+ WFIFOW(fd, 2) = type;
+ clif_ranklist_sub(WFIFOP(fd,4), type);
+
+ if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH)
+ || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST)
+ || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON)
+ ) {
+ mypoint = sd->status.fame;
+ } else {
+ mypoint = 0;
+ }
+
+ WFIFOL(fd, 284) = mypoint; //mypoint
+ WFIFOSET(fd, 288);
+}
+
+/*
+ * 097c <type> (CZ_REQ_RANKING)
+ * */
+void clif_parse_ranklist(int fd, struct map_session_data *sd) {
+ int16 type = RFIFOW(fd, 2); //type
+
+ switch( type ) {
+ case RANKTYPE_BLACKSMITH:
+ case RANKTYPE_ALCHEMIST:
+ case RANKTYPE_TAEKWON:
+ clif->ranklist(sd, type); // pk_list unsuported atm
+ break;
+ }
+}
+
+// 097e <RankingType>.W <point>.L <TotalPoint>.L (ZC_UPDATE_RANKING_POINT)
+void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) {
+#if PACKETVER < 20130710
+ switch( type ) {
+ case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break;
+ case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break;
+ case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break;
+ }
+#else
+ int fd = sd->fd;
+ WFIFOHEAD(fd, 12);
+ WFIFOW(fd, 0) = 0x97e;
+ WFIFOW(fd, 2) = type;
+ WFIFOL(fd, 4) = points;
+ WFIFOL(fd, 8) = sd->status.fame;
+ WFIFOSET(fd, 12);
+#endif
}
+/// /blacksmith list (ZC_BLACKSMITH_RANK).
+/// 0219 { <name>.24B }*10 { <point>.L }*10
+void clif_blacksmith(struct map_session_data* sd) {
+ int fd = sd->fd;
+
+ WFIFOHEAD(fd,packet_len(0x219));
+ WFIFOW(fd,0) = 0x219;
+ clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH);
+ WFIFOSET(fd, packet_len(0x219));
+}
/// /blacksmith (CZ_BLACKSMITH_RANK).
/// 0217
-void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
-{
+void clif_parse_Blacksmith(int fd,struct map_session_data *sd) {
clif->blacksmith(sd);
}
-
/// Notification about backsmith points (ZC_BLACKSMITH_POINT).
/// 021b <points>.L <total points>.L
-void clif_fame_blacksmith(struct map_session_data *sd, int points)
-{
+void clif_fame_blacksmith(struct map_session_data *sd, int points) {
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x21b));
@@ -14090,49 +14155,26 @@ void clif_fame_blacksmith(struct map_session_data *sd, int points)
WFIFOSET(fd, packet_len(0x21b));
}
-
/// /alchemist list (ZC_ALCHEMIST_RANK).
/// 021a { <name>.24B }*10 { <point>.L }*10
void clif_alchemist(struct map_session_data* sd) {
- int i, fd = sd->fd;
- const char* name;
+ int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x21a));
WFIFOW(fd,0) = 0x21a;
- //Packet size limits this list to 10 elements. [Skotlex]
- for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
- if (chemist_fame_list[i].id > 0) {
- if (strcmp(chemist_fame_list[i].name, "-") == 0 &&
- (name = iMap->charid2nick(chemist_fame_list[i].id)) != NULL)
- {
- memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH);
- } else
- memcpy(WFIFOP(fd, 2 + 24 * i), chemist_fame_list[i].name, NAME_LENGTH);
- } else
- memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH);
- WFIFOL(fd, 242 + i * 4) = chemist_fame_list[i].fame;
- }
- for(;i < 10; i++) { //In case the MAX is less than 10.
- memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH);
- WFIFOL(fd, 242 + i * 4) = 0;
- }
-
+ clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST);
WFIFOSET(fd, packet_len(0x21a));
}
-
/// /alchemist (CZ_ALCHEMIST_RANK).
/// 0218
-void clif_parse_Alchemist(int fd,struct map_session_data *sd)
-{
+void clif_parse_Alchemist(int fd,struct map_session_data *sd) {
clif->alchemist(sd);
}
-
/// Notification about alchemist points (ZC_ALCHEMIST_POINT).
/// 021c <points>.L <total points>.L
-void clif_fame_alchemist(struct map_session_data *sd, int points)
-{
+void clif_fame_alchemist(struct map_session_data *sd, int points) {
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x21c));
@@ -14142,48 +14184,26 @@ void clif_fame_alchemist(struct map_session_data *sd, int points)
WFIFOSET(fd, packet_len(0x21c));
}
-
/// /taekwon list (ZC_TAEKWON_RANK).
/// 0226 { <name>.24B }*10 { <point>.L }*10
void clif_taekwon(struct map_session_data* sd) {
- int i, fd = sd->fd;
- const char* name;
+ int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x226));
WFIFOW(fd,0) = 0x226;
- //Packet size limits this list to 10 elements. [Skotlex]
- for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
- if (taekwon_fame_list[i].id > 0) {
- if (strcmp(taekwon_fame_list[i].name, "-") == 0 &&
- (name = iMap->charid2nick(taekwon_fame_list[i].id)) != NULL)
- {
- memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH);
- } else
- memcpy(WFIFOP(fd, 2 + 24 * i), taekwon_fame_list[i].name, NAME_LENGTH);
- } else
- memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH);
- WFIFOL(fd, 242 + i * 4) = taekwon_fame_list[i].fame;
- }
- for(;i < 10; i++) { //In case the MAX is less than 10.
- memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH);
- WFIFOL(fd, 242 + i * 4) = 0;
- }
+ clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON);
WFIFOSET(fd, packet_len(0x226));
}
-
/// /taekwon (CZ_TAEKWON_RANK).
/// 0225
-void clif_parse_Taekwon(int fd,struct map_session_data *sd)
-{
+void clif_parse_Taekwon(int fd,struct map_session_data *sd) {
clif->taekwon(sd);
}
-
/// Notification about taekwon points (ZC_TAEKWON_POINT).
/// 0224 <points>.L <total points>.L
-void clif_fame_taekwon(struct map_session_data *sd, int points)
-{
+void clif_fame_taekwon(struct map_session_data *sd, int points) {
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x224));
@@ -14193,7 +14213,6 @@ void clif_fame_taekwon(struct map_session_data *sd, int points)
WFIFOSET(fd, packet_len(0x224));
}
-
/// /pk list (ZC_KILLER_RANK).
/// 0238 { <name>.24B }*10 { <point>.L }*10
void clif_ranking_pk(struct map_session_data* sd) {
@@ -14211,8 +14230,7 @@ void clif_ranking_pk(struct map_session_data* sd) {
/// /pk (CZ_KILLER_RANK).
/// 0237
-void clif_parse_RankingPk(int fd,struct map_session_data *sd)
-{
+void clif_parse_RankingPk(int fd,struct map_session_data *sd) {
clif->ranking_pk(sd);
}
@@ -16180,8 +16198,7 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat
/// exp type:
/// 0 = normal exp gain/loss
/// 1 = quest exp gain/loss
-void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool quest)
-{
+void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool is_quest) {
int fd;
nullpo_retv(sd);
@@ -16193,7 +16210,7 @@ void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, b
WFIFOL(fd,2) = sd->bl.id;
WFIFOL(fd,6) = exp;
WFIFOW(fd,10) = type;
- WFIFOW(fd,12) = quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple.
+ WFIFOW(fd,12) = is_quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple.
WFIFOSET(fd,packet_len(0x7f6));
}
@@ -18068,6 +18085,9 @@ void clif_defaults(void) {
clif->fame_blacksmith = clif_fame_blacksmith;
clif->fame_alchemist = clif_fame_alchemist;
clif->fame_taekwon = clif_fame_taekwon;
+ clif->ranklist = clif_ranklist;
+ clif->pRanklist = clif_parse_ranklist;
+ clif->update_rankingpoint = clif_update_rankingpoint;
clif->hotkeys = clif_hotkeys_send;
clif->insight = clif_insight;
clif->outsight = clif_outsight;
diff --git a/src/map/clif.h b/src/map/clif.h
index 35e3e75f3..e9bef2629 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -540,8 +540,8 @@ struct clif_interface {
void (*changetraplook) (struct block_list *bl,int val);
void (*refreshlook) (struct block_list *bl,int id,int type,int val,enum send_target target);
void (*class_change) (struct block_list *bl,int class_,int type);
- void (*skill_setunit) (struct skill_unit *unit);
- void (*skill_delunit) (struct skill_unit *unit);
+ void (*skill_setunit) (struct skill_unit *su);
+ void (*skill_delunit) (struct skill_unit *su);
void (*skillunit_update) (struct block_list* bl);
int (*clearunit_delayed_sub) (int tid, unsigned int tick, int id, intptr_t data);
void (*set_unit_idle) (struct block_list* bl, struct map_session_data *tsd,enum send_target target);
@@ -552,9 +552,9 @@ struct clif_interface {
#endif
void (*set_unit_walking) (struct block_list* bl, struct map_session_data *tsd,struct unit_data* ud, enum send_target target);
int (*calc_walkdelay) (struct block_list *bl,int delay, int type, int damage, int div_);
- void (*getareachar_skillunit) (struct map_session_data *sd, struct skill_unit *unit);
+ void (*getareachar_skillunit) (struct map_session_data *sd, struct skill_unit *su);
void (*getareachar_unit) (struct map_session_data* sd,struct block_list *bl);
- void (*clearchar_skillunit) (struct skill_unit *unit, int fd);
+ void (*clearchar_skillunit) (struct skill_unit *su, int fd);
int (*getareachar) (struct block_list* bl,va_list ap);
/* main unit spawn */
int (*spawn) (struct block_list *bl);
@@ -597,6 +597,9 @@ struct clif_interface {
void (*fame_blacksmith) (struct map_session_data *sd, int points);
void (*fame_alchemist) (struct map_session_data *sd, int points);
void (*fame_taekwon) (struct map_session_data *sd, int points);
+ void (*ranklist) (struct map_session_data *sd, enum fame_list_type type);
+ void (*update_rankingpoint) (struct map_session_data *sd, enum fame_list_type type, int points);
+ void (*pRanklist) (int fd, struct map_session_data *sd);
void (*hotkeys) (struct map_session_data *sd);
int (*insight) (struct block_list *bl,va_list ap);
int (*outsight) (struct block_list *bl,va_list ap);
@@ -646,7 +649,7 @@ struct clif_interface {
void (*viewequip_ack) (struct map_session_data* sd, struct map_session_data* tsd);
void (*viewequip_fail) (struct map_session_data* sd);
void (*equpcheckbox) (struct map_session_data* sd);
- void (*displayexp) (struct map_session_data *sd, unsigned int exp, char type, bool quest);
+ void (*displayexp) (struct map_session_data *sd, unsigned int exp, char type, bool is_quest);
void (*font) (struct map_session_data *sd);
void (*progressbar) (struct map_session_data * sd, unsigned long color, unsigned int second);
void (*progressbar_abort) (struct map_session_data * sd);
@@ -758,9 +761,9 @@ struct clif_interface {
void (*openvendingreq) (struct map_session_data* sd, int num);
void (*showvendingboard) (struct block_list* bl, const char* message, int fd);
void (*closevendingboard) (struct block_list* bl, int fd);
- void (*vendinglist) (struct map_session_data* sd, unsigned int id, struct s_vending* vending);
+ void (*vendinglist) (struct map_session_data* sd, unsigned int id, struct s_vending* vending_list);
void (*buyvending) (struct map_session_data* sd, int index, int amount, int fail);
- void (*openvending) (struct map_session_data* sd, int id, struct s_vending* vending);
+ void (*openvending) (struct map_session_data* sd, int id, struct s_vending* vending_list);
void (*vendingreport) (struct map_session_data* sd, int index, int amount);
/* storage handling */
void (*storagelist) (struct map_session_data* sd, struct item* items, int items_length);
@@ -771,7 +774,7 @@ struct clif_interface {
/* skill-list handling */
void (*skillinfoblock) (struct map_session_data *sd);
void (*skillup) (struct map_session_data *sd,uint16 skill_id);
- void (*skillinfo) (struct map_session_data *sd,int skill, int inf);
+ void (*skillinfo) (struct map_session_data *sd,int skill_id, int inf);
void (*addskill) (struct map_session_data *sd, int id);
void (*deleteskill) (struct map_session_data *sd, int id);
/* party-specific */
diff --git a/src/map/duel.c b/src/map/duel.c
index c3b241e9e..1291dd02b 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -17,25 +17,23 @@
/*==========================================
* Duel organizing functions [LuzZza]
*------------------------------------------*/
-void duel_savetime(struct map_session_data* sd)
-{
- time_t timer;
+void duel_savetime(struct map_session_data* sd) {
+ time_t clock;
struct tm *t;
- time(&timer);
- t = localtime(&timer);
+ time(&clock);
+ t = localtime(&clock);
pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min);
}
-int duel_checktime(struct map_session_data* sd)
-{
+int duel_checktime(struct map_session_data* sd) {
int diff;
- time_t timer;
+ time_t clock;
struct tm *t;
- time(&timer);
- t = localtime(&timer);
+ time(&clock);
+ t = localtime(&clock);
diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME");
@@ -54,40 +52,38 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
return 1;
}
-void duel_showinfo(const unsigned int did, struct map_session_data* sd)
-{
+void duel_showinfo(const unsigned int did, struct map_session_data* sd) {
int p=0;
char output[256];
- if(iDuel->duel_list[did].max_players_limit > 0)
+ if(duel->list[did].max_players_limit > 0)
sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count,
- iDuel->duel_list[did].max_players_limit);
+ did, duel->count,
+ duel->list[did].members_count,
+ duel->list[did].members_count + duel->list[did].invites_count,
+ duel->list[did].max_players_limit);
else
sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count);
+ did, duel->count,
+ duel->list[did].members_count,
+ duel->list[did].members_count + duel->list[did].invites_count);
clif->disp_onlyself(sd, output, strlen(output));
iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
}
-int duel_create(struct map_session_data* sd, const unsigned int maxpl)
-{
+int duel_create(struct map_session_data* sd, const unsigned int maxpl) {
int i=1;
char output[256];
- while(iDuel->duel_list[i].members_count > 0 && i < MAX_DUEL) i++;
+ while(duel->list[i].members_count > 0 && i < MAX_DUEL) i++;
if(i == MAX_DUEL) return 0;
- iDuel->duel_count++;
+ duel->count++;
sd->duel_group = i;
- iDuel->duel_list[i].members_count++;
- iDuel->duel_list[i].invites_count = 0;
- iDuel->duel_list[i].max_players_limit = maxpl;
+ duel->list[i].members_count++;
+ duel->list[i].invites_count = 0;
+ duel->list[i].max_players_limit = maxpl;
strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
clif->disp_onlyself(sd, output, strlen(output));
@@ -97,8 +93,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl)
return i;
}
-void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd)
-{
+void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd) {
char output[256];
// " -- Player %s invites %s to duel --"
@@ -106,7 +101,7 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
target_sd->duel_invite = did;
- iDuel->duel_list[did].invites_count++;
+ duel->list[did].invites_count++;
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
sprintf(output, msg_txt(374), sd->status.name);
@@ -121,19 +116,18 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va)
return 0;
}
-void duel_leave(const unsigned int did, struct map_session_data* sd)
-{
+void duel_leave(const unsigned int did, struct map_session_data* sd) {
char output[256];
// " <- Player %s has left duel --"
sprintf(output, msg_txt(375), sd->status.name);
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
- iDuel->duel_list[did].members_count--;
+ duel->list[did].members_count--;
- if(iDuel->duel_list[did].members_count == 0) {
+ if(duel->list[did].members_count == 0) {
iMap->map_foreachpc(duel_leave_sub, did);
- iDuel->duel_count--;
+ duel->count--;
}
sd->duel_group = 0;
@@ -142,13 +136,12 @@ void duel_leave(const unsigned int did, struct map_session_data* sd)
clif->maptypeproperty2(&sd->bl,SELF);
}
-void duel_accept(const unsigned int did, struct map_session_data* sd)
-{
+void duel_accept(const unsigned int did, struct map_session_data* sd) {
char output[256];
- iDuel->duel_list[did].members_count++;
+ duel->list[did].members_count++;
sd->duel_group = sd->duel_invite;
- iDuel->duel_list[did].invites_count--;
+ duel->list[did].invites_count--;
sd->duel_invite = 0;
// " -> Player %s has accepted duel --"
@@ -159,25 +152,22 @@ void duel_accept(const unsigned int did, struct map_session_data* sd)
clif->maptypeproperty2(&sd->bl,SELF);
}
-void duel_reject(const unsigned int did, struct map_session_data* sd)
-{
+void duel_reject(const unsigned int did, struct map_session_data* sd) {
char output[256];
// " -- Player %s has rejected duel --"
sprintf(output, msg_txt(377), sd->status.name);
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
- iDuel->duel_list[did].invites_count--;
+ duel->list[did].invites_count--;
sd->duel_invite = 0;
}
-void do_final_duel(void)
-{
+void do_final_duel(void) {
}
-void do_init_duel(void)
-{
- memset(&iDuel->duel_list[0], 0, sizeof(iDuel->duel_list));
+void do_init_duel(void) {
+ memset(&duel->list[0], 0, sizeof(duel->list));
}
/*=====================================
@@ -185,20 +175,20 @@ void do_init_duel(void)
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
-void iDuel_defaults(void) {
- iDuel = &iDuel_s;
+void duel_defaults(void) {
+ duel = &duel_s;
/* vars */
- iDuel->duel_count = 0;
+ duel->count = 0;
/* funcs */
//Duel functions // [LuzZza]
- iDuel->create = duel_create;
- iDuel->invite = duel_invite;
- iDuel->accept = duel_accept;
- iDuel->reject = duel_reject;
- iDuel->leave = duel_leave;
- iDuel->showinfo = duel_showinfo;
- iDuel->checktime = duel_checktime;
-
- iDuel->do_init_duel = do_init_duel;
- iDuel->do_final_duel = do_final_duel;
+ duel->create = duel_create;
+ duel->invite = duel_invite;
+ duel->accept = duel_accept;
+ duel->reject = duel_reject;
+ duel->leave = duel_leave;
+ duel->showinfo = duel_showinfo;
+ duel->checktime = duel_checktime;
+
+ duel->init = do_init_duel;
+ duel->final = do_final_duel;
}
diff --git a/src/map/duel.h b/src/map/duel.h
index 9fa33833a..7802f6163 100644
--- a/src/map/duel.h
+++ b/src/map/duel.h
@@ -21,8 +21,8 @@ struct duel {
struct duel_interface {
/* vars */
- struct duel duel_list[MAX_DUEL];
- int duel_count;
+ struct duel list[MAX_DUEL];
+ int count;
/* funcs */
//Duel functions // [LuzZza]
@@ -34,12 +34,12 @@ struct duel_interface {
void (*showinfo) (const unsigned int did, struct map_session_data* sd);
int (*checktime) (struct map_session_data* sd);
- void (*do_init_duel) (void);
- void (*do_final_duel) (void);
-} iDuel_s;
+ void (*init) (void);
+ void (*final) (void);
+} duel_s;
-struct duel_interface *iDuel;
+struct duel_interface *duel;
-void iDuel_defaults(void);
+void duel_defaults(void);
#endif /* _DUEL_H_ */
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 92b92106d..79d993ede 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -71,7 +71,7 @@ enum homun_type homunculus_class2type(int class_) {
case 6052:
return HT_S;
default:
- return -1;
+ return HT_INVALID;
}
}
@@ -288,7 +288,7 @@ bool homunculus_levelup(struct homun_data *hd) {
int growth_max_hp, growth_max_sp;
enum homun_type htype;
- if((htype = homun->class2type(hd->homunculus.class_)) == -1) {
+ if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) {
ShowError("homunculus_levelup: Invalid class %d. \n", hd->homunculus.class_);
return false;
}
@@ -435,14 +435,14 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) {
m_class = homun->class2type(hd->homunculus.class_);
m_id = homun->class2type(homun_id);
- if( m_class == -1 || m_id == -1 || m_class != HT_EVO || m_id != HT_S ) {
+ if( m_class == HT_INVALID || m_id == HT_INVALID || m_class != HT_EVO || m_id != HT_S ) {
clif->emotion(&hd->bl, E_SWT);
return false;
}
prev_class = hd->homunculus.class_;
- if (!homun->change_class(hd, homun_id)) {
+ if( !homun->change_class(hd, homun_id) ) {
ShowError("homunculus_mutate: Can't evolve homunc from %d to %d", hd->homunculus.class_, homun_id);
return false;
}
@@ -474,7 +474,7 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) {
if(hd->homunculus.vaporize)
return 1;
- if((htype = homun->class2type(hd->homunculus.class_)) == -1) {
+ if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) {
ShowError("homunculus_gainexp: Invalid class %d. \n", hd->homunculus.class_);
return 0;
}
@@ -1127,11 +1127,11 @@ void homunculus_read_db(void) {
memset(homun->db,0,sizeof(homun->db));
for(i = 0; i<ARRAYLENGTH(filename); i++) {
if( i > 0 ) {
- char path[256];
+ char filepath[256];
- sprintf(path, "%s/%s", iMap->db_path, filename[i]);
+ sprintf(filepath, "%s/%s", iMap->db_path, filename[i]);
- if( !exists(path) ) {
+ if( !exists(filepath) ) {
continue;
}
}
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index 4b35c0992..a90faf2e2 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -53,13 +53,13 @@ struct homun_data {
struct status_data base_status, battle_status;
struct status_change sc;
struct regen_data regen;
- struct s_homunculus_db *homunculusDB; //[orn]
- struct s_homunculus homunculus; //[orn]
+ struct s_homunculus_db *homunculusDB; //[orn]
+ struct s_homunculus homunculus; //[orn]
- struct map_session_data *master; //pointer back to its master
- int hungry_timer; //[orn]
+ struct map_session_data *master; //pointer back to its master
+ int hungry_timer; //[orn]
unsigned int exp_next;
- char blockskill[MAX_SKILL]; // [orn]
+ char blockskill[MAX_SKILL]; // [orn]
};
struct homun_skill_tree_entry {
@@ -74,9 +74,10 @@ struct homun_skill_tree_entry {
}; // Celest
enum homun_type {
- HT_REG = 0x1,
- HT_EVO = 0x2,
- HT_S = 0x4,
+ HT_REG, // Regular Homunculus
+ HT_EVO, // Evolved Homunculus
+ HT_S, // Homunculus S
+ HT_INVALID = -1, // Invalid Homunculus
};
/* homunculus.c interface */
diff --git a/src/map/instance.c b/src/map/instance.c
index 563c4326f..476a4d0e3 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -377,7 +377,7 @@ void instance_del_map(int16 m) {
if( map[m].mob_delete_timer != INVALID_TIMER )
timer->delete(map[m].mob_delete_timer, iMap->removemobs_timer);
- mapindex_removemap( map[m].index );
+ mapindex_removemap(map_id2index(m));
// Free memory
aFree(map[m].cell);
diff --git a/src/map/intif.c b/src/map/intif.c
index ac1471d23..634735bd6 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -458,8 +458,7 @@ int intif_party_leave(int party_id,int account_id, int char_id)
}
// Request keeping party for new map ??
-int intif_party_changemap(struct map_session_data *sd,int online)
-{
+int intif_party_changemap(struct map_session_data *sd,int online) {
int16 m, mapindex;
if (intif->CheckForCharServer())
@@ -468,7 +467,7 @@ int intif_party_changemap(struct map_session_data *sd,int online)
return 0;
if( (m=iMap->mapindex2mapid(sd->mapindex)) >= 0 && map[m].instance_id >= 0 )
- mapindex = map[map[m].instance_src_map].index;
+ mapindex = map_id2index(map[m].instance_src_map);
else
mapindex = sd->mapindex;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index c2a25c2d4..2398ba04c 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1379,13 +1379,13 @@ void itemdb_read_combos() {
uint32 lines = 0, count = 0;
char line[1024];
- char path[256];
+ char filepath[256];
FILE* fp;
- sprintf(path, "%s/%s", iMap->db_path, DBPATH"item_combo_db.txt");
+ sprintf(filepath, "%s/%s", iMap->db_path, DBPATH"item_combo_db.txt");
- if ((fp = fopen(path, "r")) == NULL) {
- ShowError("itemdb_read_combos: File not found \"%s\".\n", path);
+ if ((fp = fopen(filepath, "r")) == NULL) {
+ ShowError("itemdb_read_combos: File not found \"%s\".\n", filepath);
return;
}
@@ -1407,10 +1407,9 @@ void itemdb_read_combos() {
if (*p == '\0')
continue;// empty line
- if (!strchr(p,','))
- {
+ if (!strchr(p,',')) {
/* is there even a single column? */
- ShowError("itemdb_read_combos: Insufficient columns in line %d of \"%s\", skipping.\n", lines, path);
+ ShowError("itemdb_read_combos: Insufficient columns in line %d of \"%s\", skipping.\n", lines, filepath);
continue;
}
@@ -1424,13 +1423,13 @@ void itemdb_read_combos() {
p++;
if (str[1][0] != '{') {
- ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, path);
+ ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath);
continue;
}
/* no ending key anywhere (missing \}\) */
if ( str[1][strlen(str[1])-1] != '}' ) {
- ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, path);
+ ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath);
continue;
} else {
int items[MAX_ITEMS_PER_COMBO];
@@ -1439,14 +1438,14 @@ void itemdb_read_combos() {
int idx = 0;
if((retcount = itemdb->combo_split_atoi(str[0], items)) < 2) {
- ShowError("itemdb_read_combos: line %d of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, path);
+ ShowError("itemdb_read_combos: line %d of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath);
continue;
}
/* validate */
for(v = 0; v < retcount; v++) {
if( !itemdb->exists(items[v]) ) {
- ShowError("itemdb_read_combos: line %d of \"%s\" contains unknown item ID %d, skipping.\n", lines, path,items[v]);
+ ShowError("itemdb_read_combos: line %d of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath,items[v]);
break;
}
}
@@ -1470,7 +1469,7 @@ void itemdb_read_combos() {
id->combos[idx]->nameid = aMalloc( retcount * sizeof(unsigned short) );
id->combos[idx]->count = retcount;
- id->combos[idx]->script = script->parse(str[1], path, lines, 0);
+ id->combos[idx]->script = script->parse(str[1], filepath, lines, 0);
id->combos[idx]->id = count;
id->combos[idx]->isRef = false;
/* populate ->nameid field */
@@ -1712,13 +1711,13 @@ int itemdb_readdb(void)
uint32 lines = 0, count = 0;
char line[1024];
- char path[256];
+ char filepath[256];
FILE* fp;
- sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
- fp = fopen(path, "r");
+ sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ fp = fopen(filepath, "r");
if( fp == NULL ) {
- ShowWarning("itemdb_readdb: File not found \"%s\", skipping.\n", path);
+ ShowWarning("itemdb_readdb: File not found \"%s\", skipping.\n", filepath);
continue;
}
@@ -1737,8 +1736,7 @@ int itemdb_readdb(void)
++p;
if( *p == '\0' )
continue;// empty line
- for( i = 0; i < 19; ++i )
- {
+ for( i = 0; i < 19; ++i ) {
str[i] = p;
p = strchr(p,',');
if( p == NULL )
@@ -1747,48 +1745,42 @@ int itemdb_readdb(void)
++p;
}
- if( p == NULL )
- {
- ShowError("itemdb_readdb: Insufficient columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( p == NULL ) {
+ ShowError("itemdb_readdb: Insufficient columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
// Script
- if( *p != '{' )
- {
- ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( *p != '{' ) {
+ ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
str[19] = p;
p = strstr(p+1,"},");
- if( p == NULL )
- {
- ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( p == NULL ) {
+ ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
p[1] = '\0';
p += 2;
// OnEquip_Script
- if( *p != '{' )
- {
- ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( *p != '{' ) {
+ ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
str[20] = p;
p = strstr(p+1,"},");
- if( p == NULL )
- {
- ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( p == NULL ) {
+ ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
p[1] = '\0';
p += 2;
// OnUnequip_Script (last column)
- if( *p != '{' )
- {
- ShowError("itemdb_readdb: Invalid format (OnUnequip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ if( *p != '{' ) {
+ ShowError("itemdb_readdb: Invalid format (OnUnequip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
str[21] = p;
@@ -1805,12 +1797,12 @@ int itemdb_readdb(void)
}
if( lcurly != rcurly ) {
- ShowError("itemdb_readdb: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ ShowError("itemdb_readdb: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, filepath, atoi(str[0]));
continue;
}
}
- if (!itemdb->parse_dbrow(str, path, lines, 0))
+ if (!itemdb->parse_dbrow(str, filepath, lines, 0))
continue;
count++;
diff --git a/src/map/map.c b/src/map/map.c
index aff696f06..aeeff5178 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -483,7 +483,7 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type)
struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag) {
int16 m,bx,by;
struct block_list *bl;
- struct skill_unit *unit;
+ struct skill_unit *su;
m = target->m;
if (x < 0 || y < 0 || (x >= map[m].xs) || (y >= map[m].ys))
@@ -497,11 +497,11 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,
if (bl->x != x || bl->y != y || bl->type != BL_SKILL)
continue;
- unit = (struct skill_unit *) bl;
- if( unit == out_unit || !unit->alive || !unit->group || unit->group->skill_id != skill_id )
+ su = (struct skill_unit *) bl;
+ if( su == out_unit || !su->alive || !su->group || su->group->skill_id != skill_id )
continue;
- if( !(flag&1) || battle->check_target(&unit->bl,target,unit->group->target_flag) > 0 )
- return unit;
+ if( !(flag&1) || battle->check_target(&su->bl,target,su->group->target_flag) > 0 )
+ return su;
}
return NULL;
}
@@ -1935,44 +1935,40 @@ struct s_mapiterator
/// @param flags Flags of the iterator
/// @param type Target types
/// @return Iterator
-struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types)
-{
- struct s_mapiterator* mapit;
+struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types) {
+ struct s_mapiterator* iter;
- mapit = ers_alloc(map_iterator_ers, struct s_mapiterator);
- mapit->flags = flags;
- mapit->types = types;
- if( types == BL_PC ) mapit->dbi = db_iterator(pc_db);
- else if( types == BL_MOB ) mapit->dbi = db_iterator(mobid_db);
- else mapit->dbi = db_iterator(id_db);
- return mapit;
+ iter = ers_alloc(map_iterator_ers, struct s_mapiterator);
+ iter->flags = flags;
+ iter->types = types;
+ if( types == BL_PC ) iter->dbi = db_iterator(pc_db);
+ else if( types == BL_MOB ) iter->dbi = db_iterator(mobid_db);
+ else iter->dbi = db_iterator(id_db);
+ return iter;
}
/// Frees the iterator.
///
-/// @param mapit Iterator
-void mapit_free(struct s_mapiterator* mapit)
-{
- nullpo_retv(mapit);
+/// @param iter Iterator
+void mapit_free(struct s_mapiterator* iter) {
+ nullpo_retv(iter);
- dbi_destroy(mapit->dbi);
- ers_free(map_iterator_ers, mapit);
+ dbi_destroy(iter->dbi);
+ ers_free(map_iterator_ers, iter);
}
/// Returns the first block_list that matches the description.
/// Returns NULL if not found.
///
-/// @param mapit Iterator
+/// @param iter Iterator
/// @return first block_list or NULL
-struct block_list* mapit_first(struct s_mapiterator* mapit)
-{
+struct block_list* mapit_first(struct s_mapiterator* iter) {
struct block_list* bl;
- nullpo_retr(NULL,mapit);
+ nullpo_retr(NULL,iter);
- for( bl = (struct block_list*)dbi_first(mapit->dbi); bl != NULL; bl = (struct block_list*)dbi_next(mapit->dbi) )
- {
- if( MAPIT_MATCHES(mapit,bl) )
+ for( bl = (struct block_list*)dbi_first(iter->dbi); bl != NULL; bl = (struct block_list*)dbi_next(iter->dbi) ) {
+ if( MAPIT_MATCHES(iter,bl) )
break;// found match
}
return bl;
@@ -1981,17 +1977,15 @@ struct block_list* mapit_first(struct s_mapiterator* mapit)
/// Returns the last block_list that matches the description.
/// Returns NULL if not found.
///
-/// @param mapit Iterator
+/// @param iter Iterator
/// @return last block_list or NULL
-struct block_list* mapit_last(struct s_mapiterator* mapit)
-{
+struct block_list* mapit_last(struct s_mapiterator* iter) {
struct block_list* bl;
- nullpo_retr(NULL,mapit);
+ nullpo_retr(NULL,iter);
- for( bl = (struct block_list*)dbi_last(mapit->dbi); bl != NULL; bl = (struct block_list*)dbi_prev(mapit->dbi) )
- {
- if( MAPIT_MATCHES(mapit,bl) )
+ for( bl = (struct block_list*)dbi_last(iter->dbi); bl != NULL; bl = (struct block_list*)dbi_prev(iter->dbi) ) {
+ if( MAPIT_MATCHES(iter,bl) )
break;// found match
}
return bl;
@@ -2000,20 +1994,18 @@ struct block_list* mapit_last(struct s_mapiterator* mapit)
/// Returns the next block_list that matches the description.
/// Returns NULL if not found.
///
-/// @param mapit Iterator
+/// @param iter Iterator
/// @return next block_list or NULL
-struct block_list* mapit_next(struct s_mapiterator* mapit)
-{
+struct block_list* mapit_next(struct s_mapiterator* iter) {
struct block_list* bl;
- nullpo_retr(NULL,mapit);
+ nullpo_retr(NULL,iter);
- for( ; ; )
- {
- bl = (struct block_list*)dbi_next(mapit->dbi);
+ for( ; ; ) {
+ bl = (struct block_list*)dbi_next(iter->dbi);
if( bl == NULL )
break;// end
- if( MAPIT_MATCHES(mapit,bl) )
+ if( MAPIT_MATCHES(iter,bl) )
break;// found a match
// try next
}
@@ -2023,20 +2015,18 @@ struct block_list* mapit_next(struct s_mapiterator* mapit)
/// Returns the previous block_list that matches the description.
/// Returns NULL if not found.
///
-/// @param mapit Iterator
+/// @param iter Iterator
/// @return previous block_list or NULL
-struct block_list* mapit_prev(struct s_mapiterator* mapit)
-{
+struct block_list* mapit_prev(struct s_mapiterator* iter) {
struct block_list* bl;
- nullpo_retr(NULL,mapit);
+ nullpo_retr(NULL,iter);
- for( ; ; )
- {
- bl = (struct block_list*)dbi_prev(mapit->dbi);
+ for( ; ; ) {
+ bl = (struct block_list*)dbi_prev(iter->dbi);
if( bl == NULL )
break;// end
- if( MAPIT_MATCHES(mapit,bl) )
+ if( MAPIT_MATCHES(iter,bl) )
break;// found a match
// try prev
}
@@ -2045,13 +2035,12 @@ struct block_list* mapit_prev(struct s_mapiterator* mapit)
/// Returns true if the current block_list exists in the database.
///
-/// @param mapit Iterator
+/// @param iter Iterator
/// @return true if it exists
-bool mapit_exists(struct s_mapiterator* mapit)
-{
- nullpo_retr(false,mapit);
+bool mapit_exists(struct s_mapiterator* iter) {
+ nullpo_retr(false,iter);
- return dbi_exists(mapit->dbi);
+ return dbi_exists(iter->dbi);
}
/*==========================================
@@ -3167,7 +3156,7 @@ int map_readallmaps (void) {
map[i].index = mapindex_name2id(map[i].name);
- if ( index2mapid[map[i].index] != -1 ) {
+ if ( index2mapid[map_id2index(i)] != -1 ) {
ShowWarning("Map %s already loaded!"CL_CLL"\n", map[i].name);
if (map[i].cell && map[i].cell != (struct mapcell *)0xdeadbeaf) {
aFree(map[i].cell);
@@ -4491,8 +4480,8 @@ void read_map_zone_db(void) {
disabled_skills_count = config_setting_length(skills);
/* validate */
for(h = 0; h < config_setting_length(skills); h++) {
- config_setting_t *skill = config_setting_get_elem(skills, h);
- name = config_setting_name(skill);
+ config_setting_t *skillinfo = config_setting_get_elem(skills, h);
+ name = config_setting_name(skillinfo);
if( !map_zone_str2skillid(name) ) {
ShowError("map_zone_db: unknown skill (%s) in disabled_skills for zone '%s', skipping skill...\n",name,zone->name);
config_setting_remove_elem(skills,h);
@@ -4506,10 +4495,10 @@ void read_map_zone_db(void) {
/* all ok, process */
CREATE( zone->disabled_skills, struct map_zone_disabled_skill_entry *, disabled_skills_count );
for(h = 0, v = 0; h < config_setting_length(skills); h++) {
- config_setting_t *skill = config_setting_get_elem(skills, h);
+ config_setting_t *skillinfo = config_setting_get_elem(skills, h);
struct map_zone_disabled_skill_entry * entry;
enum bl_type type;
- name = config_setting_name(skill);
+ name = config_setting_name(skillinfo);
if( (type = map_zone_bl_type(config_setting_get_string_elem(skills,h),&subtype)) ) { /* only add if enabled */
CREATE( entry, struct map_zone_disabled_skill_entry, 1 );
@@ -4710,8 +4699,8 @@ void read_map_zone_db(void) {
for(j = 0; j < disabled_skills_count_i; j++) {
int k;
for(k = 0; k < disabled_skills_count; k++) {
- config_setting_t *skill = config_setting_get_elem(skills, k);
- if( map_zone_str2skillid(config_setting_name(skill)) == izone->disabled_skills[j]->nameid ) {
+ config_setting_t *skillinfo = config_setting_get_elem(skills, k);
+ if( map_zone_str2skillid(config_setting_name(skillinfo)) == izone->disabled_skills[j]->nameid ) {
break;
}
}
@@ -4952,7 +4941,7 @@ void do_final(void)
iStatus->do_final_status();
unit->final();
bg->final();
- iDuel->do_final_duel();
+ duel->final();
elemental->do_final_elemental();
do_final_maps();
vending->final();
@@ -5164,7 +5153,7 @@ void map_hp_symbols(void) {
HPM->share(trade,"trade");
HPM->share(iStatus,"iStatus");
HPM->share(chat, "chat");
- HPM->share(iDuel,"iDuel");
+ HPM->share(duel,"duel");
HPM->share(elemental,"elemental");
HPM->share(intif,"intif");
HPM->share(mercenary,"mercenary");
@@ -5218,7 +5207,7 @@ void map_load_defaults(void) {
trade_defaults();
status_defaults();
chat_defaults();
- iDuel_defaults();
+ duel_defaults();
elemental_defaults();
intif_defaults();
mercenary_defaults();
@@ -5433,7 +5422,7 @@ int do_init(int argc, char *argv[])
npc->init();
unit->init();
bg->init();
- iDuel->do_init_duel();
+ duel->init();
vending->init();
npc->event_do_oninit(); // Init npcs (OnInit)
diff --git a/src/map/map.h b/src/map/map.h
index 266d0ccde..e2d5261b0 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -711,12 +711,12 @@ struct s_mapiterator;
/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
struct mapit_interface {
struct s_mapiterator* (*alloc) (enum e_mapitflags flags, enum bl_type types);
- void (*free) (struct s_mapiterator* mapit);
- struct block_list* (*first) (struct s_mapiterator* mapit);
- struct block_list* (*last) (struct s_mapiterator* mapit);
- struct block_list* (*next) (struct s_mapiterator* mapit);
- struct block_list* (*prev) (struct s_mapiterator* mapit);
- bool (*exists) (struct s_mapiterator* mapit);
+ void (*free) (struct s_mapiterator* iter);
+ struct block_list* (*first) (struct s_mapiterator* iter);
+ struct block_list* (*last) (struct s_mapiterator* iter);
+ struct block_list* (*next) (struct s_mapiterator* iter);
+ struct block_list* (*prev) (struct s_mapiterator* iter);
+ bool (*exists) (struct s_mapiterator* iter);
} mapit_s;
struct mapit_interface *mapit;
diff --git a/src/map/mob.c b/src/map/mob.c
index 4506ca242..d1b6990c4 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -457,8 +457,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
/*==========================================
* Spawn a single mob on the specified coordinates.
*------------------------------------------*/
-int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai)
-{
+int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) {
struct mob_data* md = NULL;
int count, lv;
@@ -467,26 +466,22 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
lv = (sd) ? sd->status.base_level : 255;
- for (count = 0; count < amount; count++)
- {
+ for (count = 0; count < amount; count++) {
int c = (class_ >= 0) ? class_ : mob->get_random_id(-class_ - 1, (battle_config.random_monster_checklv) ? 3 : 1, lv);
md = mob->once_spawn_sub((sd) ? &sd->bl : NULL, m, x, y, mobname, c, event, size, ai);
if (!md)
continue;
- if (class_ == MOBID_EMPERIUM)
- {
- struct guild_castle* gc = guild->mapindex2gc(map[m].index);
+ if (class_ == MOBID_EMPERIUM) {
+ struct guild_castle* gc = guild->mapindex2gc(map_id2index(m));
struct guild* g = (gc) ? guild->search(gc->guild_id) : NULL;
- if (gc)
- {
+ if (gc) {
md->guardian_data = (struct guardian_data*)aCalloc(1, sizeof(struct guardian_data));
md->guardian_data->castle = gc;
md->guardian_data->number = MAX_GUARDIANS;
md->guardian_data->guild_id = gc->guild_id;
- if (g)
- {
+ if (g) {
md->guardian_data->emblem_id = g->emblem_id;
memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
}
@@ -497,10 +492,11 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
mob->spawn(md);
- if (class_ < 0 && battle_config.dead_branch_active)
+ if (class_ < 0 && battle_config.dead_branch_active) {
//Behold Aegis's masterful decisions yet again...
//"I understand the "Aggressive" part, but the "Can Move" and "Can Attack" is just stupid" - Poki#3
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE|MD_CANATTACK|MD_CANMOVE|MD_ANGRY, 0, 60000);
+ }
}
return (md) ? md->bl.id : 0; // id of last spawned mob
@@ -1182,12 +1178,12 @@ int mob_warpchase_sub(struct block_list *bl,va_list ap) {
if(nd->subtype != WARP)
return 0; //Not a warp
- if(nd->u.warp.mapindex != map[target->m].index)
+ if(nd->u.warp.mapindex != map_id2index(target->m))
return 0; //Does not lead to the same map.
cur_distance = distance_blxy(target, nd->u.warp.x, nd->u.warp.y);
- if (cur_distance < *min_distance)
- { //Pick warp that leads closest to target.
+ if (cur_distance < *min_distance) {
+ //Pick warp that leads closest to target.
*target_nd = nd;
*min_distance = cur_distance;
return 1;
@@ -3891,26 +3887,21 @@ bool mob_parse_dbrow(char** str)
/*==========================================
* mob_db.txt reading
*------------------------------------------*/
-bool mob_readdb_sub(char* fields[], int columns, int current)
-{
+bool mob_readdb_sub(char* fields[], int columns, int current) {
return mob->parse_dbrow(fields);
}
-void mob_readdb(void)
-{
+void mob_readdb(void) {
const char* filename[] = {
DBPATH"mob_db.txt",
"mob_db2.txt" };
int fi;
- for( fi = 0; fi < ARRAYLENGTH(filename); ++fi )
- {
- if(fi > 0)
- {
- char path[256];
- sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
- if(!exists(path))
- {
+ for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
+ if(fi > 0) {
+ char filepath[256];
+ sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ if(!exists(filepath)) {
continue;
}
}
@@ -4139,23 +4130,20 @@ bool mob_parse_row_chatdb(char** str, const char* source, int line, int* last_ms
/*==========================================
* mob_chat_db.txt reading [SnakeDrak]
*-------------------------------------------------------------------------*/
-void mob_readchatdb(void)
-{
+void mob_readchatdb(void) {
char arc[]="mob_chat_db.txt";
uint32 lines=0, count=0;
- char line[1024], path[256];
+ char line[1024], filepath[256];
int i, tmp=0;
FILE *fp;
- sprintf(path, "%s/%s", iMap->db_path, arc);
- fp=fopen(path, "r");
- if(fp == NULL)
- {
- ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", path);
+ sprintf(filepath, "%s/%s", iMap->db_path, arc);
+ fp=fopen(filepath, "r");
+ if(fp == NULL) {
+ ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", filepath);
return;
}
- while(fgets(line, sizeof(line), fp))
- {
+ while(fgets(line, sizeof(line), fp)) {
char *str[3], *p, *np;
int j=0;
@@ -4183,7 +4171,7 @@ void mob_readchatdb(void)
continue;
}
- if( !mob->parse_row_chatdb(str, path, lines, &tmp) )
+ if( !mob->parse_row_chatdb(str, filepath, lines, &tmp) )
continue;
count++;
@@ -4461,20 +4449,16 @@ void mob_readskilldb(void) {
"mob_skill_db2.txt" };
int fi;
- if( battle_config.mob_skill_rate == 0 )
- {
+ if( battle_config.mob_skill_rate == 0 ) {
ShowStatus("Mob skill use disabled. Not reading mob skills.\n");
return;
}
- for( fi = 0; fi < ARRAYLENGTH(filename); ++fi )
- {
- if(fi > 0)
- {
- char path[256];
- sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
- if(!exists(path))
- {
+ for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
+ if(fi > 0) {
+ char filepath[256];
+ sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ if(!exists(filepath)) {
continue;
}
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 2439969a9..1769b660e 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -398,13 +398,13 @@ int npc_event_doall(const char* name)
int npc_event_do_clock(int tid, unsigned int tick, int id, intptr_t data)
{
static struct tm ev_tm_b; // tracks previous execution time
- time_t timer;
+ time_t clock;
struct tm* t;
char buf[64];
int c = 0;
- timer = time(NULL);
- t = localtime(&timer);
+ clock = time(NULL);
+ t = localtime(&clock);
if (t->tm_min != ev_tm_b.tm_min ) {
char* day;
@@ -1952,8 +1952,7 @@ void npc_delsrcfile(const char* name)
/// Parses and sets the name and exname of a npc.
/// Assumes that m, x and y are already set in nd.
-void npc_parsename(struct npc_data* nd, const char* name, const char* start, const char* buffer, const char* filepath)
-{
+void npc_parsename(struct npc_data* nd, const char* name, const char* start, const char* buffer, const char* filepath) {
const char* p;
struct npc_data* dnd;// duplicate npc
char newname[NAME_LENGTH];
@@ -1997,8 +1996,8 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
snprintf(newname, ARRAYLENGTH(newname), "%d_%d_%d_%d", i, nd->bl.m, nd->bl.x, nd->bl.y);
} while( npc->name2id(newname) != NULL );
- strcpy(this_mapname, (nd->bl.m==-1?"(not on a map)":mapindex_id2name(map[nd->bl.m].index)));
- strcpy(other_mapname, (dnd->bl.m==-1?"(not on a map)":mapindex_id2name(map[dnd->bl.m].index)));
+ strcpy(this_mapname, (nd->bl.m == -1 ? "(not on a map)" : mapindex_id2name(map_id2index(nd->bl.m))));
+ strcpy(other_mapname, (dnd->bl.m == -1 ? "(not on a map)" : mapindex_id2name(map_id2index(dnd->bl.m))));
ShowWarning("npc_parsename: Duplicate unique name in file '%s', line'%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname);
ShowDebug("this npc:\n display name '%s'\n unique name '%s'\n map=%s, x=%d, y=%d\n", nd->name, nd->exname, this_mapname, nd->bl.x, nd->bl.y);
@@ -2627,7 +2626,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
int npc_duplicate4instance(struct npc_data *snd, int16 m) {
char newname[NAME_LENGTH];
- if( map[m].instance_id == -1 )
+ if( m == -1 || map[m].instance_id == -1 )
return 1;
snprintf(newname, ARRAYLENGTH(newname), "dup_%d_%d", map[m].instance_id, snd->bl.id);
@@ -2924,8 +2923,7 @@ void npc_parse_mob2(struct spawn_data* mobspawn)
}
}
-const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
-{
+const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath) {
int num, class_, m,x,y,xs,ys, i,j;
int mob_lv = -1, ai = -1, size = -1;
char mapname[32], mobname[NAME_LENGTH];
@@ -2940,14 +2938,13 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
// w3=<mob name>{,<mob level>}
// w4=<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}
if( sscanf(w1, "%31[^,],%d,%d,%d,%d", mapname, &x, &y, &xs, &ys) < 3
- || sscanf(w3, "%23[^,],%d", mobname, &mob_lv) < 1
- || sscanf(w4, "%d,%d,%u,%u,%127[^,],%d,%d[^\t\r\n]", &class_, &num, &mobspawn.delay1, &mobspawn.delay2, mobspawn.eventname, &size, &ai) < 2 )
- {
+ || sscanf(w3, "%23[^,],%d", mobname, &mob_lv) < 1
+ || sscanf(w4, "%d,%d,%u,%u,%127[^,],%d,%d[^\t\r\n]", &class_, &num, &mobspawn.delay1, &mobspawn.delay2, mobspawn.eventname, &size, &ai) < 2
+ ) {
ShowError("npc_parse_mob: Invalid mob definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return strchr(start,'\n');// skip and continue
}
- if( mapindex_name2id(mapname) == 0 )
- {
+ if( mapindex_name2id(mapname) == 0 ) {
ShowError("npc_parse_mob: Unknown map '%s' in file '%s', line '%d'.\n", mapname, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
@@ -2956,39 +2953,33 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
return strchr(start,'\n');// skip and continue
mobspawn.m = (unsigned short)m;
- if( x < 0 || x >= map[mobspawn.m].xs || y < 0 || y >= map[mobspawn.m].ys )
- {
+ if( x < 0 || x >= map[mobspawn.m].xs || y < 0 || y >= map[mobspawn.m].ys ) {
ShowError("npc_parse_mob: Spawn coordinates out of range: %s (%d,%d), map size is (%d,%d) - %s %s (file '%s', line '%d').\n", map[mobspawn.m].name, x, y, (map[mobspawn.m].xs-1), (map[mobspawn.m].ys-1), w1, w3, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
// check monster ID if exists!
- if( mob->db_checkid(class_) == 0 )
- {
+ if( mob->db_checkid(class_) == 0 ) {
ShowError("npc_parse_mob: Unknown mob ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
- if( num < 1 || num > 1000 )
- {
+ if( num < 1 || num > 1000 ) {
ShowError("npc_parse_mob: Invalid number of monsters %d, must be inside the range [1,1000] (file '%s', line '%d').\n", num, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
- if( (mobspawn.state.size < 0 || mobspawn.state.size > 2) && size != -1 )
- {
+ if( (mobspawn.state.size < 0 || mobspawn.state.size > 2) && size != -1 ) {
ShowError("npc_parse_mob: Invalid size number %d for mob ID %d (file '%s', line '%d').\n", mobspawn.state.size, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
- if( (mobspawn.state.ai < 0 || mobspawn.state.ai > 4) && ai != -1 )
- {
+ if( (mobspawn.state.ai < 0 || mobspawn.state.ai > 4) && ai != -1 ) {
ShowError("npc_parse_mob: Invalid ai %d for mob ID %d (file '%s', line '%d').\n", mobspawn.state.ai, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
- if( (mob_lv == 0 || mob_lv > MAX_LEVEL) && mob_lv != -1 )
- {
+ if( (mob_lv == 0 || mob_lv > MAX_LEVEL) && mob_lv != -1 ) {
ShowError("npc_parse_mob: Invalid level %d for mob ID %d (file '%s', line '%d').\n", mob_lv, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
@@ -3012,8 +3003,8 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
mobspawn.num = 1;
}
- if (battle_config.force_random_spawn || (mobspawn.x == 0 && mobspawn.y == 0))
- { //Force a random spawn anywhere on the map.
+ if (battle_config.force_random_spawn || (mobspawn.x == 0 && mobspawn.y == 0)) {
+ //Force a random spawn anywhere on the map.
mobspawn.x = mobspawn.y = 0;
mobspawn.xs = mobspawn.ys = -1;
}
@@ -3032,23 +3023,20 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
safestrncpy(mobspawn.name, mobname, sizeof(mobspawn.name));
//Verify dataset.
- if( !mob->parse_dataset(&mobspawn) )
- {
+ if( !mob->parse_dataset(&mobspawn) ) {
ShowError("npc_parse_mob: Invalid dataset for monster ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
//Update mob spawn lookup database
db = mob->db(class_);
- for( i = 0; i < ARRAYLENGTH(db->spawn); ++i )
- {
- if (map[mobspawn.m].index == db->spawn[i].mapindex)
- { //Update total
+ for( i = 0; i < ARRAYLENGTH(db->spawn); ++i ) {
+ if (map_id2index(mobspawn.m) == db->spawn[i].mapindex) {
+ //Update total
db->spawn[i].qty += mobspawn.num;
//Re-sort list
for( j = i; j > 0 && db->spawn[j-1].qty < db->spawn[i].qty; --j );
- if( j != i )
- {
+ if( j != i ) {
xs = db->spawn[i].mapindex;
ys = db->spawn[i].qty;
memmove(&db->spawn[j+1], &db->spawn[j], (i-j)*sizeof(db->spawn[0]));
@@ -3057,10 +3045,10 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
}
break;
}
- if (mobspawn.num > db->spawn[i].qty)
- { //Insert into list
+ if (mobspawn.num > db->spawn[i].qty) {
+ //Insert into list
memmove(&db->spawn[i+1], &db->spawn[i], sizeof(db->spawn) -(i+1)*sizeof(db->spawn[0]));
- db->spawn[i].mapindex = map[mobspawn.m].index;
+ db->spawn[i].mapindex = map_id2index(mobspawn.m);
db->spawn[i].qty = mobspawn.num;
break;
}
@@ -3847,13 +3835,13 @@ int npc_reload(void) {
}
//Unload all npc in the given file
-bool npc_unloadfile( const char* path ) {
+bool npc_unloadfile( const char* filepath ) {
DBIterator * iter = db_iterator(npc->name_db);
struct npc_data* nd = NULL;
bool found = false;
for( nd = dbi_first(iter); dbi_exists(iter); nd = dbi_next(iter) ) {
- if( nd->path && strcasecmp(nd->path,path) == 0 ) {
+ if( nd->path && strcasecmp(nd->path,filepath) == 0 ) {
found = true;
npc->unload_duplicates(nd);/* unload any npcs which could duplicate this but be in a different file */
npc->unload(nd, true);
diff --git a/src/map/npc.h b/src/map/npc.h
index 6c1ca0972..3c273fffb 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -213,7 +213,7 @@ struct npc_interface {
void (*setclass) (struct npc_data *nd, short class_);
int (*do_atcmd_event) (struct map_session_data *sd, const char *command, const char *message, const char *eventname);
const char* (*parse_function) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath);
- void (*parse_mob2) (struct spawn_data *mob);
+ void (*parse_mob2) (struct spawn_data *mobspawn);
const char* (*parse_mob) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath);
const char* (*parse_mapflag) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath);
void (*parsesrcfile) (const char *filepath, bool runOnInit);
@@ -222,7 +222,7 @@ struct npc_interface {
int (*path_db_clear_sub) (DBKey key, DBData *data, va_list args);
int (*ev_label_db_clear_sub) (DBKey key, DBData *data, va_list args);
int (*reload) (void);
- bool (*unloadfile) (const char *path);
+ bool (*unloadfile) (const char *filepath);
void (*do_clear_npc) (void);
void (*debug_warps_sub) (struct npc_data *nd);
void (*debug_warps) (void);
diff --git a/src/map/packets.h b/src/map/packets.h
index 091c48a77..8fcc6c863 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2366,8 +2366,10 @@ packet(0x020d,-1);
packet(0x0360,26,clif->pFriendsListAdd,2);
packet(0x094A,5,clif->pHomMenu,2,4);
packet(0x0873,36,clif->pStoragePassword,0);
+ packet(0x097C,4,clif->pRanklist);
#endif
+
/* PacketKeys: http://hercules.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */
#if PACKETVER >= 20110817
packetKeys(0x053D5CED,0x3DED6DED,0x6DED6DED); /* Thanks to Shakto */
diff --git a/src/map/pc.c b/src/map/pc.c
index 949a66d8c..441230c29 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -400,21 +400,17 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
// Increases a player's fame points and displays a notice to him
void pc_addfame(struct map_session_data *sd,int count)
{
+ int ranktype = -1;
nullpo_retv(sd);
sd->status.fame += count;
if(sd->status.fame > MAX_FAME)
sd->status.fame = MAX_FAME;
switch(sd->class_&MAPID_UPPERMASK){
- case MAPID_BLACKSMITH: // Blacksmith
- clif->fame_blacksmith(sd,count);
- break;
- case MAPID_ALCHEMIST: // Alchemist
- clif->fame_alchemist(sd,count);
- break;
- case MAPID_TAEKWON: // Taekwon
- clif->fame_taekwon(sd,count);
- break;
+ case MAPID_BLACKSMITH: ranktype = RANKTYPE_BLACKSMITH; break;
+ case MAPID_ALCHEMIST: ranktype = RANKTYPE_ALCHEMIST; break;
+ case MAPID_TAEKWON: ranktype = RANKTYPE_TAEKWON; break;
}
+ clif->update_rankingpoint(sd, ranktype, count);
chrif->updatefamelist(sd);
}
@@ -1862,13 +1858,10 @@ static int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id,
return 1;
}
-static int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill, unsigned char target)
-{
+static int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target) {
int i;
- for( i = 0; i < max && effect[i].skill; i++ )
- {
- if( effect[i].id == id && effect[i].skill == skill && effect[i].target == target )
- {
+ for( i = 0; i < max && effect[i].skill; i++ ) {
+ if( effect[i].id == id && effect[i].skill == skill_id && effect[i].target == target ) {
effect[i].rate += rate;
return 1;
}
@@ -1879,7 +1872,7 @@ static int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, e
}
effect[i].id = id;
effect[i].rate = rate;
- effect[i].skill = skill;
+ effect[i].skill = skill_id;
effect[i].target = target;
return 1;
}
@@ -1933,8 +1926,7 @@ static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id
return 1;
}
-int pc_addautobonus(struct s_autobonus *bonus,char max,const char *script,short rate,unsigned int dur,short flag,const char *other_script,unsigned short pos,bool onskill)
-{
+int pc_addautobonus(struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short flag,const char *other_script,unsigned short pos,bool onskill) {
int i;
ARR_FIND(0, max, i, bonus[i].rate == 0);
@@ -1964,7 +1956,7 @@ int pc_addautobonus(struct s_autobonus *bonus,char max,const char *script,short
bonus[i].active = INVALID_TIMER;
bonus[i].atk_type = flag;
bonus[i].pos = pos;
- bonus[i].bonus_script = aStrdup(script);
+ bonus[i].bonus_script = aStrdup(bonus_script);
bonus[i].other_script = other_script?aStrdup(other_script):NULL;
return 1;
}
@@ -3651,13 +3643,12 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
/*==========================================
* Update buying value by skills
*------------------------------------------*/
-int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
-{
- int skill,val = orig_value,rate1 = 0,rate2 = 0;
- if((skill=pc->checkskill(sd,MC_DISCOUNT))>0) // merchant discount
- rate1 = 5+skill*2-((skill==10)? 1:0);
- if((skill=pc->checkskill(sd,RG_COMPULSION))>0) // rogue discount
- rate2 = 5+skill*4;
+int pc_modifybuyvalue(struct map_session_data *sd,int orig_value) {
+ int skill_lv,val = orig_value,rate1 = 0,rate2 = 0;
+ if((skill_lv=pc->checkskill(sd,MC_DISCOUNT))>0) // merchant discount
+ rate1 = 5+skill_lv*2-((skill_lv==10)? 1:0);
+ if((skill_lv=pc->checkskill(sd,RG_COMPULSION))>0) // rogue discount
+ rate2 = 5+skill_lv*4;
if(rate1 < rate2) rate1 = rate2;
if(rate1)
val = (int)((double)orig_value*(double)(100-rate1)/100.);
@@ -3670,11 +3661,10 @@ int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
/*==========================================
* Update selling value by skills
*------------------------------------------*/
-int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
-{
- int skill,val = orig_value,rate = 0;
- if((skill=pc->checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
- rate = 5+skill*2-((skill==10)? 1:0);
+int pc_modifysellvalue(struct map_session_data *sd,int orig_value) {
+ int skill_lv,val = orig_value,rate = 0;
+ if((skill_lv=pc->checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
+ rate = 5+skill_lv*2-((skill_lv==10)? 1:0);
if(rate)
val = (int)((double)orig_value*(double)(100+rate)/100.);
if(val < 0) val = 0;
@@ -4764,9 +4754,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
* 0 = fail
* 1 = success
*------------------------------------------*/
-int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
-{
- int rate,skill;
+int pc_steal_coin(struct map_session_data *sd,struct block_list *target) {
+ int rate,skill_lv;
struct mob_data *md;
if(!sd || !target || target->type != BL_MOB)
return 0;
@@ -4779,10 +4768,9 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
return 0;
// FIXME: This formula is either custom or outdated.
- skill = pc->checkskill(sd,RG_STEALCOIN)*10;
- rate = skill + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
- if(rnd()%1000 < rate)
- {
+ skill_lv = pc->checkskill(sd,RG_STEALCOIN)*10;
+ rate = skill_lv + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
+ if(rnd()%1000 < rate) {
int amount = md->level*10 + rnd()%100;
pc->getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
@@ -4829,7 +4817,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if( i != sd->instances ) {
m = instances[sd->instance[i]].map[j];
- mapindex = map[m].index;
+ mapindex = map_id2index(m);
stop = true;
}
}
@@ -4843,7 +4831,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if( i != p->instances ) {
m = instances[p->instance[i]].map[j];
- mapindex = map[m].index;
+ mapindex = map_id2index(m);
stop = true;
}
}
@@ -4857,7 +4845,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if( i != sd->guild->instances ) {
m = instances[sd->guild->instance[i]].map[j];
- mapindex = map[m].index;
+ mapindex = map_id2index(m);
stop = true;
}
}
@@ -5013,8 +5001,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
* 0 = fail or FIXME success (from pc->setpos)
* x(1|2) = fail
*------------------------------------------*/
-int pc_randomwarp(struct map_session_data *sd, clr_type type)
-{
+int pc_randomwarp(struct map_session_data *sd, clr_type type) {
int x,y,i=0;
int16 m;
@@ -5025,13 +5012,13 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type)
if (map[sd->bl.m].flag.noteleport) //Teleport forbidden
return 0;
- do{
+ do {
x=rnd()%(map[m].xs-2)+1;
y=rnd()%(map[m].ys-2)+1;
- }while(iMap->getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
+ } while( iMap->getcell(m,x,y,CELL_CHKNOPASS) && (i++) < 1000 );
if (i < 1000)
- return pc->setpos(sd,map[sd->bl.m].index,x,y,type);
+ return pc->setpos(sd,map_id2index(sd->bl.m),x,y,type);
return 0;
}
@@ -5040,9 +5027,8 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type)
* Records a memo point at sd's current position
* pos - entry to replace, (-1: shift oldest entry out)
*------------------------------------------*/
-int pc_memo(struct map_session_data* sd, int pos)
-{
- int skill;
+int pc_memo(struct map_session_data* sd, int pos) {
+ int skill_lv;
nullpo_ret(sd);
@@ -5057,12 +5043,12 @@ int pc_memo(struct map_session_data* sd, int pos)
return 0; // invalid input
// check required skill level
- skill = pc->checkskill(sd, AL_WARP);
- if( skill < 1 ) {
+ skill_lv = pc->checkskill(sd, AL_WARP);
+ if( skill_lv < 1 ) {
clif->skill_memomessage(sd,2); // "You haven't learned Warp."
return 0;
}
- if( skill < 2 || skill - 2 < pos ) {
+ if( skill_lv < 2 || skill_lv - 2 < pos ) {
clif->skill_memomessage(sd,1); // "Skill Level is not high enough."
return 0;
}
@@ -5897,8 +5883,7 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi
/*==========================================
* Give x exp at sd player and calculate remaining exp for next lvl
*------------------------------------------*/
-int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool quest)
-{
+int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool is_quest) {
float nextbp=0, nextjp=0;
unsigned int nextb=0, nextj=0;
nullpo_ret(sd);
@@ -5962,9 +5947,9 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
#if PACKETVER >= 20091027
if(base_exp)
- clif->displayexp(sd, base_exp, SP_BASEEXP, quest);
+ clif->displayexp(sd, base_exp, SP_BASEEXP, is_quest);
if(job_exp)
- clif->displayexp(sd, job_exp, SP_JOBEXP, quest);
+ clif->displayexp(sd, job_exp, SP_JOBEXP, is_quest);
#endif
if(sd->state.showexp) {
@@ -6749,9 +6734,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
// Leave duel if you die [LuzZza]
if(battle_config.duel_autoleave_when_die) {
if(sd->duel_group > 0)
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
if(sd->duel_invite > 0)
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
}
if (sd->npc_id && sd->st && sd->st->state != RUN)
@@ -9393,7 +9378,7 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
-void pc_setstand(struct map_session_data *sd){
+void pc_setstand(struct map_session_data *sd) {
nullpo_retv(sd);
status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER);
@@ -9407,20 +9392,20 @@ void pc_setstand(struct map_session_data *sd){
* Mechanic (MADO GEAR)
**/
void pc_overheat(struct map_session_data *sd, int val) {
- int heat = val, skill,
+ int heat = val, skill_lv,
limit[] = { 10, 20, 28, 46, 66 };
if( !pc_ismadogear(sd) || sd->sc.data[SC_OVERHEAT] )
return; // already burning
- skill = cap_value(pc->checkskill(sd,NC_MAINFRAME),0,4);
+ skill_lv = cap_value(pc->checkskill(sd,NC_MAINFRAME),0,4);
if( sd->sc.data[SC_OVERHEAT_LIMITPOINT] ) {
heat += sd->sc.data[SC_OVERHEAT_LIMITPOINT]->val1;
status_change_end(&sd->bl,SC_OVERHEAT_LIMITPOINT,INVALID_TIMER);
}
heat = max(0,heat); // Avoid negative HEAT
- if( heat >= limit[skill] )
+ if( heat >= limit[skill_lv] )
sc_start(&sd->bl,SC_OVERHEAT,100,0,1000);
else
sc_start(&sd->bl,SC_OVERHEAT_LIMITPOINT,100,heat,30000);
diff --git a/src/map/pc.h b/src/map/pc.h
index c8e7e17d5..4b90e7fc3 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -823,7 +823,7 @@ struct pc_interface {
int (*updateweightstatus) (struct map_session_data *sd);
- int (*addautobonus) (struct s_autobonus *bonus,char max,const char *script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
+ int (*addautobonus) (struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
int (*exeautobonus) (struct map_session_data* sd,struct s_autobonus *bonus);
int (*endautobonus) (int tid, unsigned int tick, int id, intptr_t data);
int (*delautobonus) (struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
@@ -850,7 +850,7 @@ struct pc_interface {
unsigned int (*maxjoblv) (struct map_session_data *sd);
int (*checkbaselevelup) (struct map_session_data *sd);
int (*checkjoblevelup) (struct map_session_data *sd);
- int (*gainexp) (struct map_session_data*,struct block_list*,unsigned int,unsigned int, bool);
+ int (*gainexp) (struct map_session_data *sd, struct block_list *src, unsigned int base_exp, unsigned int job_exp, bool is_quest);
unsigned int (*nextbaseexp) (struct map_session_data *);
unsigned int (*thisbaseexp) (struct map_session_data *);
unsigned int (*nextjobexp) (struct map_session_data *);
diff --git a/src/map/pet.c b/src/map/pet.c
index b4714cc06..d064ddfe0 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1049,13 +1049,13 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
struct map_session_data *sd=iMap->id2sd(id);
struct pet_data *pd;
int bonus;
- int next = 0;
-
+ int duration = 0;
+
if(sd == NULL || sd->pd==NULL || sd->pd->bonus == NULL)
return 1;
pd=sd->pd;
-
+
if(pd->bonus->timer != tid) {
ShowError("pet_skill_bonus_timer %d != %d\n",pd->bonus->timer,tid);
pd->bonus->timer = INVALID_TIMER;
@@ -1065,21 +1065,21 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
// determine the time for the next timer
if (pd->state.skillbonus && pd->bonus->delay > 0) {
bonus = 0;
- next = pd->bonus->delay*1000; // the duration until pet bonuses will be reactivated again
+ duration = pd->bonus->delay*1000; // the duration until pet bonuses will be reactivated again
} else if (pd->pet.intimate) {
bonus = 1;
- next = pd->bonus->duration*1000; // the duration for pet bonuses to be in effect
+ duration = pd->bonus->duration*1000; // the duration for pet bonuses to be in effect
} else { //Lost pet...
pd->bonus->timer = INVALID_TIMER;
return 0;
}
-
+
if (pd->state.skillbonus != bonus) {
pd->state.skillbonus = bonus;
status_calc_pc(sd, 0);
}
// wait for the next timer
- pd->bonus->timer=timer->add(tick+next,pet->skill_bonus_timer,sd->bl.id,0);
+ pd->bonus->timer=timer->add(tick+duration,pet->skill_bonus_timer,sd->bl.id,0);
return 0;
}
diff --git a/src/map/pet.h b/src/map/pet.h
index b0e7cec6d..2f8e0b7c2 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -121,8 +121,8 @@ struct pet_interface {
int (*hungry_timer_delete) (struct pet_data *pd);
int (*performance) (struct map_session_data *sd, struct pet_data *pd);
int (*return_egg) (struct map_session_data *sd, struct pet_data *pd);
- int (*data_init) (struct map_session_data *sd, struct s_pet *pet);
- int (*birth_process) (struct map_session_data *sd, struct s_pet *pet);
+ int (*data_init) (struct map_session_data *sd, struct s_pet *petinfo);
+ int (*birth_process) (struct map_session_data *sd, struct s_pet *petinfo);
int (*recv_petdata) (int account_id, struct s_pet *p, int flag);
int (*select_egg) (struct map_session_data *sd, short egg_index);
int (*catch_process1) (struct map_session_data *sd, int target_class);
diff --git a/src/map/quest.c b/src/map/quest.c
index 9055b61fe..881037081 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -189,29 +189,28 @@ int quest_delete(TBL_PC * sd, int quest_id)
return 0;
}
-int quest_update_objective_sub(struct block_list *bl, va_list ap)
-{
+int quest_update_objective_sub(struct block_list *bl, va_list ap) {
struct map_session_data * sd;
- int mob, party;
+ int mob_id, party_id;
nullpo_ret(bl);
nullpo_ret(sd = (struct map_session_data *)bl);
- party = va_arg(ap,int);
- mob = va_arg(ap,int);
+ party_id = va_arg(ap,int);
+ mob_id = va_arg(ap,int);
if( !sd->avail_quests )
return 0;
- if( sd->status.party_id != party )
+ if( sd->status.party_id != party_id )
return 0;
- quest->update_objective(sd, mob);
+ quest->update_objective(sd, mob_id);
return 1;
}
-void quest_update_objective(TBL_PC * sd, int mob) {
+void quest_update_objective(TBL_PC * sd, int mob_id) {
int i,j;
for( i = 0; i < sd->avail_quests; i++ ) {
@@ -219,7 +218,7 @@ void quest_update_objective(TBL_PC * sd, int mob) {
continue;
for( j = 0; j < MAX_QUEST_OBJECTIVES; j++ )
- if( quest->db[sd->quest_index[i]].mob[j] == mob && sd->quest_log[i].count[j] < quest->db[sd->quest_index[i]].count[j] ) {
+ if( quest->db[sd->quest_index[i]].mob[j] == mob_id && sd->quest_log[i].count[j] < quest->db[sd->quest_index[i]].count[j] ) {
sd->quest_log[i].count[j]++;
sd->save_quest = true;
clif->quest_update_objective(sd,&sd->quest_log[i],sd->quest_index[i]);
diff --git a/src/map/quest.h b/src/map/quest.h
index 85c987f54..c127dd402 100644
--- a/src/map/quest.h
+++ b/src/map/quest.h
@@ -28,7 +28,7 @@ struct quest_interface {
int (*change) (TBL_PC *sd, int qid1, int qid2);
int (*delete) (TBL_PC *sd, int quest_id);
int (*update_objective_sub) (struct block_list *bl, va_list ap);
- void (*update_objective) (TBL_PC *sd, int mob);
+ void (*update_objective) (TBL_PC *sd, int mob_id);
int (*update_status) (TBL_PC *sd, int quest_id, quest_state status);
int (*check) (TBL_PC *sd, int quest_id, quest_check_type type);
int (*read_db) (void);
diff --git a/src/map/script.c b/src/map/script.c
index bba74e669..6ef015009 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2761,11 +2761,10 @@ void pop_stack(struct script_state* st, int start, int end)
/*==========================================
* Release script dependent variable, dependent variable of function
*------------------------------------------*/
-void script_free_vars(struct DBMap* storage)
-{
- if( storage )
- {// destroy the storage construct containing the variables
- db_destroy(storage);
+void script_free_vars(struct DBMap* var_storage) {
+ if( var_storage ) {
+ // destroy the storage construct containing the variables
+ db_destroy(var_storage);
}
}
@@ -8151,10 +8150,9 @@ BUILDIN(savepoint)
/*==========================================
* GetTimeTick(0: System Tick, 1: Time Second Tick)
*------------------------------------------*/
-BUILDIN(gettimetick) /* Asgard Version */
-{
+BUILDIN(gettimetick) { /* Asgard Version */
int type;
- time_t tt;
+ time_t clock;
struct tm *t;
type=script_getnum(st,2);
@@ -8167,8 +8165,8 @@ BUILDIN(gettimetick) /* Asgard Version */
break;
case 1:
//type 1:(Second Ticks: 0-86399, 00:00:00-23:59:59)
- time(&tt);
- t=localtime(&tt);
+ time(&clock);
+ t=localtime(&clock);
script_pushint(st,((t->tm_hour)*3600+(t->tm_min)*60+t->tm_sec));
break;
case 0:
@@ -8179,23 +8177,21 @@ BUILDIN(gettimetick) /* Asgard Version */
}
return true;
}
-
/*==========================================
* GetTime(Type);
* 1: Sec 2: Min 3: Hour
* 4: WeekDay 5: MonthDay 6: Month
* 7: Year
*------------------------------------------*/
-BUILDIN(gettime) /* Asgard Version */
-{
+BUILDIN(gettime) { /* Asgard Version */
int type;
- time_t timer;
+ time_t clock;
struct tm *t;
type=script_getnum(st,2);
- time(&timer);
- t=localtime(&timer);
+ time(&clock);
+ t=localtime(&clock);
switch(type){
case 1://Sec(0~59)
@@ -9716,8 +9712,7 @@ BUILDIN(getstatus)
return true;
}
- switch( type )
- {
+ switch( type ) {
case 1: script_pushint(st, sd->sc.data[id]->val1); break;
case 2: script_pushint(st, sd->sc.data[id]->val2); break;
case 3: script_pushint(st, sd->sc.data[id]->val3); break;
@@ -9726,8 +9721,8 @@ BUILDIN(getstatus)
{
struct TimerData* td = (struct TimerData*)timer->get(sd->sc.data[id]->timer);
- if( td )
- {// return the amount of time remaining
+ if( td ) {
+ // return the amount of time remaining
script_pushint(st, td->tick - timer->gettick());
}
}
@@ -9797,16 +9792,16 @@ BUILDIN(homunculus_mutate) {
if( sd == NULL || sd->hd == NULL )
return true;
- if(script_hasdata(st,2))
+ if( script_hasdata(st,2) )
homun_id = script_getnum(st,2);
else
homun_id = 6048 + (rnd() % 4);
- if(homun_alive(sd->hd)) {
+ if( homun_alive(sd->hd) ) {
m_class = homun->class2type(sd->hd->homunculus.class_);
m_id = homun->class2type(homun_id);
- if ( m_class != -1 && m_id != -1 && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 )
+ if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 )
homun->mutate(sd->hd, homun_id);
else
clif->emotion(&sd->hd->bl, E_SWT);
@@ -15496,17 +15491,15 @@ BUILDIN(mercenary_sc_start)
return true;
}
-BUILDIN(mercenary_get_calls)
-{
+BUILDIN(mercenary_get_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_calls);
break;
@@ -15524,19 +15517,17 @@ BUILDIN(mercenary_get_calls)
return true;
}
-BUILDIN(mercenary_set_calls)
-{
+BUILDIN(mercenary_set_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_calls;
break;
@@ -15556,17 +15547,15 @@ BUILDIN(mercenary_set_calls)
return true;
}
-BUILDIN(mercenary_get_faith)
-{
+BUILDIN(mercenary_get_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_faith);
break;
@@ -15584,19 +15573,17 @@ BUILDIN(mercenary_get_faith)
return true;
}
-BUILDIN(mercenary_set_faith)
-{
+BUILDIN(mercenary_set_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_faith;
break;
@@ -15612,7 +15599,7 @@ BUILDIN(mercenary_set_faith)
*calls += value;
*calls = cap_value(*calls, 0, INT_MAX);
- if( mercenary->get_guild(sd->md) == guild )
+ if( mercenary->get_guild(sd->md) == guild_id )
clif->mercenary_updatestatus(sd,SP_MERCFAITH);
return true;
diff --git a/src/map/script.h b/src/map/script.h
index bcdd1fdaf..97f9bdb8c 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -386,7 +386,7 @@ struct script_interface {
int (*set_var) (struct map_session_data *sd, char *name, void *val);
void (*stop_instances) (struct script_code *code);
void (*free_code) (struct script_code* code);
- void (*free_vars) (struct DBMap *storage);
+ void (*free_vars) (struct DBMap *var_storage);
struct script_state* (*alloc_state) (struct script_code* rootscript, int pos, int rid, int oid);
void (*free_state) (struct script_state* st);
void (*run_autobonus) (const char *autobonus,int id, int pos);
diff --git a/src/map/skill.c b/src/map/skill.c
index 3b7378022..3669431f0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -366,7 +366,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
}
int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal) {
- int skill, hp;
+ int skill2_lv, hp;
struct map_session_data *sd = BL_CAST(BL_PC, src);
struct map_session_data *tsd = BL_CAST(BL_PC, target);
struct status_change* sc;
@@ -399,21 +399,21 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
#else
hp = ( iStatus->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
#endif
- if( sd && ((skill = pc->checkskill(sd, HP_MEDITATIO)) > 0) )
- hp += hp * skill * 2 / 100;
- else if( src->type == BL_HOM && (skill = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
- hp += hp * skill * 2 / 100;
+ if( sd && ((skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) )
+ hp += hp * skill2_lv * 2 / 100;
+ else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
+ hp += hp * skill2_lv * 2 / 100;
break;
}
if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND )
hp >>= 1;
- if( sd && (skill = pc->skillheal_bonus(sd, skill_id)) )
- hp += hp*skill/100;
+ if( sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) )
+ hp += hp*skill2_lv/100;
- if( tsd && (skill = pc->skillheal2_bonus(tsd, skill_id)) )
- hp += hp*skill/100;
+ if( tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) )
+ hp += hp*skill2_lv/100;
sc = iStatus->get_sc(target);
if( sc && sc->count ) {
@@ -2837,19 +2837,19 @@ int skill_area_sub (struct block_list *bl, va_list ap) {
}
int skill_check_unit_range_sub (struct block_list *bl, va_list ap) {
- struct skill_unit *unit;
+ struct skill_unit *su;
uint16 skill_id,g_skill_id;
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
if(bl->prev == NULL || bl->type != BL_SKILL)
return 0;
- if(!unit->alive)
+ if(!su->alive)
return 0;
skill_id = va_arg(ap,int);
- g_skill_id = unit->group->skill_id;
+ g_skill_id = su->group->skill_id;
switch (skill_id) {
case MH_STEINWAND:
@@ -3945,10 +3945,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
int maxlv = skill->get_max(skill_id); // learnable level
int count = 0;
int x, y;
- struct skill_unit* unit;
+ struct skill_unit *su;
- if( skill_lv > maxlv )
- {
+ if( skill_lv > maxlv ) {
if( src->type == BL_MOB && skill_lv == 10 )
range = 4;
else
@@ -3956,16 +3955,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
}
for( y = src->y - range; y <= src->y + range; ++y )
- for( x = src->x - range; x <= src->x + range; ++x )
- {
- if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) )
- {
+ for( x = src->x - range; x <= src->x + range; ++x ) {
+ if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) {
if( src->type != BL_PC || iMap->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
count++; // natural water cell
- else if( (unit = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL )
- {
+ else if( (su = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL
+ || (su = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) {
count++; // skill-induced water cell
- skill->delunit(unit); // consume cell
+ skill->delunit(su); // consume cell
}
}
}
@@ -9036,9 +9033,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag);
} else //Otherwise, it fails, shows animation and removes items.
clif->skill_fail(sd,GN_SLINGITEM_RANGEMELEEATK,0xa,0);
- } else if( itemdb_is_GNthrowable(ammo_id) ){
+ } else if( itemdb_is_GNthrowable(ammo_id) ) {
struct script_code *scriptroot = sd->inventory_data[i]->script;
- if( !script )
+ if( !scriptroot )
break;
if( dstsd )
script->run(scriptroot,0,dstsd->bl.id,npc->fake_nd->bl.id);
@@ -10410,30 +10407,30 @@ int skill_dance_overlap_sub(struct block_list* bl, va_list ap) {
//Does the song/dance overlapping -> dissonance check. [Skotlex]
//When flag is 0, this unit is about to be removed, cancel the dissonance effect
//When 1, this unit has been positioned, so start the cancel effect.
-int skill_dance_overlap(struct skill_unit* unit, int flag) {
- if (!unit || !unit->group || !(unit->group->state.song_dance&0x1))
+int skill_dance_overlap(struct skill_unit* su, int flag) {
+ if (!su || !su->group || !(su->group->state.song_dance&0x1))
return 0;
- if (unit->val1 != unit->group->skill_id) {
+ if (su->val1 != su->group->skill_id) {
//Reset state
- unit->val1 = unit->group->skill_id;
- unit->val2 &= ~UF_ENSEMBLE;
+ su->val1 = su->group->skill_id;
+ su->val2 &= ~UF_ENSEMBLE;
}
- return iMap->foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag);
+ return iMap->foreachincell(skill->dance_overlap_sub, su->bl.m,su->bl.x,su->bl.y,BL_SKILL, su,flag);
}
/*==========================================
* Converts this group information so that it is handled as a Dissonance or Ugly Dance cell.
* Flag: 0 - Convert, 1 - Revert.
*------------------------------------------*/
-bool skill_dance_switch(struct skill_unit* unit, int flag) {
+bool skill_dance_switch(struct skill_unit* su, int flag) {
static int prevflag = 1; // by default the backup is empty
static struct skill_unit_group backup;
- struct skill_unit_group* group = unit->group;
+ struct skill_unit_group* group = su->group;
// val2&UF_ENSEMBLE is a hack to indicate dissonance
- if ( !(group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) )
+ if ( !(group->state.song_dance&0x1 && su->val2&UF_ENSEMBLE) )
return false;
if( flag == prevflag ) {
@@ -10446,7 +10443,7 @@ bool skill_dance_switch(struct skill_unit* unit, int flag) {
prevflag = flag;
if( !flag ) { //Transform
- uint16 skill_id = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE;
+ uint16 skill_id = su->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE;
// backup
backup.skill_id = group->skill_id;
@@ -10885,7 +10882,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
limit = group->limit;
for( i = 0; i < layout->count; i++ ) {
- struct skill_unit *unit;
+ struct skill_unit *su;
int ux = x + layout->dx[i];
int uy = y + layout->dy[i];
int val1 = skill_lv;
@@ -10964,19 +10961,19 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
if( !alive )
continue;
- nullpo_retr(NULL, unit=skill->initunit(group,i,ux,uy,val1,val2));
- unit->limit=limit;
- unit->range=range;
+ nullpo_retr(NULL, su=skill->initunit(group,i,ux,uy,val1,val2));
+ su->limit=limit;
+ su->range=range;
if (skill_id == PF_FOGWALL && alive == 2) {
//Double duration of cells on top of Deluge/Suiton
- unit->limit *= 2;
- group->limit = unit->limit;
+ su->limit *= 2;
+ group->limit = su->limit;
}
// execute on all targets standing on this cell
if (range==0 && active_flag)
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),1);
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
}
if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector?
@@ -12085,37 +12082,37 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i
* flag&4: Invoke a onleft call (the unit might be scheduled for deletion)
*------------------------------------------*/
int skill_unit_effect (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = va_arg(ap,struct skill_unit*);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = va_arg(ap,struct skill_unit*);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
unsigned int flag = va_arg(ap,unsigned int);
uint16 skill_id;
bool dissonance;
- if( (!unit->alive && !(flag&4)) || bl->prev == NULL )
+ if( (!su->alive && !(flag&4)) || bl->prev == NULL )
return 0;
nullpo_ret(group);
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
//Necessary in case the group is deleted after calling on_place/on_out [Skotlex]
skill_id = group->skill_id;
//Target-type check.
- if( !(group->bl_flag&bl->type && battle->check_target(&unit->bl,bl,group->target_flag)>0) ) {
+ if( !(group->bl_flag&bl->type && battle->check_target(&su->bl,bl,group->target_flag)>0) ) {
if( (flag&4) && ( group->state.song_dance&0x1 || (group->src_id == bl->id && group->state.song_dance&0x2) ) )
skill->unit_onleft(skill_id, bl, tick);//Ensemble check to terminate it.
} else {
if( flag&1 )
- skill->unit_onplace(unit,bl,tick);
+ skill->unit_onplace(su,bl,tick);
else
- skill->unit_onout(unit,bl,tick);
+ skill->unit_onout(su,bl,tick);
if( flag&4 )
skill->unit_onleft(skill_id, bl, tick);
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
@@ -12304,15 +12301,15 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16
*
*------------------------------------------*/
int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) {
- int *c,src_id,mob_class,skill;
+ int *c,src_id,mob_class,skill_id;
struct mob_data *md;
md=(struct mob_data*)bl;
src_id=va_arg(ap,int);
mob_class=va_arg(ap,int);
- skill=va_arg(ap,int);
+ skill_id=va_arg(ap,int);
c=va_arg(ap,int *);
- if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:skill == MH_SUMMON_LEGION?1:3) )
+ if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill_id == AM_SPHEREMINE?2:skill_id == KO_ZANZOU?4:skill_id == MH_SUMMON_LEGION?1:3) )
return 0; //Non alchemist summoned mobs have nothing to do here.
if(md->class_==mob_class)
(*c)++;
@@ -14674,16 +14671,16 @@ struct skill_unit_group *skill_locate_element_field(struct block_list *bl) {
// for graffiti cleaner [Valaris]
int skill_graffitiremover (struct block_list *bl, va_list ap) {
- struct skill_unit *unit=NULL;
+ struct skill_unit *su=NULL;
nullpo_ret(bl);
nullpo_ret(ap);
- if(bl->type!=BL_SKILL || (unit=(struct skill_unit *)bl) == NULL)
+ if(bl->type!=BL_SKILL || (su=(struct skill_unit *)bl) == NULL)
return 0;
- if((unit->group) && (unit->group->unit_id == UNT_GRAFFITI))
- skill->delunit(unit);
+ if((su->group) && (su->group->unit_id == UNT_GRAFFITI))
+ skill->delunit(su);
return 0;
}
@@ -14702,9 +14699,8 @@ int skill_greed (struct block_list *bl, va_list ap) {
return 0;
}
//For Ranger's Detonator [Jobbie/3CeAM]
-int skill_detonator(struct block_list *bl, va_list ap)
-{
- struct skill_unit *unit=NULL;
+int skill_detonator(struct block_list *bl, va_list ap) {
+ struct skill_unit *su=NULL;
struct block_list *src;
int unit_id;
@@ -14712,14 +14708,14 @@ int skill_detonator(struct block_list *bl, va_list ap)
nullpo_ret(ap);
src = va_arg(ap,struct block_list *);
- if( bl->type != BL_SKILL || (unit = (struct skill_unit *)bl) == NULL || !unit->group )
+ if( bl->type != BL_SKILL || (su = (struct skill_unit *)bl) == NULL || !su->group )
return 0;
- if( unit->group->src_id != src->id )
+ if( su->group->src_id != src->id )
return 0;
- unit_id = unit->group->unit_id;
- switch( unit_id )
- { //List of Hunter and Ranger Traps that can be detonate.
+ unit_id = su->group->unit_id;
+ switch( unit_id ) {
+ //List of Hunter and Ranger Traps that can be detonate.
case UNT_BLASTMINE:
case UNT_SANDMAN:
case UNT_CLAYMORETRAP:
@@ -14727,23 +14723,23 @@ int skill_detonator(struct block_list *bl, va_list ap)
case UNT_CLUSTERBOMB:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- switch(unit_id){
+ switch(unit_id) {
case UNT_TALKIEBOX:
- clif->talkiebox(bl,unit->group->valstr);
- unit->group->val2 = -1;
+ clif->talkiebox(bl,su->group->valstr);
+ su->group->val2 = -1;
break;
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag|BL_SKILL|~BCT_SELF,bl,unit->group->tick);
+ iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
break;
default:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick);
+ iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
}
clif->changetraplook(bl, UNT_USED_TRAPS);
- unit->group->limit = DIFF_TICK(timer->gettick(),unit->group->tick) +
+ su->group->limit = DIFF_TICK(timer->gettick(),su->group->tick) +
(unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) );
- unit->group->unit_id = UNT_USED_TRAPS;
+ su->group->unit_id = UNT_USED_TRAPS;
break;
}
return 0;
@@ -14755,31 +14751,31 @@ int skill_detonator(struct block_list *bl, va_list ap)
int skill_cell_overlap(struct block_list *bl, va_list ap) {
uint16 skill_id;
int *alive;
- struct skill_unit *unit;
+ struct skill_unit *su;
skill_id = va_arg(ap,int);
alive = va_arg(ap,int *);
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
- if( unit == NULL || unit->group == NULL || (*alive) == 0 )
+ if( su == NULL || su->group == NULL || (*alive) == 0 )
return 0;
switch (skill_id) {
case SA_LANDPROTECTOR:
- if( unit->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex]
+ if( su->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex]
(*alive) = 0;
- skill->delunit(unit);
+ skill->delunit(su);
return 1;
}
- if( !(skill->get_inf2(unit->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || unit->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps
- skill->delunit(unit);
+ if( !(skill->get_inf2(su->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || su->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps
+ skill->delunit(su);
return 1;
}
break;
case HW_GANBANTEIN:
case LG_EARTHDRIVE:
- if( !(unit->group->state.song_dance&0x1) ) {// Don't touch song/dance.
- skill->delunit(unit);
+ if( !(su->group->state.song_dance&0x1) ) {// Don't touch song/dance.
+ skill->delunit(su);
return 1;
}
break;
@@ -14789,14 +14785,13 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
// The official implementation makes them fail to appear when casted on top of ANYTHING
// but I wonder if they didn't actually meant to fail when casted on top of each other?
// hence, I leave the alternate implementation here, commented. [Skotlex]
- if (unit->range <= 0)
- {
+ if (su->range <= 0) {
(*alive) = 0;
return 1;
}
/*
- switch (unit->group->skill_id)
- { //These cannot override each other.
+ switch (su->group->skill_id) {
+ //These cannot override each other.
case SA_VOLCANO:
case SA_DELUGE:
case SA_VIOLENTGALE:
@@ -14806,7 +14801,7 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
*/
break;
case PF_FOGWALL:
- switch(unit->group->skill_id) {
+ switch(su->group->skill_id) {
case SA_VOLCANO: //Can't be placed on top of these
case SA_VIOLENTGALE:
(*alive) = 0;
@@ -14819,14 +14814,15 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
}
break;
case HP_BASILICA:
- if (unit->group->skill_id == HP_BASILICA)
- { //Basilica can't be placed on top of itself to avoid map-cell stacking problems. [Skotlex]
+ if (su->group->skill_id == HP_BASILICA) {
+ //Basilica can't be placed on top of itself to avoid map-cell stacking problems. [Skotlex]
(*alive) = 0;
return 1;
}
break;
case GN_CRAZYWEED_ATK:
- switch(unit->group->unit_id){ //TODO: look for other ground skills that are affected.
+ switch(su->group->unit_id) {
+ //TODO: look for other ground skills that are affected.
case UNT_WALLOFTHORN:
case UNT_THORNS_TRAP:
case UNT_BLOODYLUST:
@@ -14839,13 +14835,14 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
case UNT_VIOLENTGALE:
case UNT_SAFETYWALL:
case UNT_PNEUMA:
- skill->delunit(unit);
+ skill->delunit(su);
return 1;
}
break;
}
- if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps
+ if (su->group->skill_id == SA_LANDPROTECTOR && !(skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) {
+ //It deletes everything except songs/dances/traps
(*alive) = 0;
return 1;
}
@@ -14880,17 +14877,17 @@ int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap)
int skill_trap_splash (struct block_list *bl, va_list ap) {
struct block_list *src;
int tick;
- struct skill_unit *unit;
+ struct skill_unit *su;
struct skill_unit_group *sg;
struct block_list *ss;
src = va_arg(ap,struct block_list *);
- unit = (struct skill_unit *)src;
+ su = (struct skill_unit *)src;
tick = va_arg(ap,int);
- if( !unit->alive || bl->prev == NULL )
+ if( !su->alive || bl->prev == NULL )
return 0;
- nullpo_ret(sg = unit->group);
+ nullpo_ret(sg = su->group);
nullpo_ret(ss = iMap->id2bl(sg->src_id));
if(battle->check_target(src,bl,sg->target_flag) <= 0)
@@ -14977,22 +14974,22 @@ int skill_trap_splash (struct block_list *bl, va_list ap) {
int skill_maelstrom_suction(struct block_list *bl, va_list ap) {
uint16 skill_id, skill_lv;
- struct skill_unit *unit;
+ struct skill_unit *su;
skill_id = va_arg(ap,int);
skill_lv = va_arg(ap,int);
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
- if( unit == NULL || unit->group == NULL )
+ if( su == NULL || su->group == NULL )
return 0;
if( skill->get_inf2(skill_id)&INF2_TRAP )
return 0;
- if( unit->group->skill_id == SC_MAELSTROM ){
+ if( su->group->skill_id == SC_MAELSTROM ) {
struct block_list *src;
- if( (src = iMap->id2bl(unit->group->src_id)) ){
- int sp = unit->group->skill_lv * skill_lv;
+ if( (src = iMap->id2bl(su->group->src_id)) ) {
+ int sp = su->group->skill_lv * skill_lv;
if( src->type == BL_PC )
sp += ((TBL_PC*)src)->status.job_level / 5;
iStatus->heal(src, 0, sp/2, 1);
@@ -15085,81 +15082,80 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
/*==========================================
*
*------------------------------------------*/
-struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2)
-{
- struct skill_unit *unit;
+struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2) {
+ struct skill_unit *su;
nullpo_retr(NULL, group);
nullpo_retr(NULL, group->unit); // crash-protection against poor coding
- nullpo_retr(NULL, unit=&group->unit[idx]);
+ nullpo_retr(NULL, su=&group->unit[idx]);
if( iMap->getcell(iMap->id2bl(group->src_id)->m, x, y, CELL_CHKMAELSTROM) )
- return unit;
+ return su;
- if(!unit->alive)
+ if(!su->alive)
group->alive_count++;
- unit->bl.id=iMap->get_new_object_id();
- unit->bl.type=BL_SKILL;
- unit->bl.m=group->map;
- unit->bl.x=x;
- unit->bl.y=y;
- unit->group=group;
- unit->alive=1;
- unit->val1=val1;
- unit->val2=val2;
+ su->bl.id=iMap->get_new_object_id();
+ su->bl.type=BL_SKILL;
+ su->bl.m=group->map;
+ su->bl.x=x;
+ su->bl.y=y;
+ su->group=group;
+ su->alive=1;
+ su->val1=val1;
+ su->val2=val2;
- idb_put(skillunit_db, unit->bl.id, unit);
- iMap->addiddb(&unit->bl);
- iMap->addblock(&unit->bl);
+ idb_put(skillunit_db, su->bl.id, su);
+ iMap->addiddb(&su->bl);
+ iMap->addblock(&su->bl);
// perform oninit actions
switch (group->skill_id) {
case WZ_ICEWALL:
- iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5);
- clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,5,AREA);
- skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
- map[unit->bl.m].icewall_num++;
+ iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,5);
+ clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,5,AREA);
+ skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
+ map[su->bl.m].icewall_num++;
break;
case SA_LANDPROTECTOR:
- skill->unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,true);
+ skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,true);
break;
case HP_BASILICA:
- skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,true);
+ skill->unitsetmapcell(su,HP_BASILICA,group->skill_lv,CELL_BASILICA,true);
break;
case SC_MAELSTROM:
- skill->unitsetmapcell(unit,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,true);
+ skill->unitsetmapcell(su,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,true);
break;
default:
if (group->state.song_dance&0x1) //Check for dissonance.
- skill->dance_overlap(unit, 1);
+ skill->dance_overlap(su, 1);
break;
}
- clif->skill_setunit(unit);
+ clif->skill_setunit(su);
- return unit;
+ return su;
}
/*==========================================
*
*------------------------------------------*/
-int skill_delunit (struct skill_unit* unit) {
+int skill_delunit (struct skill_unit* su) {
struct skill_unit_group *group;
- nullpo_ret(unit);
- if( !unit->alive )
+ nullpo_ret(su);
+ if( !su->alive )
return 0;
- unit->alive=0;
+ su->alive=0;
- nullpo_ret(group=unit->group);
+ nullpo_ret(group=su->group);
if( group->state.song_dance&0x1 ) //Cancel dissonance effect.
- skill->dance_overlap(unit, 0);
+ skill->dance_overlap(su, 0);
// invoke onout event
- if( !unit->range )
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),4);
+ if( !su->range )
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),4);
// perform ondelete actions
switch (group->skill_id) {
@@ -15170,16 +15166,16 @@ int skill_delunit (struct skill_unit* unit) {
}
break;
case WZ_ICEWALL:
- iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
- clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
- skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
- map[unit->bl.m].icewall_num--;
+ iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,su->val2);
+ clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,su->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
+ skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
+ map[su->bl.m].icewall_num--;
break;
case SA_LANDPROTECTOR:
- skill->unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,false);
+ skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,false);
break;
case HP_BASILICA:
- skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
+ skill->unitsetmapcell(su,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
break;
case RA_ELECTRICSHOCKER: {
struct block_list* target = iMap->id2bl(group->val2);
@@ -15188,7 +15184,7 @@ int skill_delunit (struct skill_unit* unit) {
}
break;
case SC_MAELSTROM:
- skill->unitsetmapcell(unit,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,false);
+ skill->unitsetmapcell(su,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,false);
break;
case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info)
if( group->val2 ) { // Someone Traped
@@ -15199,12 +15195,12 @@ int skill_delunit (struct skill_unit* unit) {
break;
}
- clif->skill_delunit(unit);
+ clif->skill_delunit(su);
- unit->group=NULL;
- iMap->delblock(&unit->bl); // don't free yet
- iMap->deliddb(&unit->bl);
- idb_remove(skillunit_db, unit->bl.id);
+ su->group=NULL;
+ iMap->delblock(&su->bl); // don't free yet
+ iMap->deliddb(&su->bl);
+ idb_remove(skillunit_db, su->bl.id);
if(--group->alive_count==0)
skill->del_unitgroup(group,ALC_MARK);
@@ -15496,11 +15492,11 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis
*
*------------------------------------------*/
int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = va_arg(ap,struct skill_unit *);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = va_arg(ap,struct skill_unit *);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
- if( !unit->alive || bl->prev == NULL )
+ if( !su->alive || bl->prev == NULL )
return 0;
nullpo_ret(group);
@@ -15508,10 +15504,10 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
return 0; //AoE skills are ineffective. [Skotlex]
- if( battle->check_target(&unit->bl,bl,group->target_flag) <= 0 )
+ if( battle->check_target(&su->bl,bl,group->target_flag) <= 0 )
return 0;
- skill->unit_onplace_timer(unit,bl,tick);
+ skill->unit_onplace_timer(su,bl,tick);
return 1;
}
@@ -15520,22 +15516,21 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
* @see DBApply
*/
int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
- struct skill_unit* unit = DB->data2ptr(data);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = DB->data2ptr(data);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
bool dissonance;
- struct block_list* bl = &unit->bl;
+ struct block_list* bl = &su->bl;
- if( !unit->alive )
+ if( !su->alive )
return 0;
nullpo_ret(group);
// check for expiration
- if( !group->state.guildaura && (DIFF_TICK(tick,group->tick) >= group->limit || DIFF_TICK(tick,group->tick) >= unit->limit) )
- {// skill unit expired (inlined from skill_unit_onlimit())
- switch( group->unit_id )
- {
+ if( !group->state.guildaura && (DIFF_TICK(tick,group->tick) >= group->limit || DIFF_TICK(tick,group->tick) >= su->limit) ) {
+ // skill unit expired (inlined from skill_unit_onlimit())
+ switch( group->unit_id ) {
case UNT_BLASTMINE:
#ifdef RENEWAL
case UNT_CLAYMORETRAP:
@@ -15548,14 +15543,14 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
group->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(bl, UNT_FIREPILLAR_ACTIVE);
group->limit=DIFF_TICK(tick+1500,group->tick);
- unit->limit=DIFF_TICK(tick+1500,group->tick);
+ su->limit=DIFF_TICK(tick+1500,group->tick);
break;
case UNT_ANKLESNARE:
case UNT_ELECTRICSHOCKER:
if( group->val2 > 0 || group->val3 == SC_ESCAPE ) {
// Used Trap don't returns back to item
- skill->delunit(unit);
+ skill->delunit(su);
break;
}
case UNT_SKIDTRAP:
@@ -15578,27 +15573,27 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list* src;
- if( unit->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC )
- { // revert unit back into a trap
+ if( su->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC ) {
+ // revert unit back into a trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
- skill->delunit(unit);
+ skill->delunit(su);
}
break;
case UNT_WARP_ACTIVE:
// warp portal opens (morph to a UNT_WARP_WAITING cell)
group->unit_id = skill->get_unit_id(group->skill_id, 1); // UNT_WARP_WAITING
- clif->changelook(&unit->bl, LOOK_BASE, group->unit_id);
+ clif->changelook(&su->bl, LOOK_BASE, group->unit_id);
// restart timers
group->limit = skill->get_time(group->skill_id,group->skill_lv);
- unit->limit = skill->get_time(group->skill_id,group->skill_lv);
+ su->limit = skill->get_time(group->skill_id,group->skill_lv);
// apply effect to all units standing on it
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),1);
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
break;
case UNT_CALLFAMILY:
@@ -15608,35 +15603,35 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
sd = iMap->charid2sd(group->val1);
group->val1 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
}
if(group->val2) {
sd = iMap->charid2sd(group->val2);
group->val2 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
}
- skill->delunit(unit);
+ skill->delunit(su);
}
break;
case UNT_REVERBERATION:
- if( unit->val1 <= 0 ) { // If it was deactivated.
- skill->delunit(unit);
+ if( su->val1 <= 0 ) { // If it was deactivated.
+ skill->delunit(su);
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
- unit->limit = DIFF_TICK(tick,group->tick)+1000;
+ su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
break;
case UNT_FEINTBOMB: {
struct block_list *src = iMap->id2bl(group->src_id);
if( src )
- iMap->foreachinrange(skill->area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
- skill->delunit(unit);
+ iMap->foreachinrange(skill->area_sub, &group->unit->bl, su->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
+ skill->delunit(su);
break;
}
@@ -15644,27 +15639,26 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list *src = iMap->id2bl(group->src_id);
struct status_change *sc;
- if( !src || (sc = iStatus->get_sc(src)) == NULL || !sc->data[SC_BANDING] )
- {
- skill->delunit(unit);
+ if( !src || (sc = iStatus->get_sc(src)) == NULL || !sc->data[SC_BANDING] ) {
+ skill->delunit(su);
break;
}
// This unit isn't removed while SC_BANDING is active.
group->limit = DIFF_TICK(tick+group->interval,group->tick);
- unit->limit = DIFF_TICK(tick+group->interval,group->tick);
+ su->limit = DIFF_TICK(tick+group->interval,group->tick);
}
break;
default:
- skill->delunit(unit);
+ skill->delunit(su);
}
} else {// skill unit is still active
switch( group->unit_id ) {
case UNT_ICEWALL:
// icewall loses 50 hp every second
- unit->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
- if( unit->val1 <= 0 && unit->limit + group->tick > tick + 700 )
- unit->limit = DIFF_TICK(tick+700,group->tick);
+ su->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
+ if( su->val1 <= 0 && su->limit + group->tick > tick + 700 )
+ su->limit = DIFF_TICK(tick+700,group->tick);
break;
case UNT_BLASTMINE:
case UNT_SKIDTRAP:
@@ -15676,9 +15670,9 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
case UNT_FREEZINGTRAP:
case UNT_TALKIEBOX:
case UNT_ANKLESNARE:
- if( unit->val1 <= 0 ) {
+ if( su->val1 <= 0 ) {
if( group->unit_id == UNT_ANKLESNARE && group->val2 > 0 )
- skill->delunit(unit);
+ skill->delunit(su);
else {
clif->changetraplook(bl, group->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
group->limit = DIFF_TICK(tick, group->tick) + 1500;
@@ -15687,16 +15681,16 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
break;
case UNT_REVERBERATION:
- if( unit->val1 <= 0 ){
+ if( su->val1 <= 0 ) {
clif->changetraplook(bl,UNT_USED_TRAPS);
iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
- unit->limit = DIFF_TICK(tick,group->tick)+1000;
+ su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
}
break;
case UNT_WALLOFTHORN:
- if( unit->val1 <= 0 ) {
+ if( su->val1 <= 0 ) {
group->unit_id = UNT_USED_TRAPS;
group->limit = DIFF_TICK(tick, group->tick) + 1500;
}
@@ -15705,22 +15699,21 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
//Don't continue if unit or even group is expired and has been deleted.
- if( !group || !unit->alive )
+ if( !group || !su->alive )
return 0;
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
- if( unit->range >= 0 && group->interval != -1 )
- {
+ if( su->range >= 0 && group->interval != -1 ) {
if( battle_config.skill_wall_check )
- iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
else
- iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
- if(unit->range == -1) //Unit disabled, but it should not be deleted yet.
+ if(su->range == -1) //Unit disabled, but it should not be deleted yet.
group->unit_id = UNT_USED_TRAPS;
else if( group->unit_id == UNT_TATAMIGAESHI ) {
- unit->range = -1; //Disable processed cell.
+ su->range = -1; //Disable processed cell.
if (--group->val1 <= 0) { // number of live cells
//All tiles were processed, disable skill.
group->target_flag=BCT_NOONE;
@@ -15729,7 +15722,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
@@ -15751,8 +15744,8 @@ static int skill_unit_temp[20]; // temporary storage for tracking skill unit sk
*
*------------------------------------------*/
int skill_unit_move_sub (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = (struct skill_unit *)bl;
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = (struct skill_unit *)bl;
+ struct skill_unit_group* group = su->group;
struct block_list* target = va_arg(ap,struct block_list*);
unsigned int tick = va_arg(ap,unsigned int);
@@ -15764,25 +15757,25 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
nullpo_ret(group);
- if( !unit->alive || target->prev == NULL )
+ if( !su->alive || target->prev == NULL )
return 0;
- if( flag&1 && ( unit->group->skill_id == PF_SPIDERWEB || unit->group->skill_id == GN_THORNS_TRAP ) )
+ if( flag&1 && ( su->group->skill_id == PF_SPIDERWEB || su->group->skill_id == GN_THORNS_TRAP ) )
return 0; // Fiberlock is never supposed to trigger on skill->unit_move. [Inkfish]
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
//Necessary in case the group is deleted after calling on_place/on_out [Skotlex]
- skill_id = unit->group->skill_id;
+ skill_id = su->group->skill_id;
- if( unit->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411
+ if( su->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411
{ //Non-dualmode unit skills with a timer don't trigger when walking, so just return
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
//Target-type check.
- if( !(group->bl_flag&target->type && battle->check_target(&unit->bl,target,group->target_flag) > 0) ) {
+ if( !(group->bl_flag&target->type && battle->check_target(&su->bl,target,group->target_flag) > 0) ) {
if( group->src_id == target->id && group->state.song_dance&0x2 ) { //Ensemble check to see if they went out/in of the area [Skotlex]
if( flag&1 ) {
if( flag&2 ) { //Clear this skill id.
@@ -15805,19 +15798,19 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
skill->unit_onleft(skill_id,target,tick);
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
} else {
if( flag&1 ) {
- int result = skill->unit_onplace(unit,target,tick);
+ int result = skill->unit_onplace(su,target,tick);
if( flag&2 && result ) { //Clear skill ids we have stored in onout.
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == result );
if( i < ARRAYLENGTH(skill_unit_temp) )
skill_unit_temp[i] = 0;
}
} else {
- int result = skill->unit_onout(unit,target,tick);
+ int result = skill->unit_onout(su,target,tick);
if( flag&2 && result ) { //Store this unit id.
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 );
if( i < ARRAYLENGTH(skill_unit_temp) )
@@ -15830,7 +15823,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
//TODO: Normally, this is dangerous since the unit and group could be freed
//inside the onout/onplace functions. Currently it is safe because we know song/dance
//cells do not get deleted within them. [Skotlex]
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
if( flag&4 )
skill->unit_onleft(skill_id,target,tick);
@@ -15877,8 +15870,8 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
int i,j;
unsigned int tick = timer->gettick();
int *m_flag;
- struct skill_unit *unit1;
- struct skill_unit *unit2;
+ struct skill_unit *su1;
+ struct skill_unit *su2;
if (group == NULL)
return 0;
@@ -15899,49 +15892,47 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
// 1: Unit will move to a slot that had another unit of the same group (skill_unit_onplace not needed)
// 2: Another unit from same group will end up positioned on this unit (skill_unit_onout not needed)
// 3: Both 1+2.
- for(i=0;i<group->unit_count;i++){
- unit1=&group->unit[i];
- if (!unit1->alive || unit1->bl.m!=m)
+ for(i=0;i<group->unit_count;i++) {
+ su1=&group->unit[i];
+ if (!su1->alive || su1->bl.m!=m)
continue;
- for(j=0;j<group->unit_count;j++){
- unit2=&group->unit[j];
- if (!unit2->alive)
+ for(j=0;j<group->unit_count;j++) {
+ su2=&group->unit[j];
+ if (!su2->alive)
continue;
- if (unit1->bl.x+dx==unit2->bl.x && unit1->bl.y+dy==unit2->bl.y){
+ if (su1->bl.x+dx==su2->bl.x && su1->bl.y+dy==su2->bl.y) {
m_flag[i] |= 0x1;
}
- if (unit1->bl.x-dx==unit2->bl.x && unit1->bl.y-dy==unit2->bl.y){
+ if (su1->bl.x-dx==su2->bl.x && su1->bl.y-dy==su2->bl.y) {
m_flag[i] |= 0x2;
}
}
}
j = 0;
for (i=0;i<group->unit_count;i++) {
- unit1=&group->unit[i];
- if (!unit1->alive)
+ su1=&group->unit[i];
+ if (!su1->alive)
continue;
if (!(m_flag[i]&0x2)) {
if (group->state.song_dance&0x1) //Cancel dissonance effect.
- skill->dance_overlap(unit1, 0);
- iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4);
+ skill->dance_overlap(su1, 0);
+ iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,4);
}
//Move Cell using "smart" criteria (avoid useless moving around)
- switch(m_flag[i])
- {
+ switch(m_flag[i]) {
case 0:
//Cell moves independently, safely move it.
- iMap->moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick);
+ iMap->moveblock(&su1->bl, su1->bl.x+dx, su1->bl.y+dy, tick);
break;
case 1:
//Cell moves unto another cell, look for a replacement cell that won't collide
//and has no cell moving into it (flag == 2)
- for(;j<group->unit_count;j++)
- {
+ for(;j<group->unit_count;j++) {
if(m_flag[j]!=2 || !group->unit[j].alive)
continue;
//Move to where this cell would had moved.
- unit2 = &group->unit[j];
- iMap->moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick);
+ su2 = &group->unit[j];
+ iMap->moveblock(&su1->bl, su2->bl.x+dx, su2->bl.y+dy, tick);
j++; //Skip this cell as we have used it.
break;
}
@@ -15952,9 +15943,9 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
}
if (!(m_flag[i]&0x2)) { //We only moved the cell in 0-1
if (group->state.song_dance&0x1) //Check for dissonance effect.
- skill->dance_overlap(unit1, 1);
- clif->skill_setunit(unit1);
- iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1);
+ skill->dance_overlap(su1, 1);
+ clif->skill_setunit(su1);
+ iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,1);
}
}
aFree(m_flag);
@@ -16168,9 +16159,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
+ pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ (status->int_/2)*10 + status->dex*10+status->luk*10;
if(homun_alive(sd->hd)) {//Player got a homun
- int skill;
- if((skill=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change
- make_per += skill*100; //+1% bonus per level
+ int skill2_lv;
+ if((skill2_lv=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change
+ make_per += skill2_lv*100; //+1% bonus per level
}
switch(nameid){
case 501: // Red Potion
diff --git a/src/map/skill.h b/src/map/skill.h
index 995874de4..21544b730 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1820,7 +1820,7 @@ struct skill_interface {
struct skill_unit_group* (*id2group) (int group_id);
struct skill_unit_group *(*unitsetting) (struct block_list* src, uint16 skill_id, uint16 skill_lv, short x, short y, int flag);
struct skill_unit *(*initunit) (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2);
- int (*delunit) (struct skill_unit *unit);
+ int (*delunit) (struct skill_unit *su);
struct skill_unit_group *(*init_unitgroup) (struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval);
int (*del_unitgroup) (struct skill_unit_group *group, const char* file, int line, const char* func);
int (*clear_unitgroup) (struct block_list *src);
@@ -1883,14 +1883,14 @@ struct skill_interface {
int (*graffitiremover) (struct block_list *bl, va_list ap);
int (*activate_reverberation) ( struct block_list *bl, va_list ap);
int (*dance_overlap_sub) (struct block_list* bl, va_list ap);
- int (*dance_overlap) (struct skill_unit* unit, int flag);
+ int (*dance_overlap) (struct skill_unit* su, int flag);
struct s_skill_unit_layout *(*get_unit_layout) (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y);
int (*frostjoke_scream) (struct block_list *bl, va_list ap);
int (*greed) (struct block_list *bl, va_list ap);
int (*destroy_trap) ( struct block_list *bl, va_list ap );
int (*icewall_block) (struct block_list *bl,va_list ap);
struct skill_unit_group_tickset *(*unitgrouptickset_search) (struct block_list *bl, struct skill_unit_group *group, int tick);
- bool (*dance_switch) (struct skill_unit* unit, int flag);
+ bool (*dance_switch) (struct skill_unit* su, int flag);
int (*check_condition_char_sub) (struct block_list *bl, va_list ap);
int (*check_condition_mob_master_sub) (struct block_list *bl, va_list ap);
void (*brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y);
diff --git a/src/map/status.c b/src/map/status.c
index 4f1ca9094..5d856cfb9 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -82,7 +82,7 @@ static struct status_data dummy_status;
sc_type status_skill2sc(int skill_id) {
int idx;
if( (idx = skill->get_index(skill_id)) == 0 ) {
- ShowError("status_skill2sc: Unsupported skill id %d\n", skill);
+ ShowError("status_skill2sc: Unsupported skill id %d\n", skill_id);
return SC_NONE;
}
return SkillStatusChangeTable[idx];
@@ -2334,7 +2334,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
const struct status_change *sc = &sd->sc;
struct s_skill b_skill[MAX_SKILL]; // previous skill tree
int b_weight, b_max_weight, b_cart_weight_max, // previous weight
- i, k, index, skill,refinedef=0;
+ i, k, index, skill_lv,refinedef=0;
int64 i64;
if (++calculating > 10) //Too many recursive calls!
@@ -2742,12 +2742,12 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Absolute modifiers from passive skills
if(pc->checkskill(sd,BS_HILTBINDING)>0)
status->str++;
- if((skill=pc->checkskill(sd,SA_DRAGONOLOGY))>0)
- status->int_ += (skill+1)/2; // +1 INT / 2 lv
- if((skill=pc->checkskill(sd,AC_OWL))>0)
- status->dex += skill;
- if((skill = pc->checkskill(sd,RA_RESEARCHTRAP))>0)
- status->int_ += skill;
+ if((skill_lv=pc->checkskill(sd,SA_DRAGONOLOGY))>0)
+ status->int_ += (skill_lv+1)/2; // +1 INT / 2 lv
+ if((skill_lv=pc->checkskill(sd,AC_OWL))>0)
+ status->dex += skill_lv;
+ if((skill_lv = pc->checkskill(sd,RA_RESEARCHTRAP))>0)
+ status->int_ += skill_lv;
// Bonuses from cards and equipment as well as base stat, remember to avoid overflows.
i = status->str + sd->status.str + sd->param_bonus[0] + sd->param_equip[0];
@@ -2771,7 +2771,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->batk += sd->weapon_atk[sd->status.weapon];
// Absolute modifiers from passive skills
#ifndef RENEWAL
- if((skill=pc->checkskill(sd,BS_HILTBINDING))>0) // it doesn't work in RE.
+ if((skill_lv=pc->checkskill(sd,BS_HILTBINDING))>0) // it doesn't work in RE.
status->batk += 4;
#endif
@@ -2785,8 +2785,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=pc->checkskill(sd,CR_TRUST))>0)
- status->max_hp += skill*200;
+ if((skill_lv=pc->checkskill(sd,CR_TRUST))>0)
+ status->max_hp += skill_lv*200;
// Apply relative modifiers from equipment
if(sd->hprate < 0)
@@ -2810,16 +2810,16 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=pc->checkskill(sd,SL_KAINA))>0)
- status->max_sp += 30*skill;
- if((skill=pc->checkskill(sd,HP_MEDITATIO))>0)
- status->max_sp += (int64)status->max_sp * skill/100;
- if((skill=pc->checkskill(sd,HW_SOULDRAIN))>0)
- status->max_sp += (int64)status->max_sp * 2*skill/100;
- if( (skill = pc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
- status->max_sp += 200 + 20 * skill;
- if( (skill = pc->checkskill(sd,WM_LESSON)) > 0 )
- status->max_sp += 30 * skill;
+ if((skill_lv=pc->checkskill(sd,SL_KAINA))>0)
+ status->max_sp += 30*skill_lv;
+ if((skill_lv=pc->checkskill(sd,HP_MEDITATIO))>0)
+ status->max_sp += (int64)status->max_sp * skill_lv/100;
+ if((skill_lv=pc->checkskill(sd,HW_SOULDRAIN))>0)
+ status->max_sp += (int64)status->max_sp * 2*skill_lv/100;
+ if( (skill_lv = pc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
+ status->max_sp += 200 + 20 * skill_lv;
+ if( (skill_lv = pc->checkskill(sd,WM_LESSON)) > 0 )
+ status->max_sp += 30 * skill_lv;
// Apply relative modifiers from equipment
@@ -2903,33 +2903,32 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Absolute modifiers from passive skills
#ifndef RENEWAL
- if((skill=pc->checkskill(sd,BS_WEAPONRESEARCH))>0) // is this correct in pre? there is already hitrate bonus in battle.c
- status->hit += skill*2;
+ if((skill_lv=pc->checkskill(sd,BS_WEAPONRESEARCH))>0) // is this correct in pre? there is already hitrate bonus in battle.c
+ status->hit += skill_lv*2;
#endif
- if((skill=pc->checkskill(sd,AC_VULTURE))>0){
+ if((skill_lv=pc->checkskill(sd,AC_VULTURE))>0) {
#ifndef RENEWAL
- status->hit += skill;
+ status->hit += skill_lv;
#endif
if(sd->status.weapon == W_BOW)
- status->rhw.range += skill;
+ status->rhw.range += skill_lv;
}
- if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)
- {
- if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0)
- status->hit += 2*skill;
- if((skill=pc->checkskill(sd,GS_SNAKEEYE))>0) {
- status->hit += skill;
- status->rhw.range += skill;
+ if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE) {
+ if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0)
+ status->hit += 2*skill_lv;
+ if((skill_lv=pc->checkskill(sd,GS_SNAKEEYE))>0) {
+ status->hit += skill_lv;
+ status->rhw.range += skill_lv;
}
}
// ----- FLEE CALCULATION -----
// Absolute modifiers from passive skills
- if((skill=pc->checkskill(sd,TF_MISS))>0)
- status->flee += skill*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
- if((skill=pc->checkskill(sd,MO_DODGE))>0)
- status->flee += (skill*3)>>1;
+ if((skill_lv=pc->checkskill(sd,TF_MISS))>0)
+ status->flee += skill_lv*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
+ if((skill_lv=pc->checkskill(sd,MO_DODGE))>0)
+ status->flee += (skill_lv*3)>>1;
// ----- EQUIPMENT-DEF CALCULATION -----
// Apply relative modifiers from equipment
@@ -2975,25 +2974,25 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Relative modifiers from passive skills
#ifndef RENEWAL_ASPD
- if((skill=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
- status->aspd_rate -= 5*skill;
- if((skill = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
- status->aspd_rate -= 30*skill;
- if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ status->aspd_rate -= 5*skill_lv;
+ if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
+ status->aspd_rate -= 30*skill_lv;
+ if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- status->aspd_rate -= ((skill+1)/2) * 10;
+ status->aspd_rate -= ((skill_lv+1)/2) * 10;
if(pc_isriding(sd))
status->aspd_rate += 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
status->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
- if((skill=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
- status->aspd_rate += 5*skill;
- if((skill = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
- status->aspd_rate += 30*skill;
- if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ status->aspd_rate += 5*skill_lv;
+ if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
+ status->aspd_rate += 30*skill_lv;
+ if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- status->aspd_rate += ((skill+1)/2) * 10;
+ status->aspd_rate += ((skill_lv+1)/2) * 10;
if(pc_isriding(sd))
status->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
@@ -3012,16 +3011,16 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- MISC CALCULATIONS -----
// Weight
- if((skill=pc->checkskill(sd,MC_INCCARRY))>0)
- sd->max_weight += 2000*skill;
+ if((skill_lv=pc->checkskill(sd,MC_INCCARRY))>0)
+ sd->max_weight += 2000*skill_lv;
if(pc_isriding(sd) && pc->checkskill(sd,KN_RIDING)>0)
sd->max_weight += 10000;
else if(pc_isridingdragon(sd))
sd->max_weight += 5000+2000*pc->checkskill(sd,RK_DRAGONTRAINING);
if(sc->data[SC_KNOWLEDGE])
sd->max_weight += sd->max_weight*sc->data[SC_KNOWLEDGE]->val1/10;
- if((skill=pc->checkskill(sd,ALL_INCCARRY))>0)
- sd->max_weight += 2000*skill;
+ if((skill_lv=pc->checkskill(sd,ALL_INCCARRY))>0)
+ sd->max_weight += 2000*skill_lv;
sd->cart_weight_max = battle_config.max_cart_weight + (pc->checkskill(sd, GN_REMODELING_CART)*5000);
@@ -3031,8 +3030,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
sd->regen.state.walk = 0;
// Skill SP cost
- if((skill=pc->checkskill(sd,HP_MANARECHARGE))>0 )
- sd->dsprate -= 4*skill;
+ if((skill_lv=pc->checkskill(sd,HP_MANARECHARGE))>0 )
+ sd->dsprate -= 4*skill_lv;
if(sc->data[SC_SERVICEFORYOU])
sd->dsprate -= sc->data[SC_SERVICEFORYOU]->val3;
@@ -3053,29 +3052,29 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
sd->sprecov_rate = 0;
// Anti-element and anti-race
- if((skill=pc->checkskill(sd,CR_TRUST))>0)
- sd->subele[ELE_HOLY] += skill*5;
- if((skill=pc->checkskill(sd,BS_SKINTEMPER))>0) {
- sd->subele[ELE_NEUTRAL] += skill;
- sd->subele[ELE_FIRE] += skill*4;
+ if((skill_lv=pc->checkskill(sd,CR_TRUST))>0)
+ sd->subele[ELE_HOLY] += skill_lv*5;
+ if((skill_lv=pc->checkskill(sd,BS_SKINTEMPER))>0) {
+ sd->subele[ELE_NEUTRAL] += skill_lv;
+ sd->subele[ELE_FIRE] += skill_lv*4;
}
- if((skill=pc->checkskill(sd,NC_RESEARCHFE))>0) {
- sd->subele[ELE_EARTH] += skill*10;
- sd->subele[ELE_FIRE] += skill*10;
+ if((skill_lv=pc->checkskill(sd,NC_RESEARCHFE))>0) {
+ sd->subele[ELE_EARTH] += skill_lv*10;
+ sd->subele[ELE_FIRE] += skill_lv*10;
}
- if((skill=pc->checkskill(sd,SA_DRAGONOLOGY))>0 ){
+ if((skill_lv=pc->checkskill(sd,SA_DRAGONOLOGY))>0 ) {
#ifdef RENEWAL
- skill = skill*2;
+ skill_lv = skill_lv*2;
#else
- skill = skill*4;
+ skill_lv = skill_lv*4;
#endif
- sd->right_weapon.addrace[RC_DRAGON]+=skill;
- sd->left_weapon.addrace[RC_DRAGON]+=skill;
- sd->magic_addrace[RC_DRAGON]+=skill;
- sd->subrace[RC_DRAGON]+=skill;
+ sd->right_weapon.addrace[RC_DRAGON]+=skill_lv;
+ sd->left_weapon.addrace[RC_DRAGON]+=skill_lv;
+ sd->magic_addrace[RC_DRAGON]+=skill_lv;
+ sd->subrace[RC_DRAGON]+=skill_lv;
}
- if(sc->count){
+ if(sc->count) {
if(sc->data[SC_CONCENTRATION]) { //Update the card-bonus data
sc->data[SC_CONCENTRATION]->val3 = sd->param_bonus[1]; //Agi
sc->data[SC_CONCENTRATION]->val4 = sd->param_bonus[4]; //Dex
@@ -3183,11 +3182,10 @@ int status_calc_mercenary_(struct mercenary_data *md, bool first)
return 0;
}
-int status_calc_homunculus_(struct homun_data *hd, bool first)
-{
+int status_calc_homunculus_(struct homun_data *hd, bool first) {
struct status_data *status = &hd->base_status;
struct s_homunculus *hom = &hd->homunculus;
- int skill;
+ int skill_lv;
int amotion;
status->str = hom->str / 10;
@@ -3197,7 +3195,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first)
status->int_ = hom->int_ / 10;
status->luk = hom->luk / 10;
- if (first) { //[orn]
+ if (first) { //[orn]
const struct s_homunculus_db *db = hd->homunculusDB;
status->def_ele = db->element;
status->ele_lv = 1;
@@ -3212,30 +3210,30 @@ int status_calc_homunculus_(struct homun_data *hd, bool first)
status->hp = 1;
status->sp = 1;
}
- skill = hom->level/10 + status->vit/5;
- status->def = cap_value(skill, 0, 99);
+ skill_lv = hom->level/10 + status->vit/5;
+ status->def = cap_value(skill_lv, 0, 99);
- skill = hom->level/10 + status->int_/5;
- status->mdef = cap_value(skill, 0, 99);
+ skill_lv = hom->level/10 + status->int_/5;
+ status->mdef = cap_value(skill_lv, 0, 99);
status->max_hp = hom->max_hp ;
status->max_sp = hom->max_sp ;
homun->calc_skilltree(hd, 0);
- if((skill=homun->checkskill(hd,HAMI_SKIN)) > 0)
- status->def += skill * 4;
+ if((skill_lv=homun->checkskill(hd,HAMI_SKIN)) > 0)
+ status->def += skill_lv * 4;
- if((skill = homun->checkskill(hd,HVAN_INSTRUCT)) > 0) {
- status->int_ += 1 +skill/2 +skill/4 +skill/5;
- status->str += 1 +skill/3 +skill/3 +skill/4;
+ if((skill_lv = homun->checkskill(hd,HVAN_INSTRUCT)) > 0) {
+ status->int_ += 1 +skill_lv/2 +skill_lv/4 +skill_lv/5;
+ status->str += 1 +skill_lv/3 +skill_lv/3 +skill_lv/4;
}
- if((skill=homun->checkskill(hd,HAMI_SKIN)) > 0)
- status->max_hp += skill * 2 * status->max_hp / 100;
+ if((skill_lv=homun->checkskill(hd,HAMI_SKIN)) > 0)
+ status->max_hp += skill_lv * 2 * status->max_hp / 100;
- if((skill = homun->checkskill(hd,HLIF_BRAIN)) > 0)
- status->max_sp += (1 +skill/2 -skill/4 +skill/5) * status->max_sp / 100 ;
+ if((skill_lv = homun->checkskill(hd,HLIF_BRAIN)) > 0)
+ status->max_sp += (1 +skill_lv/2 -skill_lv/4 +skill_lv/5) * status->max_sp / 100 ;
if (first) {
hd->battle_status.hp = hom->hp ;
@@ -3365,10 +3363,9 @@ static unsigned short status_calc_batk(struct block_list *,struct status_change
#endif
//Calculates base regen values.
-void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen)
-{
+void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen) {
struct map_session_data *sd;
- int val, skill, reg_flag;
+ int val, skill_lv, reg_flag;
if( !(bl->type&BL_REGEN) || !regen )
return;
@@ -3392,29 +3389,27 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
regen->sp = cap_value(val, reg_flag, SHRT_MAX);
- if( sd )
- {
+ if( sd ) {
struct regen_data_sub *sregen;
- if( (skill=pc->checkskill(sd,HP_MEDITATIO)) > 0 )
- {
- val = regen->sp*(100+3*skill)/100;
+ if( (skill_lv=pc->checkskill(sd,HP_MEDITATIO)) > 0 ) {
+ val = regen->sp*(100+3*skill_lv)/100;
regen->sp = cap_value(val, 1, SHRT_MAX);
}
//Only players have skill/sitting skill regen for now.
sregen = regen->sregen;
val = 0;
- if( (skill=pc->checkskill(sd,SM_RECOVERY)) > 0 )
- val += skill*5 + skill*status->max_hp/500;
+ if( (skill_lv=pc->checkskill(sd,SM_RECOVERY)) > 0 )
+ val += skill_lv*5 + skill_lv*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=pc->checkskill(sd,MG_SRECOVERY)) > 0 )
- val += skill*3 + skill*status->max_sp/500;
- if( (skill=pc->checkskill(sd,NJ_NINPOU)) > 0 )
- val += skill*3 + skill*status->max_sp/500;
- if( (skill=pc->checkskill(sd,WM_LESSON)) > 0 )
- val += 3 + 3 * skill;
+ if( (skill_lv=pc->checkskill(sd,MG_SRECOVERY)) > 0 )
+ val += skill_lv*3 + skill_lv*status->max_sp/500;
+ if( (skill_lv=pc->checkskill(sd,NJ_NINPOU)) > 0 )
+ val += skill_lv*3 + skill_lv*status->max_sp/500;
+ if( (skill_lv=pc->checkskill(sd,WM_LESSON)) > 0 )
+ val += 3 + 3 * skill_lv;
sregen->sp = cap_value(val, 0, SHRT_MAX);
@@ -3422,33 +3417,32 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
sregen = regen->ssregen;
val = 0;
- if( (skill=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
- val += skill*4 + skill*status->max_hp/500;
+ if( (skill_lv=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ val += skill_lv*4 + skill_lv*status->max_hp/500;
- if( (skill=pc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
- val += skill*30 + skill*status->max_hp/500;
+ if( (skill_lv=pc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
+ val += skill_lv*30 + skill_lv*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=pc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest )
- {
- val += skill*3 + skill*status->max_sp/500;
- if ((skill=pc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
- val += (30+10*skill)*val/100;
+ if( (skill_lv=pc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest ) {
+ val += skill_lv*3 + skill_lv*status->max_sp/500;
+ if ((skill_lv=pc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
+ val += (30+10*skill_lv)*val/100;
}
- if( (skill=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
- val += skill*2 + skill*status->max_sp/500;
+ if( (skill_lv=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ val += skill_lv*2 + skill_lv*status->max_sp/500;
sregen->sp = cap_value(val, 0, SHRT_MAX);
}
if( bl->type == BL_HOM ) {
struct homun_data *hd = (TBL_HOM*)bl;
- if( (skill = homun->checkskill(hd,HAMI_SKIN)) > 0 ) {
- val = regen->hp*(100+5*skill)/100;
+ if( (skill_lv = homun->checkskill(hd,HAMI_SKIN)) > 0 ) {
+ val = regen->hp*(100+5*skill_lv)/100;
regen->hp = cap_value(val, 1, SHRT_MAX);
}
- if( (skill = homun->checkskill(hd,HLIF_BRAIN)) > 0 ) {
- val = regen->sp*(100+3*skill)/100;
+ if( (skill_lv = homun->checkskill(hd,HLIF_BRAIN)) > 0 ) {
+ val = regen->sp*(100+3*skill_lv)/100;
regen->sp = cap_value(val, 1, SHRT_MAX);
}
} else if( bl->type == BL_MER ) {
@@ -10318,9 +10312,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_SPLASHER:
// custom Venom Splasher countdown timer
//if (sce->val4 % 1000 == 0) {
- // char timer[10];
- // snprintf (timer, 10, "%d", sce->val4/1000);
- // clif->message(bl, timer);
+ // char counter[10];
+ // snprintf (counter, 10, "%d", sce->val4/1000);
+ // clif->message(bl, counter);
//}
if((sce->val4 -= 500) > 0) {
sc_timer_next(500 + tick, iStatus->change_timer, bl->id, data);
@@ -11131,7 +11125,6 @@ int status_change_clear_buffs (struct block_list* bl, int type)
int status_change_spread( struct block_list *src, struct block_list *bl ) {
int i, flag = 0;
struct status_change *sc = iStatus->get_sc(src);
- const struct TimerData *td;
unsigned int tick;
struct status_change_data data;
@@ -11171,7 +11164,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
case SC_DEATHHURT:
case SC_PARALYSE:
if( sc->data[i]->timer != INVALID_TIMER ) {
- td = timer->get(sc->data[i]->timer);
+ const struct TimerData *td = timer->get(sc->data[i]->timer);
if (td == NULL || td->func != iStatus->change_timer || DIFF_TICK(td->tick,tick) < 0)
continue;
data.tick = DIFF_TICK(td->tick,tick);
diff --git a/src/map/status.h b/src/map/status.h
index d5a40e356..9d49ff3af 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1796,7 +1796,7 @@ struct status_interface {
int (*get_refine_chance) (enum refine_type wlv, int refine);
// for looking up associated data
- sc_type (*skill2sc) (int skill);
+ sc_type (*skill2sc) (int skill_id);
int (*sc2skill) (sc_type sc);
unsigned int (*sc2scb_flag) (sc_type sc);
int (*type2relevant_bl_types) (int type);
diff --git a/src/map/unit.c b/src/map/unit.c
index 1bae8885a..d95b411da 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2177,7 +2177,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
sd->pvp_rank = 0;
}
if(sd->duel_group > 0)
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
if(pc_issit(sd)) {
pc->setstand(sd);
@@ -2354,7 +2354,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
pc->stop_following(sd);
if( sd->duel_invite > 0 )
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
// Notify friends that this char logged out. [Skotlex]
iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
diff --git a/src/map/vending.h b/src/map/vending.h
index 1b4381ccd..968811ecd 100644
--- a/src/map/vending.h
+++ b/src/map/vending.h
@@ -31,7 +31,7 @@ struct vending_interface {
bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s);
};
-struct vending_interface * vending;
+struct vending_interface *vending;
void vending_defaults(void);
diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
index 98f18f4d4..ff7d5b2e2 100644
--- a/src/plugins/Makefile.in
+++ b/src/plugins/Makefile.in
@@ -9,9 +9,9 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all $(PLUGINS) sample db2sql clean help
+.PHONY: all $(PLUGINS) sample db2sql clean help
-all: $(PLUGINS)
+all: $(PLUGINS) Makefile
sample: sample@DLLEXT@
@@ -28,6 +28,9 @@ help:
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/plugins/Makefile
+
%@DLLEXT@: %.c $(COMMON_H)
@echo " CC $<"
@$(CC) @DEFS@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ @SOFLAGS@ -o ../../plugins/$@ $<
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
index 56cbfefc9..cb99e7004 100644
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -1,20 +1,22 @@
COMMON_H = $(shell ls ../common/*.h)
+CONFIG_H = $(shell ls ../config/*.h ../config/*/*.h)
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
TEST_SPINLOCK_OBJ=obj/test_spinlock.o
TEST_SPINLOCK_H=
-TEST_SPINLOCK_DEPENDS=obj $(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+TEST_SPINLOCK_DEPENDS=$(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
@SET_MAKE@
@@ -22,9 +24,9 @@ CC = @CC@
export CC
#####################################################################
-.PHONY :all test_spinlock
+.PHONY: all test_spinlock
-all: test_spinlock
+all: test_spinlock Makefile
clean:
@echo " CLEAN test"
@@ -32,6 +34,9 @@ clean:
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/test/Makefile
+
# object directories
obj:
@@ -40,25 +45,29 @@ obj:
#executables
-test_spinlock: $(TEST_SPINLOCK_DEPENDS)
+test_spinlock: $(TEST_SPINLOCK_DEPENDS) Makefile
@echo " LD $@"
@$(CC) @LDFLAGS@ -o ../../test_spinlock@EXEEXT@ $(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
# login object files
-obj/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DWITH_SQL @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
../common/obj_all/common.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
../common/obj_sql/common_sql.a:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)
diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in
index de4607dc3..baf4a0327 100644
--- a/src/tool/Makefile.in
+++ b/src/tool/Makefile.in
@@ -1,19 +1,18 @@
-COMMON_OBJ = ../common/obj_all/minicore.o ../common/obj_all/malloc.o \
- ../common/obj_all/showmsg.o ../common/obj_all/strlib.o \
- ../common/obj_all/utils.o ../common/obj_all/des.o ../common/obj_all/grfio.o ../common/obj_all/miniconsole.o
-COMMON_H = ../common/core.h ../common/mmo.h \
- ../common/malloc.h ../common/showmsg.h ../common/strlib.h \
- ../common/utils.h ../common/cbasetypes.h ../common/des.h ../common/grfio.h ../common/console.h ../config/renewal.h
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
-OTHER_H = ../config/renewal.h
+COMMON_D = ../common
+COMMON_OBJ = $(addprefix $(COMMON_D)/obj_all/, des.o grfio.o malloc.o \
+ miniconsole.o minicore.o showmsg.o strlib.o utils.o)
+COMMON_H = $(addprefix $(COMMON_D)/, cbasetypes.h console.h core.h des.h \
+ grfio.h malloc.h mmo.h showmsg.h strlib.h utils.h)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+CONFIG_H = $(shell ls ../config/*.h ../config/*/*.h)
MAPCACHE_OBJ = obj_all/mapcache.o
@@ -23,12 +22,14 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all mapcache clean help
+.PHONY: all mapcache clean help
-all: mapcache
+all: mapcache Makefile
-mapcache: obj_all $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ)
- @echo " LD $@"
+mapcache: ../../mapcache@EXEEXT@
+
+../../mapcache@EXEEXT@: $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) Makefile
+ @echo " LD $(notdir $@)"
@$(CC) @LDFLAGS@ $(LIBCONFIG_INCLUDE) -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) @LIBS@
clean:
@@ -44,20 +45,26 @@ help:
#####################################################################
+Makefile: Makefile.in
+ @$(MAKE) -C ../.. src/tool/Makefile
+
obj_all:
@echo " MKDIR obj_all"
@-mkdir obj_all
-obj_all/%.o: %.c $(COMMON_H) $(OTHER_H) $(LIBCONFIG_H)
+obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing common object files
../common/obj_all/%.o:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
../common/obj_all/mini%.o:
+ @echo " MAKE $@"
@$(MAKE) -C ../common sql
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)