… | |
… | |
566 | return items; |
566 | return items; |
567 | } |
567 | } |
568 | |
568 | |
569 | /* opposite of parse string, this puts the string that was originally fed in to |
569 | /* opposite of parse string, this puts the string that was originally fed in to |
570 | * the map (or something equivilent) into output_string. */ |
570 | * the map (or something equivilent) into output_string. */ |
571 | static void |
571 | static const char * |
572 | print_shop_string (maptile *m, char *output_string) |
572 | print_shop_string (maptile *m) |
573 | { |
573 | { |
574 | int i; |
574 | static dynbuf_text buf; buf.clear (); |
575 | char tmp[MAX_BUF]; |
|
|
576 | |
575 | |
577 | strcpy (output_string, ""); |
|
|
578 | for (i = 0; i < m->shopitems[0].index; i++) |
576 | for (int i = 0; i < m->shopitems[0].index; i++) |
579 | { |
577 | { |
580 | if (m->shopitems[i].typenum) |
578 | if (m->shopitems[i].typenum) |
581 | { |
579 | { |
582 | if (m->shopitems[i].strength) |
580 | if (m->shopitems[i].strength) |
583 | sprintf (tmp, "%s:%d;", m->shopitems[i].name, m->shopitems[i].strength); |
581 | buf.printf ("%s:%d;", m->shopitems[i].name, m->shopitems[i].strength); |
584 | else |
582 | else |
585 | sprintf (tmp, "%s;", m->shopitems[i].name); |
583 | buf.printf ("%s;", m->shopitems[i].name); |
586 | } |
584 | } |
587 | else |
585 | else |
588 | { |
586 | { |
589 | if (m->shopitems[i].strength) |
587 | if (m->shopitems[i].strength) |
590 | sprintf (tmp, "*:%d;", m->shopitems[i].strength); |
588 | buf.printf ("*:%d;", m->shopitems[i].strength); |
591 | else |
589 | else |
592 | sprintf (tmp, "*"); |
590 | buf.printf ("*"); |
593 | } |
591 | } |
594 | |
|
|
595 | strcat (output_string, tmp); |
|
|
596 | } |
592 | } |
|
|
593 | |
|
|
594 | return buf; |
597 | } |
595 | } |
598 | |
596 | |
599 | /* This loads the header information of the map. The header |
597 | /* This loads the header information of the map. The header |
600 | * contains things like difficulty, size, timeout, etc. |
598 | * contains things like difficulty, size, timeout, etc. |
601 | * this used to be stored in the map object, but with the |
599 | * this used to be stored in the map object, but with the |
… | |
… | |
736 | MAP_OUT (reset_timeout); |
734 | MAP_OUT (reset_timeout); |
737 | MAP_OUT (fixed_resettime); |
735 | MAP_OUT (fixed_resettime); |
738 | MAP_OUT (no_reset); |
736 | MAP_OUT (no_reset); |
739 | MAP_OUT (no_drop); |
737 | MAP_OUT (no_drop); |
740 | MAP_OUT (difficulty); |
738 | MAP_OUT (difficulty); |
741 | |
|
|
742 | if (default_region) MAP_OUT2 (region, default_region->name); |
739 | if (default_region) MAP_OUT2 (region, default_region->name); |
743 | |
740 | |
744 | if (shopitems) |
741 | if (shopitems) MAP_OUT2 (shopitems, print_shop_string (this)); |
745 | { |
|
|
746 | char shop[MAX_BUF]; |
|
|
747 | print_shop_string (this, shop); |
|
|
748 | MAP_OUT2 (shopitems, shop); |
|
|
749 | } |
|
|
750 | |
|
|
751 | MAP_OUT (shopgreed); |
742 | MAP_OUT (shopgreed); |
752 | MAP_OUT (shopmin); |
743 | MAP_OUT (shopmin); |
753 | MAP_OUT (shopmax); |
744 | MAP_OUT (shopmax); |
754 | if (shoprace) MAP_OUT (shoprace); |
745 | if (shoprace) MAP_OUT (shoprace); |
|
|
746 | |
755 | MAP_OUT (darkness); |
747 | MAP_OUT (darkness); |
756 | MAP_OUT (width); |
748 | MAP_OUT (width); |
757 | MAP_OUT (height); |
749 | MAP_OUT (height); |
758 | MAP_OUT (enter_x); |
750 | MAP_OUT (enter_x); |
759 | MAP_OUT (enter_y); |
751 | MAP_OUT (enter_y); |