… | |
… | |
730 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
730 | char *shop_string, *p, *q, *next_semicolon, *next_colon; |
731 | shopitems *items = NULL; |
731 | shopitems *items = NULL; |
732 | int i = 0, number_of_entries = 0; |
732 | int i = 0, number_of_entries = 0; |
733 | const typedata *current_type; |
733 | const typedata *current_type; |
734 | |
734 | |
735 | shop_string = strdup_local (input_string); |
735 | shop_string = strdup (input_string); |
736 | p = shop_string; |
736 | p = shop_string; |
737 | /* first we'll count the entries, we'll need that for allocating the array shortly */ |
737 | /* first we'll count the entries, we'll need that for allocating the array shortly */ |
738 | while (p) |
738 | while (p) |
739 | { |
739 | { |
740 | p = strchr (p, ';'); |
740 | p = strchr (p, ';'); |
… | |
… | |
926 | * with nothing between). There is no reason in those cases to |
926 | * with nothing between). There is no reason in those cases to |
927 | * keep the empty message. Also, msgbuf contains garbage data |
927 | * keep the empty message. Also, msgbuf contains garbage data |
928 | * when msgpos is zero, so copying it results in crashes |
928 | * when msgpos is zero, so copying it results in crashes |
929 | */ |
929 | */ |
930 | if (msgpos != 0) |
930 | if (msgpos != 0) |
931 | m->msg = strdup_local (msgbuf); |
931 | m->msg = strdup (msgbuf); |
932 | } |
932 | } |
933 | else if (!strcmp (key, "maplore")) |
933 | else if (!strcmp (key, "maplore")) |
934 | { |
934 | { |
935 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
935 | while (fgets (buf, HUGE_BUF, fp) != NULL) |
936 | { |
936 | { |
… | |
… | |
942 | strcpy (maplorebuf + maplorepos, buf); |
942 | strcpy (maplorebuf + maplorepos, buf); |
943 | maplorepos += strlen (buf); |
943 | maplorepos += strlen (buf); |
944 | } |
944 | } |
945 | } |
945 | } |
946 | if (maplorepos != 0) |
946 | if (maplorepos != 0) |
947 | m->maplore = strdup_local (maplorebuf); |
947 | m->maplore = strdup (maplorebuf); |
948 | } |
948 | } |
949 | else if (!strcmp (key, "end")) |
949 | else if (!strcmp (key, "end")) |
950 | { |
950 | { |
951 | break; |
951 | break; |
952 | } |
952 | } |
… | |
… | |
961 | LOG (llevError, "loading map and got a non 'arch map' line(%s %s)?\n", key, value); |
961 | LOG (llevError, "loading map and got a non 'arch map' line(%s %s)?\n", key, value); |
962 | } |
962 | } |
963 | else if (!strcmp (key, "name")) |
963 | else if (!strcmp (key, "name")) |
964 | { |
964 | { |
965 | *end = 0; |
965 | *end = 0; |
966 | m->name = strdup_local (value); |
966 | m->name = strdup (value); |
967 | } |
967 | } |
968 | /* first strcmp value on these are old names supported |
968 | /* first strcmp value on these are old names supported |
969 | * for compatibility reasons. The new values (second) are |
969 | * for compatibility reasons. The new values (second) are |
970 | * what really should be used. |
970 | * what really should be used. |
971 | */ |
971 | */ |
… | |
… | |
1009 | else if (!strcmp (key, "shopmax")) |
1009 | else if (!strcmp (key, "shopmax")) |
1010 | m->shopmax = atol (value); |
1010 | m->shopmax = atol (value); |
1011 | else if (!strcmp (key, "shoprace")) |
1011 | else if (!strcmp (key, "shoprace")) |
1012 | { |
1012 | { |
1013 | *end = 0; |
1013 | *end = 0; |
1014 | m->shoprace = strdup_local (value); |
1014 | m->shoprace = strdup (value); |
1015 | } |
1015 | } |
1016 | else if (!strcmp (key, "outdoor")) |
1016 | else if (!strcmp (key, "outdoor")) |
1017 | m->outdoor = atoi (value); |
1017 | m->outdoor = atoi (value); |
1018 | else if (!strcmp (key, "temp")) |
1018 | else if (!strcmp (key, "temp")) |
1019 | m->temp = atoi (value); |
1019 | m->temp = atoi (value); |
… | |
… | |
1069 | } |
1069 | } |
1070 | |
1070 | |
1071 | if (editor) |
1071 | if (editor) |
1072 | { |
1072 | { |
1073 | /* Use the value as in the file. */ |
1073 | /* Use the value as in the file. */ |
1074 | m->tile_path[tile - 1] = strdup_local (value); |
1074 | m->tile_path[tile - 1] = strdup (value); |
1075 | } |
1075 | } |
1076 | else if (path != NULL) |
1076 | else if (path != NULL) |
1077 | { |
1077 | { |
1078 | /* Use the normalized value. */ |
1078 | /* Use the normalized value. */ |
1079 | m->tile_path[tile - 1] = strdup_local (path); |
1079 | m->tile_path[tile - 1] = strdup (path); |
1080 | } |
1080 | } |
1081 | } /* end if tile direction (in)valid */ |
1081 | } /* end if tile direction (in)valid */ |
1082 | } |
1082 | } |
1083 | else |
1083 | else |
1084 | LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); |
1084 | LOG (llevError, "Got unknown value in map header: %s %s\n", key, value); |
… | |
… | |
1343 | make_path_to_file (filename); |
1343 | make_path_to_file (filename); |
1344 | } |
1344 | } |
1345 | else |
1345 | else |
1346 | { |
1346 | { |
1347 | if (!m->tmpname) |
1347 | if (!m->tmpname) |
1348 | m->tmpname = tempnam_local (settings.tmpdir, NULL); |
1348 | m->tmpname = tempnam (settings.tmpdir, NULL); |
1349 | |
1349 | |
1350 | strcpy (filename, m->tmpname); |
1350 | strcpy (filename, m->tmpname); |
1351 | } |
1351 | } |
1352 | |
1352 | |
1353 | LOG (llevDebug, "Saving map %s to %s\n", m->path, filename); |
1353 | LOG (llevDebug, "Saving map %s to %s\n", m->path, filename); |