… | |
… | |
20 | |
20 | |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #ifndef __CEXTRACT__ |
|
|
26 | # include <sproto.h> |
25 | #include <sproto.h> |
27 | #endif |
|
|
28 | |
26 | |
29 | /* |
27 | /* |
30 | * The score structure is used when treating new high-scores |
28 | * The score structure is used when treating new high-scores |
31 | */ |
29 | */ |
32 | |
|
|
33 | typedef struct scr |
30 | typedef struct scr |
34 | { |
31 | { |
35 | char name[64]; // name */ |
32 | char name[64]; // name */ |
36 | char title[64]; // Title */ |
33 | char title[64]; // Title */ |
37 | char killer[64]; // name (+ title) or "quit" */ |
34 | char killer[64]; // name (+ title) or "quit" */ |
… | |
… | |
102 | static char * |
99 | static char * |
103 | put_score (score *sc) |
100 | put_score (score *sc) |
104 | { |
101 | { |
105 | static char buf[MAX_BUF]; |
102 | static char buf[MAX_BUF]; |
106 | |
103 | |
107 | sprintf (buf, "%s:%s:%lld:%s:%s:%d:%d:%d", sc->name, sc->title, (long long) sc->exp, sc->killer, sc->maplevel, |
104 | sprintf (buf, "%s:%s:%" PRId64 ":%s:%s:%d:%d:%d", |
|
|
105 | sc->name, sc->title, (sint64)sc->exp, sc->killer, |
108 | sc->maxhp, sc->maxsp, sc->maxgrace); |
106 | sc->maplevel, sc->maxhp, sc->maxsp, sc->maxgrace); |
109 | return buf; |
107 | return buf; |
110 | } |
108 | } |
111 | |
109 | |
112 | /* |
110 | /* |
113 | * The oposite of put_score, get_score reads from the given buffer into |
111 | * The oposite of put_score, get_score reads from the given buffer into |
… | |
… | |
134 | assign (sc.title, cp); |
132 | assign (sc.title, cp); |
135 | |
133 | |
136 | if ((cp = spool (0, "score")) == NULL) |
134 | if ((cp = spool (0, "score")) == NULL) |
137 | return 0; |
135 | return 0; |
138 | |
136 | |
139 | long long exp; |
|
|
140 | sscanf (cp, "%lld", &exp); |
137 | sscanf (cp, "%" SCNd64, &sc.exp); |
141 | sc.exp = exp; |
|
|
142 | |
138 | |
143 | if ((cp = spool (0, "killer")) == NULL) |
139 | if ((cp = spool (0, "killer")) == NULL) |
144 | return 0; |
140 | return 0; |
145 | |
141 | |
146 | assign (sc.killer, cp); |
142 | assign (sc.killer, cp); |
… | |
… | |
269 | score *old_score; |
265 | score *old_score; |
270 | |
266 | |
271 | if (op->stats.exp == 0) |
267 | if (op->stats.exp == 0) |
272 | return; |
268 | return; |
273 | |
269 | |
274 | if (!op->contr->name_changed) |
|
|
275 | { |
|
|
276 | if (op->stats.exp > 0) |
|
|
277 | { |
|
|
278 | new_draw_info (NDI_UNIQUE, 0, op, "As you haven't changed your name, you won't"); |
|
|
279 | new_draw_info (NDI_UNIQUE, 0, op, "get into the high-score list."); |
|
|
280 | } |
|
|
281 | return; |
|
|
282 | } |
|
|
283 | if (QUERY_FLAG (op, FLAG_WAS_WIZ)) |
|
|
284 | { |
|
|
285 | new_draw_info (NDI_UNIQUE, 0, op, "Since you have been in wizard mode,"); |
|
|
286 | new_draw_info (NDI_UNIQUE, 0, op, "you can't enter the high-score list."); |
|
|
287 | return; |
|
|
288 | } |
|
|
289 | if (op->contr->explore) |
270 | if (op->contr->explore) |
290 | { |
271 | { |
291 | new_draw_info (NDI_UNIQUE, 0, op, "Since you were in explore mode,"); |
272 | new_draw_info (NDI_UNIQUE, 0, op, "Since you were in explore mode,"); |
292 | new_draw_info (NDI_UNIQUE, 0, op, "you can't enter the high-score list."); |
273 | new_draw_info (NDI_UNIQUE, 0, op, "you can't enter the high-score list."); |
293 | return; |
274 | return; |