Fix code style. Fix error text

This commit is contained in:
Oli414 2017-10-04 15:51:45 +02:00 committed by Michał Janiszewski
parent 59eae9defa
commit d39c80da42
5 changed files with 30 additions and 17 deletions

View File

@ -205,7 +205,7 @@ extern "C"
#pragma region GuestSetName
void guest_set_name(uint16 spriteIndex, const char *name)
void guest_set_name(uint16 spriteIndex, const char * name)
{
auto gameAction = GuestSetNameAction(spriteIndex, name);
GameActions::Execute(&gameAction);
@ -215,7 +215,8 @@ extern "C"
*
* rct2: 0x00698D6C
*/
void game_command_set_guest_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp) {
void game_command_set_guest_name(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp)
{
Guard::Assert(false, "GAME_COMMAND_SET_GUEST_NAME DEPRECATED");
}
@ -223,13 +224,14 @@ extern "C"
#pragma region StaffSetName
void staff_set_name(uint16 spriteIndex, const char *name)
void staff_set_name(uint16 spriteIndex, const char * name)
{
auto gameAction = StaffSetNameAction(spriteIndex, name);
GameActions::Execute(&gameAction);
}
void game_command_set_staff_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp) {
void game_command_set_staff_name(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp)
{
Guard::Assert(false, "GAME_COMMAND_SET_STAFF_NAME DEPRECATED");
}

View File

@ -53,6 +53,7 @@ public:
GameActionResult::Ptr Query() const override
{
if (_spriteIndex >= MAX_SPRITES)
{
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
@ -63,7 +64,7 @@ public:
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_ERR_INVALID_NAME_FOR_GUEST);
}
rct_peep *peep = GET_PEEP(_spriteIndex);
rct_peep * peep = GET_PEEP(_spriteIndex);
if (peep->type != PEEP_TYPE_GUEST)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
@ -74,7 +75,7 @@ public:
if (newUserStringId == 0)
{
// TODO: Probably exhausted, introduce new error.
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, gGameCommandErrorText);
}
user_string_free(newUserStringId);
@ -84,8 +85,13 @@ public:
GameActionResult::Ptr Execute() const override
{
rct_string_id newUserStringId = user_string_allocate(USER_STRING_HIGH_ID_NUMBER | USER_STRING_DUPLICATION_PERMITTED, _name.c_str());
rct_peep *peep = GET_PEEP(_spriteIndex);
if (newUserStringId == 0)
{
// TODO: Probably exhausted, introduce new error.
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, gGameCommandErrorText);
}
rct_peep * peep = GET_PEEP(_spriteIndex);
if (peep->type != PEEP_TYPE_GUEST)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
@ -93,7 +99,7 @@ public:
}
set_format_arg(0, uint32, peep->id);
utf8* curName = gCommonStringFormatBuffer;
utf8 * curName = gCommonStringFormatBuffer;
rct_string_id curId = peep->name_string_idx;
format_string(curName, 256, curId, gCommonFormatArgs);
@ -112,7 +118,7 @@ public:
gfx_invalidate_screen();
// Force guest list window refresh
rct_window *w = window_find_by_class(WC_GUEST_LIST);
rct_window * w = window_find_by_class(WC_GUEST_LIST);
if (w != NULL)
{
w->no_list_items = 0;

View File

@ -64,7 +64,7 @@ public:
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER);
}
rct_peep *peep = GET_PEEP(_spriteIndex);
rct_peep * peep = GET_PEEP(_spriteIndex);
if (peep->type != PEEP_TYPE_STAFF)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
@ -75,7 +75,7 @@ public:
if (newUserStringId == 0)
{
// TODO: Probably exhausted, introduce new error.
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, gGameCommandErrorText);
}
user_string_free(newUserStringId);
@ -85,8 +85,13 @@ public:
GameActionResult::Ptr Execute() const override
{
rct_string_id newUserStringId = user_string_allocate(USER_STRING_HIGH_ID_NUMBER | USER_STRING_DUPLICATION_PERMITTED, _name.c_str());
if (newUserStringId == 0)
{
// TODO: Probably exhausted, introduce new error.
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, gGameCommandErrorText);
}
rct_peep *peep = GET_PEEP(_spriteIndex);
rct_peep * peep = GET_PEEP(_spriteIndex);
if (peep->type != PEEP_TYPE_STAFF)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
@ -94,7 +99,7 @@ public:
}
set_format_arg(0, uint32, peep->id);
utf8* curName = gCommonStringFormatBuffer;
utf8 * curName = gCommonStringFormatBuffer;
rct_string_id curId = peep->name_string_idx;
format_string(curName, 256, curId, gCommonFormatArgs);
@ -113,7 +118,7 @@ public:
gfx_invalidate_screen();
// Force staff list window refresh
rct_window *w = window_find_by_class(WC_STAFF_LIST);
rct_window * w = window_find_by_class(WC_STAFF_LIST);
if (w != NULL)
{
w->no_list_items = 0;

View File

@ -1148,7 +1148,7 @@ void window_guest_overview_text_input(rct_window *w, rct_widgetindex widgetIndex
gGameCommandErrorTitle = STR_CANT_NAME_GUEST;
guest_set_name(w->number, text);
guest_set_name(w->number, text);
}
/**

View File

@ -1194,7 +1194,7 @@ void window_staff_overview_text_input(rct_window *w, rct_widgetindex widgetIndex
gGameCommandErrorTitle = STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER;
staff_set_name(w->number, text);
staff_set_name(w->number, text);
}
/**