diff options
-rw-r--r-- | src/common/showmsg.c | 4 | ||||
-rw-r--r-- | src/map/map.c | 100 | ||||
-rw-r--r-- | src/map/skill.c | 7 |
3 files changed, 77 insertions, 34 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 8ed8efc1d..d8864684d 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -804,7 +804,11 @@ void showmsg_showConfigWarning(struct config_setting_t *config, const char *stri StrBuf->AppendStr(&buf, string); StrBuf->Printf(&buf, " (%s:%u)\n", config_setting_source_file(config), config_setting_source_line(config)); va_start(ap, string); +#ifdef BUILDBOT + vShowMessage_(MSG_ERROR, StrBuf->Value(&buf), ap); +#else // BUILDBOT vShowMessage_(MSG_WARNING, StrBuf->Value(&buf), ap); +#endif // BUILDBOT va_end(ap); StrBuf->Destroy(&buf); } diff --git a/src/map/map.c b/src/map/map.c index c5ea7c1f3..d6425b94e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -683,49 +683,95 @@ static int bl_getall_area(int type, int m, int x0, int y0, int x1, int y1, int ( x1 = min(x1, map->list[m].xs - 1); y1 = min(y1, map->list[m].ys - 1); - for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { - for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { - if (type&~BL_MOB) { - for (bl = map->list[m].block[bx + by * map->list[m].bxs]; bl != NULL; bl = bl->next) { - if (bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1) { - if( map->bl_list_count >= map->bl_list_size ) - map_bl_list_expand(); - if (func) { - va_start(args, func); - if (func(bl, args)) { + { + const int x0b = x0 / BLOCK_SIZE; + const int x1b = x1 / BLOCK_SIZE; + const int y0b = y0 / BLOCK_SIZE; + const int y1b = y1 / BLOCK_SIZE; + const struct map_data *const listm = &map->list[m]; + const int bxs0 = listm->bxs; + + // duplication for better performance + if (func != NULL) { + if (type & ~BL_MOB) { + for (by = y0b; by <= y1b; by++) { + const int bxs = by * bxs0; + for (bx = x0b; bx <= x1b; bx++) { + for (bl = listm->block[bx + bxs]; bl != NULL; bl = bl->next) { + const int x = bl->x; + const int y = bl->y; + if (bl->type & type && x >= x0 && x <= x1 && y >= y0 && y <= y1) { + va_start(args, func); + if (func(bl, args)) { + if (map->bl_list_count >= map->bl_list_size) + map_bl_list_expand(); + map->bl_list[map->bl_list_count++] = bl; + found++; + } + va_end(args); + } + } + } + } + } + if (type & BL_MOB) { + for (by = y0b; by <= y1b; by++) { + const int bxs = by * bxs0; + for (bx = x0b; bx <= x1b; bx++) { + for (bl = listm->block_mob[bx + bxs]; bl != NULL; bl = bl->next) { + const int x = bl->x; + const int y = bl->y; + if (x >= x0 && x <= x1 && y >= y0 && y <= y1) { + va_start(args, func); + if (func(bl, args)) { + if (map->bl_list_count >= map->bl_list_size) + map_bl_list_expand(); + map->bl_list[map->bl_list_count++] = bl; + found++; + } + va_end(args); + } + } + } + } + } + } else { // func != NULL + if (type & ~BL_MOB) { + for (by = y0b; by <= y1b; by++) { + const int bxs = by * bxs0; + for (bx = x0b; bx <= x1b; bx++) { + for (bl = listm->block[bx + bxs]; bl != NULL; bl = bl->next) { + const int x = bl->x; + const int y = bl->y; + if (bl->type & type && x >= x0 && x <= x1 && y >= y0 && y <= y1) { + if (map->bl_list_count >= map->bl_list_size) + map_bl_list_expand(); map->bl_list[map->bl_list_count++] = bl; found++; } - va_end(args); - } else { - map->bl_list[map->bl_list_count++] = bl; - found++; } } } } - if (type&BL_MOB) { // TODO: fix this code duplication - for (bl = map->list[m].block_mob[bx + by * map->list[m].bxs]; bl != NULL; bl = bl->next) { - if (bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1) { - if( map->bl_list_count >= map->bl_list_size ) - map_bl_list_expand(); - if (func) { - va_start(args, func); - if (func(bl, args)) { + if (type & BL_MOB) { + for (by = y0b; by <= y1b; by++) { + const int bxs = by * bxs0; + for (bx = x0b; bx <= x1b; bx++) { + for (bl = listm->block_mob[bx + bxs]; bl != NULL; bl = bl->next) { + const int x = bl->x; + const int y = bl->y; + if (x >= x0 && x <= x1 && y >= y0 && y <= y1) { + if (map->bl_list_count >= map->bl_list_size) + map_bl_list_expand(); map->bl_list[map->bl_list_count++] = bl; found++; } - va_end(args); - } else { - map->bl_list[map->bl_list_count++] = bl; - found++; } } } } } } - return found; } diff --git a/src/map/skill.c b/src/map/skill.c index 0c2f099fb..1527d31b2 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -20261,12 +20261,6 @@ bool skill_read_skilldb(const char *filename) /*=============================== * DB reading. - * skill_db.txt - * skill_require_db.txt - * skill_cast_db.txt - * skill_castnodex_db.txt - * skill_nocast_db.txt - * skill_unit_db.txt * produce_db.txt * create_arrow_db.txt * abra_db.txt @@ -20289,7 +20283,6 @@ void skill_readdb(bool minimal) { #ifdef ENABLE_CASE_CHECK script->parser_current_file = DBPATH"skill_db.conf"; #endif // ENABLE_CASE_CHECK - //sv->readdb(map->db_path, DBPATH"skill_db.txt", ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb); skill->read_skilldb(DBPATH"skill_db.conf"); #ifdef ENABLE_CASE_CHECK script->parser_current_file = NULL; |