Bläddra i källkod

Reformatting @_@

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10581 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 18 år sedan
förälder
incheckning
711d01a128

+ 2 - 37
src/char/char.c

@@ -412,8 +412,8 @@ void set_all_offline(int id) {
 /*---------------------------------------------------
   Make a data line for friends list
  --------------------------------------------------*/
-
-int mmo_friends_list_data_str(char *str, struct mmo_charstatus *p) {
+int mmo_friends_list_data_str(char *str, struct mmo_charstatus *p)
+{
 	int i;
 	char *str_p = str;
 	str_p += sprintf(str_p, "%d", p->char_id);
@@ -435,14 +435,6 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg,
 	int i,j;
 	char *str_p = str;
 
-	/* We shouldn't need this anymore... [Skotlex]
-	// on multi-map server, sometimes it's posssible that last_point become void. (reason???) We check that to not lost character at restart.
-	if (!p->last_point.map) {
-		p->last_point.map = mapindex_name2id(MAP_PRONTERA);
-		p->last_point.x = 273;
-		p->last_point.y = 354;
-	}
-	*/
 	str_p += sprintf(str_p,
 		"%d\t%d,%d\t%s\t%d,%d,%d\t%u,%u,%d" //Up to Zeny field
 		"\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" //Up to Skill Point
@@ -648,33 +640,6 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg
 	p->account_id = tmp_int[1];
 	p->char_num = tmp_int[2];
 	p->class_ = tmp_int[3];
-/* Unneeded unless you are running a real old character database now.
-	//Temporal fix until all chars are reverted from peco-flying-class to 
-	//normal classes. [Skotlex]
-	switch (p->class_) {
-		case JOB_KNIGHT2: //Job_Knight2
-			p->class_ = JOB_KNIGHT;
-			break;
-		case JOB_CRUSADER2: //Job_Crusader2
-			p->class_ = JOB_CRUSADER;
-			break;
-		case JOB_LORD_KNIGHT2: //Job_Lord_Knight2
-			p->class_	= JOB_LORD_KNIGHT;
-			break;
-		case JOB_PALADIN2: //Job_Paladin2
-			p->class_ = JOB_PALADIN;
-			break;
-		case JOB_BABY_KNIGHT2: //Job_Baby_Knight2
-			p->class_ = JOB_BABY_KNIGHT;
-			break;
-		case JOB_BABY_CRUSADER2: //Job_Baby_Crusader2
-			p->class_ = JOB_BABY_CRUSADER;
-			break;
-		case JOB_STAR_GLADIATOR2: //Job_Star_Gladiator2
-			p->class_ = JOB_STAR_GLADIATOR;
-			break;
-	}
-*/
 	p->base_level = tmp_int[4];
 	p->job_level = tmp_int[5];
 	p->base_exp = tmp_uint[0];

+ 8 - 14
src/char/int_status.c

@@ -23,8 +23,7 @@ static void* create_scdata(DBKey key, va_list args) {
 
 /*==========================================
  * Loads status change data of the player given. [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct scdata* status_search_scdata(int aid, int cid)
 {
 	struct scdata *data;
@@ -35,8 +34,7 @@ struct scdata* status_search_scdata(int aid, int cid)
 /*==========================================
  * Deletes status change data of the player given. [Skotlex]
  * Should be invoked after the data of said player was successfully loaded.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void status_delete_scdata(int aid, int cid)
 {
 	struct scdata *scdata = idb_remove(scdata_db, cid);
@@ -87,8 +85,7 @@ static int inter_scdata_fromstr(char *line, struct scdata *sc_data)
 }
 /*==========================================
  * Loads all scdata from the given filename.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void status_load_scdata(const char* filename)
 {
 	FILE *fp;
@@ -138,8 +135,7 @@ static int inter_status_save_sub(DBKey key, void *data, va_list ap) {
 
 /*==========================================
  * Saves all scdata to the given filename.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void inter_status_save()
 {
 	FILE *fp;
@@ -155,8 +151,7 @@ void inter_status_save()
 
 /*==========================================
  * Initializes db.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void status_init()
 {
 	scdata_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int));
@@ -165,8 +160,7 @@ void status_init()
 
 /*==========================================
  * Frees up memory.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int scdata_db_final(DBKey k,void *d,va_list ap)
 {
 	struct scdata *data = (struct scdata*)d;
@@ -178,10 +172,10 @@ static int scdata_db_final(DBKey k,void *d,va_list ap)
 
 /*==========================================
  * Final cleanup.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void status_final(void)
 {
 	scdata_db->destroy(scdata_db, scdata_db_final);
 }
+
 #endif //ENABLE_SC_SAVING

+ 1 - 10
src/char/inter.c

@@ -171,8 +171,7 @@ int inter_accreg_save(void) {
 #endif //TXT_SQL_CONVERT
 /*==========================================
  * 設定ファイルを読み込む
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int inter_config_read(const char *cfgName) {
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;
@@ -533,14 +532,6 @@ int mapif_parse_WisRequest(int fd) {
 	}
 	//Not found.
 	return mapif_wis_fail(fd, RFIFOP(fd, 4));
-
-/* Scrapped since now we know where characters are online in. [Skotlex]
-	wd = mapif_create_whisper(fd, RFIFOP(fd, 4), RFIFOP(fd,28), RFIFOP(fd,52), RFIFOW(fd,2)-52);
-	if (!wd) return 0;
-	idb_put(wis_db, wd->id, wd);
-	mapif_wis_message(wd);
-	return 0;
-*/
 }
 
 // Wisp/page transmission result

+ 2 - 1
src/char_sql/int_party.c

@@ -300,7 +300,8 @@ struct party_data *inter_party_fromsql(int party_id)
 	return p;
 }
 
-int inter_party_sql_init(void){
+int inter_party_sql_init(void)
+{
 	//memory alloc
 	party_db_ = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
 	party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1);

+ 3 - 3
src/char_sql/inter.c

@@ -189,9 +189,9 @@ int inter_accreg_sql_init(void)
 
 /*==========================================
  * read config file
- *------------------------------------------
- */
-static int inter_config_read(const char *cfgName) {
+ *------------------------------------------*/
+static int inter_config_read(const char *cfgName)
+{
 	int i;
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;

+ 5 - 10
src/char_sql/itemdb.c

@@ -34,8 +34,7 @@ static void* create_item(DBKey key, va_list args) {
 }
 /*==========================================
  * DBの検索
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct item_data* itemdb_search(int nameid)
 {
 	return idb_ensure(item_db,nameid,create_item);
@@ -43,8 +42,7 @@ struct item_data* itemdb_search(int nameid)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isequip(int nameid)
 {
 	int type=itemdb_type(nameid);
@@ -54,8 +52,7 @@ int itemdb_isequip(int nameid)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isequip2(struct item_data *data)
 {
 	if(data) {
@@ -72,8 +69,7 @@ int itemdb_isequip2(struct item_data *data)
 
 /*==========================================
  * アイテムデータベースの読み込み
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_readdb(void)
 {
 	FILE *fp;
@@ -202,8 +198,7 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 void do_final_itemdb(void)
 {
 	if(item_db){

+ 3 - 6
src/common/core.c

@@ -69,8 +69,7 @@ sigfunc *compat_signal(int signo, sigfunc *func)
 
 /*======================================
  *	CORE : Signal Sub Function
- *--------------------------------------
- */
+ *--------------------------------------*/
 static void sig_proc(int sn)
 {
 	static int is_called = 0;
@@ -174,8 +173,7 @@ const char* get_svn_revision(void)
 
 /*======================================
  *	CORE : Display title
- *--------------------------------------
- */
+ *--------------------------------------*/
 static void display_title(void)
 {
 	//ClearScreen(); // clear screen and go up/left (0, 0 position in text)
@@ -213,8 +211,7 @@ void usercheck(void)
 
 /*======================================
  *	CORE : MAINROUTINE
- *--------------------------------------
- */
+ *--------------------------------------*/
 int main (int argc, char **argv)
 {
 	{// initialize program arguments

+ 16 - 8
src/common/malloc.c

@@ -189,7 +189,8 @@ static void   block_free(struct block* p);
 static void memmgr_info(void);
 static unsigned int memmgr_usage_bytes = 0;
 
-void* _mmalloc(size_t size, const char *file, int line, const char *func ) {
+void* _mmalloc(size_t size, const char *file, int line, const char *func )
+{
 	int i;
 	struct block *block;
 	size_t size_hash;
@@ -291,13 +292,15 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) {
 	return NULL;
 };
 
-void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func ) {
+void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func )
+{
 	void *p = _mmalloc(num * size,file,line,func);
 	memset(p,0,num * size);
 	return p;
 }
 
-void* _mrealloc(void *memblock, size_t size, const char *file, int line, const char *func ) {
+void* _mrealloc(void *memblock, size_t size, const char *file, int line, const char *func )
+{
 	size_t old_size;
 	if(memblock == NULL) {
 		return _mmalloc(size,file,line,func);
@@ -318,7 +321,8 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c
 	}
 }
 
-char* _mstrdup(const char *p, const char *file, int line, const char *func ) {
+char* _mstrdup(const char *p, const char *file, int line, const char *func )
+{
 	if(p == NULL) {
 		return NULL;
 	} else {
@@ -329,7 +333,8 @@ char* _mstrdup(const char *p, const char *file, int line, const char *func ) {
 	}
 }
 
-void _mfree(void *ptr, const char *file, int line, const char *func ) {
+void _mfree(void *ptr, const char *file, int line, const char *func )
+{
 	struct unit_head *head;
 	size_t size_hash;
 
@@ -420,7 +425,8 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) {
 }
 
 /* 現在の状況を表示する */
-static void memmgr_info(void) {
+static void memmgr_info(void)
+{
 	int i;
 	struct block *p;
 	ShowInfo("** Memory Manager Information **\n");
@@ -461,7 +467,8 @@ static void memmgr_info(void) {
 }
 
 /* ブロックを確保する */
-static struct block* block_malloc(void) {
+static struct block* block_malloc(void)
+{
 	if(block_unused != NULL) {
 		/* ブロック用の領域は確保済み */
 		struct block* ret = block_unused;
@@ -523,7 +530,8 @@ static struct block* block_malloc(void) {
 	}
 }
 
-static void block_free(struct block* p) {
+static void block_free(struct block* p)
+{
 	/* free() せずに、未使用フラグを付けるだけ */
 	p->unit_size = 0;
 	/* 未使用ポインターを更新する */

+ 8 - 4
src/common/mapindex.c

@@ -64,7 +64,8 @@ int mapindex_addmap(int index, const char *name)
 	return 1;
 }
 
-unsigned short mapindex_name2id(const char* name) {
+unsigned short mapindex_name2id(const char* name)
+{
 	//TODO: Perhaps use a db to speed this up? [Skotlex]
 	int i;
 	char map_name[MAP_NAME_LENGTH_EXT];
@@ -91,7 +92,8 @@ unsigned short mapindex_name2id(const char* name) {
 #endif
 }
 
-const char* mapindex_id2name(unsigned short id) {
+const char* mapindex_id2name(unsigned short id)
+{
 	if (id > MAX_MAPINDEX || !indexes[id].exists) {
 		ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", id);
 		return indexes[0].name; //Theorically this should never happen, hence we return this string to prevent null pointer crashes.
@@ -99,7 +101,8 @@ const char* mapindex_id2name(unsigned short id) {
 	return indexes[id].name;
 }
 
-void mapindex_init(void) {
+void mapindex_init(void)
+{
 	FILE *fp;
 	char line[1024];
 	int last_index = -1;
@@ -130,5 +133,6 @@ void mapindex_init(void) {
 	fclose(fp);
 }
 
-void mapindex_final(void) {
+void mapindex_final(void)
+{
 }

+ 3 - 6
src/common/nullpo.c

@@ -13,8 +13,7 @@ static void nullpo_info_core(const char *file, int line, const char *func,
 
 /*======================================
  * Nullチェック 及び 情報出力
- *--------------------------------------
- */
+ *--------------------------------------*/
 int nullpo_chk_f(const char *file, int line, const char *func, const void *target,
                  const char *fmt, ...)
 {
@@ -41,8 +40,7 @@ int nullpo_chk(const char *file, int line, const char *func, const void *target)
 
 /*======================================
  * nullpo情報出力(外部呼出し向けラッパ)
- *--------------------------------------
- */
+ *--------------------------------------*/
 void nullpo_info_f(const char *file, int line, const char *func, 
                  const char *fmt, ...)
 {
@@ -61,8 +59,7 @@ void nullpo_info(const char *file, int line, const char *func)
 
 /*======================================
  * nullpo情報出力(Main)
- *--------------------------------------
- */
+ *--------------------------------------*/
 static void nullpo_info_core(const char *file, int line, const char *func, 
                              const char *fmt, va_list ap)
 {

+ 2 - 4
src/common/timer.c

@@ -137,8 +137,7 @@ unsigned int gettick(void)
 
 /*======================================
  * 	CORE : Timer Heap
- *--------------------------------------
- */
+ *--------------------------------------*/
 /// Adds a timer to the timer_heap
 static void push_timer_heap(int tid)
 {
@@ -197,8 +196,7 @@ static void push_timer_heap(int tid)
 
 /*==========================
  * 	Timer Management
- *--------------------------
- */
+ *--------------------------*/
 
 /// Returns a free timer id.
 static int acquire_timer(void)

+ 83 - 55
src/ladmin/ladmin.c

@@ -261,7 +261,8 @@ int already_exit_function = 0; // sometimes, the exit function is called twice..
 //------------------------------
 // Writing function of logs file
 //------------------------------
-int ladmin_log(char *fmt, ...) {
+int ladmin_log(char *fmt, ...)
+{
 	FILE *logfp;
 	va_list ap;
 	struct timeval tv;
@@ -289,7 +290,8 @@ int ladmin_log(char *fmt, ...) {
 //---------------------------------------------
 // Function to return ordonal text of a number.
 //---------------------------------------------
-char* makeordinal(int number) {
+char* makeordinal(int number)
+{
 	if (defaultlanguage == 'F') {
 		if (number == 0)
 			return "";
@@ -315,7 +317,8 @@ char* makeordinal(int number) {
 //-----------------------------------------------------------------------------------------
 // Function to test of the validity of an account name (return 0 if incorrect, and 1 if ok)
 //-----------------------------------------------------------------------------------------
-int verify_accountname(char* account_name) {
+int verify_accountname(char* account_name)
+{
 	int i;
 
 	for(i = 0; account_name[i]; i++) {
@@ -359,7 +362,8 @@ int verify_accountname(char* account_name) {
 //----------------------------------
 // Sub-function: Input of a password
 //----------------------------------
-int typepasswd(char * password) {
+int typepasswd(char * password)
+{
 	char password1[1023], password2[1023];
 	int letter;
 	int i;
@@ -415,7 +419,8 @@ int typepasswd(char * password) {
 //------------------------------------------------------------------------------------
 // Sub-function: Test of the validity of password (return 0 if incorrect, and 1 if ok)
 //------------------------------------------------------------------------------------
-int verify_password(char * password) {
+int verify_password(char * password)
+{
 	int i;
 
 	for(i = 0; password[i]; i++) {
@@ -459,7 +464,8 @@ int verify_password(char * password) {
 //------------------------------------------------------------------
 // Sub-function: Check the name of a command (return complete name)
 //-----------------------------------------------------------------
-int check_command(char * command) {
+int check_command(char * command)
+{
 // help
 	if (strncmp(command, "aide", 2) == 0 && strncmp(command, "aide", strlen(command)) == 0) // not 1 letter command: 'aide' or 'add'?
 		strcpy(command, "aide");
@@ -561,7 +567,8 @@ int check_command(char * command) {
 //-----------------------------------------
 // Sub-function: Display commands of ladmin
 //-----------------------------------------
-void display_help(char* param, int language) {
+void display_help(char* param, int language)
+{
 	char command[1023];
 	int i;
 
@@ -1087,7 +1094,8 @@ void display_help(char* param, int language) {
 //-----------------------------
 // Sub-function: add an account
 //-----------------------------
-int addaccount(char* param, int emailflag) {
+int addaccount(char* param, int emailflag)
+{
 	char name[1023], sex[1023], email[1023], password[1023];
 //	int i;
 	WFIFOHEAD(login_fd,91);
@@ -1133,19 +1141,6 @@ int addaccount(char* param, int emailflag) {
 		return 102;
 	}
 
-/*	for(i = 0; name[i]; i++) {
-		if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_", name[i]) == NULL) {
-			if (defaultlanguage == 'F') {
-				ShowMessage("Caractère interdit (%c) trouvé dans le nom du compte (%d%s caractère).\n", name[i], i+1, makeordinal(i+1));
-				ladmin_log("Caractère interdit (%c) trouvé dans le nom du compte (%d%s caractère)." RETCODE, name[i], i+1, makeordinal(i+1));
-			} else {
-				ShowMessage("Illegal character (%c) found in the account name (%d%s character).\n", name[i], i+1, makeordinal(i+1));
-				ladmin_log("Illegal character (%c) found in the account name (%d%s character)." RETCODE, name[i], i+1, makeordinal(i+1));
-			}
-			return 101;
-		}
-	}*/
-
 	sex[0] = TOUPPER(sex[0]);
 	if (strchr("MF", sex[0]) == NULL) {
 		if (defaultlanguage == 'F') {
@@ -1216,7 +1211,8 @@ int addaccount(char* param, int emailflag) {
 //---------------------------------------------------------------------------------
 // Sub-function: Add/substract time to the final date of a banishment of an account
 //---------------------------------------------------------------------------------
-int banaddaccount(char* param) {
+int banaddaccount(char* param)
+{
 	char name[1023], modif[1023];
 	int year, month, day, hour, minute, second;
 	char * p_modif;
@@ -1420,7 +1416,8 @@ int banaddaccount(char* param) {
 // Sub-function of sub-function banaccount, unbanaccount or bansetaccount
 // Set the final date of a banishment of an account
 //-----------------------------------------------------------------------
-int bansetaccountsub(char* name, char* date, char* time) {
+int bansetaccountsub(char* name, char* date, char* time)
+{
 	int year, month, day, hour, minute, second;
 	time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban)
 	struct tm *tmtime;
@@ -1564,7 +1561,8 @@ int bansetaccountsub(char* name, char* date, char* time) {
 //---------------------------------------------------------------------
 // Sub-function: Set the final date of a banishment of an account (ban)
 //---------------------------------------------------------------------
-int banaccount(char* param) {
+int banaccount(char* param)
+{
 	char name[1023], date[1023], time[1023];
 
 	memset(name, '\0', sizeof(name));
@@ -1600,7 +1598,8 @@ int banaccount(char* param) {
 //------------------------------------------------------------------------
 // Sub-function: Set the final date of a banishment of an account (banset)
 //------------------------------------------------------------------------
-int bansetaccount(char* param) {
+int bansetaccount(char* param)
+{
 	char name[1023], date[1023], time[1023];
 
 	memset(name, '\0', sizeof(name));
@@ -1639,7 +1638,8 @@ int bansetaccount(char* param) {
 //-------------------------------------------------
 // Sub-function: unbanishment of an account (unban)
 //-------------------------------------------------
-int unbanaccount(char* param) {
+int unbanaccount(char* param)
+{
 	char name[1023];
 
 	memset(name, '\0', sizeof(name));
@@ -1676,7 +1676,8 @@ int unbanaccount(char* param) {
 // Sub-function: Asking to check the validity of a password
 // (Note: never send back a password with login-server!! security of passwords)
 //---------------------------------------------------------
-int checkaccount(char* param) {
+int checkaccount(char* param)
+{
 	char name[1023], password[1023];
 	WFIFOHEAD(login_fd,50);
 
@@ -1727,7 +1728,8 @@ int checkaccount(char* param) {
 //------------------------------------------------
 // Sub-function: Asking for deletion of an account
 //------------------------------------------------
-int delaccount(char* param) {
+int delaccount(char* param)
+{
 	char name[1023];
 	char letter;
 	char confirm[1023];
@@ -1798,7 +1800,8 @@ int delaccount(char* param) {
 //----------------------------------------------------------
 // Sub-function: Asking to modification of an account e-mail
 //----------------------------------------------------------
-int changeemail(char* param) {
+int changeemail(char* param)
+{
 	char name[1023], email[1023];
 	WFIFOHEAD(login_fd,66);
 
@@ -1873,7 +1876,8 @@ int changeemail(char* param) {
 //-----------------------------------------------------
 // Sub-function: Asking of the number of online players
 //-----------------------------------------------------
-int getlogincount(void) {
+int getlogincount(void)
+{
 	WFIFOHEAD(login_fd,2);
 	if (defaultlanguage == 'F') {
 		ladmin_log("Envoi d'un requête au serveur de logins pour obtenir le nombre de joueurs en jeu." RETCODE);
@@ -1891,7 +1895,8 @@ int getlogincount(void) {
 //----------------------------------------------------------
 // Sub-function: Asking to modify the GM level of an account
 //----------------------------------------------------------
-int changegmlevel(char* param) {
+int changegmlevel(char* param)
+{
 	char name[1023];
 	int GM_level;
 	WFIFOHEAD(login_fd,27);
@@ -1947,7 +1952,8 @@ int changegmlevel(char* param) {
 //---------------------------------------------
 // Sub-function: Asking to obtain an account id
 //---------------------------------------------
-int idaccount(char* param) {
+int idaccount(char* param)
+{
 	char name[1023];
 	WFIFOHEAD(login_fd,26);
 
@@ -1991,7 +1997,8 @@ int idaccount(char* param) {
 //----------------------------------------------------------------------------
 // Sub-function: Asking to displaying information about an account (by its id)
 //----------------------------------------------------------------------------
-int infoaccount(int account_id) {
+int infoaccount(int account_id)
+{
 	WFIFOHEAD(login_fd,6);
 	if (account_id < 0) {
 		if (defaultlanguage == 'F') {
@@ -2021,7 +2028,8 @@ int infoaccount(int account_id) {
 //---------------------------------------
 // Sub-function: Send a broadcast message
 //---------------------------------------
-int sendbroadcast(short type, char* message) {
+int sendbroadcast(short type, char* message)
+{
 	int len = strlen(message);
 	WFIFOHEAD(login_fd,9+len);
 	if (len == 0) {
@@ -2058,7 +2066,8 @@ int sendbroadcast(short type, char* message) {
 //--------------------------------------------
 // Sub-function: Change language of displaying
 //--------------------------------------------
-int changelanguage(char* language) {
+int changelanguage(char* language)
+{
 	if (strlen(language) == 0) {
 		if (defaultlanguage == 'F') {
 			ShowMessage("Entrez une langue svp.\n");
@@ -2100,7 +2109,8 @@ int changelanguage(char* language) {
 //--------------------------------------------------------
 // Sub-function: Asking to Displaying of the accounts list
 //--------------------------------------------------------
-int listaccount(char* param, int type) {
+int listaccount(char* param, int type)
+{
 //int list_first, list_last, list_type; // parameter to display a list of accounts
 	int i;
 	WFIFOHEAD(login_fd,10);
@@ -2165,7 +2175,8 @@ int listaccount(char* param, int type) {
 //--------------------------------------------
 // Sub-function: Asking to modify a memo field
 //--------------------------------------------
-int changememo(char* param) {
+int changememo(char* param)
+{
 	char name[1023], memo[1023];
 	WFIFOHEAD(login_fd,28+255);
 
@@ -2224,7 +2235,8 @@ int changememo(char* param) {
 //-----------------------------------------------
 // Sub-function: Asking to obtain an account name
 //-----------------------------------------------
-int nameaccount(int id) {
+int nameaccount(int id)
+{
 	WFIFOHEAD(login_fd,6);
 	if (id < 0) {
 		if (defaultlanguage == 'F') {
@@ -2254,7 +2266,8 @@ int nameaccount(int id) {
 // Sub-function: Asking to modify a password
 // (Note: never send back a password with login-server!! security of passwords)
 //------------------------------------------
-int changepasswd(char* param) {
+int changepasswd(char* param)
+{
 	char name[1023], password[1023];
 	WFIFOHEAD(login_fd,50);
 
@@ -2306,7 +2319,8 @@ int changepasswd(char* param) {
 // Sub-function: Request to login-server to reload GM configuration file
 // this function have no answer
 //----------------------------------------------------------------------
-int reloadGM(void) {
+int reloadGM(void)
+{
 	WFIFOHEAD(login_fd,2);
 	WFIFOW(login_fd,0) = 0x7955;
 	WFIFOSET(login_fd,2);
@@ -2329,7 +2343,8 @@ int reloadGM(void) {
 //-----------------------------------------------------
 // Sub-function: Asking to modify the sex of an account
 //-----------------------------------------------------
-int changesex(char* param) {
+int changesex(char* param)
+{
 	char name[1023], sex[1023];
 	WFIFOHEAD(login_fd,27);
 
@@ -2386,7 +2401,8 @@ int changesex(char* param) {
 // Sub-function of sub-function changestate, blockaccount or unblockaccount
 // Asking to modify the state of an account
 //-------------------------------------------------------------------------
-int changestatesub(char* name, int state, char* error_message7) {
+int changestatesub(char* name, int state, char* error_message7)
+{
 	char error_message[1023]; // need to use, because we can modify error_message7
 	WFIFOHEAD(login_fd,50);
 
@@ -2470,7 +2486,8 @@ int changestatesub(char* name, int state, char* error_message7) {
 //-------------------------------------------------------
 // Sub-function: Asking to modify the state of an account
 //-------------------------------------------------------
-int changestate(char* param) {
+int changestate(char* param)
+{
 	char name[1023], error_message[1023];
 	int state;
 
@@ -2504,7 +2521,8 @@ int changestate(char* param) {
 //-------------------------------------------
 // Sub-function: Asking to unblock an account
 //-------------------------------------------
-int unblockaccount(char* param) {
+int unblockaccount(char* param)
+{
 	char name[1023];
 
 	memset(name, '\0', sizeof(name));
@@ -2538,7 +2556,8 @@ int unblockaccount(char* param) {
 //-------------------------------------------
 // Sub-function: Asking to unblock an account
 //-------------------------------------------
-int blockaccount(char* param) {
+int blockaccount(char* param)
+{
 	char name[1023];
 
 	memset(name, '\0', sizeof(name));
@@ -2572,7 +2591,8 @@ int blockaccount(char* param) {
 //---------------------------------------------------------------------
 // Sub-function: Add/substract time to the validity limit of an account
 //---------------------------------------------------------------------
-int timeaddaccount(char* param) {
+int timeaddaccount(char* param)
+{
 	char name[1023], modif[1023];
 	int year, month, day, hour, minute, second;
 	char * p_modif;
@@ -2775,7 +2795,8 @@ int timeaddaccount(char* param) {
 //-------------------------------------------------
 // Sub-function: Set a validity limit of an account
 //-------------------------------------------------
-int timesetaccount(char* param) {
+int timesetaccount(char* param)
+{
 	char name[1023], date[1023], time[1023];
 	int year, month, day, hour, minute, second;
 	time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
@@ -2941,7 +2962,8 @@ int timesetaccount(char* param) {
 //------------------------------------------------------------------------------
 // Sub-function: Asking to displaying information about an account (by its name)
 //------------------------------------------------------------------------------
-int whoaccount(char* param) {
+int whoaccount(char* param)
+{
 	char name[1023];
 	WFIFOHEAD(login_fd,26);
 
@@ -2984,7 +3006,8 @@ int whoaccount(char* param) {
 //--------------------------------------------------------
 // Sub-function: Asking of the version of the login-server
 //--------------------------------------------------------
-int checkloginversion(void) {
+int checkloginversion(void)
+{
 	WFIFOHEAD(login_fd,2);
 	if (defaultlanguage == 'F')
 		ladmin_log("Envoi d'un requête au serveur de logins pour obtenir sa version." RETCODE);
@@ -3003,7 +3026,8 @@ int checkloginversion(void) {
 // this function wait until user type a command
 // and analyse the command.
 //---------------------------------------------
-int prompt(void) {
+int prompt(void)
+{
 	int i, j;
 	char buf[1024];
 	char *p;
@@ -4162,7 +4186,8 @@ int parse_fromlogin(int fd)
 //------------------------------------
 // Function to connect to login-server
 //------------------------------------
-int Connect_login_server(void) {
+int Connect_login_server(void)
+{
 	if (defaultlanguage == 'F') {
 		ShowMessage("Essai de connection au server de logins...\n");
 		ladmin_log("Essai de connection au server de logins..." RETCODE);
@@ -4211,7 +4236,8 @@ int Connect_login_server(void) {
 //-----------------------------------
 // Reading general configuration file
 //-----------------------------------
-int ladmin_config_read(const char *cfgName) {
+int ladmin_config_read(const char *cfgName)
+{
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;
 
@@ -4291,13 +4317,15 @@ int ladmin_config_read(const char *cfgName) {
 // Function called when the server
 // has received a crash signal.
 //------------------------------
-void do_abort(void) {}
+void do_abort(void)
+{
+}
 
 //--------------------------------------
 // Function called at exit of the server
 //--------------------------------------
-void do_final(void) {
-
+void do_final(void)
+{
 	if (already_exit_function == 0) {
 
 		if (defaultlanguage == 'F') {

+ 20 - 10
src/login/login.c

@@ -166,7 +166,8 @@ int charif_sendallwos(int sfd, unsigned char *buf, unsigned int len);
 //------------------------------
 // Writing function of logs file
 //------------------------------
-int login_log(char *fmt, ...) {
+int login_log(char *fmt, ...)
+{
 	if (log_login) {
 		va_list ap;
 		time_t raw_time;
@@ -257,7 +258,8 @@ static int sync_ip_addresses(int tid, unsigned int tick, int id, int data)
 // Determine if an account (id) is a GM account
 // and returns its level (or 0 if it isn't a GM account or if not found)
 //----------------------------------------------------------------------
-int isGM(int account_id) {
+int isGM(int account_id)
+{
 	unsigned int i;
 	for(i=0; i < GM_num; i++)
 		if(gm_account_db[i].account_id == account_id)
@@ -309,7 +311,8 @@ void addGM(uint32 account_id, int level)
 //-------------------------------------------------------
 // Reading function of GM accounts file (and their level)
 //-------------------------------------------------------
-int read_gm_account(void) {
+int read_gm_account(void)
+{
 	char line[512];
 	FILE *fp;
 	int account_id, level;
@@ -494,7 +497,8 @@ int check_ladminip(uint32 ip)
 //   and returns index if only 1 account is found
 //   and similar to the searched name.
 //-----------------------------------------------
-int search_account_index(char* account_name) {
+int search_account_index(char* account_name)
+{
 	unsigned int i, quantity;
 	int index;
 
@@ -523,7 +527,8 @@ int search_account_index(char* account_name) {
 //--------------------------------------------------------
 // Create a string to save the account in the account file
 //--------------------------------------------------------
-int mmo_auth_tostr(char* str, struct auth_data* p) {
+int mmo_auth_tostr(char* str, struct auth_data* p)
+{
 	int i;
 	char *str_p = str;
 
@@ -946,7 +951,8 @@ void mmo_auth_sync(void)
 //       immediatly and set  the minimum of
 //       authentifications to its initialization value.
 //-----------------------------------------------------
-int check_auth_sync(int tid, unsigned int tick, int id, int data) {
+int check_auth_sync(int tid, unsigned int tick, int id, int data)
+{
 	// we only save if necessary:
 	// we have do some authentifications without do saving
 	if (auth_before_save_file < AUTH_BEFORE_SAVE_FILE ||
@@ -1009,7 +1015,8 @@ void send_GM_accounts(void)
 //-----------------------------------------------------
 // Check if GM file account have been changed
 //-----------------------------------------------------
-int check_GM_file(int tid, unsigned int tick, int id, int data) {
+int check_GM_file(int tid, unsigned int tick, int id, int data)
+{
 	struct stat file_stat;
 	long new_time;
 
@@ -3656,7 +3663,8 @@ int login_config_read(const char* cfgName)
 //-------------------------------------
 // Displaying of configuration warnings
 //-------------------------------------
-void display_conf_warnings(void) {
+void display_conf_warnings(void)
+{
 	if (admin_state != 0 && admin_state != 1) {
 		ShowWarning("Invalid value for admin_state parameter -> setting to 0 (no remote admin).\n");
 		admin_state = 0;
@@ -3768,7 +3776,8 @@ void display_conf_warnings(void) {
 //-------------------------------
 // Save configuration in log file
 //-------------------------------
-void save_config_in_log(void) {
+void save_config_in_log(void)
+{
 	int i;
 
 	// a newline in the log...
@@ -3906,7 +3915,8 @@ void save_config_in_log(void) {
 //--------------------------------------
 // Function called at exit of the server
 //--------------------------------------
-void do_final(void) {
+void do_final(void)
+{
 	int i, fd;
 	ShowInfo("Terminating...\n");
 	fflush(stdout);

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 100 - 210
src/map/atcommand.c


+ 26 - 39
src/map/battle.c

@@ -45,8 +45,7 @@ int battle_getcurrentskill(struct block_list *bl)
 
 /*==========================================
  * Get random targetting enemy
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int battle_gettargeted_sub(struct block_list *bl, va_list ap)
 {
 	struct block_list **bl_list;
@@ -206,8 +205,7 @@ int battle_delay_damage (unsigned int tick, struct block_list *src, struct block
  * Does attribute fix modifiers. 
  * Added passing of the chars so that the status changes can affect it. [Skotlex]
  * Note: Passing src/target == NULL is perfectly valid, it skips SC_ checks.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_type, int def_lv)
 {
 	struct status_change *sc=NULL, *tsc=NULL;
@@ -257,8 +255,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
 
 /*==========================================
  * ƒ_ƒ??[ƒW?Å?IŒvŽZ
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
 {
 	struct map_session_data *sd = NULL;
@@ -514,8 +511,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
 
 /*==========================================
  * Calculates GVG related damage adjustments.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
 {
 	struct mob_data *md = NULL;
@@ -583,8 +579,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
 
 /*==========================================
  * HP/SP‹zŽû‚ÌŒvŽZ
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int battle_calc_drain(int damage, int rate, int per)
 {
 	int diff = 0;
@@ -603,8 +598,7 @@ static int battle_calc_drain(int damage, int rate, int per)
 
 /*==========================================
  * ?C—ûƒ_ƒ??[ƒW
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_addmastery(struct map_session_data *sd,struct block_list *target,int dmg,int type)
 {
 	int damage,skill;
@@ -787,8 +781,7 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk
 
 /*==========================================
  * Consumes ammo for the given skill.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void battle_consume_ammo(TBL_PC*sd, int skill, int lv)
 {
 	int qty=1;
@@ -856,8 +849,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 #define damage_div_fix(dmg, div) { if (div > 1) (dmg)*=div; else if (div < 0) (div)*=-1; }
 /*==========================================
  * battle_calc_weapon_attack (by Skotlex)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static struct Damage battle_calc_weapon_attack(
 	struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag)
 {
@@ -2113,8 +2105,7 @@ static struct Damage battle_calc_weapon_attack(
 
 /*==========================================
  * battle_calc_magic_attack [DracoRPG]
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct Damage battle_calc_magic_attack(
 	struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag)
 	{
@@ -2435,8 +2426,7 @@ struct Damage battle_calc_magic_attack(
 
 /*==========================================
  * ‚»‚Ì‘¼ƒ_ƒ??[ƒWŒvŽZ
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct Damage  battle_calc_misc_attack(
 	struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag)
 {
@@ -2658,10 +2648,8 @@ struct Damage  battle_calc_misc_attack(
 }
 /*==========================================
  * ƒ_ƒ??[ƒWŒvŽZˆêЇ?ˆ—?—p
- *------------------------------------------
- */
-struct Damage battle_calc_attack(	int attack_type,
-	struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag)
+ *------------------------------------------*/
+struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag)
 {
 	struct Damage d;
 	switch(attack_type){
@@ -2783,8 +2771,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage,
 
 /*==========================================
  * ’Ê?í?UŒ‚?ˆ—?‚܂Ƃß
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag)
 {
 	struct map_session_data *sd = NULL, *tsd = NULL;
@@ -3050,8 +3037,7 @@ struct block_list* battle_get_master(struct block_list *src)
  * 1: flag holds true (is enemy, party, etc)
  * -1: flag fails
  * 0: Invalid target (non-targetable ever)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_check_target( struct block_list *src, struct block_list *target,int flag)
 {
 	int m,state = 0; //Initial state none
@@ -3323,8 +3309,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 }
 /*==========================================
  * ŽË’ö”»’è
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_check_range(struct block_list *src,struct block_list *bl,int range)
 {
 	nullpo_retr(0, src);
@@ -3635,7 +3620,6 @@ static const struct battle_data_short {
 	{ "title_lvl7",				&battle_config.title_lvl7}, // [Lupus]
 	{ "title_lvl8",				&battle_config.title_lvl8}, // [Lupus]
 	
-	{ "duel_enable",						&battle_config.duel_enable}, // [LuzZza]
 	{ "duel_allow_pvp",						&battle_config.duel_allow_pvp}, // [LuzZza]
 	{ "duel_allow_gvg",						&battle_config.duel_allow_gvg}, // [LuzZza]
 	{ "duel_allow_teleport",				&battle_config.duel_allow_teleport}, // [LuzZza]
@@ -3710,7 +3694,8 @@ static const struct battle_data_int {
 	{ "hvan_explosion_intimate",				&battle_config.hvan_explosion_intimate },	//[orn]
 };
 
-int battle_set_value(const char* w1, const char* w2) {
+int battle_set_value(const char* w1, const char* w2)
+{
 	int i;
 	for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++)
 		if (strcmpi(w1, battle_data_short[i].str) == 0) {
@@ -3725,7 +3710,8 @@ int battle_set_value(const char* w1, const char* w2) {
 	return 0;
 }
 
-int battle_get_value(const char* w1) {
+int battle_get_value(const char* w1)
+{
 	int i;
 	for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++)
 		if (strcmpi(w1, battle_data_short[i].str) == 0) {
@@ -3738,7 +3724,8 @@ int battle_get_value(const char* w1) {
 	return 0;
 }
 
-void battle_set_defaults() {
+void battle_set_defaults()
+{
 	battle_config.warp_point_debug=0;
 	battle_config.enable_critical=BL_PC;
 	battle_config.mob_critical_rate=100;
@@ -4065,7 +4052,6 @@ void battle_set_defaults() {
 	battle_config.title_lvl7 = 80;
 	battle_config.title_lvl8 = 99;
 	
-	battle_config.duel_enable = 1;
 	battle_config.duel_allow_pvp = 0;
 	battle_config.duel_allow_gvg = 0;
 	battle_config.duel_allow_teleport = 0;
@@ -4300,8 +4286,7 @@ void battle_validate_conf() {
 
 /*==========================================
  * ?Ý’èƒtƒ@ƒCƒ‹‚ð“Ç‚Ý?ž‚Þ
- *------------------------------------------
- */
+ *------------------------------------------*/
 int battle_config_read(const char *cfgName)
 {
 	char line[1024], w1[1024], w2[1024];
@@ -4334,11 +4319,13 @@ int battle_config_read(const char *cfgName)
 	return 0;
 }
 
-void do_init_battle(void) {
+void do_init_battle(void)
+{
 	delay_damage_ers = ers_new(sizeof(struct delay_damage));
 	add_timer_func_list(battle_delay_damage_sub, "battle_delay_damage_sub");
 }
 
-void do_final_battle(void) {
+void do_final_battle(void)
+{
 	ers_destroy(delay_damage_ers);
 }

+ 0 - 1
src/map/battle.h

@@ -401,7 +401,6 @@ extern struct Battle_Config {
 	unsigned short title_lvl7; // Players titles [Lupus]
 	unsigned short title_lvl8; // Players titles [Lupus]
 	
-	unsigned short duel_enable; // [LuzZza]
 	unsigned short duel_allow_pvp; // [LuzZza]
 	unsigned short duel_allow_gvg; // [LuzZza]
 	unsigned short duel_allow_teleport; // [LuzZza]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 140 - 343
src/map/charcommand.c


+ 6 - 12
src/map/chat.c

@@ -19,8 +19,7 @@ int chat_triggerevent(struct chat_data *cd);
 
 /*==========================================
  * chatroom creation
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass, char* title, int titlelen)
 {
 	struct chat_data *cd;
@@ -68,8 +67,7 @@ int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass,
 
 /*==========================================
  * 既存チャットルームに参加
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_joinchat(struct map_session_data* sd, int chatid, char* pass)
 {
 	struct chat_data *cd;
@@ -173,8 +171,7 @@ int chat_leavechat(struct map_session_data* sd)
 
 /*==========================================
  * チャットルームの持ち主を譲る
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_changechatowner(struct map_session_data *sd,char *nextownername)
 {
 	struct chat_data *cd;
@@ -219,8 +216,7 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername)
 
 /*==========================================
  * チャットの状態(タイトル等)を変更
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pass,char* title,int titlelen)
 {
 	struct chat_data *cd;
@@ -247,8 +243,7 @@ int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pa
 
 /*==========================================
  * チャットルームから蹴り出す
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_kickchat(struct map_session_data *sd,char *kickusername)
 {
 	struct chat_data *cd;
@@ -334,8 +329,7 @@ int chat_deletenpcchat(struct npc_data* nd)
 
 /*==========================================
  * 規定人数以上でイベントが定義されてるなら実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chat_triggerevent(struct chat_data *cd)
 {
 	nullpo_retr(0, cd);

+ 48 - 67
src/map/chrif.c

@@ -378,8 +378,7 @@ int chrif_connectack(int fd)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_sendmapack(int fd)
 {
 	RFIFOHEAD(fd);
@@ -403,8 +402,7 @@ int chrif_sendmapack(int fd)
 
 /*==========================================
  * Request sc_data from charserver [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_scdata_request(int account_id, int char_id)
 {
 #ifdef ENABLE_SC_SAVING
@@ -421,8 +419,7 @@ int chrif_scdata_request(int account_id, int char_id)
 
 /*==========================================
  * new auth system [Kevin]
- *------------------------------------------
- */
+ *------------------------------------------*/
 void chrif_authreq(struct map_session_data *sd)
 {
 	struct auth_node *auth_data;
@@ -454,7 +451,8 @@ void chrif_authreq(struct map_session_data *sd)
 }
 
 //character selected, insert into auth db
-void chrif_authok(int fd) {
+void chrif_authok(int fd)
+{
 	struct auth_node *auth_data;
 	TBL_PC* sd;
 	RFIFOHEAD(fd);
@@ -520,15 +518,15 @@ int auth_db_cleanup_sub(DBKey key,void *data,va_list ap)
 	return 0;
 }
 
-int auth_db_cleanup(int tid, unsigned int tick, int id, int data) {
+int auth_db_cleanup(int tid, unsigned int tick, int id, int data)
+{
 	auth_db->foreach(auth_db, auth_db_cleanup_sub);
 	return 0;
 }
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip)
 {
 	nullpo_retr(-1, sd);
@@ -550,8 +548,7 @@ int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip)
 
 /*==========================================
  * キャラ名問い合わせ
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_searchcharid(int char_id)
 {
 	if( !char_id )
@@ -568,8 +565,7 @@ int chrif_searchcharid(int char_id)
 
 /*==========================================
  * GMに変化要求
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_changegm(int id, const char *pass, int len)
 {
 	if (battle_config.etc_log)
@@ -589,8 +585,7 @@ int chrif_changegm(int id, const char *pass, int len)
 
 /*==========================================
  * Change Email
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_changeemail(int id, const char *actual_email, const char *new_email)
 {
 	if (battle_config.etc_log)
@@ -617,8 +612,7 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email)
  *   3: unblock
  *   4: unban
  *   5: changesex
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_char_ask_name(int id, char * character_name, short operation_type, int year, int month, int day, int hour, int minute, int second)
 {
 	chrif_check(-1);
@@ -644,9 +638,9 @@ int chrif_char_ask_name(int id, char * character_name, short operation_type, int
 
 /*==========================================
  * 性別変化要求
- *------------------------------------------
- */
-int chrif_changesex(int id, int sex) {
+ *------------------------------------------*/
+int chrif_changesex(int id, int sex)
+{
 	chrif_check(-1);
 
         WFIFOHEAD(char_fd, 9);
@@ -672,8 +666,7 @@ int chrif_changesex(int id, int sex) {
  *   1: player not found
  *   2: gm level too low
  *   3: login-server offline
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_char_ask_name_answer(int fd)
 {
 	int acc;
@@ -776,8 +769,7 @@ int chrif_char_ask_name_answer(int fd)
 
 /*==========================================
  * End of GM change (@GM) (modified by Yor)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_changedgm(int fd)
 {
 	int acc, level;
@@ -803,8 +795,7 @@ int chrif_changedgm(int fd)
 
 /*==========================================
  * 性別変化終了 (modified by Yor)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_changedsex(int fd)
 {
 	int acc, sex, i;
@@ -875,8 +866,7 @@ int chrif_changedsex(int fd)
 
 /*==========================================
  * 離婚情報同期要求
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_divorce(int char_id, int partner_id)
 {
 	struct map_session_data *sd = NULL;
@@ -901,8 +891,7 @@ int chrif_divorce(int char_id, int partner_id)
 
 /*==========================================
  * Disconnection of a player (account has been deleted in login-server) by [Yor]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_accountdeletion(int fd)
 {
 	int acc;
@@ -929,8 +918,7 @@ int chrif_accountdeletion(int fd)
 
 /*==========================================
  * Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_accountban(int fd)
 {
 	int acc;
@@ -1047,8 +1035,7 @@ int chrif_disconnectplayer(int fd)
 
 /*==========================================
  * Request to reload GM accounts and their levels: send to char-server by [Yor]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_reloadGMdb(void)
 {
 	chrif_check(-1);
@@ -1062,8 +1049,7 @@ int chrif_reloadGMdb(void)
 
 /*==========================================
  * Receiving GM accounts and their levels from char-server by [Yor]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_recvgmaccounts(int fd)
 {
 	ShowInfo("From login-server: receiving information of '"CL_WHITE"%d"CL_RESET"' GM accounts.\n", pc_read_gm_account(fd));
@@ -1072,8 +1058,7 @@ int chrif_recvgmaccounts(int fd)
 
 /*==========================================
  * Request/Receive top 10 Fame character list
- *------------------------------------------
- */
+ *------------------------------------------*/
 
 int chrif_updatefamelist(struct map_session_data *sd)
 {
@@ -1261,8 +1246,7 @@ int chrif_load_scdata(int fd)
 
 /*==========================================
  * Send rates and motd to char server [Wizputer]
- *------------------------------------------
- */
+ *------------------------------------------*/
  int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
 {
 	char buf[256];
@@ -1301,9 +1285,7 @@ int chrif_load_scdata(int fd)
 
 /*=========================================
  * Tell char-server charcter disconnected [Wizputer]
- *-----------------------------------------
- */
-
+ *-----------------------------------------*/
 int chrif_char_offline(struct map_session_data *sd)
 {
 	chrif_check(-1);
@@ -1319,9 +1301,9 @@ int chrif_char_offline(struct map_session_data *sd)
 
 /*=========================================
  * Tell char-server to reset all chars offline [Wizputer]
- *-----------------------------------------
- */
-int chrif_flush_fifo(void) {
+ *-----------------------------------------*/
+int chrif_flush_fifo(void)
+{
 	chrif_check(-1);
 
 	set_nonblocking(char_fd, 0);
@@ -1333,9 +1315,9 @@ int chrif_flush_fifo(void) {
 
 /*=========================================
  * Tell char-server to reset all chars offline [Wizputer]
- *-----------------------------------------
- */
-int chrif_char_reset_offline(void) {
+ *-----------------------------------------*/
+int chrif_char_reset_offline(void)
+{
 	chrif_check(-1);
 
 	WFIFOHEAD(char_fd, 2);
@@ -1347,8 +1329,7 @@ int chrif_char_reset_offline(void) {
 
 /*=========================================
  * Tell char-server charcter is online [Wizputer]
- *-----------------------------------------
- */
+ *-----------------------------------------*/
 
 int chrif_char_online(struct map_session_data *sd)
 {
@@ -1363,7 +1344,8 @@ int chrif_char_online(struct map_session_data *sd)
 	return 0;
 }
 
-int chrif_disconnect(int fd) {
+int chrif_disconnect(int fd)
+{
 	if(fd == char_fd) {
 		char_fd = 0;
 		ShowWarning("Map Server disconnected from Char Server.\n\n");
@@ -1395,8 +1377,7 @@ void chrif_update_ip(int fd)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int chrif_parse(int fd)
 {
 	int packet_len, cmd;
@@ -1475,7 +1456,8 @@ int chrif_parse(int fd)
 	return 0;
 }
 
-int send_usercount_tochar(int tid, unsigned int tick, int id, int data) {
+int send_usercount_tochar(int tid, unsigned int tick, int id, int data)
+{
 	int count;
 	static int last_count = 0;
 
@@ -1497,9 +1479,9 @@ int send_usercount_tochar(int tid, unsigned int tick, int id, int data) {
 /*==========================================
  * timer関数
  * 今このmap鯖に繋がっているクライアント人数をchar鯖へ送る
- *------------------------------------------
- */
-int send_users_tochar(int tid, unsigned int tick, int id, int data) {
+ *------------------------------------------*/
+int send_users_tochar(int tid, unsigned int tick, int id, int data)
+{
 	int count, users=0, i;
 	struct map_session_data **all_sd;
 
@@ -1523,9 +1505,9 @@ int send_users_tochar(int tid, unsigned int tick, int id, int data) {
 /*==========================================
  * timer関数
  * char鯖との接続を確認し、もし切れていたら再度接続する
- *------------------------------------------
- */
-int check_connect_char_server(int tid, unsigned int tick, int id, int data) {
+ *------------------------------------------*/
+int check_connect_char_server(int tid, unsigned int tick, int id, int data)
+{
 	static int displayed = 0;
 	if (char_fd <= 0 || session[char_fd] == NULL) {
 		if (!displayed) {
@@ -1567,7 +1549,8 @@ int check_connect_char_server(int tid, unsigned int tick, int id, int data) {
 	return 0;
 }
 
-int auth_db_final(DBKey k,void *d,va_list ap) {
+int auth_db_final(DBKey k,void *d,va_list ap)
+{
 	struct auth_node *node=(struct auth_node*)d;
 	if (node->char_dat)
 		aFree(node->char_dat);
@@ -1576,8 +1559,7 @@ int auth_db_final(DBKey k,void *d,va_list ap) {
 
 /*==========================================
  * 終了
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_final_chrif(void)
 {
 	if (char_fd > 0)
@@ -1588,8 +1570,7 @@ int do_final_chrif(void)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_chrif(void)
 {
 	add_timer_func_list(check_connect_char_server, "check_connect_char_server");

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 162 - 202
src/map/clif.c


+ 6 - 6
src/map/guild.c

@@ -86,8 +86,7 @@ int guild_checkskill(struct guild *g,int id)
 
 /*==========================================
  * guild_skill_tree.txt reading - from jA [Komurka]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int guild_read_guildskill_tree_db(void)
 {
 	int i,k,id=0,ln=0;
@@ -131,8 +130,7 @@ int guild_read_guildskill_tree_db(void)
 
 /*==========================================
  * Guild skill check - from jA [Komurka]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int guild_check_skill_require(struct guild *g,int id)
 {
 	int i;
@@ -1118,7 +1116,8 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
 	return 0;
 }
 
-static void* create_expcache(DBKey key, va_list args) {
+static void* create_expcache(DBKey key, va_list args)
+{
 	struct guild_expcache *c;
 	struct map_session_data *sd = va_arg(args, struct map_session_data*);
 
@@ -1233,7 +1232,8 @@ int guild_get_alliance_count(struct guild *g,int flag)
 }
 
 // Blocks all guild skills which have a common delay time.
-void guild_block_skill(struct map_session_data *sd, int time) {
+void guild_block_skill(struct map_session_data *sd, int time)
+{
 	int skill_num[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
 	int i;
 	for (i = 0; i < 4; i++)

+ 24 - 12
src/map/intif.c

@@ -45,7 +45,8 @@ extern int char_fd;		// inter server
 //-----------------------------------------------------------------
 // inter serverへの送信
 
-int CheckForCharServer(void) {
+int CheckForCharServer(void)
+{
 	return ((char_fd <= 0) || session[char_fd] == NULL || session[char_fd]->wdata == NULL);
 }
 
@@ -176,7 +177,8 @@ int intif_announce(const char* mes,int len, unsigned long color, int flag)
 }
 
 // The transmission of Wisp/Page to inter-server (player not found on this server)
-int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int mes_len) {
+int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int mes_len)
+{
 	nullpo_retr(0, sd);
 	if (CheckForCharServer())
 		return 0;
@@ -202,7 +204,8 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int me
 }
 
 // The reply of Wisp/page
-int intif_wis_replay(int id, int flag) {
+int intif_wis_replay(int id, int flag)
+{
 	if (CheckForCharServer())
 		return 0;
 	WFIFOHEAD(inter_fd,7);
@@ -218,7 +221,8 @@ int intif_wis_replay(int id, int flag) {
 }
 
 // The transmission of GM only Wisp/Page from server to inter-server
-int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes) {
+int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes)
+{
 	int mes_len;
 	if (CheckForCharServer())
 		return 0;
@@ -237,7 +241,8 @@ int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes) {
 	return 0;
 }
 
-int intif_regtostr(char* str, struct global_reg *reg, int qty) {
+int intif_regtostr(char* str, struct global_reg *reg, int qty)
+{
 	int len =0, i;
 
 	for (i = 0; i < qty; i++) {
@@ -837,8 +842,9 @@ int intif_homunculus_requestdelete(int homun_id)
 //-----------------------------------------------------------------
 // Packets receive from inter server
 
-// Wisp/Page reception
-int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
+// Wisp/Page reception // rewritten by [Yor]
+int intif_parse_WisMessage(int fd)
+{ 
 	struct map_session_data* sd;
 	char *wisp_source;
 	char name[NAME_LENGTH];
@@ -876,7 +882,8 @@ int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
 }
 
 // Wisp/page transmission result reception
-int intif_parse_WisEnd(int fd) {
+int intif_parse_WisEnd(int fd)
+{
 	struct map_session_data* sd;
 	RFIFOHEAD(fd);
 
@@ -889,7 +896,8 @@ int intif_parse_WisEnd(int fd) {
 	return 0;
 }
 
-static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) {
+static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va)
+{
 	int min_gm_level = va_arg(va, int);
 	char *wisp_name;
 	char *message;
@@ -903,7 +911,9 @@ static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) {
 }
 
 // Received wisp message from map-server via char-server for ALL gm
-int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
+// 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
+int mapif_parse_WisToGM(int fd)
+{
 	int min_gm_level, mes_len;
 	char Wisp_name[NAME_LENGTH];
 	char mbuf[255];
@@ -927,7 +937,8 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 <packet_len>.w <wispname>.24B
 }
 
 // アカウント変数通知
-int intif_parse_Registers(int fd) {
+int intif_parse_Registers(int fd)
+{
 	int j,p,len,max, flag;
 	struct map_session_data *sd;
 	struct global_reg *reg;
@@ -979,7 +990,8 @@ int intif_parse_Registers(int fd) {
 }
 
 // 倉庫データ受信
-int intif_parse_LoadStorage(int fd) {
+int intif_parse_LoadStorage(int fd)
+{
 	struct storage *stor;
 	struct map_session_data *sd;
 	RFIFOHEAD(fd);

+ 12 - 6
src/map/irc.c

@@ -366,7 +366,8 @@ void do_init_irc(void)
 }
 
 //NAMES Packet(353) parser [Zido]
-int parse_names_packet(char *str) {
+int parse_names_packet(char *str)
+{
 	char *tok;
 	char source[256];
 	char numeric[10];
@@ -395,7 +396,8 @@ int parse_names_packet(char *str) {
 }
 
 //User access level prefix parser [Zido]
-int parse_names(char *str) {
+int parse_names(char *str)
+{
 	char *tok;
 	if (str == NULL)  return 0; //Nothing to parse!
 	tok=strtok(str," ");
@@ -447,7 +449,8 @@ int parse_names(char *str) {
 }
 
 //Store user's access level [Zido]
-int set_access(char *nick,int newlevel) {
+int set_access(char *nick,int newlevel)
+{
 	int i=0;
 	
 	for(i=0;i<=MAX_CHANNEL_USERS;i++) {
@@ -465,7 +468,8 @@ int set_access(char *nick,int newlevel) {
 }
 
 //Returns users access level [Zido]
-int get_access(char *nick) {
+int get_access(char *nick)
+{
 	int i=0;
 	
 	for(i=0;i<=MAX_CHANNEL_USERS;i++) {
@@ -477,7 +481,8 @@ int get_access(char *nick) {
 	return -1;
 }
 
-int irc_rmnames() {
+int irc_rmnames()
+{
 	int i=0;
 	
 	for(i=0;i<=MAX_CHANNEL_USERS;i++) {
@@ -491,7 +496,8 @@ int irc_rmnames() {
 	return 0;
 }
 
-int irc_read_conf(char *file) {
+int irc_read_conf(char *file)
+{
 	FILE *fp=NULL;
 	char w1[256];
 	char w2[256];

+ 31 - 50
src/map/itemdb.c

@@ -23,8 +23,7 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist
 
 /*==========================================
  * 名前で検索用
- *------------------------------------------
- */
+ *------------------------------------------*/
 // name = item alias, so we should find items aliases first. if not found then look for "jname" (full name)
 int itemdb_searchname_sub(DBKey key,void *data,va_list ap)
 {
@@ -49,8 +48,7 @@ int itemdb_searchname_sub(DBKey key,void *data,va_list ap)
 
 /*==========================================
  * 名前で検索
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct item_data* itemdb_searchname(const char *str)
 {
 	struct item_data *item=NULL, *item2=NULL;
@@ -75,8 +73,7 @@ static int itemdb_searchname_array_sub(DBKey key,void * data,va_list ap)
 
 /*==========================================
  * Founds up to N matches. Returns number of matches [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_searchname_array(struct item_data** data, int size, const char *str)
 {
 	return item_db->getall(item_db,(void**)data,size,itemdb_searchname_array_sub,str);
@@ -85,8 +82,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str)
 
 /*==========================================
  * 箱系アイテム検索
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_searchrandomid(int group)
 {
 	if(group<1 || group>=MAX_ITEMGROUP) {
@@ -124,8 +120,7 @@ int itemdb_group_bonus(const int itemgrouphealrate[MAX_ITEMGROUP], int itemid)
 
 /*==========================================
  * DBの存在確認
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct item_data* itemdb_exists(int nameid)
 {
 	struct item_data* id;
@@ -140,8 +135,7 @@ struct item_data* itemdb_exists(int nameid)
 /*==========================================
  * Converts the jobid from the format in itemdb 
  * to the format used by the map server. [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
 {
 	int i;
@@ -199,7 +193,8 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
 		bclass[0] |= 1<<MAPID_NINJA;
 }
 
-static void create_dummy_data(void) {
+static void create_dummy_data(void)
+{
 	memset(&dummy_item, 0, sizeof(struct item_data));
 	dummy_item.nameid=500;
 	dummy_item.weight=1;
@@ -210,7 +205,8 @@ static void create_dummy_data(void) {
 	dummy_item.view_id = UNKNOWN_ITEM_ID;
 }
 
-static void* create_item_data(DBKey key, va_list args) {
+static void* create_item_data(DBKey key, va_list args)
+{
 	struct item_data *id;
 	id=(struct item_data *)aCalloc(1,sizeof(struct item_data));
 	id->nameid = key.i;
@@ -221,8 +217,7 @@ static void* create_item_data(DBKey key, va_list args) {
 
 /*==========================================
  * Loads (and creates if not found) an item from the db.
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct item_data* itemdb_load(int nameid)
 {
 	struct item_data *id = idb_ensure(item_db,nameid,create_item_data);
@@ -237,7 +232,8 @@ struct item_data* itemdb_load(int nameid)
 	return id;
 }
 
-static void* return_dummy_data(DBKey key, va_list args) {
+static void* return_dummy_data(DBKey key, va_list args)
+{
 	if (battle_config.error_log)
 		ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i);
 	dummy_item.nameid = key.i;
@@ -246,8 +242,7 @@ static void* return_dummy_data(DBKey key, va_list args) {
 
 /*==========================================
  * Loads an item from the db. If not found, it will return the dummy item.
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct item_data* itemdb_search(int nameid)
 {
 	return idb_ensure(item_db,nameid,return_dummy_data);
@@ -255,8 +250,7 @@ struct item_data* itemdb_search(int nameid)
 
 /*==========================================
  * Returns if given item is a player-equippable piece.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isequip(int nameid)
 {
 	int type=itemdb_type(nameid);
@@ -272,8 +266,7 @@ int itemdb_isequip(int nameid)
 
 /*==========================================
  * Alternate version of itemdb_isequip
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isequip2(struct item_data *data)
 { 
 	nullpo_retr(0, data);
@@ -288,9 +281,8 @@ int itemdb_isequip2(struct item_data *data)
 }
 
 /*==========================================
-* Returns if given item's type is stackable.
-*------------------------------------------
-*/
+ * Returns if given item's type is stackable.
+ *------------------------------------------*/
 int itemdb_isstackable(int nameid)
 {
   int type=itemdb_type(nameid);
@@ -306,9 +298,8 @@ int itemdb_isstackable(int nameid)
 }
 
 /*==========================================
-* Alternate version of itemdb_isstackable
-*------------------------------------------
-*/
+ * Alternate version of itemdb_isstackable
+ *------------------------------------------*/
 int itemdb_isstackable2(struct item_data *data)
 {
   nullpo_retr(0, data);
@@ -326,8 +317,7 @@ int itemdb_isstackable2(struct item_data *data)
 
 /*==========================================
  * Trade Restriction functions [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isdropable_sub(struct item_data *item, int gmlv, int unused)
 {
 	return (item && (!(item->flag.trade_restriction&1) || gmlv >= item->gm_lv_trade_override));
@@ -384,8 +374,7 @@ int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(stru
 
 /*==========================================
  *	Specifies if item-type should drop unidentified.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int itemdb_isidentified(int nameid)
 {
 	int type=itemdb_type(nameid);
@@ -401,8 +390,7 @@ int itemdb_isidentified(int nameid)
 
 /*==========================================
  * アイテム使用可能フラグのオーバーライド
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_read_itemavail (void)
 {
 	FILE *fp;
@@ -520,8 +508,7 @@ static void itemdb_read_itemgroup(void)
 
 /*==========================================
  * 装備制限ファイル読み出し
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_read_noequip(void)
 {
 	FILE *fp;
@@ -566,8 +553,7 @@ static int itemdb_read_noequip(void)
 
 /*==========================================
  * Reads item trade restrictions [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_read_itemtrade(void)
 {
 	FILE *fp;
@@ -612,8 +598,7 @@ static int itemdb_read_itemtrade(void)
 
 /*======================================
  * Applies gender restrictions according to settings. [Skotlex]
- *======================================
- */
+ *======================================*/
 static int itemdb_gendercheck(struct item_data *id)
 {
 	if (id->nameid == WEDDING_RING_M) //Grom Ring
@@ -630,9 +615,8 @@ static int itemdb_gendercheck(struct item_data *id)
 #ifndef TXT_ONLY
 
 /*======================================
-* SQL
-*===================================
-*/
+ * SQL
+ *======================================*/
 static int itemdb_read_sqldb(void)
 {
 	unsigned short nameid;
@@ -812,8 +796,7 @@ static int itemdb_read_sqldb(void)
 
 /*==========================================
  * アイテムデータベースの読み込み
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_readdb(void)
 {
 	FILE *fp;
@@ -989,8 +972,7 @@ static int itemdb_readdb(void)
 
 /*====================================
  * Removed item_value_db, don't re-add
- *------------------------------------
- */
+ *------------------------------------*/
 static void itemdb_read(void)
 {
 #ifndef TXT_ONLY
@@ -1008,8 +990,7 @@ static void itemdb_read(void)
 
 /*==========================================
  * Initialize / Finalize
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int itemdb_final_sub (DBKey key,void *data,va_list ap)
 {
 	int flag;

+ 2 - 1
src/map/log.c

@@ -42,7 +42,8 @@ time_t curtime;
 //12 - Log rare items (if their drop chance <= rare_log )
 
 //check if this item should be logged according the settings
-int should_log_item(int filter, int nameid, int amount) {
+int should_log_item(int filter, int nameid, int amount)
+{
 	struct item_data *item_data;
 	if ((item_data= itemdb_exists(nameid)) == NULL) return 0;
 	if ((filter&1) || // Filter = 1, we log any item

+ 176 - 176
src/map/map.c

@@ -176,8 +176,7 @@ int enable_grf = 0;	//To enable/disable reading maps from GRF files, bypassing m
 /*==========================================
  * 全map鯖?計での接??設定
  * (char鯖から送られてくる)
- *------------------------------------------
- */
+ *------------------------------------------*/
 void map_setusers(int fd)
 {
 	RFIFOHEAD(fd);
@@ -191,14 +190,15 @@ void map_setusers(int fd)
 
 /*==========================================
  * 全map鯖?計での接??取得 (/wへの?答用)
- *------------------------------------------
- */
-int map_getusers(void) {
+ *------------------------------------------*/
+int map_getusers(void)
+{
 	return map_users;
 }
 
 //Distance functions, taken from http://www.flipcode.com/articles/article_fastdistance.shtml
-int check_distance(int dx, int dy, int distance) {
+int check_distance(int dx, int dy, int distance)
+{
 #ifdef CIRCULAR_AREA
 	//In this case, we just do a square comparison. Add 1 tile grace for diagonal range checks.
 	return (dx*dx + dy*dy <= distance*distance + (dx&&dy?1:0));
@@ -209,7 +209,8 @@ int check_distance(int dx, int dy, int distance) {
 #endif
 }
 
-unsigned int distance(int dx, int dy) {
+unsigned int distance(int dx, int dy)
+{
 #ifdef CIRCULAR_AREA
 	unsigned int min, max;
 
@@ -244,8 +245,7 @@ unsigned int distance(int dx, int dy) {
 /*==========================================
  * blockをfreeするときfreeの?わりに呼ぶ
  * ロックされているときはバッファにためる
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_freeblock (struct block_list *bl)
 {
 	nullpo_retr(block_free_lock, bl);
@@ -264,8 +264,7 @@ int map_freeblock (struct block_list *bl)
 }
 /*==========================================
  * blockのfreeを一市Iに禁止する
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_freeblock_lock (void)
 {
 	return ++block_free_lock;
@@ -275,8 +274,7 @@ int map_freeblock_lock (void)
  * blockのfreeのロックを解除する
  * このとき、ロックが完全になくなると
  * バッファにたまっていたblockを全部削除
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_freeblock_unlock (void)
 {
 	if ((--block_free_lock) == 0) {
@@ -318,16 +316,14 @@ int map_freeblock_timer (int tid, unsigned int tick, int id, int data)
 /*==========================================
  * map[]のblock_listから?がっている場合に
  * bl->prevにbl_headのアドレスを入れておく
- *------------------------------------------
- */
+ *------------------------------------------*/
 static struct block_list bl_head;
 
 #ifdef CELL_NOSTACK
 /*==========================================
  * These pair of functions update the counter of how many objects
  * lie on a tile.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void map_addblcell(struct block_list *bl)
 {
 	if(bl->m<0 || bl->x<0 || bl->x>=map[bl->m].xs
@@ -350,8 +346,7 @@ void map_delblcell(struct block_list *bl)
  * Adds a block to the map.
  * If flag is 1, then the block was just added
  * otherwise it is part of a transition.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_addblock_sub (struct block_list *bl, int flag)
 {
 	int m, x, y, pos;
@@ -410,8 +405,7 @@ int map_addblock_sub (struct block_list *bl, int flag)
  * Removes a block from the map.
  * If flag is 1, then the block is removed for good
  * otherwise it is part of a transition.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_delblock_sub (struct block_list *bl, int flag)
 {
 	int b;
@@ -463,9 +457,9 @@ int map_delblock_sub (struct block_list *bl, int flag)
  * Moves a block a x/y target position. [Skotlex]
  * Pass flag as 1 to prevent doing skill_unit_move checks
  * (which are executed by default on BL_CHAR types)
- *------------------------------------------
- */
-int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) {
+ *------------------------------------------*/
+int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
+{
 	int x0 = bl->x, y0 = bl->y;
 	struct status_change *sc = NULL;
 	int moveblock = ( x0/BLOCK_SIZE != x1/BLOCK_SIZE || y0/BLOCK_SIZE != y1/BLOCK_SIZE);
@@ -523,8 +517,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) {
 	
 /*==========================================
  * 周?のPC人?を?える (unused)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_countnearpc (int m, int x, int y)
 {
 	int bx, by, c = 0;
@@ -552,9 +545,9 @@ int map_countnearpc (int m, int x, int y)
 
 /*==========================================
  * Counts specified number of objects on given cell.
- *------------------------------------------
- */
-int map_count_oncell(int m, int x, int y, int type) {
+ *------------------------------------------*/
+int map_count_oncell(int m, int x, int y, int type)
+{
 	int bx,by;
 	struct block_list *bl=NULL;
 	int i,c;
@@ -615,10 +608,9 @@ struct skill_unit *map_find_skill_unit_oncell(struct block_list *target,int x,in
 
 /*==========================================
  * Adapted from foreachinarea for an easier invocation. [Skotlex]
- *------------------------------------------
- */
-
-int map_foreachinrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...) {
+ *------------------------------------------*/
+int map_foreachinrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...)
+{
 	va_list ap;
 	int bx,by,m;
 	int returnCount =0;	//total sum of returned values of func() [Skotlex]
@@ -690,9 +682,9 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list),struct block_list
 
 /*==========================================
  * Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex]
- *------------------------------------------
- */
-int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...) {
+ *------------------------------------------*/
+int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...)
+{
 	va_list ap;
 	int bx,by,m;
 	int returnCount =0;	//total sum of returned values of func() [Skotlex]
@@ -770,9 +762,9 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
  * map m (x0,y0)-(x1,y1)?の全objに?して
  * funcを呼ぶ
  * type!=0 ならその種類のみ
- *------------------------------------------
- */
-int map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int type,...) {
+ *------------------------------------------*/
+int map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int type,...)
+{
 	va_list ap;
 	int bx,by;
 	int returnCount =0;	//total sum of returned values of func() [Skotlex]
@@ -846,9 +838,9 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int y
  * ?してfuncを呼ぶ
  *
  * dx,dyは-1,0,1のみとする(どんな値でもいいっぽい?)
- *------------------------------------------
- */
-int map_foreachinmovearea(int (*func)(struct block_list*,va_list),struct block_list *center,int range, int dx,int dy,int type,...) {
+ *------------------------------------------*/
+int map_foreachinmovearea(int (*func)(struct block_list*,va_list),struct block_list *center,int range, int dx,int dy,int type,...)
+{
 	int bx,by,m;
 	int returnCount =0;  //total sum of returned values of func() [Skotlex]
 	struct block_list *bl=NULL;
@@ -986,7 +978,8 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list),struct block_l
 //			 which only checks the exact single x/y passed to it rather than an
 //			 area radius - may be more useful in some instances)
 //
-int map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y,int type,...) {
+int map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y,int type,...)
+{
 	int bx,by;
 	int returnCount =0;  //total sum of returned values of func() [Skotlex]
 	struct block_list *bl=NULL;
@@ -1042,8 +1035,7 @@ int map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y,
 
 /*============================================================
 * For checking a path between two points (x0, y0) and (x1, y1)
-*------------------------------------------------------------
- */
+*------------------------------------------------------------*/
 int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int range,int type,...)
 {
 	int returnCount =0;  //total sum of returned values of func() [Skotlex]
@@ -1224,7 +1216,8 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y
 }
 
 // Copy of map_foreachincell, but applied to the whole map. [Skotlex]
-int map_foreachinmap(int (*func)(struct block_list*,va_list),int m,int type,...) {
+int map_foreachinmap(int (*func)(struct block_list*,va_list),int m,int type,...)
+{
 	int b, bsize;
 	int returnCount =0;  //total sum of returned values of func() [Skotlex]
 	struct block_list *bl=NULL;
@@ -1283,9 +1276,9 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list),int m,int type,...)
  * object[]への保存とid_db登?まで
  *
  * bl->idもこの中で設定して問題無い?
- *------------------------------------------
- */
-int map_addobject(struct block_list *bl) {
+ *------------------------------------------*/
+int map_addobject(struct block_list *bl)
+{
 	int i;
 	if( bl == NULL ){
 		ShowWarning("map_addobject nullpo?\n");
@@ -1310,9 +1303,9 @@ int map_addobject(struct block_list *bl) {
 /*==========================================
  * 一三bjectの解放
  *	map_delobjectのfreeしないバ?ジョン
- *------------------------------------------
- */
-int map_delobjectnofree(int id) {
+ *------------------------------------------*/
+int map_delobjectnofree(int id)
+{
 	if(objects[id]==NULL)
 		return 0;
 
@@ -1335,9 +1328,9 @@ int map_delobjectnofree(int id) {
  * object dataのfree、object[]へのNULL代入
  *
  * addとの??性が無いのが?になる
- *------------------------------------------
- */
-int map_delobject(int id) {
+ *------------------------------------------*/
+int map_delobject(int id)
+{
 	struct block_list *obj = objects[id];
 
 	if(obj==NULL)
@@ -1352,9 +1345,9 @@ int map_delobject(int id) {
 /*==========================================
  * 全一三bj相手にfuncを呼ぶ
  *
- *------------------------------------------
- */
-void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) {
+ *------------------------------------------*/
+void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...)
+{
 	int i;
 	int blockcount=bl_list_count;
 	va_list ap;
@@ -1393,9 +1386,9 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) {
  *
  * 後者は、map_clearflooritem(id)へ
  * map.h?で#defineしてある
- *------------------------------------------
- */
-int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) {
+ *------------------------------------------*/
+int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data)
+{
 	struct flooritem_data *fitem=NULL;
 
 	fitem = (struct flooritem_data *)objects[id];
@@ -1418,9 +1411,9 @@ int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) {
  * (m,x,y) locates a random available free cell around the given coordinates
  * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success.
  * x and y are modified with the target cell when successful.
- *------------------------------------------
- */
-int map_searchrandfreecell(int m,int *x,int *y,int stack) {
+ *------------------------------------------*/
+int map_searchrandfreecell(int m,int *x,int *y,int stack)
+{
 	int free_cell,i,j;
 	int free_cells[9][2];
 
@@ -1464,9 +1457,9 @@ static int map_count_sub(struct block_list *bl,va_list ap)
  * &1 = random cell must be around given m,x,y, not around src
  * &2 = the target should be able to walk to the target tile.
  * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting)
- *------------------------------------------
- */
-int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx, int ry, int flag) {
+ *------------------------------------------*/
+int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx, int ry, int flag)
+{
 	int tries, spawn=0;
 	int bx, by;
 	int rx2 = 2*rx+1;
@@ -1534,10 +1527,10 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx
  *
  * item_dataはamount以外をcopyする
  * type flag: &1 MVP item. &2 do stacking check.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,struct map_session_data *first_sd,
-    struct map_session_data *second_sd,struct map_session_data *third_sd,int type) {
+    struct map_session_data *second_sd,struct map_session_data *third_sd,int type)
+{
 	int r;
 	unsigned int tick;
 	struct flooritem_data *fitem=NULL;
@@ -1595,16 +1588,18 @@ int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,struct
 	return fitem->bl.id;
 }
 
-static void* create_charid2nick(DBKey key, va_list args) {
+static void* create_charid2nick(DBKey key, va_list args)
+{
 	struct charid2nick *p;
 	p = (struct charid2nick *)aCallocA(1, sizeof (struct charid2nick));
 	return p;
 }
+
 /*==========================================
  * charid_dbへ追加(返信待ちがあれば返信)
- *------------------------------------------
- */
-void map_addchariddb(int charid, char *name) {
+ *------------------------------------------*/
+void map_addchariddb(int charid, char *name)
+{
 	struct charid2nick *p;
 	int req = 0;
 
@@ -1622,9 +1617,9 @@ void map_addchariddb(int charid, char *name) {
 
 /*==========================================
  * charid_dbへ追加(返信要求のみ)
- *------------------------------------------
- */
-int map_reqchariddb(struct map_session_data * sd,int charid) {
+ *------------------------------------------*/
+int map_reqchariddb(struct map_session_data * sd,int charid)
+{
 	struct charid2nick *p=NULL;
 
 	nullpo_retr(0, sd);
@@ -1639,9 +1634,9 @@ int map_reqchariddb(struct map_session_data * sd,int charid) {
 
 /*==========================================
  * id_dbへblを追加
- *------------------------------------------
- */
-void map_addiddb(struct block_list *bl) {
+ *------------------------------------------*/
+void map_addiddb(struct block_list *bl)
+{
 	nullpo_retv(bl);
 
 	if (bl->type == BL_PC)
@@ -1651,9 +1646,9 @@ void map_addiddb(struct block_list *bl) {
 
 /*==========================================
  * id_dbからblを削除
- *------------------------------------------
- */
-void map_deliddb(struct block_list *bl) {
+ *------------------------------------------*/
+void map_deliddb(struct block_list *bl)
+{
 	nullpo_retv(bl);
 
 	if (bl->type == BL_PC)
@@ -1665,10 +1660,9 @@ void map_deliddb(struct block_list *bl) {
  * PCのquit?理 map.c?分
  *
  * quit?理の主?が違うような?もしてきた
- *------------------------------------------
- */
-int map_quit(struct map_session_data *sd) {
-
+ *------------------------------------------*/
+int map_quit(struct map_session_data *sd)
+{
 	if(!sd->state.auth) { //Removing a player that hasn't even finished loading
 		TBL_PC *sd2 = map_id2sd(sd->status.account_id);
 		if (sd->pd) unit_free(&sd->pd->bl,-1);
@@ -1733,14 +1727,16 @@ int map_quit(struct map_session_data *sd) {
 	return 0;
 }
 
-void map_quit_ack(struct map_session_data *sd) {
+void map_quit_ack(struct map_session_data *sd)
+{
 	if (sd && sd->state.finalsave) {
 		idb_remove(pc_db,sd->status.account_id);
 		aFree(sd);
 	}
 }
 
-static int do_reconnect_map_sub(DBKey key,void *data,va_list va) {
+static int do_reconnect_map_sub(DBKey key,void *data,va_list va)
+{
 	struct map_session_data *sd = (TBL_PC*)data;
 	if (sd->state.finalsave) {
 		sd->state.finalsave = 0;
@@ -1750,25 +1746,25 @@ static int do_reconnect_map_sub(DBKey key,void *data,va_list va) {
 	return 0;
 }
 
-void do_reconnect_map(void) {
+void do_reconnect_map(void)
+{
 	pc_db->foreach(pc_db,do_reconnect_map_sub);
 }
 
 /*==========================================
  * id番?のPCを探す。居なければNULL
- *------------------------------------------
- */
-struct map_session_data * map_id2sd(int id) {
-// Now using pc_db to handle all players, should be quicker than both previous methods at a small expense of more memory. [Skotlex]
+ *------------------------------------------*/
+struct map_session_data * map_id2sd(int id)
+{
 	if (id <= 0) return NULL;
 	return (struct map_session_data*)idb_get(pc_db,id);
 }
 
 /*==========================================
  * char_id番?の名前を探す
- *------------------------------------------
- */
-char * map_charid2nick(int id) {
+ *------------------------------------------*/
+char * map_charid2nick(int id)
+{
 	struct charid2nick *p = (struct charid2nick*)idb_get(charid_db,id);
 
 	if(p==NULL)
@@ -1776,7 +1772,8 @@ char * map_charid2nick(int id) {
 	return p->nick;
 }
 
-struct map_session_data * map_charid2sd(int id) {
+struct map_session_data * map_charid2sd(int id)
+{
 	int i, users;
 	struct map_session_data **all_sd;
 
@@ -1794,9 +1791,9 @@ struct map_session_data * map_charid2sd(int id) {
  * Search session data from a nick name
  * (without sensitive case if necessary)
  * return map_session_data pointer or NULL
- *------------------------------------------
- */
-struct map_session_data * map_nick2sd(const char *nick) {
+ *------------------------------------------*/
+struct map_session_data * map_nick2sd(const char *nick)
+{
 	int i, users;
 	struct map_session_data *pl_sd = NULL, **pl_allsd;
 
@@ -1835,8 +1832,7 @@ struct map_session_data * map_nick2sd(const char *nick) {
 /*==========================================
  * id番?の物を探す
  * 一三bjectの場合は配列を引くのみ
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct block_list * map_id2bl(int id)
 {
 	struct block_list *bl=NULL;
@@ -1861,9 +1857,9 @@ static int map_getallpc_sub(DBKey key,void * data,va_list ap)
  * Returns an array of all players in the server (includes non connected ones) [Skotlex]
  * The int pointer given returns the count of elements in the array.
  * If null is passed, it is requested that the memory be freed (for shutdown), and null is returned.
- *------------------------------------------
- */
-struct map_session_data** map_getallusers(int *users) {
+ *------------------------------------------*/
+struct map_session_data** map_getallusers(int *users)
+{
 	static struct map_session_data **all_sd=NULL;
 	static unsigned int all_count = 0;
 
@@ -1893,7 +1889,8 @@ struct map_session_data** map_getallusers(int *users) {
 	return all_sd;
 }
 
-void map_foreachpc(int (*func)(DBKey,void*,va_list),...) {
+void map_foreachpc(int (*func)(DBKey,void*,va_list),...)
+{
 	va_list ap;
 	va_start(ap,func);
 	pc_db->vforeach(pc_db,func,ap);
@@ -1902,9 +1899,9 @@ void map_foreachpc(int (*func)(DBKey,void*,va_list),...) {
 
 /*==========================================
  * id_db?の全てにfuncを?行
- *------------------------------------------
- */
-int map_foreachiddb(int (*func)(DBKey,void*,va_list),...) {
+ *------------------------------------------*/
+int map_foreachiddb(int (*func)(DBKey,void*,va_list),...)
+{
 	va_list ap;
 
 	va_start(ap,func);
@@ -1915,9 +1912,9 @@ int map_foreachiddb(int (*func)(DBKey,void*,va_list),...) {
 
 /*==========================================
  * map.npcへ追加 (warp等の領域持ちのみ)
- *------------------------------------------
- */
-int map_addnpc(int m,struct npc_data *nd) {
+ *------------------------------------------*/
+int map_addnpc(int m,struct npc_data *nd)
+{
 	int i;
 	if(m<0 || m>=map_num)
 		return -1;
@@ -1942,7 +1939,8 @@ int map_addnpc(int m,struct npc_data *nd) {
 	return i;
 }
 
-void map_removenpc(void) {
+void map_removenpc(void)
+{
 	int i,m,n=0;
 
 	for(m=0;m<map_num;m++) {
@@ -1967,9 +1965,7 @@ void map_removenpc(void) {
 
 /*=========================================
  * Dynamic Mobs [Wizputer]
- *-----------------------------------------
- */
-
+ *-----------------------------------------*/
 // allocates a struct when it there is place free in the cache,
 // and returns NULL otherwise
 // -- i'll just leave the old code in case it's needed ^^;
@@ -2007,7 +2003,8 @@ void map_spawnmobs(int m)
 	}
 }
 
-int mob_cache_cleanup_sub(struct block_list *bl, va_list ap) {
+int mob_cache_cleanup_sub(struct block_list *bl, va_list ap)
+{
 	struct mob_data *md = (struct mob_data *)bl;
 	nullpo_retr(0, md);
 
@@ -2064,9 +2061,9 @@ void map_removemobs(int m)
 
 /*==========================================
  * map名からmap番?へ?換
- *------------------------------------------
- */
-int map_mapname2mapid(const char* name) {
+ *------------------------------------------*/
+int map_mapname2mapid(const char* name)
+{
 	unsigned short map_index;
 	map_index = mapindex_name2id(name);
 	if (!map_index)
@@ -2076,9 +2073,9 @@ int map_mapname2mapid(const char* name) {
 
 /*==========================================
  * Returns the map of the given mapindex. [Skotlex]
- *------------------------------------------
- */
-int map_mapindex2mapid(unsigned short mapindex) {
+ *------------------------------------------*/
+int map_mapindex2mapid(unsigned short mapindex)
+{
 	struct map_data *md=NULL;
 	
 	if (!mapindex)
@@ -2107,9 +2104,9 @@ int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port)
 
 /*==========================================
  * Checks if both dirs point in the same direction.
- *------------------------------------------
- */
-int map_check_dir(int s_dir,int t_dir) {
+ *------------------------------------------*/
+int map_check_dir(int s_dir,int t_dir)
+{
 	if(s_dir == t_dir)
 		return 0;
 	switch(s_dir) {
@@ -2152,9 +2149,9 @@ int map_check_dir(int s_dir,int t_dir) {
 /*==========================================
  * Returns the direction of the given cell in absolute relation to the char
  * (regardless of where the char is facing)
- *------------------------------------------
- */
-int map_calc_dir( struct block_list *src,int x,int y) {
+ *------------------------------------------*/
+int map_calc_dir( struct block_list *src,int x,int y)
+{
 	int dir=0;
 	int dx,dy;
 
@@ -2187,9 +2184,9 @@ int map_calc_dir( struct block_list *src,int x,int y) {
 /*==========================================
  * Randomizes target cell x,y to a random walkable cell that 
  * has the same distance from object as given coordinates do. [Skotlex]
- *------------------------------------------
- */
-int map_random_dir(struct block_list *bl, short *x, short *y) {
+ *------------------------------------------*/
+int map_random_dir(struct block_list *bl, short *x, short *y)
+{
 	struct walkpath_data wpd;
 	short xi = *x-bl->x;
 	short yi = *y-bl->y;
@@ -2221,9 +2218,7 @@ int map_random_dir(struct block_list *bl, short *x, short *y) {
 // gat系
 /*==========================================
  * (m,x,y)の状態を調べる
- *------------------------------------------
- */
-
+ *------------------------------------------*/
 int map_getcell(int m,int x,int y,cell_t cellchk)
 {
 	return (m < 0 || m >= MAX_MAP_PER_SERVER) ? 0 : map_getcellp(&map[m],x,y,cellchk);
@@ -2300,8 +2295,7 @@ int map_getcellp(struct map_data* m,int x,int y,cell_t cellchk)
 
 /*==========================================
  * (m,x,y)の状態を設定する
- *------------------------------------------
- */
+ *------------------------------------------*/
 void map_setcell(int m,int x,int y,int cell)
 {
 	int j;
@@ -2354,7 +2348,8 @@ void map_setcell(int m,int x,int y,int cell)
 			break;
 	}
 }
-static void* create_map_data_other_server(DBKey key, va_list args) {
+static void* create_map_data_other_server(DBKey key, va_list args)
+{
 	struct map_data_other_server *mdos;
 	unsigned short mapindex = (unsigned short)key.ui;
 	mdos=(struct map_data_other_server *)aCalloc(1,sizeof(struct map_data_other_server));
@@ -2362,10 +2357,10 @@ static void* create_map_data_other_server(DBKey key, va_list args) {
 	memcpy(mdos->name, mapindex_id2name(mapindex), MAP_NAME_LENGTH);
 	return mdos;
 }
+
 /*==========================================
  * 他鯖管理のマップをdbに追加
  *------------------------------------------*/
-
 int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
 {
 	struct map_data_other_server *mdos=NULL;
@@ -2386,9 +2381,9 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
 
 /*==========================================
  * 他鯖管理のマップを全て削除
- *------------------------------------------
- */
-int map_eraseallipport_sub(DBKey key,void *data,va_list va) {
+ *------------------------------------------*/
+int map_eraseallipport_sub(DBKey key,void *data,va_list va)
+{
 	struct map_data_other_server *mdos = (struct map_data_other_server*)data;
 	if(mdos->gat == NULL) {
 		db_remove(map_db,key);
@@ -2397,7 +2392,8 @@ int map_eraseallipport_sub(DBKey key,void *data,va_list va) {
 	return 0;
 }
 
-int map_eraseallipport(void) {
+int map_eraseallipport(void)
+{
 	map_db->foreach(map_db,map_eraseallipport_sub);
 	return 1;
 }
@@ -2424,7 +2420,6 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
 /*==========================================
 * Map cache reading
 *===========================================*/
-
 int map_readfromcache(struct map_data *m, FILE *fp)
 {
 	int i;
@@ -2458,7 +2453,8 @@ int map_readfromcache(struct map_data *m, FILE *fp)
 	return 0;
 }
 
-int map_addmap(char *mapname) {
+int map_addmap(char *mapname)
+{
 	if (strcmpi(mapname,"clear")==0) {
 		map_num=0;
 		return 0;
@@ -2482,8 +2478,8 @@ static void map_delmapid(int id)
 	map_num--;
 }
 
-int map_delmap(char *mapname) {
-
+int map_delmap(char *mapname)
+{
 	int i;
 
 	if (strcmpi(mapname, "all") == 0) {
@@ -2510,7 +2506,8 @@ int map_delmap(char *mapname) {
  * Assumed path for file is data/mapname.rsw
  * Credits to LittleWolf
  */
-int map_waterheight(char *mapname) {
+int map_waterheight(char *mapname)
+{
 	char fn[256];
  	char *rsw, *found;
 	float whtemp;
@@ -2549,8 +2546,7 @@ int map_waterheight(char *mapname) {
 
 /*==================================
  * .GAT format
- *----------------------------------
- */
+ *----------------------------------*/
 int map_readgat (struct map_data *m)
 {
 	char fn[256];
@@ -2590,8 +2586,7 @@ int map_readgat (struct map_data *m)
 
 /*======================================
  * Initiate maps loading stage
- *--------------------------------------
- */
+ *--------------------------------------*/
 int map_readallmaps (void)
 {
 	int i;
@@ -2709,8 +2704,7 @@ static int char_ip_set = 0;
 
 /*==========================================
  * Console Command Parser [Wizputer]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int parse_console(char* buf)
 {
 	char type[64];
@@ -2774,9 +2768,9 @@ int parse_console(char* buf)
 
 /*==========================================
  * 設定ファイルを?み?む
- *------------------------------------------
- */
-int map_config_read(char *cfgName) {
+ *------------------------------------------*/
+int map_config_read(char *cfgName)
+{
 	char line[1024], w1[1024], w2[1024], *ptr;
 	FILE *fp;
 
@@ -2970,8 +2964,8 @@ int inter_config_read(char *cfgName)
 /*=======================================
  *  MySQL Init
  *---------------------------------------*/
-int map_sql_init(void){
-
+int map_sql_init(void)
+{
 	mysql_init(&mmysql_handle);
 
 	//DB connection start
@@ -3014,7 +3008,8 @@ int map_sql_init(void){
 	return 0;
 }
 
-int map_sql_close(void){
+int map_sql_close(void)
+{
 	mysql_close(&mmysql_handle);
 	ShowStatus("Close Map DB Connection....\n");
 
@@ -3027,8 +3022,8 @@ int map_sql_close(void){
 	return 0;
 }
 
-int log_sql_init(void){
-
+int log_sql_init(void)
+{
     mysql_init(&logmysql_handle);
 
 	//DB connection start
@@ -3099,6 +3094,7 @@ int map_db_final(DBKey k,void *d,va_list ap)
 		aFree(mdos);
 	return 0;
 }
+
 int nick_db_final(void *k,void *d,va_list ap)
 {
 	char *p = (char *) d;
@@ -3106,7 +3102,8 @@ int nick_db_final(void *k,void *d,va_list ap)
 	return 0;
 }
 
-int cleanup_sub(struct block_list *bl, va_list ap) {
+int cleanup_sub(struct block_list *bl, va_list ap)
+{
 	nullpo_retr(0, bl);
 
 	switch(bl->type) {
@@ -3133,11 +3130,13 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
 	return 1;
 }
 
-static int cleanup_db_sub(DBKey key,void *data,va_list va) {
+static int cleanup_db_sub(DBKey key,void *data,va_list va)
+{
 	return cleanup_sub((struct block_list*)data, NULL);
 }
 
-static int cleanup_db_subpc(DBKey key,void *data,va_list va) {
+static int cleanup_db_subpc(DBKey key,void *data,va_list va)
+{
 	struct map_session_data *sd = (TBL_PC*)data;
 	if (!sd->state.finalsave)
   	{	//Error?
@@ -3151,9 +3150,9 @@ static int cleanup_db_subpc(DBKey key,void *data,va_list va) {
 
 /*==========================================
  * map鯖終了・理
- *------------------------------------------
- */
-void do_final(void) {
+ *------------------------------------------*/
+void do_final(void)
+{
 	int i, j;
 	struct map_session_data **pl_allsd;
 
@@ -3241,7 +3240,8 @@ static int map_abort_sub(DBKey key,void * data,va_list ap)
 // Function called when the server
 // has received a crash signal.
 //------------------------------
-void do_abort(void) {
+void do_abort(void)
+{
 	//Save all characters and then flush the inter-connection.
 	if (!chrif_isconnect())
 	{
@@ -3256,9 +3256,9 @@ void do_abort(void) {
 
 /*======================================================
  * Map-Server Version Screen [MC Cameri]
- *------------------------------------------------------
- */
-void map_helpscreen(int flag) { // by MC Cameri
+ *------------------------------------------------------*/
+void map_helpscreen(int flag)
+{
 	puts("Usage: map-server [options]");
 	puts("Options:");
 	puts(CL_WHITE"  Commands\t\t\tDescription"CL_RESET);
@@ -3282,9 +3282,9 @@ void map_helpscreen(int flag) { // by MC Cameri
 
 /*======================================================
  * Map-Server Version Screen [MC Cameri]
- *------------------------------------------------------
- */
-void map_versionscreen(int flag) {
+ *------------------------------------------------------*/
+void map_versionscreen(int flag)
+{
 	printf("CL_WHITE" "eAthena version %d.%02d.%02d, Athena Mod version %d" CL_RESET"\n",
 		ATHENA_MAJOR_VERSION, ATHENA_MINOR_VERSION, ATHENA_REVISION,
 		ATHENA_MOD_VERSION);

+ 66 - 124
src/map/mob.c

@@ -60,8 +60,7 @@ static struct eri *item_drop_list_ers;
 
 /*==========================================
  * Local prototype declaration   (only required thing)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_makedummymobdb(int);
 static int mob_spawn_guardian_sub(int,unsigned int,int,int);
 int mobskill_use(struct mob_data *md,unsigned int tick,int event);
@@ -69,8 +68,7 @@ int mob_skillid2skillidx(int class_,int skillid);
 
 /*==========================================
  * Mob is searched with a name.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mobdb_searchname(const char *str)
 {
 	int i;
@@ -100,8 +98,7 @@ static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
 
 /*==========================================
  * Founds up to N matches. Returns number of matches [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mobdb_searchname_array(struct mob_db** data, int size, const char *str)
 {
 	int count = 0, i;
@@ -121,8 +118,7 @@ int mobdb_searchname_array(struct mob_db** data, int size, const char *str)
 
 /*==========================================
  * Id Mob is checked.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mobdb_checkid(const int id)
 {
 	if (mob_db(id) == mob_dummy)
@@ -134,8 +130,7 @@ int mobdb_checkid(const int id)
 
 /*==========================================
  * Returns the view data associated to this mob class.
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct view_data * mob_get_viewdata(int class_) 
 {
 	if (mob_db(class_) == mob_dummy)
@@ -144,9 +139,9 @@ struct view_data * mob_get_viewdata(int class_)
 }
 /*==========================================
  * Cleans up mob-spawn data to make it "valid"
- *------------------------------------------
- */
-int mob_parse_dataset(struct spawn_data *data) {
+ *------------------------------------------*/
+int mob_parse_dataset(struct spawn_data *data)
+{
 	int i;
 	//FIXME: This implementation is not stable, npc scripts will stop working once MAX_MOB_DB changes value! [Skotlex]
 	if(data->class_ > 2*MAX_MOB_DB){ // large/tiny mobs [Valaris]
@@ -197,8 +192,7 @@ int mob_parse_dataset(struct spawn_data *data) {
 }
 /*==========================================
  * Generates the basic mob data using the spawn_data provided.
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct mob_data* mob_spawn_dataset(struct spawn_data *data)
 {
 	struct mob_data *md = aCalloc(1, sizeof(struct mob_data));
@@ -244,10 +238,9 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data)
  * &4: Selected monster should not be a boss type
  * &8: Selected monster must give base exp.
  * lv: Mob level to check against
- *------------------------------------------
- */
-
-int mob_get_random_id(int type, int flag, int lv) {
+ *------------------------------------------*/
+int mob_get_random_id(int type, int flag, int lv)
+{
 	struct mob_db *mob;
 	int i=0, class_;
 	if(type < 0 || type >= MAX_RANDOMMONSTER) {
@@ -308,8 +301,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m,
 }
 /*==========================================
  * The MOB appearance for one time (for scripts)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_once_spawn (struct map_session_data *sd, const char *mapname,
 	short x, short y, const char *mobname, int class_, int amount, const char *event)
 {
@@ -361,8 +353,7 @@ int mob_once_spawn (struct map_session_data *sd, const char *mapname,
 }
 /*==========================================
  * The MOB appearance for one time (& area specification for scripts)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_once_spawn_area(struct map_session_data *sd,const char *mapname,
 	int x0,int y0,int x1,int y1,
 	const char *mobname,int class_,int amount,const char *event)
@@ -403,8 +394,7 @@ int mob_once_spawn_area(struct map_session_data *sd,const char *mapname,
 }
 /*==========================================
  * Set a Guardian's guild data [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_spawn_guardian_sub(int tid,unsigned int tick,int id,int data)
 {	//Needed because the guild_data may not be available at guardian spawn time.
 	struct block_list* bl = map_id2bl(id);
@@ -456,8 +446,7 @@ static int mob_spawn_guardian_sub(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  * Summoning Guardians [Valaris]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian)
 {
 	struct mob_data *md=NULL;
@@ -548,8 +537,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
  * - MSS_LOOT: Looking for item, path must be easy.
  * - MSS_RUSH: Chasing attacking player, path is complex
  * - MSS_FOLLOW: Initiative/support seek, path is complex
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_can_reach(struct mob_data *md,struct block_list *bl,int range, int state)
 {
 	int easy = 0;
@@ -571,8 +559,7 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range, int state
 
 /*==========================================
  * Links nearby mobs (supportive mobs)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_linksearch(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md;
@@ -603,8 +590,7 @@ int mob_linksearch(struct block_list *bl,va_list ap)
 
 /*==========================================
  * mob spawn with delay (timer function)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_delayspawn(int tid, unsigned int tick, int m, int n)
 {
 	struct block_list *bl = map_id2bl(m);
@@ -615,8 +601,7 @@ static int mob_delayspawn(int tid, unsigned int tick, int m, int n)
 
 /*==========================================
  * spawn timing calculation
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_setdelayspawn(struct mob_data *md)
 {
 	unsigned int spawntime, spawntime1, spawntime2, spawntime3;
@@ -647,8 +632,7 @@ static int mob_count_sub(struct block_list *bl,va_list ap)
 
 /*==========================================
  * Mob spawning. Initialization is also variously here.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_spawn (struct mob_data *md)
 {
 	int i=0;
@@ -723,8 +707,7 @@ int mob_spawn (struct mob_data *md)
 
 /*==========================================
  * Determines if the mob can change target. [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_can_changetarget(struct mob_data* md, struct block_list* target, int mode)
 {
 	// if the monster was provoked ignore the above rule [celest]
@@ -756,8 +739,7 @@ static int mob_can_changetarget(struct mob_data* md, struct block_list* target,
 
 /*==========================================
  * Determination for an attack of a monster
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_target(struct mob_data *md,struct block_list *bl,int dist)
 {
 	nullpo_retr(0, md);
@@ -781,8 +763,7 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist)
 
 /*==========================================
  * The ?? routine of an active monster
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md;
@@ -834,8 +815,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
 
 /*==========================================
  * chase target-change routine.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md;
@@ -864,8 +844,7 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
 
 /*==========================================
  * loot monster item search
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
 {
 	struct mob_data* md;
@@ -905,8 +884,7 @@ static int mob_ai_sub_hard_warpsearch(struct block_list *bl,va_list ap)
 }
 /*==========================================
  * Processing of slave monsters
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
 {
 	struct block_list *bl;
@@ -992,8 +970,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
  * This also triggers idle skill/movement since the AI can get stuck
  * when trying to pick new targets when the current chosen target is
  * unreachable.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_unlocktarget(struct mob_data *md,int tick)
 {
 	nullpo_retr(0, md);
@@ -1035,8 +1012,7 @@ int mob_unlocktarget(struct mob_data *md,int tick)
 }
 /*==========================================
  * Random walk
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_randomwalk(struct mob_data *md,int tick)
 {
 	const int retrycount=20;
@@ -1089,8 +1065,7 @@ int mob_randomwalk(struct mob_data *md,int tick)
 
 /*==========================================
  * AI of MOB whose is near a Player
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md;
@@ -1345,8 +1320,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
 
 /*==========================================
  * Serious processing for mob in PC field of view (foreachclient)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
 {
 	unsigned int tick;
@@ -1358,8 +1332,7 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
 
 /*==========================================
  * Negligent mode MOB AI (PC is not in near)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap)
 {
 	struct mob_data *md = (struct mob_data *)data;
@@ -1425,8 +1398,7 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap)
 
 /*==========================================
  * Negligent processing for mob outside PC field of view   (interval timer function)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_lazy(int tid,unsigned int tick,int id,int data)
 {
 	map_foreachiddb(mob_ai_sub_lazy,tick);
@@ -1435,8 +1407,7 @@ static int mob_ai_lazy(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  * Serious processing for mob in PC field of view   (interval timer function)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
 {
 
@@ -1450,8 +1421,7 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  * Initializes the delay drop structure for mob-dropped items.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static struct item_drop* mob_setdropitem(int nameid, int qty)
 {
 	struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop);
@@ -1465,8 +1435,7 @@ static struct item_drop* mob_setdropitem(int nameid, int qty)
 
 /*==========================================
  * Initializes the delay drop structure for mob-looted items.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static struct item_drop* mob_setlootitem(struct item* item)
 {
 	struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop);
@@ -1477,8 +1446,7 @@ static struct item_drop* mob_setlootitem(struct item* item)
 
 /*==========================================
  * item drop with delay (timer function)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data)
 {
 	struct item_drop_list *list;
@@ -1501,9 +1469,7 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data)
  * Sets the item_drop into the item_drop_list.
  * Also performs logging and autoloot if enabled.
  * rate is the drop-rate of the item, required for autoloot.
- *------------------------------------------
- * by [Skotlex]
- */
+ *------------------------------------------*/
 static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct item_drop *ditem, int loot, int drop_rate)
 {
 	if(log_config.enable_logs&0x10)
@@ -1576,8 +1542,7 @@ int mob_convertslave(struct mob_data *md)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_deleteslave_sub(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md;
@@ -1595,8 +1560,7 @@ int mob_deleteslave_sub(struct block_list *bl,va_list ap)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_deleteslave(struct mob_data *md)
 {
 	nullpo_retr(0, md);
@@ -1734,8 +1698,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage)
 
 /*==========================================
  * Signals death of mob. type&1 -> no drops, type&2 -> no exp
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_dead(struct mob_data *md, struct block_list *src, int type)
 {
 	struct status_data *status;
@@ -2322,8 +2285,7 @@ int mob_guardian_guildchange(struct block_list *bl,va_list ap)
 	
 /*==========================================
  * Pick a random class for the mob
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_random_class (int *value, size_t count)
 {
 	nullpo_retr(0, value);
@@ -2345,8 +2307,7 @@ int mob_random_class (int *value, size_t count)
 
 /*==========================================
  * Change mob base class
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_class_change (struct mob_data *md, int class_)
 {
 	unsigned int tick = gettick();
@@ -2413,8 +2374,7 @@ int mob_class_change (struct mob_data *md, int class_)
 
 /*==========================================
  * mob回復
- *------------------------------------------
- */
+ *------------------------------------------*/
 void mob_heal(struct mob_data *md,unsigned int heal)
 {
 	if(md->guardian_data && md->guardian_data->number < MAX_GUARDIANS)
@@ -2427,8 +2387,7 @@ void mob_heal(struct mob_data *md,unsigned int heal)
 
 /*==========================================
  * Added by RoVeRT
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_warpslave_sub(struct block_list *bl,va_list ap)
 {
 	struct mob_data *md=(struct mob_data *)bl;
@@ -2449,8 +2408,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
  * Added by RoVeRT
  * Warps slaves. Range is the area around the master that they can
  * appear in randomly.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_warpslave(struct block_list *bl, int range)
 {
 	if (range < 1)
@@ -2461,8 +2419,7 @@ int mob_warpslave(struct block_list *bl, int range)
 
 /*==========================================
  * 画面内の取り巻きの数計算用(foreachinarea)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_countslave_sub(struct block_list *bl,va_list ap)
 {
 	int id;
@@ -2477,16 +2434,15 @@ int mob_countslave_sub(struct block_list *bl,va_list ap)
 
 /*==========================================
  * 画面内の取り巻きの数計算
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_countslave(struct block_list *bl)
 {
 	return map_foreachinmap(mob_countslave_sub, bl->m, BL_MOB,bl->id);
 }
+
 /*==========================================
  * Summons amount slaves contained in the value[5] array using round-robin. [adapted by Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
 {
 	struct mob_data *md;
@@ -2585,8 +2541,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
 
 /*==========================================
  *MOBskillから該当skillidのskillidxを返す
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_skillid2skillidx(int class_,int skillid)
 {
 	int i, max = mob_db(class_)->maxskill;
@@ -2605,8 +2560,7 @@ int mob_skillid2skillidx(int class_,int skillid)
 
 /*==========================================
  * Friendly Mob whose HP is decreasing by a nearby MOB is looked for.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_getfriendhprate_sub(struct block_list *bl,va_list ap)
 {
 	int min_rate, max_rate,rate;
@@ -2648,8 +2602,7 @@ static struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,i
 }
 /*==========================================
  * Check hp rate of its master
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate)
 {
 	if (md && md->master_id > 0) {
@@ -2662,8 +2615,7 @@ struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate)
 }
 /*==========================================
  * What a status state suits by nearby MOB is looked for.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
 {
 	int cond1,cond2;
@@ -2696,6 +2648,7 @@ int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
 
 	return 0;
 }
+
 struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2)
 {
 	struct mob_data *fr=NULL;
@@ -2709,8 +2662,7 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2)
 
 /*==========================================
  * Skill use judging
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 {
 	struct mob_skill *ms;
@@ -2911,8 +2863,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 }
 /*==========================================
  * Skill use event processing
- *------------------------------------------
- */
+ *------------------------------------------*/
 int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tick, int flag)
 {
 	int target_id, res = 0;
@@ -3176,8 +3127,7 @@ int mob_script_callback(struct mob_data *md, struct block_list *target, short ac
 //
 /*==========================================
  * Since un-setting [ mob ] up was used, it is an initial provisional value setup.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_makedummymobdb(int class_)
 {
 	if (mob_dummy != NULL)
@@ -3459,8 +3409,7 @@ int mob_parse_dbrow(char** str)
 
 /*==========================================
  * mob_db.txt reading
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_readdb(void)
 {
 	FILE *fp;
@@ -3512,8 +3461,7 @@ static int mob_readdb(void)
 #ifndef TXT_ONLY
 /*==========================================
  * SQL reading
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_read_sqldb(void)
 {
 	char *mob_db_name[] = { mob_db_db, mob_db2_db };
@@ -3548,8 +3496,7 @@ static int mob_read_sqldb(void)
 
 /*==========================================
  * MOB display graphic change data reading
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_readdb_mobavail(void)
 {
 	FILE *fp;
@@ -3620,8 +3567,7 @@ static int mob_readdb_mobavail(void)
 
 /*==========================================
  * Reading of random monster data
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_read_randommonster(void)
 {
 	FILE *fp;
@@ -3670,8 +3616,7 @@ static int mob_read_randommonster(void)
 
 /*==========================================
  * mob_skill_db.txt reading
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_readskilldb(void)
 {
 	FILE *fp;
@@ -3960,8 +3905,7 @@ static int mob_readskilldb(void)
 }
 /*==========================================
  * mob_race_db.txt reading
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int mob_readdb_race(void)
 {
 	FILE *fp;
@@ -4035,8 +3979,7 @@ void mob_reload(void)
 
 /*==========================================
  * Circumference initialization of mob
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_mob(void)
 {	//Initialize the mob database
 	memset(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
@@ -4072,8 +4015,7 @@ int do_init_mob(void)
 
 /*==========================================
  * Clean memory usage.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_final_mob(void)
 {
 	int i;

+ 52 - 84
src/map/npc.c

@@ -82,8 +82,7 @@ struct view_data* npc_get_viewdata(int class_)
  * NPCの無効化/有効化
  * npc_enable
  * npc_enable_sub 有効時にOnTouchイベントを実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_enable_sub( struct block_list *bl, va_list ap )
 {
 	struct map_session_data *sd;
@@ -141,8 +140,7 @@ int npc_enable(const char *name,int flag)
 
 /*==========================================
  * NPCを名前で探す
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct npc_data* npc_name2id(const char *name)
 {
 	return (struct npc_data *) strdb_get(npcname_db,(unsigned char*)name);
@@ -150,8 +148,7 @@ struct npc_data* npc_name2id(const char *name)
 
 /*==========================================
  * イベントキューのイベント処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_dequeue(struct map_session_data *sd)
 {
 	nullpo_retr(0, sd);
@@ -187,8 +184,7 @@ int npc_event_dequeue(struct map_session_data *sd)
 
 /*==========================================
  * イベントの遅延実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_timer(int tid,unsigned int tick,int id,int data)
 {
 	unsigned char *eventname = (unsigned char *)data;
@@ -278,11 +274,11 @@ int npc_timer(int tid,unsigned int tick,int id,int data)	// Added by RoVeRT
 	aFree((void*)data);
 	return 0;
 }*/
+
 /*==========================================
  * イベント用ラベルのエクスポート
  * npc_parse_script->strdb_foreachから呼ばれる
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_export(char *lname,void *data,va_list ap)
 {
 	int pos=(int)data;
@@ -315,8 +311,7 @@ int npc_event_export(char *lname,void *data,va_list ap)
 int npc_event_sub(struct map_session_data *, struct event_data *, const unsigned char *); //[Lance]
 /*==========================================
  * 全てのNPCのOn*イベント実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_doall_sub(DBKey key,void *data,va_list ap)
 {
 	const char*p = key.str;
@@ -393,8 +388,7 @@ int npc_event_do(const unsigned char *name)
 
 /*==========================================
  * 時計イベント実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
 {
 	time_t timer;
@@ -437,8 +431,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
 }
 /*==========================================
  * OnInitイベント実行(&時計イベント開始)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event_do_oninit(void)
 {
 //	int c = npc_event_doall("OnInit");
@@ -452,8 +445,7 @@ int npc_event_do_oninit(void)
 }
 /*==========================================
  * OnTimer NPC event - by RoVeRT
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_addeventtimer(struct npc_data *nd,int tick,const char *name)
 {
 	int i;
@@ -542,8 +534,7 @@ int npc_do_ontimer(int npc_id, int option)
 /*==========================================
  * タイマーイベント用ラベルの取り込み
  * npc_parse_script->strdb_foreachから呼ばれる
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_timerevent_import(char *lname,void *data,va_list ap)
 {
 	int pos=(int)data;
@@ -582,8 +573,7 @@ struct timer_event_data {
 
 /*==========================================
  * タイマーイベント実行
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_timerevent(int tid,unsigned int tick,int id,int data)
 {
 	int next,t,old_rid,old_timer;
@@ -643,8 +633,7 @@ int npc_timerevent(int tid,unsigned int tick,int id,int data)
 }
 /*==========================================
  * タイマーイベント開始
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_timerevent_start(struct npc_data *nd, int rid)
 {
 	int j,n, next;
@@ -700,8 +689,7 @@ int npc_timerevent_start(struct npc_data *nd, int rid)
 }
 /*==========================================
  * タイマーイベント終了
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_timerevent_stop(struct npc_data *nd)
 {
 	struct map_session_data *sd =NULL;
@@ -733,9 +721,9 @@ int npc_timerevent_stop(struct npc_data *nd)
 }
 /*==========================================
  * Aborts a running npc timer that is attached to a player.
- *------------------------------------------
- */
-void npc_timerevent_quit(struct map_session_data *sd) {
+ *------------------------------------------*/
+void npc_timerevent_quit(struct map_session_data *sd)
+{
 	struct TimerData *td;
 	struct npc_data* nd;
 	struct timer_event_data *ted;
@@ -787,8 +775,7 @@ void npc_timerevent_quit(struct map_session_data *sd) {
 
 /*==========================================
  * タイマー値の所得
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_gettimerevent_tick(struct npc_data *nd)
 {
 	int tick;
@@ -801,8 +788,7 @@ int npc_gettimerevent_tick(struct npc_data *nd)
 }
 /*==========================================
  * タイマー値の設定
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_settimerevent_tick(struct npc_data *nd,int newtimer)
 {
 	int flag;
@@ -829,8 +815,8 @@ int npc_settimerevent_tick(struct npc_data *nd,int newtimer)
 	return 0;
 }
 
-int npc_event_sub(struct map_session_data *sd, struct event_data *ev, const unsigned char *eventname){
-
+int npc_event_sub(struct map_session_data *sd, struct event_data *ev, const unsigned char *eventname)
+{
 	if ( sd->npc_id!=0) {
 		//Enqueue the event trigger.
 		int i;
@@ -854,8 +840,7 @@ int npc_event_sub(struct map_session_data *sd, struct event_data *ev, const unsi
 
 /*==========================================
  * イベント型のNPC処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_event (struct map_session_data *sd, const unsigned char *eventname, int mob_kill)
 {
 	struct event_data *ev=strdb_get(ev_db,(unsigned char*)eventname);
@@ -932,8 +917,7 @@ int npc_command(struct map_session_data* sd, const char* npcname, const char* co
 }
 /*==========================================
  * 接触型のNPC処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
 {
 	int i,f=1;
@@ -1098,8 +1082,7 @@ int npc_check_areanpc(int flag,int m,int x,int y,int range)
 
 /*==========================================
  * 近くかどうかの判定
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_checknear2(struct map_session_data *sd,struct block_list *bl)
 {
 	nullpo_retr(1, sd);
@@ -1144,8 +1127,7 @@ TBL_NPC *npc_checknear(struct map_session_data *sd,struct block_list *bl)
 
 /*==========================================
  * NPCのオープンチャット発言
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_globalmessage(const char *name,const char *mes)
 {
 	struct npc_data *nd=(struct npc_data *) strdb_get(npcname_db,(unsigned char*)name);
@@ -1162,8 +1144,7 @@ int npc_globalmessage(const char *name,const char *mes)
 
 /*==========================================
  * クリック時のNPC処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_click(struct map_session_data *sd,struct npc_data *nd)
 {
 	nullpo_retr(1, sd);
@@ -1195,8 +1176,7 @@ int npc_click(struct map_session_data *sd,struct npc_data *nd)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_scriptcont(struct map_session_data *sd,int id)
 {
 	nullpo_retr(1, sd);
@@ -1223,8 +1203,7 @@ int npc_scriptcont(struct map_session_data *sd,int id)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_buysellsel(struct map_session_data *sd,int id,int type)
 {
 	struct npc_data *nd;
@@ -1254,9 +1233,7 @@ int npc_buysellsel(struct map_session_data *sd,int id,int type)
 }
 
 //npc_buylist for script-controlled shops.
-static int npc_buylist_sub(
-	struct map_session_data *sd,int n,
-	unsigned short *item_list, struct npc_data *nd)
+static int npc_buylist_sub(struct map_session_data *sd, int n, unsigned short *item_list, struct npc_data *nd)
 {
 	unsigned char npc_ev[51];
 	int i;
@@ -1273,8 +1250,7 @@ static int npc_buylist_sub(
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
 {
 	struct npc_data *nd;
@@ -1371,8 +1347,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list)
 {
 	double z;
@@ -1498,7 +1473,8 @@ int npc_remove_map(struct npc_data *nd)
 	return 0;
 }
 
-static int npc_unload_ev(DBKey key,void *data,va_list ap) {
+static int npc_unload_ev(DBKey key,void *data,va_list ap)
+{
 	struct event_data *ev=(struct event_data *)data;
 	unsigned char *npcname=va_arg(ap,unsigned char *);
 
@@ -1654,8 +1630,7 @@ void npc_delsrcfile(const char* name)
 
 /*==========================================
  * warp行解析
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_parse_warp (char *w1,char *w2,char *w3,char *w4)
 {
 	int x, y, xs, ys, to_x, to_y, m;
@@ -1717,8 +1692,7 @@ int npc_parse_warp (char *w1,char *w2,char *w3,char *w4)
 
 /*==========================================
  * shop行解析
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
 {
 	#define MAX_SHOPITEM 100
@@ -1816,8 +1790,7 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
 
 /*==========================================
  * NPCのラベルデータコンバート
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_convertlabel_db (DBKey key, void *data, va_list ap)
 {
 	const char *lname = (const char*)key.str;
@@ -1861,9 +1834,9 @@ int npc_convertlabel_db (DBKey key, void *data, va_list ap)
 
 /*==========================================
  * script行解析
- *------------------------------------------
- */
-static void npc_parse_script_line(unsigned char *p,int *curly_count,int line) {
+ *------------------------------------------*/
+static void npc_parse_script_line(unsigned char *p,int *curly_count,int line)
+{
 	int i = strlen((char *)p),j;
 	int string_flag = 0;
 	static int comment_flag = 0;
@@ -2277,8 +2250,7 @@ void npc_movenpc(struct npc_data *nd, int x, int y)
 }
 /*==========================================
  * function行解析
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *first_line, FILE *fp, int *lines,const char* file)
 {
 	unsigned char *srcbuf, *p;
@@ -2360,8 +2332,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir
  * If cached =1, it is a dynamic cached mob
  * index points to the index in the mob_list of the map_data cache.
  * -1 indicates that it is not stored on the map.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int npc_parse_mob2 (struct spawn_data *mob, int index)
 {
 	int i;
@@ -2511,8 +2482,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
 
 /*==========================================
  * マップフラグ行の解析
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
 {
 	int m;
@@ -2765,8 +2735,7 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
 
 /*==========================================
  * Setting up map cells
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int npc_parse_mapcell (char *w1, char *w2, char *w3, char *w4)
 {
 	int m, cell, x, y, x0, y0, x1, y1;
@@ -2976,10 +2945,9 @@ void npc_read_event_script(void)
 
 /*==========================================
  *
- *------------------------------------------
- */
-
-static int npc_cleanup_sub (struct block_list *bl, va_list ap) {
+ *------------------------------------------*/
+static int npc_cleanup_sub (struct block_list *bl, va_list ap)
+{
 	nullpo_retr(0, bl);
 
 	switch(bl->type) {
@@ -2994,7 +2962,8 @@ static int npc_cleanup_sub (struct block_list *bl, va_list ap) {
 	return 0;
 }
 
-static int npc_cleanup_dbsub(DBKey key,void * data,va_list ap) {
+static int npc_cleanup_dbsub(DBKey key,void * data,va_list ap)
+{
 	return npc_cleanup_sub((struct block_list*)data, 0);
 }
 
@@ -3073,8 +3042,7 @@ int npc_reload (void)
 
 /*==========================================
  * 終了
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_final_npc(void)
 {
 	int i;
@@ -3134,8 +3102,7 @@ static void npc_debug_warps(void)
 
 /*==========================================
  * npc初期化
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_npc(void)
 {
 	struct npc_src_list *file;
@@ -3223,7 +3190,8 @@ int do_init_npc(void)
 	return 0;
 }
 // [Lance]
-int npc_changename(const char *name, const char *newname, short look){
+int npc_changename(const char *name, const char *newname, short look)
+{
 	struct npc_data *nd= (struct npc_data *) strdb_remove(npcname_db,(unsigned char*)name);
 	if (nd==NULL)
 		return 0;

+ 18 - 9
src/map/npc_chat.c

@@ -113,7 +113,8 @@ struct npc_parse {
  * This does NOT do the list management
  */
 
-void finalize_pcrematch_entry(struct pcrematch_entry *e) {
+void finalize_pcrematch_entry(struct pcrematch_entry *e)
+{
 //TODO: For some odd reason this causes a already-free'd error under Windows, but not *nix! [Skotlex]
 #ifndef _WIN32
 	if (e->pcre_) {
@@ -176,7 +177,8 @@ static struct pcrematch_set * lookup_pcreset(struct npc_data *nd,int setid)
  * if the setid does not exist, this will silently return
  */
 
-static void activate_pcreset(struct npc_data *nd,int setid) {
+static void activate_pcreset(struct npc_data *nd,int setid)
+{
     struct pcrematch_set *pcreset;
     struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
     if (npcParse == NULL) 
@@ -209,7 +211,8 @@ static void activate_pcreset(struct npc_data *nd,int setid) {
  * if the setid does not exist, this will silently return
  */
 
-static void deactivate_pcreset(struct npc_data *nd,int setid) {
+static void deactivate_pcreset(struct npc_data *nd,int setid)
+{
     struct pcrematch_set *pcreset;
     struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
     if (npcParse == NULL) 
@@ -244,7 +247,8 @@ static void deactivate_pcreset(struct npc_data *nd,int setid) {
 /**
  * delete a set of patterns.
  */
-static void delete_pcreset(struct npc_data *nd,int setid) {
+static void delete_pcreset(struct npc_data *nd,int setid)
+{
     int active = 1;
     struct pcrematch_set *pcreset;
     struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
@@ -294,7 +298,8 @@ static void delete_pcreset(struct npc_data *nd,int setid) {
 /**
  * create a new pattern entry 
  */
-static struct pcrematch_entry *create_pcrematch_entry(struct pcrematch_set * set) {
+static struct pcrematch_entry *create_pcrematch_entry(struct pcrematch_set * set)
+{
     struct pcrematch_entry * e =  (struct pcrematch_entry *)
         aCalloc(sizeof(struct pcrematch_entry), 1);
     struct pcrematch_entry * last = set->head_;
@@ -476,7 +481,8 @@ int mob_chat_sub(struct block_list *bl, va_list ap){
 
 // Various script builtins used to support these functions
 
-int buildin_defpattern(struct script_state *st) {
+int buildin_defpattern(struct script_state *st)
+{
     int setid=conv_num(st,& (st->stack->stack_data[st->start+2]));
     const char *pattern=conv_str(st,& (st->stack->stack_data[st->start+3]));
     const char *label=conv_str(st,& (st->stack->stack_data[st->start+4]));
@@ -487,7 +493,8 @@ int buildin_defpattern(struct script_state *st) {
     return 0;
 }
 
-int buildin_activatepset(struct script_state *st) {
+int buildin_activatepset(struct script_state *st)
+{
     int setid=conv_num(st,& (st->stack->stack_data[st->start+2]));
     struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
 
@@ -496,7 +503,8 @@ int buildin_activatepset(struct script_state *st) {
     return 0;
 }
 
-int buildin_deactivatepset(struct script_state *st) {
+int buildin_deactivatepset(struct script_state *st)
+{
     int setid=conv_num(st,& (st->stack->stack_data[st->start+2]));
     struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
 
@@ -505,7 +513,8 @@ int buildin_deactivatepset(struct script_state *st) {
     return 0;
 }
 
-int buildin_deletepset(struct script_state *st) {
+int buildin_deletepset(struct script_state *st)
+{
     int setid=conv_num(st,& (st->stack->stack_data[st->start+2]));
     struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
 

+ 6 - 6
src/map/party.c

@@ -30,9 +30,9 @@ int party_send_xy_timer(int tid,unsigned int tick,int id,int data);
 /*==========================================
  * Fills the given party_member structure according to the sd provided. 
  * Used when creating/adding people to a party. [Skotlex]
- *------------------------------------------
- */
-static void party_fill_member(struct party_member *member, struct map_session_data *sd) {
+ *------------------------------------------*/
+static void party_fill_member(struct party_member *member, struct map_session_data *sd)
+{
   	member->account_id = sd->status.account_id;
 	member->char_id    = sd->status.char_id;
 	memcpy(member->name, sd->status.name, NAME_LENGTH);
@@ -45,8 +45,7 @@ static void party_fill_member(struct party_member *member, struct map_session_da
 
 /*==========================================
  * �I—¹
- *------------------------------------------
- */
+ *------------------------------------------*/
 void do_final_party(void)
 {
 	party_db->destroy(party_db,NULL);
@@ -182,7 +181,8 @@ int party_recv_noinfo(int party_id)
 	return 0;
 }
 
-static void* create_party(DBKey key, va_list args) {
+static void* create_party(DBKey key, va_list args)
+{
 	struct party_data *p;
 	p=(struct party_data *)aCalloc(1,sizeof(struct party_data));
 	return p;

+ 12 - 28
src/map/path.c

@@ -32,8 +32,7 @@ const char walk_choices [3][3] =
 
 /*==========================================
  * 経路探索補助heap push
- *------------------------------------------
- */
+ *------------------------------------------*/
 static void push_heap_path(int *heap,struct tmp_path *tp,int index)
 {
 	int i,h;
@@ -50,8 +49,7 @@ static void push_heap_path(int *heap,struct tmp_path *tp,int index)
 /*==========================================
  * 経路探索補助heap update
  * costが減ったので根の方へ移動
- *------------------------------------------
- */
+ *------------------------------------------*/
 static void update_heap_path(int *heap,struct tmp_path *tp,int index)
 {
 	int i,h;
@@ -72,8 +70,7 @@ static void update_heap_path(int *heap,struct tmp_path *tp,int index)
 
 /*==========================================
  * 経路探索補助heap pop
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int pop_heap_path(int *heap,struct tmp_path *tp)
 {
 	int i,h,k;
@@ -104,8 +101,7 @@ static int pop_heap_path(int *heap,struct tmp_path *tp)
 
 /*==========================================
  * 現在の点のcost計算
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int calc_cost(struct tmp_path *p,int x1,int y1)
 {
 	int xd,yd;
@@ -119,8 +115,7 @@ static int calc_cost(struct tmp_path *p,int x1,int y1)
 
 /*==========================================
  * 必要ならpathを追加/修正する
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int add_path(int *heap,struct tmp_path *tp,int x,int y,int dist,int before,int cost)
 {
 	int i;
@@ -159,8 +154,7 @@ static int add_path(int *heap,struct tmp_path *tp,int x,int y,int dist,int befor
 /*==========================================
  * (x,y)が移動不可能地帯かどうか
  * flag 0x10000 遠距離攻撃判定
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int can_place(struct map_data *m,int x,int y,int flag)
 {
 	if(map_getcellp(m,x,y,CELL_CHKPASS))
@@ -177,8 +171,7 @@ static int can_place(struct map_data *m,int x,int y,int flag)
 
 /*==========================================
  * (x0,y0)から(x1,y1)へ1歩で移動可能か計算
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int can_move(struct map_data *m,int x0,int y0,int x1,int y1,int flag)
 {
 	if(x1<0 || y1<0 || x1>=m->xs || y1>=m->ys)
@@ -202,8 +195,7 @@ static int can_move(struct map_data *m,int x0,int y0,int x1,int y1,int flag)
 /*==========================================
  * (x0,y0)から(dx,dy)方向へcountセル分
  * 吹き飛ばしたあとの座標を所得
- *------------------------------------------
- */
+ *------------------------------------------*/
 int path_blownpos(int m,int x0,int y0,int dx,int dy,int count)
 {
 	struct map_data *md;
@@ -243,8 +235,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count)
 
 /*==========================================
  *  遠距離攻撃が可能かどうかを返す
- *------------------------------------------
- */
+ *------------------------------------------*/
 int path_search_long_real(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1,cell_t flag)
 {
 	int dx, dy;
@@ -312,9 +303,7 @@ int path_search_long_real(struct shootpath_data *spd,int m,int x0,int y0,int x1,
 
 /*==========================================
  * path探索 (x0,y0)->(x1,y1)
- *------------------------------------------
- */
-
+ *------------------------------------------*/
 int path_search_real(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int flag,cell_t flag2)
 {
 	int heap[MAX_HEAP+1];
@@ -483,12 +472,8 @@ int path_search_real(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1
 }
 
 /*==========================================
-
  * path探索 (x0,y0)->(x1,y1)
-
- *------------------------------------------
- 
- */
+ *------------------------------------------*/
 
 #ifdef PATH_STANDALONETEST
 char gat[64][64]={
@@ -502,8 +487,7 @@ struct map_data map[1];
 
 /*==========================================
  * 経路探索ルーチン単体テスト用main関数
- *------------------------------------------
- */
+ *------------------------------------------*/
 void main(int argc,char *argv[])
 {
 	struct walkpath_data wpd;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 139 - 185
src/map/pc.c


+ 7 - 14
src/map/pet.c

@@ -130,8 +130,7 @@ int pet_unlocktarget(struct pet_data *pd)
 
 /*==========================================
  * Pet Attack Skill [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int pet_attackskill(struct pet_data *pd, int target_id)
 {
 	struct block_list *bl;
@@ -204,8 +203,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type)
 }
 /*==========================================
  * Pet SC Check [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int pet_sc_check(struct map_session_data *sd, int type)
 {	
 	struct pet_data *pd;
@@ -1109,8 +1107,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
 
 /*==========================================
  * pet bonus giving skills [Valaris] / Rewritten by [Skotlex]
- *------------------------------------------
- */ 
+ *------------------------------------------*/ 
 int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data)
 {
 	struct map_session_data *sd=map_id2sd(id);
@@ -1155,8 +1152,7 @@ int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  * pet recovery skills [Valaris] / Rewritten by [Skotlex]
- *------------------------------------------
- */ 
+ *------------------------------------------*/ 
 int pet_recovery_timer(int tid,unsigned int tick,int id,int data)
 {
 	struct map_session_data *sd=map_id2sd(id);
@@ -1224,8 +1220,7 @@ int pet_heal_timer(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  * pet support skills [Skotlex]
- *------------------------------------------
- */ 
+ *------------------------------------------*/ 
 int pet_skill_support_timer(int tid,unsigned int tick,int id,int data)
 {
 	struct map_session_data *sd=map_id2sd(id);
@@ -1274,8 +1269,7 @@ int pet_skill_support_timer(int tid,unsigned int tick,int id,int data)
 
 /*==========================================
  *ペットデータ読み込み
- *------------------------------------------
- */ 
+ *------------------------------------------*/ 
 int read_petdb()
 {
 	FILE *fp;
@@ -1370,8 +1364,7 @@ int read_petdb()
 
 /*==========================================
  * スキル関係初期化処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_pet(void)
 {
 	memset(pet_db,0,sizeof(pet_db));

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 112 - 198
src/map/script.c


+ 72 - 160
src/map/skill.c

@@ -705,7 +705,8 @@ const char*	skill_get_name( int id ){
 	return skill_db[id].name; 
 }
 
-int skill_tree_get_max(int id, int b_class){
+int skill_tree_get_max(int id, int b_class)
+{
 	int i, skillid;
 	for(i=0;(skillid=skill_tree[b_class][i].id)>0;i++)
 		if (id == skillid) return skill_tree[b_class][i].max;
@@ -974,8 +975,7 @@ struct skill_unit_layout *skill_get_unit_layout (int skillid, int skilllv, struc
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick)
 {
 	struct map_session_data *sd=NULL, *dstsd=NULL;
@@ -1854,9 +1854,7 @@ int skill_blown (struct block_list *src, struct block_list *target, int count)
  *      packet shouldn't display a skill animation)
  * flag&0x2000 is used to signal that the skilllv should be passed as -1 to the
  *      client (causes player characters to not scream skill name)
- *-------------------------------------------------------------------------
- */
-
+ *-------------------------------------------------------------------------*/
 int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag)
 {
 	struct Damage dmg;
@@ -2207,8 +2205,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
  *	T	=タ?ゲット選?用(BCT_*)
  *  ffff=自由に使用可能
  *  0	=予約?B0に固定
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_area_temp[8];
 static int skill_unit_temp[64];	/* For storing skill_unit ids as players move in/out of them. [Skotlex] */
 static int skill_unit_index=0;	//Well, yeah... am too lazy to pass pointers around :X
@@ -2386,8 +2383,7 @@ int skill_guildaura_sub (struct block_list *bl, va_list ap)
  * Flag:
  * &1: finished casting the skill (invoke hp/sp/item consumption)
  * &2: picked menu entry (Warp Portal, Teleport and other menu based skills)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv, int type)
 {
 	struct status_data *status;
@@ -2506,9 +2502,9 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 	return 1;
 }
 
-/*=========================================================================
+/*==========================================
  *
- */
+ *------------------------------------------*/
 int skill_area_sub_count (struct block_list *src, struct block_list *target, int skillid, int skilllv, unsigned int tick, int flag)
 {
 	if(skill_area_temp[0] < 0xffff)
@@ -2541,8 +2537,7 @@ int skill_count_water (struct block_list *src, int range)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_timerskill (int tid, unsigned int tick, int id, int data)
 {
 	struct block_list *src = map_id2bl(id),*target;
@@ -2634,8 +2629,7 @@ static int skill_timerskill (int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, int x,int y, int skill_id, int skill_lv, int type, int flag)
 {
 	int i;
@@ -2663,8 +2657,7 @@ int skill_addtimerskill (struct block_list *src, unsigned int tick, int target,
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_cleartimerskill (struct block_list *src)
 {
 	int i;
@@ -2699,8 +2692,7 @@ static int skill_reveal_trap (struct block_list *bl, va_list ap)
 /*==========================================
  *
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag)
 {
 	struct map_session_data *sd = NULL, *tsd = NULL;
@@ -3301,8 +3293,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag)
 {
 	struct map_session_data *sd = NULL;
@@ -4568,7 +4559,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 			clif_skill_fail(sd,skillid,0,0); //Nothing stripped.
 		break;
 
-	/* PotionPitcher */
 	case AM_BERSERKPITCHER:
 	case AM_POTIONPITCHER:
 		{
@@ -5051,7 +5041,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		}
 		break;
 
-// parent-baby skills
+	// parent-baby skills
 	case WE_BABY:
 		if(sd){
 			struct map_session_data *f_sd = pc_get_father(sd);
@@ -5623,8 +5613,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_id (int tid, unsigned int tick, int id, int data)
 {
 	struct block_list *target, *src = map_id2bl(id);
@@ -5847,8 +5836,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_pos (int tid, unsigned int tick, int id, int data)
 {
 	struct block_list* src = map_id2bl(id);
@@ -5966,8 +5954,7 @@ int skill_castend_pos (int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int skilllv, unsigned int tick, int flag)
 {
 	struct map_session_data *sd=NULL;
@@ -6346,8 +6333,7 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castend_map (struct map_session_data *sd, int skill_num, const char *map)
 {
 	int x=0,y=0;
@@ -6525,8 +6511,7 @@ int skill_dance_overlap(struct skill_unit *unit, int flag)
  * Converts this group information so that it is handled
  * as a Dissonance or Ugly Dance cell.
  * Flag: 0 - Convert, 1 - Revert, 2 - Initialize.
- *------------------------------------------
- */
+ *------------------------------------------*/
 #define skill_dance_switch(unit, group, flag) (((group)->state.song_dance&0x1 && (unit)->val2&UF_ENSEMBLE)?skill_dance_switch_sub(unit, group, flag):0)
 static int skill_dance_switch_sub(struct skill_unit *unit, struct skill_unit_group *group, int flag)
 {
@@ -6578,8 +6563,7 @@ static int skill_dance_switch_sub(struct skill_unit *unit, struct skill_unit_gro
  * Initializes and sets a ground skill.
  * flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active)
  * flag&2 is used to determine if this skill was casted with Magic Power active.
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid, int skilllv, int x, int y, int flag)
 {
 	struct skill_unit_group *group;
@@ -6964,8 +6948,7 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned int tick)
 {
 	struct skill_unit_group *sg;
@@ -7106,8 +7089,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, unsigned int tick)
 {
 	struct skill_unit_group *sg;
@@ -7518,8 +7500,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned int tick)
 {
 	struct skill_unit_group *sg;
@@ -7566,8 +7547,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
 
 /*==========================================
  * Triggered when a char steps out of a skill group [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int tick)
 {
 	struct status_change *sc;
@@ -7664,8 +7644,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
  * flag values:
  * flag&1: Invoke onplace function (otherwise invoke onout)
  * 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;
@@ -7713,8 +7692,7 @@ int skill_unit_effect (struct block_list *bl, va_list ap)
 
 /*==========================================
  * If flag, this is a forced delete, otherwise, it's natural expiration.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_onlimit (struct skill_unit *src, unsigned int tick, int flag)
 {
 	struct skill_unit_group *sg;
@@ -7761,8 +7739,7 @@ int skill_unit_onlimit (struct skill_unit *src, unsigned int tick, int flag)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int damage, unsigned int tick)
 {
 	struct skill_unit_group *sg;
@@ -7786,9 +7763,7 @@ int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int dam
 
 /*==========================================
  *
- *------------------------------------------
- */
-
+ *------------------------------------------*/
 static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
 {
 	int *c, skillid;
@@ -7856,8 +7831,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
 
 /*==========================================
  * Checks and stores partners for ensemble skills [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skill_lv, int range, int cast_flag)
 {
 	static int c=0;
@@ -7905,9 +7879,7 @@ int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skil
 
 /*==========================================
  * 
- *------------------------------------------
- */
-
+ *------------------------------------------*/
 static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap)
 {
 	int *c,src_id,mob_class,skill;
@@ -7932,8 +7904,7 @@ static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list
 /*==========================================
  * Determines if a given skill should be made to consume ammo 
  * when used by the player. [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_isammotype (TBL_PC *sd, int skill)
 {
 	return (
@@ -7951,8 +7922,7 @@ int skill_isammotype (TBL_PC *sd, int skill)
  * Flag:
  * &1: finished casting the skill (invoke hp/sp/item consumption)
  * &2: picked menu entry (Warp Portal, Teleport and other menu based skills)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_check_condition (struct map_session_data *sd, int skill, int lv, int type)
 {
 	struct status_data *status;
@@ -8684,9 +8654,6 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
 			if(index[i] >= 0)
 				pc_delitem(sd,index[i],amount[i],0);
 		}
-//	Ammo is now reduced in battle_calc_weapon_attack. [Skotlex]		
-//		if (ammo && battle_config.arrow_decrement)
-//			pc_delitem(sd,sd->equip_index[10],ammo_qty,0);
 	}
 
 	if(type&2)
@@ -8704,8 +8671,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castfix (struct block_list *bl, int skill_id, int skill_lv)
 {
 	int time = skill_get_cast(skill_id, skill_lv);	
@@ -8736,8 +8702,7 @@ int skill_castfix (struct block_list *bl, int skill_id, int skill_lv)
 
 /*==========================================
  * Does cast-time reductions based on sc data.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_castfix_sc (struct block_list *bl, int time)
 {
 	struct status_change *sc = status_get_sc(bl);
@@ -8760,8 +8725,7 @@ int skill_castfix_sc (struct block_list *bl, int time)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
 {
 	int delaynochange = skill_get_delaynodex(skill_id, skill_lv);
@@ -8834,8 +8798,7 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
 
 /*=========================================
  * 
- *----------------------------------------
- */
+ *-----------------------------------------*/
 void skill_brandishspear_first (struct square *tc, int dir, int x, int y)
 {
 	nullpo_retv(tc);
@@ -8941,8 +8904,7 @@ void skill_brandishspear_first (struct square *tc, int dir, int x, int y)
 
 /*=========================================
  *
- *-----------------------------------------
- */
+ *-----------------------------------------*/
 void skill_brandishspear_dir (struct square *tc, int dir, int are)
 {
 	int c;
@@ -8972,8 +8934,7 @@ void skill_brandishspear_dir (struct square *tc, int dir, int are)
 
 /*==========================================
  * Weapon Repair [Celest/DracoRPG]
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_repairweapon (struct map_session_data *sd, int idx)
 {
 	int material;
@@ -9018,8 +8979,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx)
 
 /*==========================================
  * Item Appraisal
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_identify (struct map_session_data *sd, int idx)
 {
 	int flag=1;
@@ -9037,8 +8997,7 @@ void skill_identify (struct map_session_data *sd, int idx)
 
 /*==========================================
  * Weapon Refine [Celest]
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_weaponrefine (struct map_session_data *sd, int idx)
 {
 	int i = 0, ep = 0, per;
@@ -9107,8 +9066,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_autospell (struct map_session_data *sd, int skillid)
 {
 	int skilllv;
@@ -9151,8 +9109,7 @@ int skill_autospell (struct map_session_data *sd, int skillid)
 
 /*==========================================
  * Sitting skills functions.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_sit_count (struct block_list *bl, va_list ap)
 {
 	struct map_session_data *sd;
@@ -9245,8 +9202,7 @@ int skill_sit (struct map_session_data *sd, int type)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_frostjoke_scream (struct block_list *bl, va_list ap)
 {
 	struct block_list *src;
@@ -9280,8 +9236,7 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_unitsetmapcell (struct skill_unit *src, int skill_num, int skill_lv, int flag)
 {
 	int i,x,y,range = skill_get_unit_range(skill_num,skill_lv);
@@ -9296,8 +9251,7 @@ void skill_unitsetmapcell (struct skill_unit *src, int skill_num, int skill_lv,
 
 /*==========================================
  * Sets a map cell around the caster, according to the skill's splash range.
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_setmapcell (struct block_list *src, int skill_num, int skill_lv, int flag)
 {
 	int i,x,y,range = skill_get_splash(skill_num, skill_lv);
@@ -9312,8 +9266,7 @@ void skill_setmapcell (struct block_list *src, int skill_num, int skill_lv, int
 	
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_attack_area (struct block_list *bl, va_list ap)
 {
 	struct block_list *src,*dsrc;
@@ -9348,8 +9301,7 @@ int skill_attack_area (struct block_list *bl, va_list ap)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_clear_group (struct block_list *bl, int flag)
 {
 	struct unit_data *ud = unit_bl2ud(bl);
@@ -9386,8 +9338,7 @@ int skill_clear_group (struct block_list *bl, int flag)
 	
 /*==========================================
  * Returns the first element field found [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct skill_unit_group *skill_locate_element_field(struct block_list *bl)
 {
 	struct unit_data *ud = unit_bl2ud(bl);
@@ -9443,8 +9394,7 @@ int skill_greed (struct block_list *bl, va_list ap)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_cell_overlap(struct block_list *bl, va_list ap)
 {
 	int skillid;
@@ -9538,8 +9488,7 @@ int skill_cell_overlap(struct block_list *bl, va_list ap)
 
 /*==========================================
  * variation of skill_cell_overlap
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_ganbatein (struct block_list *bl, va_list ap)
 {
 	struct skill_unit *unit;
@@ -9558,8 +9507,7 @@ int skill_ganbatein (struct block_list *bl, va_list ap)
 
 /*==========================================
  * 
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap)
 {
 	struct mob_data* md;
@@ -9580,8 +9528,7 @@ int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap)
 
 /*==========================================
  * 謖�ョ夂ッ�峇蜀�〒src縺ォ蟇セ縺励※譛牙柑縺ェ繧ソ繝シ繧イ繝�ヨ縺ョbl縺ョ謨ー繧呈焚縺医k(foreachinarea)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_count_target (struct block_list *bl, va_list ap)
 {
 	struct block_list *src = va_arg(ap,struct block_list *);
@@ -9591,8 +9538,7 @@ int skill_count_target (struct block_list *bl, va_list ap)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_trap_splash (struct block_list *bl, va_list ap)
 {
 	struct block_list *src;
@@ -9656,8 +9602,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_enchant_elemental_end (struct block_list *bl, int type)
 {
 	struct status_change *sc;
@@ -9726,17 +9671,10 @@ int skill_check_cloaking(struct block_list *bl, struct status_change *sc)
 	return end;
 }
 
-/*
- *----------------------------------------------------------------------------
- *
- *----------------------------------------------------------------------------
- */
-
 /*==========================================
  *
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 void skill_stop_dancing (struct block_list *src)
 {
 	struct status_change* sc;
@@ -9773,8 +9711,7 @@ void skill_stop_dancing (struct block_list *src)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2)
 {
 	struct skill_unit *unit;
@@ -9824,8 +9761,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
 
 /*==========================================
  * if flag =1 -> forced removal, 0 is for natural expiration.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_delunit (struct skill_unit *unit, int flag)
 {
 	struct skill_unit_group *group;
@@ -9875,8 +9811,7 @@ int skill_delunit (struct skill_unit *unit, int flag)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int skill_unit_group_newid = MAX_SKILL_DB;
 struct skill_unit_group *skill_initunitgroup (struct block_list *src, int count, int skillid, int skilllv, int unit_id, int limit, int interval)
 {
@@ -9932,8 +9867,7 @@ struct skill_unit_group *skill_initunitgroup (struct block_list *src, int count,
 
 /*==========================================
  * If flag, this is a forced deletion, otherwise it's natural expiration.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_delunitgroup (struct block_list *src, struct skill_unit_group *group, int flag)
 {
 	struct unit_data *ud;
@@ -10008,8 +9942,7 @@ int skill_delunitgroup (struct block_list *src, struct skill_unit_group *group,
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_clear_unitgroup (struct block_list *src)
 {
 	struct unit_data *ud = unit_bl2ud(src);
@@ -10023,8 +9956,7 @@ int skill_clear_unitgroup (struct block_list *src)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_list *bl, struct skill_unit_group *group, int tick)
 {
 	int i,j=-1,k,s,id;
@@ -10067,8 +9999,7 @@ 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;
@@ -10096,8 +10027,7 @@ int skill_unit_timer_sub_onplace (struct block_list *bl, va_list ap)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_timer_sub (struct block_list *bl, va_list ap)
 {
 	struct skill_unit *unit;
@@ -10191,8 +10121,7 @@ int skill_unit_timer_sub (struct block_list *bl, va_list ap)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_timer (int tid, unsigned int tick, int id, int data)
 {
 	map_freeblock_lock();
@@ -10206,8 +10135,7 @@ int skill_unit_timer (int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_move_sub (struct block_list *bl, va_list ap)
 {
 	struct skill_unit *unit = (struct skill_unit *)bl;
@@ -10315,8 +10243,7 @@ int skill_unit_move_sub (struct block_list *bl, va_list ap)
  * flag&2: this function is being invoked twice as a bl moves, store in memory the affected
  * units to figure out when they have left a group.
  * flag&4: Force a onleft event (triggered when the bl is killed, for example)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_move (struct block_list *bl, unsigned int tick, int flag)
 {
 	nullpo_retr(0, bl);
@@ -10346,8 +10273,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_unit_move_unit_group (struct skill_unit_group *group, int m, int dx, int dy)
 {
 	int i,j;
@@ -10435,15 +10361,9 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int m, int dx, i
 	return 0;
 }
 
-/*----------------------------------------------------------------------------
- *
- *----------------------------------------------------------------------------
- */
-
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, int qty)
 {
 	int i,j;
@@ -10497,8 +10417,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, int slot1, int slot2, int slot3, int qty)
 {
 	int slot[3];
@@ -10893,8 +10812,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_blockpc_end (int tid, unsigned int tick, int id, int data)
 {
 	struct map_session_data *sd = map_id2sd(id);
@@ -10955,10 +10873,6 @@ int skill_blockmerc_start(struct homun_data *hd, int skillid, int tick)	//[orn]
 }
 
 
-/*----------------------------------------------------------------------------
- *
- */
-
 /*
  *
  */
@@ -11255,8 +11169,7 @@ void skill_init_unit_layout (void)
  * produce_db.txt 
  * create_arrow_db.txt
  * abra_db.txt
- *------------------------------------------
- */
+ *------------------------------------------*/
 int skill_readdb (void)
 {
 	int i,j,k,l,m;
@@ -11680,8 +11593,7 @@ void skill_reload (void)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_skill (void)
 {
 	skill_readdb();

+ 19 - 30
src/map/status.c

@@ -88,7 +88,8 @@ static void set_sc(int skill, int sc, int icon, unsigned int flag)
 
 //Initializes the StatusIconChangeTable variable. May seem somewhat slower than directly defining the array,
 //but it is much less prone to errors. [Skotlex]
-void initChangeTables(void) {
+void initChangeTables(void)
+{
 	int i;
 	for (i = 0; i < SC_MAX; i++)
 		StatusIconChangeTable[i] = SI_BLANK;
@@ -485,7 +486,8 @@ int SkillStatusChangeTable(int skill)
 	return SkillStatusChangeTableArray[sk];
 }
 int StatusIconChangeTable[SC_MAX]; //Stores the icon that should be associated to this status change.
-static void initDummyData(void) {
+static void initDummyData(void)
+{
 	memset(&dummy_status, 0, sizeof(dummy_status));
 	dummy_status.hp = 
 	dummy_status.max_hp = 
@@ -507,8 +509,7 @@ static void initDummyData(void) {
 
 /*==========================================
  * 精錬ボーナス
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_getrefinebonus(int lv,int type)
 {
 	if (lv >= 0 && lv < 5 && type >= 0 && type < 3)
@@ -933,8 +934,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
  * src MAY be null to indicate we shouldn't check it, this is a ground-based skill attack.
  * target MAY Be null, in which case the checks are only to see 
  * whether the source can cast or not the skill on the ground.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag)
 {
 	struct status_data *status;
@@ -1435,7 +1435,6 @@ int status_calc_mob(struct mob_data* md, int first)
 //Skotlex: Calculates the stats of the given pet.
 int status_calc_pet(struct pet_data *pd, int first)
 {
-
 	nullpo_retr(0, pd);
 
 	if (first) {
@@ -3111,8 +3110,7 @@ void status_calc_bl(struct block_list *bl, unsigned long flag)
 }
 /*==========================================
  * Apply shared stat mods from status changes [DracoRPG]
- *------------------------------------------
- */
+ *------------------------------------------*/
 static unsigned short status_calc_str(struct block_list *bl, struct status_change *sc, int str)
 {
 	if(!sc || !sc->count)
@@ -3923,8 +3921,7 @@ static unsigned short status_calc_mode(struct block_list *bl, struct status_chan
 
 /*==========================================
  * Quick swap of adelay/speed when starting ending SA_FREECAST
- *------------------------------------------
- */
+ *------------------------------------------*/
 void status_freecast_switch(struct map_session_data *sd)
 {
 	struct status_data *status;
@@ -3969,8 +3966,7 @@ const char * status_get_name(struct block_list *bl)
 /*==========================================
  * 対象のClassを返す(汎用)
  * 戻りは整数で0以上
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_get_class(struct block_list *bl)
 {
 	nullpo_retr(0, bl);
@@ -3987,8 +3983,7 @@ int status_get_class(struct block_list *bl)
 /*==========================================
  * 対象のレベルを返す(汎用)
  * 戻りは整数で0以上
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_get_lv(struct block_list *bl)
 {
 	nullpo_retr(0, bl);
@@ -4522,8 +4517,7 @@ int status_get_sc_def(struct block_list *bl, int type, int rate, int tick, int f
  * &2: Tick should not be reduced (by vit, luk, lv, etc)
  * &4: sc_data loaded, no value has to be altered.
  * &8: rate should not be reduced
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_start(struct block_list *bl,int type,int rate,int val1,int val2,int val3,int val4,int tick,int flag)
 {
 	struct map_session_data *sd = NULL;
@@ -6008,8 +6002,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 }
 /*==========================================
  * ステータス異常全解除
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_clear(struct block_list *bl,int type)
 {
 	struct status_change* sc;
@@ -6066,8 +6059,7 @@ int status_change_clear(struct block_list *bl,int type)
 
 /*==========================================
  * ステータス異常終了
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_end( struct block_list* bl , int type,int tid )
 {
 	struct map_session_data *sd;
@@ -6534,8 +6526,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  * ステータス異常終了タイマー
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_timer(int tid, unsigned int tick, int id, int data)
 {
 	int type = data;
@@ -6916,8 +6907,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
 
 /*==========================================
  * ステータス異常タイマー範囲処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_timer_sub(struct block_list *bl, va_list ap )
 {
 	struct block_list *src;
@@ -6980,8 +6970,7 @@ int status_change_timer_sub(struct block_list *bl, va_list ap )
 /*==========================================
  * Clears buffs/debuffs of a character.
  * type&1 -> buffs, type&2 -> debuffs
- *------------------------------------------
- */
+ *------------------------------------------*/
 int status_change_clear_buffs (struct block_list *bl, int type)
 {
 	int i;
@@ -7280,7 +7269,8 @@ static int status_calc_sigma(void)
 	return 0;
 }
 
-int status_readdb(void) {
+int status_readdb(void)
+{
 	int i,j;
 	FILE *fp;
 	char line[1024], path[1024],*p;
@@ -7417,8 +7407,7 @@ int status_readdb(void) {
 
 /*==========================================
  * スキル関係初期化処理
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_status(void)
 {
 	add_timer_func_list(status_change_timer,"status_change_timer");

+ 17 - 26
src/map/storage.c

@@ -25,8 +25,7 @@ static struct dbt *guild_storage_db;
 
 /*==========================================
  * 倉庫内アイテムソート
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_comp_item(const void *_i1, const void *_i2)
 {
 	struct item *i1 = (struct item *)_i1;
@@ -55,8 +54,7 @@ void storage_gsortitem (struct guild_storage* gstor)
 
 /*==========================================
  * 初期化とか
- *------------------------------------------
- */
+ *------------------------------------------*/
 int do_init_storage(void) // map.c::do_init()から呼ばれる
 {
 	storage_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
@@ -95,7 +93,8 @@ void do_reconnect_storage(void)
 	guild_storage_db->foreach(guild_storage_db, storage_reconnect_sub, 1);
 }
 
-static void* create_storage(DBKey key, va_list args) {
+static void* create_storage(DBKey key, va_list args)
+{
 	struct storage *stor;
 	stor = (struct storage *) aCallocA (sizeof(struct storage), 1);
 	stor->account_id = key.i;
@@ -123,8 +122,7 @@ int storage_delete(int account_id)
  * 0 - success
  * 1 - fail
  * 2 - Storage requested from char-server (will open automatically later)
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storageopen(struct map_session_data *sd)
 {
 	struct storage *stor;
@@ -159,8 +157,8 @@ int storage_storageopen(struct map_session_data *sd)
 }
 
 // helper function
-int compare_item(struct item *a, struct item *b) {
-
+int compare_item(struct item *a, struct item *b)
+{
 	if (a->nameid == b->nameid &&
 		a->identify == b->identify &&
 		a->refine == b->refine &&
@@ -175,8 +173,7 @@ int compare_item(struct item *a, struct item *b) {
 
 /*==========================================
  * Internal add-item function.
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int storage_additem(struct map_session_data *sd,struct storage *stor,struct item *item_data,int amount)
 {
 	struct item_data *data;
@@ -228,8 +225,7 @@ static int storage_additem(struct map_session_data *sd,struct storage *stor,stru
 }
 /*==========================================
  * Internal del-item function
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int storage_delitem(struct map_session_data *sd,struct storage *stor,int n,int amount)
 {
 
@@ -251,8 +247,7 @@ static int storage_delitem(struct map_session_data *sd,struct storage *stor,int
 }
 /*==========================================
  * Add an item to the storage from the inventory.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storageadd(struct map_session_data *sd,int index,int amount)
 {
 	struct storage *stor;
@@ -282,8 +277,7 @@ int storage_storageadd(struct map_session_data *sd,int index,int amount)
 
 /*==========================================
  * Retrieve an item from the storage.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storageget(struct map_session_data *sd,int index,int amount)
 {
 	struct storage *stor;
@@ -311,8 +305,7 @@ int storage_storageget(struct map_session_data *sd,int index,int amount)
 }
 /*==========================================
  * Move an item from cart to storage.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
 {
 	struct storage *stor;
@@ -340,8 +333,7 @@ int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
 
 /*==========================================
  * Get from Storage to the Cart
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
 {
 	struct storage *stor;
@@ -370,8 +362,7 @@ int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
 
 /*==========================================
  * Modified By Valaris to save upon closing [massdriller]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storageclose(struct map_session_data *sd)
 {
 	struct storage *stor;
@@ -394,8 +385,7 @@ int storage_storageclose(struct map_session_data *sd)
 
 /*==========================================
  * When quitting the game.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int storage_storage_quit(struct map_session_data *sd, int flag)
 {
 	struct storage *stor;
@@ -473,7 +463,8 @@ int storage_storage_saved(int account_id)
 	return 0;
 }
 
-static void* create_guildstorage(DBKey key, va_list args) {
+static void* create_guildstorage(DBKey key, va_list args)
+{
 	struct guild_storage *gs = NULL;
 	gs = (struct guild_storage *) aCallocA(sizeof(struct guild_storage), 1);
 	gs->guild_id=key.i;

+ 24 - 24
src/map/trade.c

@@ -23,9 +23,9 @@
 
 /*==========================================
  * Initiates a trade request.
- *------------------------------------------
- */
-void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd) {
+ *------------------------------------------*/
+void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd)
+{
 	int level;
 
 	nullpo_retv(sd);
@@ -89,9 +89,9 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
  * 4: Cancel
  * Weird enough, the client should only send 3/4
  * and the server is the one that can reply 0~2
- *------------------------------------------
- */
-void trade_tradeack(struct map_session_data *sd, int type) {
+ *------------------------------------------*/
+void trade_tradeack(struct map_session_data *sd, int type)
+{
 	struct map_session_data *tsd;
 	nullpo_retv(sd);
 
@@ -159,9 +159,9 @@ void trade_tradeack(struct map_session_data *sd, int type) {
  * Check here hacker for duplicate item in trade
  * normal client refuse to have 2 same types of item (except equipment) in same trade window
  * normal client authorise only no equiped item and only from inventory
- *------------------------------------------
- */
-int impossible_trade_check(struct map_session_data *sd) {
+ *------------------------------------------*/
+int impossible_trade_check(struct map_session_data *sd)
+{
 	struct item inventory[MAX_INVENTORY];
 	char message_to_gm[200];
 	int i, index;
@@ -221,9 +221,9 @@ int impossible_trade_check(struct map_session_data *sd) {
 
 /*==========================================
  * Checks if trade is possible (against zeny limits, inventory limits, etc)
- *------------------------------------------
- */
-int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
+ *------------------------------------------*/
+int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
+{
 	struct item inventory[MAX_INVENTORY];
 	struct item inventory2[MAX_INVENTORY];
 	struct item_data *data;
@@ -310,9 +310,9 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
 
 /*==========================================
  * Adds an item/qty to the trade window [rewrite by Skotlex] 
- *------------------------------------------
- */
-void trade_tradeadditem(struct map_session_data *sd, int index, int amount) {
+ *------------------------------------------*/
+void trade_tradeadditem(struct map_session_data *sd, int index, int amount)
+{
 	struct map_session_data *target_sd;
 	struct item *item;
 	int trade_i, trade_weight;
@@ -402,9 +402,9 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) {
 
 /*==========================================
  * 'Ok' button on the trade window is pressed.
- *------------------------------------------
- */
-void trade_tradeok(struct map_session_data *sd) {
+ *------------------------------------------*/
+void trade_tradeok(struct map_session_data *sd)
+{
 	struct map_session_data *target_sd;
 
 	if(sd->state.deal_locked || !sd->state.trading)
@@ -422,9 +422,9 @@ void trade_tradeok(struct map_session_data *sd) {
 
 /*==========================================
  * 'Cancel' is pressed. (or trade was force-cancelled by the code)
- *------------------------------------------
- */
-void trade_tradecancel(struct map_session_data *sd) {
+ *------------------------------------------*/
+void trade_tradecancel(struct map_session_data *sd)
+{
 	struct map_session_data *target_sd;
 	int trade_i;
 
@@ -472,9 +472,9 @@ void trade_tradecancel(struct map_session_data *sd) {
 
 /*==========================================
  * Žæˆø‹–‘ø(trade‰Ÿ‚µ)
- *------------------------------------------
- */
-void trade_tradecommit(struct map_session_data *sd) {
+ *------------------------------------------*/
+void trade_tradecommit(struct map_session_data *sd)
+{
 	struct map_session_data *tsd;
 	int trade_i;
 	int flag;

+ 40 - 41
src/map/unit.c

@@ -33,7 +33,8 @@
 const int dirx[8]={0,-1,-1,-1,0,1,1,1};
 const int diry[8]={1,1,0,-1,-1,-1,0,1};
 
-struct unit_data* unit_bl2ud(struct block_list *bl) {
+struct unit_data* unit_bl2ud(struct block_list *bl)
+{
 	if( bl == NULL) return NULL;
 	if( bl->type == BL_PC)  return &((struct map_session_data*)bl)->ud;
 	if( bl->type == BL_MOB) return &((struct mob_data*)bl)->ud;
@@ -271,7 +272,8 @@ static int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, int dat
 //&1 -> 1/0 = easy/hard
 //&2 -> force walking
 //&4 -> Delay walking if the reason you can't walk is the canwalk delay
-int unit_walktoxy( struct block_list *bl, int x, int y, int flag) {
+int unit_walktoxy( struct block_list *bl, int x, int y, int flag)
+{
 	struct unit_data        *ud = NULL;
 	struct status_change		*sc = NULL;
 
@@ -332,7 +334,8 @@ static int unit_walktobl_sub(int tid,unsigned int tick,int id,int data)
 
 // Chases a tbl. If the flag&1, use hard-path seek,
 // if flag&2, start attacking upon arrival within range, otherwise just walk to that character.
-int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int flag) {
+int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int flag)
+{
 	struct unit_data        *ud = NULL;
 	struct status_change		*sc = NULL;
 	nullpo_retr(0, bl);
@@ -619,8 +622,7 @@ int unit_warp(struct block_list *bl,int m,short x,short y,int type)
 
 /*==========================================
  * 歩行停止
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_stop_walking(struct block_list *bl,int type)
 {
 	struct unit_data *ud;
@@ -661,8 +663,8 @@ int unit_stop_walking(struct block_list *bl,int type)
 	return 1;
 }
 
-int unit_skilluse_id(struct block_list *src, int target_id, int skill_num, int skill_lv) {
-
+int unit_skilluse_id(struct block_list *src, int target_id, int skill_num, int skill_lv)
+{
 	if(skill_num < 0) return 0;
 
 	return unit_skilluse_id2(
@@ -682,8 +684,7 @@ int unit_is_walking(struct block_list *bl)
 
 /*==========================================
  * Determines if the bl can move based on status changes. [Skotlex]
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_can_move(struct block_list *bl)
 {
 	struct map_session_data *sd;
@@ -748,8 +749,7 @@ int unit_can_move(struct block_list *bl)
  * Applies walk delay to character, considering that 
  * if type is 0, this is a damage induced delay: if previous delay is active, do not change it.
  * if type is 1, this is a skill induced delay: walk-delay may only be increased, not decreased.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type)
 {
 	struct unit_data *ud = unit_bl2ud(bl);
@@ -777,7 +777,8 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
 	return 1;
 }
 
-int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int skill_lv, int casttime, int castcancel) {
+int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int skill_lv, int casttime, int castcancel)
+{
 	struct unit_data *ud;
 	struct status_data *tstatus;
 	struct status_change *sc;
@@ -1042,7 +1043,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int
 	return 1;
 }
 
-int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv) {
+int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv)
+{
 	if(skill_num < 0)
 		return 0;
 	return unit_skilluse_pos2(
@@ -1052,7 +1054,8 @@ int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skil
 	);
 }
 
-int unit_skilluse_pos2( struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv, int casttime, int castcancel) {
+int unit_skilluse_pos2( struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv, int casttime, int castcancel)
+{
 	struct map_session_data *sd = NULL;
 	struct unit_data        *ud = NULL;
 	struct status_change *sc;
@@ -1164,7 +1167,8 @@ int unit_stop_attack(struct block_list *bl)
 }
 
 //Means current target is unattackable. For now only unlocks mobs.
-int unit_unattackable(struct block_list *bl) {
+int unit_unattackable(struct block_list *bl)
+{
 	struct unit_data *ud = unit_bl2ud(bl);
 	if (ud) {
 		ud->target = 0;
@@ -1181,9 +1185,7 @@ int unit_unattackable(struct block_list *bl) {
 /*==========================================
  * 攻撃要求
  * typeが1なら継続攻撃
- *------------------------------------------
- */
-
+ *------------------------------------------*/
 int unit_attack(struct block_list *src,int target_id,int continuous)
 {
 	struct block_list *target;
@@ -1263,8 +1265,7 @@ int unit_cancel_combo(struct block_list *bl)
 }
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_can_reach_pos(struct block_list *bl,int x,int y, int easy)
 {
 	struct walkpath_data wpd;
@@ -1283,8 +1284,7 @@ int unit_can_reach_pos(struct block_list *bl,int x,int y, int easy)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y)
 {
 	struct walkpath_data wpd;
@@ -1328,8 +1328,7 @@ int unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, i
 
 /*==========================================
  * PCの攻撃 (timer関数)
- *------------------------------------------
- */
+ *------------------------------------------*/
 static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
 {
 	struct block_list *target;
@@ -1445,7 +1444,8 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
 	return 1;
 }
 
-static int unit_attack_timer(int tid,unsigned int tick,int id,int data) {
+static int unit_attack_timer(int tid,unsigned int tick,int id,int data)
+{
 	struct block_list *bl;
 	bl = map_id2bl(id);
 	if(bl && unit_attack_timer_sub(bl, tid, tick) == 0)
@@ -1457,8 +1457,7 @@ static int unit_attack_timer(int tid,unsigned int tick,int id,int data) {
  * Cancels an ongoing skill cast.
  * flag&1: Cast-Cancel invoked.
  * flag&2: Cancel only if skill is cancellable.
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_skillcastcancel(struct block_list *bl,int type)
 {
 	struct map_session_data *sd = NULL;
@@ -1506,7 +1505,8 @@ int unit_skillcastcancel(struct block_list *bl,int type)
 }
 
 // unit_data の初期化処理
-void unit_dataset(struct block_list *bl) {
+void unit_dataset(struct block_list *bl)
+{
 	struct unit_data *ud;
 	nullpo_retv(ud = unit_bl2ud(bl));
 
@@ -1551,8 +1551,7 @@ int unit_counttargeted(struct block_list* bl, int target_lv)
 
 /*==========================================
  *
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2)
 {
 	nullpo_retr(0, target);
@@ -1565,8 +1564,7 @@ int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int
 
 /*==========================================
  * 見た目のサイズを変更する
- *------------------------------------------
- */
+ *------------------------------------------*/
 int unit_changeviewsize(struct block_list *bl,short size)
 {
 	nullpo_retr(0, bl);
@@ -1590,9 +1588,9 @@ int unit_changeviewsize(struct block_list *bl,short size)
  * if clrtype is 1 (death), appropiate cleanup is performed. 
  * Otherwise it is assumed bl is being warped.
  * On-Kill specific stuff is not performed here, look at status_damage for that.
- *------------------------------------------
- */
-int unit_remove_map(struct block_list *bl, int clrtype) {
+ *------------------------------------------*/
+int unit_remove_map(struct block_list *bl, int clrtype)
+{
 	struct unit_data *ud = unit_bl2ud(bl);
 	struct status_change *sc = status_get_sc(bl);
 	nullpo_retr(0, ud);
@@ -1738,10 +1736,9 @@ int unit_remove_map(struct block_list *bl, int clrtype) {
  * if unit is on map, it is removed using the clrtype specified
  * If clrtype is <0, no saving is performed. This is only for non-authed
  * objects that shouldn't be on a map yet.
- *------------------------------------------
- */
-
-int unit_free(struct block_list *bl, int clrtype) {
+ *------------------------------------------*/
+int unit_free(struct block_list *bl, int clrtype)
+{
 	struct unit_data *ud = unit_bl2ud( bl );
 	nullpo_retr(0, ud);
 
@@ -1922,7 +1919,8 @@ int unit_free(struct block_list *bl, int clrtype) {
 	return 0;
 }
 
-int do_init_unit(void) {
+int do_init_unit(void)
+{
 	add_timer_func_list(unit_attack_timer,  "unit_attack_timer");
 	add_timer_func_list(unit_walktoxy_timer,"unit_walktoxy_timer");
 	add_timer_func_list(unit_walktobl_sub, "unit_walktobl_sub");
@@ -1930,7 +1928,8 @@ int do_init_unit(void) {
 	return 0;
 }
 
-int do_final_unit(void) {
+int do_final_unit(void)
+{
 	// nothing to do
 	return 0;
 }

+ 4 - 8
src/map/vending.c

@@ -20,8 +20,7 @@
 
 /*==========================================
  * 露店閉鎖
- *------------------------------------------
-*/
+ *------------------------------------------*/
 void vending_closevending(struct map_session_data *sd)
 {
 	nullpo_retv(sd);
@@ -34,8 +33,7 @@ void vending_closevending(struct map_session_data *sd)
 
 /*==========================================
  * 露店アイテムリスト要求
- *------------------------------------------
- */
+ *------------------------------------------*/
 void vending_vendinglistreq(struct map_session_data *sd,int id)
 {
 	struct map_session_data *vsd;
@@ -51,8 +49,7 @@ void vending_vendinglistreq(struct map_session_data *sd,int id)
 
 /*==========================================
  * 露店アイテム購入
- *------------------------------------------
- */
+ *------------------------------------------*/
 void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned char *p)
 {
 	int i, j, w, new_ = 0, blank, vend_list[MAX_VENDING];
@@ -208,8 +205,7 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
 
 /*==========================================
  * 露店開設
- *------------------------------------------
- */
+ *------------------------------------------*/
 void vending_openvending(struct map_session_data *sd,int len,char *message,int flag,unsigned char *p)
 {
 	int i, j;

+ 4 - 2
src/plugins/gui.c

@@ -31,7 +31,8 @@ int (*add_timer_interval)(unsigned int,int (*)(int,unsigned int,int,int),int,int
 //Used to output 'I'm Alive' every few seconds
 //Intended to let frontends know if the app froze
 //-----------------------------------------------------
-int imalive_timer(int tid, unsigned int tick, int id, int data){
+int imalive_timer(int tid, unsigned int tick, int id, int data)
+{
 	printf("I'm Alive\n");
 	return 0;
 }
@@ -40,7 +41,8 @@ int imalive_timer(int tid, unsigned int tick, int id, int data){
 //Flush stdout
 //stdout buffer needs flushed to be seen in GUI
 //-----------------------------------------------------
-int flush_timer(int tid, unsigned int tick, int id, int data){
+int flush_timer(int tid, unsigned int tick, int id, int data)
+{
 	fflush(stdout);
 	return 0;
 }

+ 4 - 2
src/plugins/sig.c

@@ -26,13 +26,15 @@ PLUGIN_EVENTS_TABLE = {
 //////////////////////////////////////
 
 #if defined(_WIN32) || defined(MINGW)
-	int sig_init() {
+	int sig_init()
+	{
 		ShowError("sig: This plugin is not supported - Enable 'exchndl' instead!\n");
 		return 0;
 	}
 	int sig_final() { return 0; }
 #elif defined (__NETBSD__) || defined (__FREEBSD__)
-	int sig_init() {
+	int sig_init()
+	{
 		ShowError("sig: This plugin is not supported!\n");
 		return 0;
 	}

+ 4 - 3
src/tool/adduser.c

@@ -15,7 +15,8 @@ char *account_txt = "../save/account.txt";
 //-----------------------------------------------------
 // Function to suppress control characters in a string.
 //-----------------------------------------------------
-int remove_control_chars(unsigned char *str) {
+int remove_control_chars(unsigned char *str)
+{
 	int i;
 	int change = 0;
 
@@ -29,8 +30,8 @@ int remove_control_chars(unsigned char *str) {
 	return change;
 }
 
-int main(int argc, char *argv[]) {
-
+int main(int argc, char *argv[])
+{
 	char username[24];
 	char password[24];
 	char sex[2];

+ 5 - 4
src/txt-converter/char-converter.c

@@ -31,7 +31,8 @@ char t_name[256];
 #define SQL_CONF_NAME "conf/inter_athena.conf"
 #define INTER_CONF_NAME "conf/inter_athena.conf"
 //--------------------------------------------------------
-int convert_init(void){
+int convert_init(void)
+{
 	char line[65536];
 	int ret;
 	int set,tmp_int[2], lineno, count;
@@ -265,8 +266,8 @@ int convert_init(void){
 	return 0;
 }
 
-int do_init(int argc, char **argv){
-
+int do_init(int argc, char **argv)
+{
 	char_config_read((argc>1)?argv[1]:CHAR_CONF_NAME);
 	mapindex_init();
 	sql_config_read((argc>2)?argv[2]:SQL_CONF_NAME);
@@ -280,4 +281,4 @@ int do_init(int argc, char **argv){
 
 void do_abort(void) {}
 
-void do_final (void) {}
+void do_final(void) {}

+ 2 - 1
src/txt-converter/login-converter.c

@@ -161,7 +161,8 @@ int mmo_auth_init(void)
 	return 0;
 }
 
-int login_config_read(const char *cfgName){
+int login_config_read(const char *cfgName)
+{
 	int i;
 	char line[1024], w1[1024], w2[1024];
 	FILE *fp;

Vissa filer visades inte eftersom för många filer har ändrats