forked from github/server
fix highly theoretical source of crash.
bind_eressea now checks if bindings were called without filename
This commit is contained in:
parent
56141ee7a1
commit
36653ec65b
|
@ -28,15 +28,22 @@ void eressea_free_game(void) {
|
|||
}
|
||||
|
||||
int eressea_read_game(const char * filename) {
|
||||
if (filename) {
|
||||
return readgame(filename);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int eressea_write_game(const char * filename) {
|
||||
if (filename) {
|
||||
remove_empty_factions();
|
||||
return writegame(filename);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int eressea_read_orders(const char * filename) {
|
||||
if (filename) {
|
||||
FILE *F = fopen(filename, "r");
|
||||
int result;
|
||||
|
||||
|
@ -49,8 +56,11 @@ int eressea_read_orders(const char * filename) {
|
|||
fclose(F);
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int eressea_export_json(const char * filename, int flags) {
|
||||
if (filename) {
|
||||
FILE *F = fopen(filename, "w");
|
||||
if (F) {
|
||||
stream out = { 0 };
|
||||
|
@ -61,10 +71,12 @@ int eressea_export_json(const char * filename, int flags) {
|
|||
return err;
|
||||
}
|
||||
perror(filename);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int eressea_import_json(const char * filename) {
|
||||
if (filename) {
|
||||
FILE *F = fopen(filename, "r");
|
||||
if (F) {
|
||||
stream out = { 0 };
|
||||
|
@ -75,5 +87,6 @@ int eressea_import_json(const char * filename) {
|
|||
return err;
|
||||
}
|
||||
perror(filename);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ int volcano_damage(unit* u, const char* dice)
|
|||
{
|
||||
int hp = u->hp / u->number;
|
||||
int remain = u->hp % u->number;
|
||||
int ac, i, dead = 0, total = 0;
|
||||
int ac = 0, i, dead = 0, total = 0;
|
||||
int healings = 0;
|
||||
const struct race* rc_cat = get_race(RC_CAT);
|
||||
int protect = inside_building(u) ? (building_protection(u->building) + 1) : 0;
|
||||
|
|
Loading…
Reference in New Issue