mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
f15d8bc5e4
|
@ -17,7 +17,7 @@ namespace Json
|
|||
class JsonException : public Exception
|
||||
{
|
||||
private:
|
||||
json_error_t _jsonError;
|
||||
json_error_t _jsonError = { 0 };
|
||||
|
||||
public:
|
||||
JsonException(const char * message) : Exception(message) { }
|
||||
|
|
|
@ -183,18 +183,6 @@ bool NetworkPacket::CommandRequiresAuth()
|
|||
}
|
||||
}
|
||||
|
||||
NetworkPlayer::NetworkPlayer()
|
||||
{
|
||||
name[0] = 0;
|
||||
ping = 0;
|
||||
flags = 0;
|
||||
money_spent = MONEY(0, 0);
|
||||
commands_ran = 0;
|
||||
group = 0;
|
||||
last_action = -999;
|
||||
last_action_coord = {0};
|
||||
}
|
||||
|
||||
void NetworkPlayer::Read(NetworkPacket& packet)
|
||||
{
|
||||
const char* name = packet.ReadString();
|
||||
|
|
|
@ -153,21 +153,21 @@ public:
|
|||
class NetworkPlayer
|
||||
{
|
||||
public:
|
||||
NetworkPlayer();
|
||||
NetworkPlayer() = default;
|
||||
void Read(NetworkPacket& packet);
|
||||
void Write(NetworkPacket& packet);
|
||||
void SetName(const char* name);
|
||||
void AddMoneySpent(money32 cost);
|
||||
uint8 id;
|
||||
uint8 name[32 + 1];
|
||||
uint16 ping;
|
||||
uint8 flags;
|
||||
uint8 group;
|
||||
money32 money_spent;
|
||||
unsigned int commands_ran;
|
||||
int last_action;
|
||||
uint32 last_action_time;
|
||||
rct_xyz16 last_action_coord;
|
||||
uint8 id = 0;
|
||||
uint8 name[32 + 1] = { 0 };
|
||||
uint16 ping = 0;
|
||||
uint8 flags = 0;
|
||||
uint8 group = 0;
|
||||
money32 money_spent = MONEY(0, 0);
|
||||
unsigned int commands_ran = 0;
|
||||
int last_action = -999;
|
||||
uint32 last_action_time = 0;
|
||||
rct_xyz16 last_action_coord = { 0 };
|
||||
};
|
||||
|
||||
class NetworkAction
|
||||
|
@ -219,7 +219,7 @@ public:
|
|||
void SetName(std::string name);
|
||||
rct_string_id GetNameStringId();
|
||||
std::array<uint8, 8> actions_allowed;
|
||||
uint8 id;
|
||||
uint8 id = 0;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
|
|
|
@ -7873,7 +7873,7 @@ int peep_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep *peep)
|
|||
*RCT2_ADDRESS(0x00F1AEDC, int) = saved_f1aedc;
|
||||
|
||||
if (score < best_score || (score == best_score && RCT2_GLOBAL(0x00F1AED3, uint8) < best_sub)) {
|
||||
chosen_edge = test_edge;
|
||||
chosen_edge = test_edge;
|
||||
best_score = score;
|
||||
best_sub = RCT2_GLOBAL(0x00F1AED3, uint8);
|
||||
}
|
||||
|
|
|
@ -796,6 +796,9 @@ static int staff_path_finding_handyman(rct_peep* peep) {
|
|||
|
||||
}
|
||||
|
||||
// countof(TileDirectionDelta)
|
||||
assert(direction < 8);
|
||||
|
||||
rct_xy16 chosenTile = {
|
||||
.x = peep->next_x + TileDirectionDelta[direction].x,
|
||||
.y = peep->next_y + TileDirectionDelta[direction].y
|
||||
|
@ -819,7 +822,7 @@ static int staff_path_finding_handyman(rct_peep* peep) {
|
|||
|
||||
uint8 staff_direction_surface(rct_peep* peep, uint8 initialDirection) {
|
||||
uint8 direction = initialDirection;
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
// Looks left and right from initial direction
|
||||
switch (i) {
|
||||
case 1:
|
||||
|
@ -1038,6 +1041,9 @@ static int staff_path_finding_mechanic(rct_peep* peep) {
|
|||
direction = staff_mechanic_direction_path(peep, validDirections, pathElement);
|
||||
}
|
||||
|
||||
// countof(TileDirectionDelta)
|
||||
assert(direction < 8);
|
||||
|
||||
rct_xy16 chosenTile = {
|
||||
.x = peep->next_x + TileDirectionDelta[direction].x,
|
||||
.y = peep->next_y + TileDirectionDelta[direction].y
|
||||
|
|
|
@ -152,10 +152,9 @@ void platform_posix_sub_resolve_openrct_data_path(utf8 *out) {
|
|||
|
||||
void execute_cmd(char *command, int *exit_value, char *buf, size_t *buf_size) {
|
||||
FILE *f;
|
||||
int status;
|
||||
size_t n_chars;
|
||||
|
||||
printf("executing \"%s\"...\n", command);
|
||||
log_verbose("executing \"%s\"...\n", command);
|
||||
f = popen(command, "r");
|
||||
|
||||
if (buf && buf_size) {
|
||||
|
@ -164,8 +163,8 @@ void execute_cmd(char *command, int *exit_value, char *buf, size_t *buf_size) {
|
|||
// make sure string is null-terminated
|
||||
if (n_chars == *buf_size) {
|
||||
n_chars--;
|
||||
buf[n_chars] = 0;
|
||||
}
|
||||
buf[n_chars] = '\0';
|
||||
|
||||
*buf_size = n_chars;
|
||||
} else {
|
||||
|
@ -203,8 +202,7 @@ dialog_type get_dialog_app(char *cmd, size_t *cmd_size) {
|
|||
}
|
||||
}
|
||||
|
||||
if (cmd[size-1] == '\n')
|
||||
cmd[size-1] = 0;
|
||||
cmd[size-1] = '\0';
|
||||
|
||||
*cmd_size = size;
|
||||
|
||||
|
@ -216,17 +214,15 @@ int platform_open_common_file_dialog(filedialog_type type, utf8 *title, utf8 *fi
|
|||
char executable[MAX_PATH];
|
||||
char cmd[MAX_PATH];
|
||||
char result[MAX_PATH];
|
||||
char *app;
|
||||
size_t size;
|
||||
dialog_type dtype;
|
||||
char *action;
|
||||
char *flags;
|
||||
char *filter;
|
||||
char *filter = NULL;
|
||||
|
||||
size = MAX_PATH;
|
||||
dtype = get_dialog_app(executable, &size);
|
||||
|
||||
filter = 0;
|
||||
switch (dtype) {
|
||||
case DT_KDIALOG:
|
||||
switch (type) {
|
||||
|
@ -263,18 +259,18 @@ int platform_open_common_file_dialog(filedialog_type type, utf8 *title, utf8 *fi
|
|||
|
||||
snprintf(cmd, MAX_PATH, "%s %s %s --title=\"%s\" / %s", executable, action, flags, title, filter?filter:"");
|
||||
break;
|
||||
default: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
size = MAX_PATH;
|
||||
execute_cmd(cmd, &exit_value, result, &size);
|
||||
|
||||
if (exit_value != 0) {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result[size-1] == '\n')
|
||||
result[size-1] = 0;
|
||||
result[size-1] = '\0';
|
||||
log_verbose("filename = %s", result);
|
||||
|
||||
if (type == FD_OPEN && access(result, F_OK) == -1) {
|
||||
char msg[MAX_PATH];
|
||||
|
@ -282,7 +278,7 @@ int platform_open_common_file_dialog(filedialog_type type, utf8 *title, utf8 *fi
|
|||
snprintf(msg, MAX_PATH, "\"%s\" not found: %s, please choose another file\n", result, strerror(errno));
|
||||
platform_show_messagebox(msg);
|
||||
|
||||
if (filter)
|
||||
if (filter != NULL)
|
||||
free(filter);
|
||||
return platform_open_common_file_dialog(type, title, filename, filterPattern, filterName);
|
||||
} else
|
||||
|
@ -292,13 +288,19 @@ int platform_open_common_file_dialog(filedialog_type type, utf8 *title, utf8 *fi
|
|||
size = MAX_PATH;
|
||||
execute_cmd(cmd, &exit_value, 0, 0);
|
||||
|
||||
if (exit_value != 0)
|
||||
if (exit_value != 0) {
|
||||
if (filter != NULL)
|
||||
free(filter);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(filename, result, MAX_PATH);
|
||||
|
||||
return 0;
|
||||
if (filter != NULL)
|
||||
free(filter);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
utf8 *platform_open_directory_browser(utf8 *title) {
|
||||
|
@ -327,11 +329,10 @@ utf8 *platform_open_directory_browser(utf8 *title) {
|
|||
execute_cmd(cmd, &exit_value, result, &size);
|
||||
|
||||
if (exit_value != 0) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (result[size-1] == '\n')
|
||||
result[size-1] = 0;
|
||||
result[size-1] = '\0';
|
||||
|
||||
return_value = (char*) malloc(strlen(result)+1);
|
||||
strcpy(return_value, result);
|
||||
|
|
|
@ -4470,7 +4470,7 @@ train_ref vehicle_create_train(int rideIndex, int x, int y, int z, int *remainin
|
|||
void vehicle_create_trains(int rideIndex, int x, int y, int z, rct_map_element *mapElement)
|
||||
{
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
train_ref firstTrain, lastTrain;
|
||||
train_ref firstTrain = { 0 }, lastTrain = { 0 };
|
||||
int remainingDistance = 0;
|
||||
|
||||
for (int vehicleIndex = 0; vehicleIndex < ride->num_vehicles; vehicleIndex++) {
|
||||
|
|
|
@ -989,7 +989,6 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_THEMES_DROPDOWN:
|
||||
theme_manager_get_num_available_themes();
|
||||
num_items = (int)theme_manager_get_num_available_themes();
|
||||
|
||||
for (int i = 0; i < num_items; i++) {
|
||||
|
|
Loading…
Reference in New Issue