From 31420c03a8443b729cc850acdad4f32845379f85 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 11 Apr 2013 16:53:30 -0300 Subject: Missing stuff from the merges done earlier Signed-off-by: shennetsind --- src/common/mmo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/mmo.h b/src/common/mmo.h index 7d1928201..bd6b29f76 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -98,7 +98,7 @@ #define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan] #define MAX_GUILDLEVEL 50 #define MAX_GUARDIANS 8 //Local max per castle. [Skotlex] -#define MAX_QUEST_DB 2350 //Max quests that the server will load +#define MAX_QUEST_DB 2400 //Max quests that the server will load #define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest // for produce -- cgit v1.2.3-70-g09d2 From 2967335cb41866162a69732abe4fc3a07b02e27c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 15 Apr 2013 23:27:29 -0300 Subject: Fixed Bug #7127 Also Implemented allow party invitations state. Implemented saving of client options (atm show_equip and allow party invitation) http://hercules.ws/board/tracker/issue-7127-view-equipment/ Signed-off-by: shennetsind --- sql-files/main.sql | 5 ++++- sql-files/upgrades/2013-04-16--02-15.sql | 4 ++++ src/char/char.c | 30 +++++++++++++++++++++++------- src/common/mmo.h | 8 +++++++- src/map/clif.c | 27 +++++++++++++++++++++++++-- src/map/clif.h | 2 ++ src/map/packets.h | 2 +- 7 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 sql-files/upgrades/2013-04-16--02-15.sql (limited to 'src/common') diff --git a/sql-files/main.sql b/sql-files/main.sql index ae8fa7b03..0e9dc5b67 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -105,8 +105,9 @@ CREATE TABLE IF NOT EXISTS `char` ( `child` int(11) unsigned NOT NULL default '0', `fame` int(11) unsigned NOT NULL default '0', `rename` SMALLINT(3) unsigned NOT NULL default '0', - `delete_date` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `delete_date` INT(11) unsigned NOT NULL DEFAULT '0', `slotchange` SMALLINT(3) unsigned NOT NULL default '0', + `char_opt` INT( 11 ) unsigned NOT NULL default '0', PRIMARY KEY (`char_id`), UNIQUE KEY `name_key` (`name`), KEY `account_id` (`account_id`), @@ -654,6 +655,8 @@ INSERT INTO `sql_updates` (`timestamp`) VALUES (1362445531); INSERT INTO `sql_updates` (`timestamp`) VALUES (1362528000); INSERT INTO `sql_updates` (`timestamp`) VALUES (1362794218); INSERT INTO `sql_updates` (`timestamp`) VALUES (1364409316); +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366075474); +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541); -- -- Table structure for table `sstatus` diff --git a/sql-files/upgrades/2013-04-16--02-15.sql b/sql-files/upgrades/2013-04-16--02-15.sql new file mode 100644 index 000000000..8d051421f --- /dev/null +++ b/sql-files/upgrades/2013-04-16--02-15.sql @@ -0,0 +1,4 @@ +#1366078541 +ALTER TABLE `char` ADD `char_opt` INT( 11 ) UNSIGNED NOT NULL; +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366075474);#for the previous that missed it.. +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541); \ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 99505f632..ce0d067a7 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -436,7 +436,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) else errors++; } - + if ( (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || @@ -453,9 +453,16 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || - (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) - ) - { //Save status + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) + ) { //Save status + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d'," @@ -463,7 +470,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) "`option`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," - "`delete_date`='%lu',`robe`='%d',`slotchange`='%d'" + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u'" " WHERE `account_id`='%d' AND `char_id` = '%d'", char_db, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, @@ -474,7 +481,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) mapindex_id2name(p->last_point.map), p->last_point.x, p->last_point.y, mapindex_id2name(p->save_point.map), p->save_point.x, p->save_point.y, p->rename, (unsigned long)p->delete_date, // FIXME: platform-dependent size - p->robe,p->slotchange, + p->robe,p->slotchange,opt, p->account_id, p->char_id) ) { Sql_ShowDebug(sql_handle); @@ -1084,6 +1091,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything struct hotkey tmp_hotkey; int hotkey_num; #endif + unsigned int opt; memset(p, 0, sizeof(struct mmo_charstatus)); @@ -1102,7 +1110,8 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," "`hair_color`,`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," - "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`" + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`" " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) @@ -1159,6 +1168,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_SHORT, &p->robe, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_USHORT, &p->slotchange, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_UINT, &opt, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); @@ -1330,6 +1340,12 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything SqlStmt_Free(stmt); StringBuf_Destroy(&buf); + /* load options into proper vars */ + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = true; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = true; + cp = idb_ensure(char_db_, char_id, create_charstatus); memcpy(cp, p, sizeof(struct mmo_charstatus)); return 1; diff --git a/src/common/mmo.h b/src/common/mmo.h index bd6b29f76..c0842bac2 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -219,6 +219,12 @@ enum e_skill_flag //... }; +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + struct s_skill { unsigned short id; unsigned char lv; @@ -378,7 +384,7 @@ struct mmo_charstatus { #ifdef HOTKEY_SAVING struct hotkey hotkeys[MAX_HOTKEYS]; #endif - bool show_equip; + bool show_equip, allow_party; unsigned short rename; unsigned short slotchange; diff --git a/src/map/clif.c b/src/map/clif.c index b1998de77..57b14b1de 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6354,7 +6354,7 @@ void clif_partyinvitationstate(struct map_session_data* sd) WFIFOHEAD(fd, packet_len(0x2c9)); WFIFOW(fd, 0) = 0x2c9; - WFIFOB(fd, 2) = 0; // not implemented + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; WFIFOSET(fd, packet_len(0x2c9)); } @@ -14641,6 +14641,16 @@ void clif_parse_EquipTick(int fd, struct map_session_data* sd) clif->equiptickack(sd, flag); } +/// Request to change party invitation tick. +/// value: +/// 0 = disabled +/// 1 = enabled +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + bool flag = RFIFOB(fd,6)?true:false; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} /// Questlog System [Kevin] [Inkfish] /// @@ -16595,6 +16605,15 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { clif->send(&p,sizeof(p),bl,t); #endif } + +void clif_partytickack(struct map_session_data* sd, bool flag) { + + WFIFOHEAD(sd->fd, packet_len(0x2c9)); + WFIFOW(sd->fd, 0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_len(0x2c9)); +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -16974,6 +16993,7 @@ void clif_defaults(void) { clif->hate_info = clif_hate_info; clif->mission_info = clif_mission_info; clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; clif->equiptickack = clif_equiptickack; clif->viewequip_ack = clif_viewequip_ack; clif->viewequip_fail = clif_viewequip_fail; @@ -17465,10 +17485,13 @@ void clif_defaults(void) { clif->pDebug = clif_parse_debug; clif->pSkillSelectMenu = clif_parse_SkillSelectMenu; clif->pMoveItem = clif_parse_MoveItem; - clif->pDull = clif_parse_dull; /* RagExe Cash Shop [Ind/Hercules] */ clif->pCashShopOpen = clif_parse_CashShopOpen; clif->pCashShopClose = clif_parse_CashShopClose; clif->pCashShopSchedule = clif_parse_CashShopSchedule; clif->pCashShopBuy = clif_parse_CashShopBuy; + /* */ + clif->pPartyTick = clif_parse_PartyTick; + /* dull */ + clif->pDull = clif_parse_dull; } diff --git a/src/map/clif.h b/src/map/clif.h index 89a330a90..0e13b29f2 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -575,6 +575,7 @@ struct clif_interface { void (*hate_info) (struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type); void (*mission_info) (struct map_session_data *sd, int mob_id, unsigned char progress); void (*feel_hate_reset) (struct map_session_data *sd); + void (*partytickack) (struct map_session_data* sd, bool flag); void (*equiptickack) (struct map_session_data* sd, int flag); void (*viewequip_ack) (struct map_session_data* sd, struct map_session_data* tsd); void (*viewequip_fail) (struct map_session_data* sd); @@ -1071,6 +1072,7 @@ struct clif_interface { void (*pCashShopClose) (int fd, struct map_session_data *sd); void (*pCashShopSchedule) (int fd, struct map_session_data *sd); void (*pCashShopBuy) (int fd, struct map_session_data *sd); + void (*pPartyTick) (int fd, struct map_session_data *sd); } clif_s; struct clif_interface *clif; diff --git a/src/map/packets.h b/src/map/packets.h index 09e035413..3c204c978 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1116,7 +1116,7 @@ packet(0x020d,-1); packet(0x02c5,30); packet(0x02c6,30); packet(0x02c7,7,clif->pReplyPartyInvite2,2,6); - packet(0x02c8,3); + packet(0x02c8,3,clif->pPartyTick,2); packet(0x02c9,3); packet(0x02ca,3); packet(0x02cb,20); -- cgit v1.2.3-70-g09d2 From 561ea3c0008b8f12c62fdd0e3c45eef0a76485d9 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 16 Apr 2013 04:11:48 -0300 Subject: Partial Fix for #3110 Translated mallo.c from japanese to english (yes with google so some stuff still sound iffy) http://hercules.ws/board/tracker/issue-3110-source-korean-comments/ Signed-off-by: shennetsind --- src/common/malloc.c | 92 ++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/common') diff --git a/src/common/malloc.c b/src/common/malloc.c index eb073036e..d8799b2a1 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -130,49 +130,49 @@ void aFree_(void *p, const char *file, int line, const char *func) /* USE_MEMMGR */ /* - * メモリマネージャ - * malloc , free の処理を効率的に出来るようにしたもの。 - * 複雑な処理を行っているので、若干重くなるかもしれません。 + * Memory manager + * able to handle malloc and free efficiently + * Since the complex processing, I might be slightly heavier. * - * データ構造など(説明下手ですいません^^; ) - * ・メモリを複数の「ブロック」に分けて、さらにブロックを複数の「ユニット」 - * に分けています。ユニットのサイズは、1ブロックの容量を複数個に均等配分 - * したものです。たとえば、1ユニット32KBの場合、ブロック1つは32Byteのユ - * ニットが、1024個集まって出来ていたり、64Byteのユニットが 512個集まって - * 出来ていたりします。(padding,unit_head を除く) + * (I'm sorry for the poor description ^ ^;) such as data structures + * Divided into "blocks" of a plurality of memory, "unit" of a plurality of blocks further + * I have to divide. Size of the unit, a plurality of distribution equal to the capacity of one block + * That's what you have. For example, if one unit of 32KB, one block 1 Yu 32Byte + * Knit, or are able to gather 1024, gathered 512 units 64Byte + * I can be or have. (Excluding padding, the unit_head) * - * ・ブロック同士はリンクリスト(block_prev,block_next) でつながり、同じサイ - * ズを持つブロック同士もリンクリスト(hash_prev,hash_nect) でつな - * がっています。それにより、不要となったメモリの再利用が効率的に行えます。 + * Lead-linked list (block_prev, block_next) in each other is the same size block + * Linked list (hash_prev, hash_nect) even among such one in the block with the figure + * I like to have. Thus, reuse of memory no longer needed can be performed efficiently. */ -/* ブロックのアライメント */ +/* Alignment of the block */ #define BLOCK_ALIGNMENT1 16 #define BLOCK_ALIGNMENT2 64 -/* ブロックに入るデータ量 */ +/* Amount of data entering a block */ #define BLOCK_DATA_COUNT1 128 #define BLOCK_DATA_COUNT2 608 -/* ブロックの大きさ: 16*128 + 64*576 = 40KB */ +/* The size of the block: 16*128 + 64*576 = 40KB */ #define BLOCK_DATA_SIZE1 ( BLOCK_ALIGNMENT1 * BLOCK_DATA_COUNT1 ) #define BLOCK_DATA_SIZE2 ( BLOCK_ALIGNMENT2 * BLOCK_DATA_COUNT2 ) #define BLOCK_DATA_SIZE ( BLOCK_DATA_SIZE1 + BLOCK_DATA_SIZE2 ) -/* 一度に確保するブロックの数。 */ +/* The number of blocks to be allocated at a time. */ #define BLOCK_ALLOC 104 -/* ブロック */ +/* block */ struct block { - struct block* block_next; /* 次に確保した領域 */ - struct block* unfill_prev; /* 次の埋まっていない領域 */ - struct block* unfill_next; /* 次の埋まっていない領域 */ - unsigned short unit_size; /* ユニットの大きさ */ - unsigned short unit_hash; /* ユニットのハッシュ */ - unsigned short unit_count; /* ユニットの個数 */ - unsigned short unit_used; /* 使用ユニット数 */ - unsigned short unit_unfill; /* 未使用ユニットの場所 */ - unsigned short unit_maxused; /* 使用ユニットの最大値 */ + struct block* block_next; /* Then the allocated area */ + struct block* unfill_prev; /* The previous area not filled */ + struct block* unfill_next; /* The next area not filled */ + unsigned short unit_size; /* The size of the unit */ + unsigned short unit_hash; /* The hash of the unit */ + unsigned short unit_count; /* The number of units */ + unsigned short unit_used; /* The number of used units */ + unsigned short unit_unfill; /* The number of unused units */ + unsigned short unit_maxused; /* The maximum value of units used */ char data[ BLOCK_DATA_SIZE ]; }; @@ -187,7 +187,7 @@ struct unit_head { static struct block* hash_unfill[BLOCK_DATA_COUNT1 + BLOCK_DATA_COUNT2 + 1]; static struct block* block_first, *block_last, block_head; -/* メモリを使い回せない領域用のデータ */ +/* Data for areas that do not use the memory be turned */ struct unit_head_large { size_t size; struct unit_head_large* prev; @@ -212,7 +212,7 @@ static unsigned short size2hash( size_t size ) return (unsigned short)(size - BLOCK_DATA_SIZE1 + BLOCK_ALIGNMENT2 - 1) / BLOCK_ALIGNMENT2 + BLOCK_DATA_COUNT1; } else { - return 0xffff; // ブロック長を超える場合は hash にしない + return 0xffff; // If it exceeds the block length hash I do not } } @@ -241,8 +241,8 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) } memmgr_usage_bytes += size; - /* ブロック長を超える領域の確保には、malloc() を用いる */ - /* その際、unit_head.block に NULL を代入して区別する */ + /* To ensure the area that exceeds the length of the block, using malloc () to */ + /* At that time, the distinction by assigning NULL to unit_head.block */ if(hash2size(size_hash) > BLOCK_DATA_SIZE - sizeof(struct unit_head)) { struct unit_head_large* p = (struct unit_head_large*)MALLOC(sizeof(struct unit_head_large)+size,file,line,func); if(p != NULL) { @@ -267,7 +267,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) } } - /* 同一サイズのブロックが確保されていない時、新たに確保する */ + /* When a block of the same size is not ensured, to ensure a new */ if(hash_unfill[size_hash]) { block = hash_unfill[size_hash]; } else { @@ -275,7 +275,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) } if( block->unit_unfill == 0xFFFF ) { - // free済み領域が残っていない + // there are no more free space that memmgr_assert(block->unit_used < block->unit_count); memmgr_assert(block->unit_used == block->unit_maxused); head = block2unit(block, block->unit_maxused); @@ -288,7 +288,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) } if( block->unit_unfill == 0xFFFF && block->unit_maxused >= block->unit_count) { - // ユニットを使い果たしたので、unfillリストから削除 + // Since I ran out of the unit, removed from the list unfill if( block->unfill_prev == &block_head) { hash_unfill[ size_hash ] = block->unfill_next; } else { @@ -349,10 +349,10 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c old_size = ((struct unit_head_large *)((char *)memblock - sizeof(struct unit_head_large) + sizeof(long)))->size; } if(old_size > size) { - // サイズ縮小 -> そのまま返す(手抜き) + // Size reduction - return> as it is (negligence) return memblock; } else { - // サイズ拡大 + // Size Large void *p = _mmalloc(size,file,line,func); if(p != NULL) { memcpy(p,memblock,old_size); @@ -383,7 +383,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) head = (struct unit_head *)((char *)ptr - sizeof(struct unit_head) + sizeof(long)); if(head->size == 0) { - /* malloc() で直に確保された領域 */ + /* area that is directly secured by malloc () */ struct unit_head_large *head_large = (struct unit_head_large *)((char *)ptr - sizeof(struct unit_head_large) + sizeof(long)); if( *(long*)((char*)head_large + sizeof(struct unit_head_large) - sizeof(long) + head_large->size) @@ -408,7 +408,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) FREE(head_large,file,line,func); } } else { - /* ユニット解放 */ + /* Release unit */ struct block *block = head->block; if( (char*)head - (char*)block > sizeof(struct block) ) { ShowError("Memory manager: args of aFree 0x%p is invalid pointer %s line %d\n", ptr, file, line); @@ -426,11 +426,11 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) #endif memmgr_assert( block->unit_used > 0 ); if(--block->unit_used == 0) { - /* ブロックの解放 */ + /* Release of the block */ block_free(block); } else { if( block->unfill_prev == NULL) { - // unfill リストに追加 + // add to unfill list if( hash_unfill[ block->unit_hash ] ) { hash_unfill[ block->unit_hash ]->unfill_prev = block; } @@ -445,17 +445,17 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) } } -/* ブロックを確保する */ +/* Allocating blocks */ static struct block* block_malloc(unsigned short hash) { int i; struct block *p; if(hash_unfill[0] != NULL) { - /* ブロック用の領域は確保済み */ + /* Space for the block has already been secured */ p = hash_unfill[0]; hash_unfill[0] = hash_unfill[0]->unfill_next; } else { - /* ブロック用の領域を新たに確保する */ + /* Newly allocated space for the block */ p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ ); if(p == NULL) { ShowFatalError("Memory manager::block_alloc failed.\n"); @@ -463,17 +463,17 @@ static struct block* block_malloc(unsigned short hash) } if(block_first == NULL) { - /* 初回確保 */ + /* First ensure */ block_first = p; } else { block_last->block_next = p; } block_last = &p[BLOCK_ALLOC - 1]; block_last->block_next = NULL; - /* ブロックを連結させる */ + /* Linking the block */ for(i=0;iunfill_prev = &block_head; -- cgit v1.2.3-70-g09d2 From 60cfb9545fbfa1301d147ba242a8048a0fbde758 Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Mon, 22 Apr 2013 22:15:23 -0300 Subject: Little fix to start_items. Thanks to lighta! Signed-off-by: Matheus Macabu --- src/char/char.c | 4 ++-- src/common/mmo.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/char/char.c b/src/char/char.c index ae65caa56..204397dd3 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -125,7 +125,7 @@ int max_connect_user = -1; int gm_allow_group = -1; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; int start_zeny = 0; -int start_items[64]; //32 starting items allowed [mkbu95] +int start_items[MAX_START_ITEMS*2]; int guild_exp_rate = 100; //Custom limits for the fame lists. [Skotlex] @@ -4790,7 +4790,7 @@ int char_config_read(const char* cfgName) i = 0; split = strtok(w2, ","); - while (split != NULL) { + while (split != NULL && i < MAX_START_ITEMS) { split2 = split; split = strtok(NULL, ","); start_items[i] = atoi(split2); diff --git a/src/common/mmo.h b/src/common/mmo.h index c0842bac2..e19c8f94d 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -100,6 +100,7 @@ #define MAX_GUARDIANS 8 //Local max per castle. [Skotlex] #define MAX_QUEST_DB 2400 //Max quests that the server will load #define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest +#define MAX_START_ITEMS 32 //Max number of items allowed to be given to a char whenever it's created. [mkbu95] // for produce #define MIN_ATTRIBUTE 0 -- cgit v1.2.3-70-g09d2