Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 7d4012d

Browse files
author
Kayne Ruse
committed
Patched bug #45 without resolving it
1 parent 878d502 commit 7d4012d

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Outline
22

3-
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.
3+
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.
44

55
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.
66

client/gameplay_scenes/world_logic.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,16 @@ void World::Update() {
125125
it.second.Update();
126126
}
127127

128-
//update the map
129-
UpdateMap();
128+
try {
129+
//update the map
130+
UpdateMap();
131+
}
132+
catch(terminal_error& e) {
133+
throw(e);
134+
}
135+
catch(std::exception& e) {
136+
std::cerr << "UpdateMap Error: " << e.what() << std::endl;
137+
}
130138

131139
//skip the rest without a local character
132140
if (!localCharacter) {

client/gameplay_scenes/world_map.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "channels.hpp"
2525

26-
#include <iostream>
26+
#include <sstream>
2727

2828
//-------------------------
2929
//static functions
@@ -58,12 +58,11 @@ void World::SendRegionRequest(int roomIndex, int x, int y) {
5858
}
5959

6060
void World::hRegionContent(RegionPacket* const argPacket) {
61-
//debugging
62-
std::cout << "hRegionContent(" << roomIndex << ", " << argPacket->x << ", " << argPacket->y << ")" << std::endl;
63-
6461
//checksum
6562
if (regionChecksum(argPacket->region) == 0) {
66-
std::cout << "Received checksum failed: " << argPacket->x << ", " << argPacket->y << std::endl;
63+
std::ostringstream msg;
64+
msg << "Received region checksum failed: " << argPacket->x << ", " << argPacket->y;
65+
throw(std::runtime_error(msg.str()));
6766
}
6867

6968
//replace existing regions
@@ -99,11 +98,20 @@ void World::UpdateMap() {
9998
for (int j = yStart; j <= yEnd; j += REGION_HEIGHT) {
10099
Region* region = regionPager.FindRegion(i, j);
101100
if (!region) {
101+
//request absent region
102102
SendRegionRequest(roomIndex, i, j);
103103
}
104104
else if (regionChecksum(region) == 0) {
105-
std::cout << "Existing checksum failed: " << roomIndex << ", " << i << ", " << j << std::endl;
105+
//checksum failed
106+
//NOTE: this patches bug #45, but does not resolve it
107+
regionPager.UnloadIf([region](Region const& ref) -> bool {
108+
//remove the erroneous region
109+
return region == &ref;
110+
});
106111
SendRegionRequest(roomIndex, i, j);
112+
std::ostringstream msg;
113+
msg << "Existing region checksum failed: " << roomIndex << ", " << i << ", " << j;
114+
throw(std::runtime_error(msg.str()));
107115
}
108116
}
109117
}

common/map/region_pager_base.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ Region* RegionPagerBase::FindRegion(int x, int y) {
7070
}
7171

7272
Region* RegionPagerBase::PushRegion(Region* const ptr) {
73-
//BUG: Lists seem to not work properly
73+
//BUG: #45 Some regions are occasionally losing their tile data
7474
regionList.push_front(*ptr);
75-
// if (debugRegionSum(&regionList.front()) == 0) {
76-
// throw(std::runtime_error("Checksum fail; RegionPagerBase::PushRegion()"));
77-
// }
7875
return &regionList.front();
7976
}
8077

server/rooms/room_data.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <stack>
2727
#include <stdexcept>
2828

29+
//TODO: (9) character collisions should be preformed client-side
2930
void RoomData::RunFrame() {
3031
//get the hook
3132
lua_rawgeti(lua, LUA_REGISTRYINDEX, tickRef);

0 commit comments

Comments
 (0)