[crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
[EMAIL PROTECTED] wrote: Module Name:crossfire Committed By: cavesomething Date: Mon Oct 3 03:29:41 UTC 2005 Modified Files: crossfire: ChangeLog crossfire/common: item.c loader.l map.c crossfire/doc/Developers: map-technical crossfire/include: define.h libproto.h map.h sproto.h crossfire/server: apply.c c_object.c shop.c skill_util.c Added Files: crossfire/doc/Developers: shops Log Message: add support for specialised shops Mikee and I both discovered a segfault caused here: Saving map /scorn/shops/bowshop Program received signal SIGSEGV, Segmentation fault. print_shop_string (m=0xafffee20, output_string=0xafffee20 ) at map.c:710 710 for (i=0; iitems[0].index; i++) { (gdb) bt #0 print_shop_string (m=0xafffee20, output_string=0xafffee20 ) at map.c:710 #1 0x080d29d9 in new_save_map (m=0x888d1d8, flag=0) at map.c:1194 #2 0x080aab16 in swap_map (map=0x888d1d8) at swap.c:166 #3 0x080aabf2 in check_active_maps () at swap.c:194 #4 0x08085429 in main (argc=13, argv=0xafffee20) at main.c:1247 (gdb) print i $13 = 0 (gdb) print items[i] Cannot access memory at address 0x0 (gdb) print items $15 = (shopitems *) 0x0 (gdb) print m-shopitems $14 = (shopitems *) 0x2e3a72 (gdb) print *m-shopitems Cannot access memory at address 0x2e3a72 Looking at this, the issue is items being a null pointer. Also, from what I've found, it's something perticular about the bowshop that's causing it. Also, if this helps: (gdb) up #1 0x080d29d9 in new_save_map (m=0x888d1d8, flag=0) at map.c:1194 1194print_shop_string(m, shop); (gdb) print m $19 = (mapstruct *) 0x888d1d8 (gdb) print shop $20 = \000\000\000\000\000\000\000\004\000\000\000\000\210S\035\b(\u\u\b\000\000\000\000\004\000\000\000\u7\u\bK\001\000\000\000\000\000\000\210\u\u\u\uU\v\b\u\205\u\b, '\0' repeats 19 times, \004\000\000\000\000\210S\035\b(\u\u\b\000\000\000\000\004\000\000\000\000{\u\bJ\001\000\000\000\000\000\000\u\u\u\u\uU\v\b\u7\u\b, '\0' repeats 19 times, \004\000\000\000\000\210S\035\b(\u\u\b\000\000\000\000\004\000\000\000\220u\u\bI\001\000\000\000\000\000\000\b\u\u\u\uU\v\b\000{\u\b, '\0' repeats 19 times, \004\000\000\000\000\210S\035\b(\u\u\b\000\000\000\000\004\000\000\000(\u\u\bH\001\000... Alex Schultz ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
[crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
*** *** 1190,1199 */ if (m-difficulty) fprintf(fp,difficulty %d\n, m-difficulty); if (m-region) fprintf(fp,region %s\n, m-region-name); ! if (m-shopgreed) { print_shop_string(m, shop); fprintf(fp,shopitems %s\n, shop); } if (m-shopmin) fprintf(fp,shopgreed %d\n, m-shopmin); if (m-shopmax) fprintf(fp,shopgreed %d\n, m-shopmax); if (m-shoprace) fprintf(fp,shoprace %s\n, m-shoprace); --- 1190,1200 */ if (m-difficulty) fprintf(fp,difficulty %d\n, m-difficulty); if (m-region) fprintf(fp,region %s\n, m-region-name); ! if (m-shopitems) { print_shop_string(m, shop); fprintf(fp,shopitems %s\n, shop); } + if (m-shopgreed) fprintf(fp,shopgreed %f\n, m-shopgreed); if (m-shopmin) fprintf(fp,shopgreed %d\n, m-shopmin); if (m-shopmax) fprintf(fp,shopgreed %d\n, m-shopmax); Is that code there really correct? It seems you are saving shopgreed as the field name when you are actually saving shopmin and shopmax. ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
Re: [crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
On 10/4/05, Mark Wedel [EMAIL PROTECTED] wrote: if (m-shopmin) fprintf(fp,shopgreed %d\n, m-shopmin); if (m-shopmax) fprintf(fp,shopgreed %d\n, m-shopmax); Is that code there really correct? It seems you are saving shopgreed as the field name when you are actually saving shopmin and shopmax. no, no it isn't, those are typos. I've fixed that now in CVS. Thanks for pointing it out. ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
[crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
[EMAIL PROTECTED] wrote: Module Name: crossfire Committed By: qal21 Date: Wed Aug 17 18:38:35 UTC 2005 Modified Files: crossfire/include: sproto.h crossfire/server: build_map.c Log Message: Fix bugs, and allow buttons and pedestals to be built underneath gates. [...] Index: crossfire/include/sproto.h diff -c crossfire/include/sproto.h:1.133 crossfire/include/sproto.h:1.134 *** crossfire/include/sproto.h:1.133 Fri Aug 12 16:16:31 2005 --- crossfire/include/sproto.hWed Aug 17 11:38:34 2005 *** *** 70,78 /* ban.c */ int checkbanned(const char *login, const char *host); /* build_map.c */ void remove_marking_runes(struct mapdef *map, short x, short y); int find_unused_connected_value(struct mapdef *map); ! int find_or_create_connection_for_map(object *pl, short x, short y); object *get_wall(struct mapdef *map, int x, int y); void fix_walls(struct mapdef *map, int x, int y); void apply_builder_floor(object *pl, object *material, short x, short y); --- 70,81 /* ban.c */ int checkbanned(const char *login, const char *host); /* build_map.c */ + object* get_connection_rune( object* pl, short x, short y ); + object* get_msg_book( object* pl, short x, short y ); + int adjust_sign_msg( object* pl, short x, short y, object* tmp ); void remove_marking_runes(struct mapdef *map, short x, short y); int find_unused_connected_value(struct mapdef *map); ! int find_or_create_connection_for_map(object* pl, short x, short y, object* rune); object *get_wall(struct mapdef *map, int x, int y); void fix_walls(struct mapdef *map, int x, int y); void apply_builder_floor(object *pl, object *material, short x, short y); This patch makes the functions get_connection_rune(), get_msg_book(), and adjust_sign_msg() global by removing the static modifier. What was the reason for this change? (Grepping through the source did show that these functions are both defined and called from build_map.c only.) ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
Re: [crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
Quoting Andreas Kirschbaum [EMAIL PROTECTED]: This patch makes the functions get_connection_rune(), get_msg_book(), and adjust_sign_msg() global by removing the static modifier. What was the reason for this change? (Grepping through the source did show that these functions are both defined and called from build_map.c only.) I did that mainly to follow the convention of the rest of the function. In build_map.c there are many other functions that could have very well been defined as static but weren't, so I changed these functions which I recently added to match. Alex Schultz ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
Re: [crossfire] Re: [Crossfire-cvs] CVS commit: crossfire
Nicolas Weeger wrote: Since Ansi C does allow you to assign any pointer value to and from void * this type cast is not necessary. OTOH such a cast potentially hides future bugs because the compiler cannot anymore generate warnings for mismatched pointer Actually, there is a warning (under MS Visual Studio) since event and options, const pointers, are treated like pointers. I see. I missed that the source pointers were const. It is also a mistake for me to send as void* (as opposed to const void*), since it's then easy to change the string in the plugin which would lead to data corruption. I agree. But wouldn't it be better to leave out the type casts and let the compiler issue warnings? After all, (as you pointed out) it *is* a problem, so suppressing the warning is not good. Note also that I added the specific conversion because (hopefully) soon plugin system will be redone and those parameter passing calls will be totally changed. OK. Then it probably does not matter anymore if the type casts are there or not. :) ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire