diff --git a/README.md b/README.md index 2444399..1b97518 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Outline -Tortuga is a 2D multiplayer JRPG featuring permadeath, with an emphasis on multiplayer cooperation, exploration and customization. The game runs on customizable public and private servers. +Tortuga is a 2D MMORPG featuring permadeath, with an emphasis on multiplayer cooperation, exploration and customization. The game runs on customizable public and private servers. This game is inspired by classic 2D RPGs (Final Fantasy, The Legend of Zelda), as well as more modern sandboxes amd MMOs (Minecraft, EVE Online). This project is currently independently created and funded, with the goal of creating a game that will engage the players and inspire a large community. diff --git a/client/gameplay_scenes/world_logic.cpp b/client/gameplay_scenes/world_logic.cpp index bf91e98..c0ff20e 100644 --- a/client/gameplay_scenes/world_logic.cpp +++ b/client/gameplay_scenes/world_logic.cpp @@ -125,8 +125,16 @@ void World::Update() { it.second.Update(); } - //update the map - UpdateMap(); + try { + //update the map + UpdateMap(); + } + catch(terminal_error& e) { + throw(e); + } + catch(std::exception& e) { + std::cerr << "UpdateMap Error: " << e.what() << std::endl; + } //skip the rest without a local character if (!localCharacter) { @@ -164,9 +172,9 @@ void World::Render(SDL_Surface* const screen) { tileSheet.DrawRegionTo(screen, &(*it), camera.x, camera.y); //debugging - std::ostringstream msg; - msg << it->GetX() << ", " << it->GetY(); - font.DrawStringTo(msg.str(), screen, it->GetX() * tileSheet.GetImage()->GetClipW() - camera.x, it->GetY() * tileSheet.GetImage()->GetClipH() - camera.y); +// std::ostringstream msg; +// msg << it->GetX() << ", " << it->GetY(); +// font.DrawStringTo(msg.str(), screen, it->GetX() * tileSheet.GetImage()->GetClipW() - camera.x, it->GetY() * tileSheet.GetImage()->GetClipH() - camera.y); } //draw the entities diff --git a/client/gameplay_scenes/world_map.cpp b/client/gameplay_scenes/world_map.cpp index e4819ab..1265281 100644 --- a/client/gameplay_scenes/world_map.cpp +++ b/client/gameplay_scenes/world_map.cpp @@ -23,7 +23,7 @@ #include "channels.hpp" -#include +#include //------------------------- //static functions @@ -58,12 +58,11 @@ void World::SendRegionRequest(int roomIndex, int x, int y) { } void World::hRegionContent(RegionPacket* const argPacket) { - //debugging - std::cout << "hRegionContent(" << roomIndex << ", " << argPacket->x << ", " << argPacket->y << ")" << std::endl; - //checksum if (regionChecksum(argPacket->region) == 0) { - std::cout << "Received checksum failed: " << argPacket->x << ", " << argPacket->y << std::endl; + std::ostringstream msg; + msg << "Received region checksum failed: " << argPacket->x << ", " << argPacket->y; + throw(std::runtime_error(msg.str())); } //replace existing regions @@ -99,11 +98,20 @@ void World::UpdateMap() { for (int j = yStart; j <= yEnd; j += REGION_HEIGHT) { Region* region = regionPager.FindRegion(i, j); if (!region) { + //request absent region SendRegionRequest(roomIndex, i, j); } else if (regionChecksum(region) == 0) { - std::cout << "Existing checksum failed: " << roomIndex << ", " << i << ", " << j << std::endl; + //checksum failed + //NOTE: this patches bug #45, but does not resolve it + regionPager.UnloadIf([region](Region const& ref) -> bool { + //remove the erroneous region + return region == &ref; + }); SendRegionRequest(roomIndex, i, j); + std::ostringstream msg; + msg << "Existing region checksum failed: " << roomIndex << ", " << i << ", " << j; + throw(std::runtime_error(msg.str())); } } } diff --git a/common/map/region_pager_base.cpp b/common/map/region_pager_base.cpp index 1b25761..857dabd 100644 --- a/common/map/region_pager_base.cpp +++ b/common/map/region_pager_base.cpp @@ -70,11 +70,8 @@ Region* RegionPagerBase::FindRegion(int x, int y) { } Region* RegionPagerBase::PushRegion(Region* const ptr) { - //BUG: Lists seem to not work properly + //BUG: #45 Some regions are occasionally losing their tile data regionList.push_front(*ptr); -// if (debugRegionSum(®ionList.front()) == 0) { -// throw(std::runtime_error("Checksum fail; RegionPagerBase::PushRegion()")); -// } return ®ionList.front(); } diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index fd0c7e7..dcb544c 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -26,6 +26,7 @@ #include #include +//TODO: (9) character collisions should be preformed client-side void RoomData::RunFrame() { //get the hook lua_rawgeti(lua, LUA_REGISTRYINDEX, tickRef);