mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
e4c20902ba
|
@ -800,7 +800,8 @@ void game_fix_save_vars() {
|
|||
if (mapElement == NULL)
|
||||
{
|
||||
log_error("Null map element at x = %d and y = %d. Fixing...", x, y);
|
||||
map_element_insert(x, y, 14, 0);
|
||||
mapElement = map_element_insert(x, y, 14, 0);
|
||||
assert(mapElement != NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -796,9 +796,7 @@ static void input_scroll_part_update_hleft(rct_window *w, int widgetIndex, int s
|
|||
assert(w != NULL);
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
w->scrolls[scroll_id].flags |= HSCROLLBAR_LEFT_PRESSED;
|
||||
if (w->scrolls[scroll_id].h_left < 0)
|
||||
w->scrolls[scroll_id].h_left = 0;
|
||||
else if (w->scrolls[scroll_id].h_left >= 3)
|
||||
if (w->scrolls[scroll_id].h_left >= 3)
|
||||
w->scrolls[scroll_id].h_left -= 3;
|
||||
widget_scroll_update_thumbs(w, widgetIndex);
|
||||
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
|
||||
|
@ -839,9 +837,7 @@ static void input_scroll_part_update_vtop(rct_window *w, int widgetIndex, int sc
|
|||
assert(w != NULL);
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
w->scrolls[scroll_id].flags |= VSCROLLBAR_UP_PRESSED;
|
||||
if (w->scrolls[scroll_id].v_top < 0)
|
||||
w->scrolls[scroll_id].v_top = 0;
|
||||
else if (w->scrolls[scroll_id].v_top >= 3)
|
||||
if (w->scrolls[scroll_id].v_top >= 3)
|
||||
w->scrolls[scroll_id].v_top -= 3;
|
||||
widget_scroll_update_thumbs(w, widgetIndex);
|
||||
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
|
||||
|
|
|
@ -1340,7 +1340,7 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
|
|||
return;
|
||||
}
|
||||
size_t chunksize = 1000;
|
||||
size_t out_size;
|
||||
size_t out_size = size;
|
||||
unsigned char *compressed = util_zlib_deflate(&buffer[0], size, &out_size);
|
||||
unsigned char *header;
|
||||
if (compressed != NULL)
|
||||
|
|
|
@ -246,11 +246,11 @@ public:
|
|||
void setLastDisconnectReason(const char *src);
|
||||
void setLastDisconnectReason(const rct_string_id string_id);
|
||||
|
||||
SOCKET socket;
|
||||
SOCKET socket = INVALID_SOCKET;
|
||||
NetworkPacket inboundpacket;
|
||||
int authstatus;
|
||||
int authstatus = NETWORK_AUTH_NONE;
|
||||
NetworkPlayer* player;
|
||||
uint32 ping_time;
|
||||
uint32 ping_time = 0;
|
||||
|
||||
private:
|
||||
char* last_disconnect_reason;
|
||||
|
@ -279,10 +279,10 @@ public:
|
|||
private:
|
||||
static int ResolveFunc(void* pointer);
|
||||
|
||||
const char* host;
|
||||
unsigned short port;
|
||||
SDL_mutex* mutex;
|
||||
SDL_cond* cond;
|
||||
const char* host = nullptr;
|
||||
unsigned short port = 0;
|
||||
SDL_mutex* mutex = nullptr;
|
||||
SDL_cond* cond = nullptr;
|
||||
std::shared_ptr<int> status;
|
||||
};
|
||||
|
||||
|
@ -364,31 +364,31 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
int mode;
|
||||
int status;
|
||||
int mode = NETWORK_MODE_NONE;
|
||||
int status = NETWORK_STATUS_NONE;
|
||||
NetworkAddress server_address;
|
||||
bool wsa_initialized;
|
||||
SOCKET listening_socket;
|
||||
unsigned short listening_port;
|
||||
bool wsa_initialized = false;
|
||||
SOCKET listening_socket = INVALID_SOCKET;
|
||||
unsigned short listening_port = 0;
|
||||
NetworkConnection server_connection;
|
||||
uint32 last_tick_sent_time;
|
||||
uint32 last_ping_sent_time;
|
||||
uint32 server_tick;
|
||||
uint32 server_srand0;
|
||||
uint32 server_srand0_tick;
|
||||
uint8 player_id;
|
||||
uint32 last_tick_sent_time = 0;
|
||||
uint32 last_ping_sent_time = 0;
|
||||
uint32 server_tick = 0;
|
||||
uint32 server_srand0 = 0;
|
||||
uint32 server_srand0_tick = 0;
|
||||
uint8 player_id = 0;
|
||||
std::list<std::unique_ptr<NetworkConnection>> client_connection_list;
|
||||
std::multiset<GameCommand> game_command_queue;
|
||||
std::vector<uint8> chunk_buffer;
|
||||
std::string password;
|
||||
bool _desynchronised;
|
||||
uint32 server_connect_time;
|
||||
uint32 last_advertise_time;
|
||||
bool _desynchronised = false;
|
||||
uint32 server_connect_time = 0;
|
||||
uint32 last_advertise_time = 0;
|
||||
std::string advertise_token;
|
||||
std::string advertise_key;
|
||||
int advertise_status;
|
||||
uint32 last_heartbeat_time;
|
||||
uint8 default_group;
|
||||
int advertise_status = 0;
|
||||
uint32 last_heartbeat_time = 0;
|
||||
uint8 default_group = 0;
|
||||
|
||||
void UpdateServer();
|
||||
void UpdateClient();
|
||||
|
|
|
@ -5661,7 +5661,7 @@ static void peep_update_thoughts(rct_peep* peep){
|
|||
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_THOUGHTS;
|
||||
|
||||
// Clear top thought, push others up
|
||||
if (i < PEEP_MAX_THOUGHTS - 1) {
|
||||
if (i < PEEP_MAX_THOUGHTS - 2) {
|
||||
memmove(&peep->thoughts[i], &peep->thoughts[i + 1], sizeof(rct_peep_thought)*(PEEP_MAX_THOUGHTS - i - 1));
|
||||
}
|
||||
peep->thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE;
|
||||
|
@ -6674,7 +6674,7 @@ void peep_insert_new_thought(rct_peep *peep, uint8 thought_type, uint8 thought_a
|
|||
// If the thought type has not changed then we need to move
|
||||
// it to the top of the thought list. This is done by first removing the
|
||||
// existing thought and placing it at the top.
|
||||
if (i < PEEP_MAX_THOUGHTS - 1) {
|
||||
if (i < PEEP_MAX_THOUGHTS - 2) {
|
||||
memmove(thought, thought + 1, sizeof(rct_peep_thought)*(PEEP_MAX_THOUGHTS - i - 1));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -289,6 +289,7 @@ int platform_open_common_file_dialog(filedialog_type type, utf8 *title, utf8 *fi
|
|||
execute_cmd(cmd, &exit_value, result, &size);
|
||||
|
||||
if (exit_value != 0) {
|
||||
free(filter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8023,6 +8023,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
|
||||
rct_map_element* mapElement = map_element_insert(x / 32, y / 32, z / 8, 0xF);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->clearance_height = clear_z;
|
||||
mapElement->properties.entrance.type = is_exit;
|
||||
mapElement->properties.entrance.index = station_num << 4;
|
||||
|
|
|
@ -4777,6 +4777,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
|||
}
|
||||
|
||||
mapElement = map_element_insert(x / 32, y / 32, baseZ, bl & 0xF);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->clearance_height = clearanceZ;
|
||||
|
||||
uint8 map_type = direction;
|
||||
|
@ -5291,6 +5292,7 @@ money32 set_maze_track(uint16 x, uint8 flags, uint8 direction, uint16 y, uint8 r
|
|||
uint16 flooredY = floor2(y, 32);
|
||||
|
||||
mapElement = map_element_insert(x / 32, y / 32, baseHeight, 0xF);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->clearance_height = clearanceHeight;
|
||||
mapElement->type = MAP_ELEMENT_TYPE_TRACK;
|
||||
mapElement->properties.track.type = 0x65;
|
||||
|
|
|
@ -863,7 +863,7 @@ static void window_map_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int sc
|
|||
*/
|
||||
static void window_map_init_map()
|
||||
{
|
||||
memset(RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, void*), 0x0A0A0A0A, 256 * 256 * sizeof(uint32));
|
||||
memset(RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, void*), 0x0A, 256 * 256 * sizeof(uint32));
|
||||
RCT2_GLOBAL(0x00F1AD6C, uint32) = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ void corrupt_element(int x, int y) {
|
|||
mapElement--;
|
||||
|
||||
mapElement = map_element_insert(x, y, mapElement->base_height, 0);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->type = (8 << 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ static money32 footpath_element_insert(int type, int x, int y, int z, int slope,
|
|||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
mapElement = map_element_insert(x / 32, y / 32, z, 0x0F);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->type = MAP_ELEMENT_TYPE_PATH;
|
||||
mapElement->clearance_height = z + 4 + (slope & 4 ? 2 : 0);
|
||||
mapElement->properties.path.type = (type << 4) | (slope & 7);
|
||||
|
@ -510,6 +511,7 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop
|
|||
}
|
||||
|
||||
mapElement = map_element_insert(x / 32, y / 32, z, 0x0F);
|
||||
assert(mapElement != NULL);
|
||||
mapElement->type = MAP_ELEMENT_TYPE_PATH;
|
||||
mapElement->clearance_height = z + 4 + (slope & 4 ? 2 : 0);
|
||||
mapElement->properties.path.type = (type << 4) | (slope & 7);
|
||||
|
|
|
@ -2738,6 +2738,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi,
|
|||
}
|
||||
|
||||
rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, (base_height + 1) * 2, 0);
|
||||
assert(new_map_element != NULL);
|
||||
gBanners[banner_index].type = type;
|
||||
gBanners[banner_index].colour = colour;
|
||||
gBanners[banner_index].x = x / 32;
|
||||
|
@ -2987,6 +2988,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
}
|
||||
int collisionQuadrants = (bl & 0xf);
|
||||
rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, zLow, collisionQuadrants);
|
||||
assert(new_map_element != NULL);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT, rct_map_element*) = new_map_element;
|
||||
uint8 type = quadrant << 6;
|
||||
type |= MAP_ELEMENT_TYPE_SCENERY;
|
||||
|
@ -3423,6 +3425,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi,
|
|||
}
|
||||
|
||||
map_element = map_element_insert(position.x / 32, position.y / 32, position.z / 8, 0);
|
||||
assert(map_element != NULL);
|
||||
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL, position.x, position.y, position.z / 8);
|
||||
|
||||
|
@ -3671,6 +3674,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
|
|||
}
|
||||
|
||||
rct_map_element *new_map_element = map_element_insert(curTile.x / 32, curTile.y / 32, zLow, F43887);
|
||||
assert(new_map_element != NULL);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_LARGE_SCENERY, curTile.x, curTile.y, zLow);
|
||||
|
||||
new_map_element->clearance_height = zHigh;
|
||||
|
@ -3914,7 +3918,10 @@ rct_map_element *map_element_insert(int x, int y, int z, int flags)
|
|||
{
|
||||
rct_map_element *originalMapElement, *newMapElement, *insertedElement;
|
||||
|
||||
sub_68B044();
|
||||
if (!sub_68B044()) {
|
||||
log_error("Cannot insert new element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newMapElement = RCT2_GLOBAL(RCT2_ADDRESS_NEXT_FREE_MAP_ELEMENT, rct_map_element*);
|
||||
originalMapElement = TILE_MAP_ELEMENT_POINTER(y * 256 + x);
|
||||
|
@ -4892,6 +4899,7 @@ money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint8 direc
|
|||
}
|
||||
|
||||
rct_map_element* newElement = map_element_insert(x / 32, y / 32, zLow, 0xF);
|
||||
assert(newElement != NULL);
|
||||
newElement->clearance_height = zHigh;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
|
@ -4934,6 +4942,7 @@ money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint8 direc
|
|||
}
|
||||
|
||||
rct_map_element* newElement = map_element_insert(x / 32, y / 32, zLow, 0xF);
|
||||
assert(newElement != NULL);
|
||||
newElement->clearance_height = zHigh;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
|
@ -4969,6 +4978,7 @@ money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint8 direc
|
|||
}
|
||||
|
||||
rct_map_element* newElement = map_element_insert(x / 32, y / 32, zLow, 0xF);
|
||||
assert(newElement != NULL);
|
||||
newElement->clearance_height = zHigh;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
|
|
|
@ -234,6 +234,7 @@ static void mapgen_place_tree(int type, int x, int y)
|
|||
|
||||
surfaceZ = map_element_height(x * 32 + 16, y * 32 + 16) / 8;
|
||||
mapElement = map_element_insert(x, y, surfaceZ, (1 | 2 | 4 | 8));
|
||||
assert(mapElement != NULL);
|
||||
mapElement->clearance_height = surfaceZ + (sceneryEntry->small_scenery.height >> 3);
|
||||
|
||||
mapElement->type = MAP_ELEMENT_TYPE_SCENERY | (util_rand() % 3);
|
||||
|
|
Loading…
Reference in New Issue