Fix no error message when attaching new template/virtual vehicle fails

See: #187
This commit is contained in:
Jonathan G Rennison
2020-09-08 23:56:38 +01:00
parent ff12051ee1
commit 11a9a4dc0c
5 changed files with 42 additions and 2 deletions

View File

@@ -198,6 +198,25 @@ public:
* @return the number of bytes written
*/
int WriteSummaryMessage(char *buf, char *last, StringID cmd_msg = 0) const;
bool IsSuccessWithMessage() const
{
return this->Succeeded() && this->message != INVALID_STRING_ID;
}
void MakeSuccessWithMessage()
{
assert(this->message != INVALID_STRING_ID);
this->success = true;
}
CommandCost UnwrapSuccessWithMessage() const
{
assert(this->IsSuccessWithMessage());
CommandCost res = *this;
res.success = false;
return res;
}
};
/**