forked from github/server
more crashes caused by shipowner==NULL
This commit is contained in:
parent
8d5ee9c811
commit
8c82b2815e
|
@ -192,7 +192,7 @@ print_curses(FILE * F, const faction * viewer, const void * obj, typ_t typ)
|
|||
unit * owner = shipowner(sh);
|
||||
a = sh->attribs;
|
||||
r = sh->region;
|
||||
if(owner != NULL) {
|
||||
if (owner != NULL) {
|
||||
if (owner->faction == viewer){
|
||||
self = 2;
|
||||
} else { /* steht eine person der Partei auf dem Schiff? */
|
||||
|
|
|
@ -449,7 +449,7 @@ print_curses(FILE *F, const faction *viewer, const void * obj, typ_t typ, int in
|
|||
unit * owner = shipowner(sh);
|
||||
a = sh->attribs;
|
||||
r = sh->region;
|
||||
if((owner) != NULL){
|
||||
if (owner) {
|
||||
if (owner->faction == viewer){
|
||||
self = 2;
|
||||
} else { /* steht eine person der Partei auf dem Schiff? */
|
||||
|
|
|
@ -1102,7 +1102,6 @@ mayboard(const unit * u, const ship * sh)
|
|||
unit *u2 = shipowner(sh);
|
||||
|
||||
return (!u2 || ucontact(u2, u) || alliedunit(u2, u->faction, HELP_GUARD));
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -652,8 +652,10 @@ ship_allowed(const struct ship * sh, const region * r)
|
|||
|
||||
if (is_freezing(u)) {
|
||||
unit * captain = shipowner(sh);
|
||||
if (captain) {
|
||||
ADDMSG(&captain->faction->msgs, msg_message("detectforbidden",
|
||||
"unit region", u, r));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -505,8 +505,10 @@ try_destruction(unit * u, unit * u2, const char *name, int skilldiff)
|
|||
sprintf(buf, destruction_failed_msg, unitname(u), name);
|
||||
addmessage(0, u->faction, buf, MSG_EVENT, ML_WARN);
|
||||
/* tell the enemy about the attempt: */
|
||||
if (u2) {
|
||||
sprintf(buf, detect_failure_msg, name);
|
||||
addmessage(0, u2->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (skilldiff < 0) {
|
||||
|
@ -514,15 +516,19 @@ try_destruction(unit * u, unit * u2, const char *name, int skilldiff)
|
|||
sprintf(buf, destruction_detected_msg, unitname(u), name);
|
||||
addmessage(0, u->faction, buf, MSG_EVENT, ML_WARN);
|
||||
/* tell the enemy whodunit: */
|
||||
if (u2) {
|
||||
sprintf(buf, detect_failure_msg, unitname(u2), unitname(u), name);
|
||||
addmessage(0, u2->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* tell the unit that the attempt succeeded */
|
||||
sprintf(buf, destruction_success_msg, name, unitname(u));
|
||||
addmessage(0, u->faction, buf, MSG_EVENT, ML_INFO);
|
||||
if (u2) {
|
||||
sprintf(buf, object_destroyed_msg, name);
|
||||
addmessage(0, u2->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||
}
|
||||
return 1; /* success */
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ verify_owners(boolean bOnce)
|
|||
}
|
||||
if (u->ship) {
|
||||
unit * bo = shipowner(u->ship);
|
||||
if (!fval(bo, UFL_OWNER)) {
|
||||
if (bo && !fval(bo, UFL_OWNER)) {
|
||||
log_error(("[verify_owners] %u ist Besitzer von %s, hat aber UFL_OWNER nicht.\n", unitname(bo), shipname(u->ship)));
|
||||
bFail = true;
|
||||
if (bOnce) break;
|
||||
|
|
Loading…
Reference in New Issue