Commit 791b6b80 authored by gerstrong's avatar gerstrong

Small bug fixes in the patcher code.

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@1238 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
parent f1919de1
......@@ -30,12 +30,18 @@ CMessages::extractString( std::string matchingstring, unsigned long start, unsig
for(unsigned long pos=start+offset ; pos<end+offset ; pos++)
{
while(mp_exe[pos] != 0)
while(mp_exe[pos] == 0xA)
{
Text += mp_exe[pos];
if(pos<end+offset) pos++;
else break;
pos++;
if(mp_exe[pos] == 0x0)
pos++;
}
if(mp_exe[pos] == 0x0)
break;
Text += mp_exe[pos];
}
return make_pair(matchingstring, Text);
......
......@@ -84,7 +84,7 @@ void CPatcher::patchMemory()
if(readIntValue(textline, number))
{
// In this case we have number
// In this case we have a number
m_data[offset] = number;
offset++;
}
......
......@@ -23,14 +23,13 @@
std::string CPatcher::readPatchItemsNextValue(std::list<std::string> &input)
{
std::string line;
std::string output="";
std::string output = "";
line = input.front();
TrimSpaces(line);
// now it depends on if we have a text string or just a value
// now it depends on if we have a text string, an item or just a value
size_t pos=0;
if(strStartsWith(line,"\""))
{
......@@ -39,18 +38,27 @@ std::string CPatcher::readPatchItemsNextValue(std::list<std::string> &input)
}
else
{
// It is a number!!
// Anything else than a string!!
pos = line.find(' ');
}
// Get the string with the element itself
output = line.substr(0,pos);
if(pos != std::string::npos)
{
output = line.substr(0,pos);
input.front().erase(0,pos);
TrimSpaces(input.front());
line = line.substr(pos);
TrimSpaces(line);
input.front() = line;
if(input.front().empty())
if(input.front().empty())
input.pop_front();
}
else
{
output = line;
input.pop_front();
}
return output;
}
......
......@@ -33,7 +33,7 @@ std::string getResourceFilename(const std::string& filename, const std::string&
if(gamepath != "")
{
found_path = gamepath + "/" + filename;
text = "Looking for \"" + found_path + "\"... ";
text = "Looking for " + found_path + " ... ";
// try to look at the local path of the game.
if(!IsFileAvailable(found_path))
found_path = "";
......@@ -46,7 +46,7 @@ std::string getResourceFilename(const std::string& filename, const std::string&
{
// if it didn't find the file try looking at the global resources
found_path = GLOBAL_DIR + "/" + filename;
text = "Looking for \"" + found_path + "\"... ";
text = "Looking for " + found_path + " ... ";
if(!IsFileAvailable(found_path))
found_path = "";
......@@ -57,7 +57,7 @@ std::string getResourceFilename(const std::string& filename, const std::string&
if(essential)
{
text += "missing!\n";
text += "The file \" " + found_path + "\" was not found. Please provide that file!\n";
text += "The file " + found_path + " was not found. Please provide that file!\n";
}
else
text += "missing, but not needed!\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment