Bug #330: Reload() does not close certain map files.
ID | #330 |
---|---|
Submitter | Cirras |
Product | EOSERV |
Severity | Normal |
Status | CLOSED, FIXED |
Submitted | 13th Apr 2015 |
Updated | 19th Aug 2015 |
Rev# | Date | Description |
---|---|---|
r477 | 19 Aug 2015 01:56:27 UTC | Spike damage (bug #5), HP/TP drains (bug #6), Refresh when player's walk attempt fails (bug # ... |
This became evident to me when I was rewriting $remap to support mass/ranged/remote reloading of maps.
In the Map::Reload() function, you will find an if statement that checks whether the map needs to be reloaded. This is the root of the problem.
std::FILE *fh = std::fopen(filename.c_str(), "rb");
if (!fh)
{
Console::Err("Could not load file: %s", filename.c_str());
return false;
}
SAFE_SEEK(fh, 0x03, SEEK_SET);
SAFE_READ(checkrid, sizeof(char), 4, fh);
if (this->rid[0] == checkrid[0] && this->rid[1] == checkrid[1]
&& this->rid[2] == checkrid[2] && this->rid[3] == checkrid[3])
{
return true;
}
As you can see, EOSERV opens the map file - But if the map doesn't need to be reloaded, the function returns true without closing the map (fh).
This created quite a headache for me, before I realized what the problem was.
Comments
Updated Status to CONFIRMED
Fixed in r477.
Updated Status to CLOSED, FIXED
Add Comment
Please don't post unless you have something relevant to the bug to say.
Do not comment to say "thanks" or "fix this please".
Please log in to add comments. EOSERV Bug Tracker > Bug #330: Reload() does not close certain map files.