Merge pull request #36 from KroArtem/master
Clean src/modes and src/karts from old logging code
This commit is contained in:
commit
3fdae349b2
@ -194,7 +194,7 @@ void AddonsManager::initAddons(const XMLNode *xml)
|
||||
if(file_manager->fileExists(full_path))
|
||||
{
|
||||
if(UserConfigParams::logAddons())
|
||||
Log::warn("[addons] Removing cached icon '%s'.\n",
|
||||
Log::warn("[AddonsManager] Removing cached icon '%s'.\n",
|
||||
addon.getIconBasename().c_str());
|
||||
file_manager->removeFile(full_path);
|
||||
}
|
||||
@ -225,10 +225,9 @@ void AddonsManager::initAddons(const XMLNode *xml)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"[addons] Found invalid node '%s' while downloading addons.\n",
|
||||
Log::error("[AddonsManager]", "Found invalid node '%s' while downloading addons.",
|
||||
node->getName().c_str());
|
||||
fprintf(stderr, "[addons] Ignored.\n");
|
||||
Log::error("[AddonsManager]", "Ignored.");
|
||||
}
|
||||
} // for i<xml->getNumNodes
|
||||
delete xml;
|
||||
@ -254,7 +253,7 @@ void AddonsManager::initAddons(const XMLNode *xml)
|
||||
// it from the list.
|
||||
if(UserConfigParams::logAddons())
|
||||
Log::warn(
|
||||
"[addons] Removing '%s' which is not on the server anymore.\n",
|
||||
"[AddonsManager] Removing '%s' which is not on the server anymore.\n",
|
||||
m_addons_list.getData()[i].getId().c_str() );
|
||||
std::string icon = m_addons_list.getData()[i].getIconBasename();
|
||||
std::string icon_file =file_manager->getAddonsFile("icons/"+icon);
|
||||
@ -311,7 +310,7 @@ void AddonsManager::checkInstalledAddons()
|
||||
if(n<0) continue;
|
||||
if(!m_addons_list.getData()[n].isInstalled())
|
||||
{
|
||||
Log::info("[addons] Marking '%s' as being installed.",
|
||||
Log::info("[AddonsManager] Marking '%s' as being installed.",
|
||||
kp->getIdent().c_str());
|
||||
m_addons_list.getData()[n].setInstalled(true);
|
||||
something_was_changed = true;
|
||||
@ -330,7 +329,7 @@ void AddonsManager::checkInstalledAddons()
|
||||
if(n<0) continue;
|
||||
if(!m_addons_list.getData()[n].isInstalled())
|
||||
{
|
||||
Log::info("[addons] Marking '%s' as being installed.",
|
||||
Log::info("[AddonsManager] Marking '%s' as being installed.",
|
||||
track->getIdent().c_str());
|
||||
m_addons_list.getData()[n].setInstalled(true);
|
||||
something_was_changed = true;
|
||||
@ -361,9 +360,8 @@ void AddonsManager::downloadIcons()
|
||||
if(icon=="")
|
||||
{
|
||||
if(UserConfigParams::logAddons())
|
||||
fprintf(stderr,
|
||||
"[addons] No icon or image specified for '%s'.\n",
|
||||
addon.getId().c_str());
|
||||
Log::error("[AddonsManager]", "No icon or image specified for '%s'.",
|
||||
addon.getId().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -401,8 +399,8 @@ void AddonsManager::loadInstalledAddons()
|
||||
/* checking for installed addons */
|
||||
if(UserConfigParams::logAddons())
|
||||
{
|
||||
std::cout << "[addons] Loading an xml file for installed addons: ";
|
||||
std::cout << m_file_installed << std::endl;
|
||||
Log::info("[AddonsManager]", "Loading an xml file for installed addons: %s",
|
||||
m_file_installed.c_str());
|
||||
}
|
||||
const XMLNode *xml = file_manager->createXMLTree(m_file_installed);
|
||||
if(!xml)
|
||||
@ -479,16 +477,16 @@ bool AddonsManager::install(const Addon &addon)
|
||||
if (!success)
|
||||
{
|
||||
// TODO: show a message in the interface
|
||||
std::cerr << "[addons] Failed to unzip '" << from << "' to '"
|
||||
<< to << "'\n";
|
||||
std::cerr << "[addons] Zip file will not be removed.\n";
|
||||
Log::error("[AddonsManager]", "Failed to unzip '%s' to '%s'",
|
||||
from.c_str(), to.c_str());
|
||||
Log::error("[AddonsManager]", "Zip file will not be removed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!file_manager->removeFile(from))
|
||||
{
|
||||
std::cerr << "[addons] Problems removing temporary file '"
|
||||
<< from << "'.\n";
|
||||
Log::error("[AddonsManager]", "Problems removing temporary file '%s'",
|
||||
from.c_str());
|
||||
}
|
||||
|
||||
int index = getAddonIndex(addon.getId());
|
||||
@ -521,8 +519,8 @@ bool AddonsManager::install(const Addon &addon)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
fprintf(stderr, "[AddonsManager] ERROR: Cannot load track <%s> : %s\n",
|
||||
addon.getDataDir().c_str(), e.what());
|
||||
Log::error("[AddonsManager]", "ERROR: Cannot load track <%s> : %s",
|
||||
addon.getDataDir().c_str(), e.what());
|
||||
}
|
||||
}
|
||||
saveInstalled();
|
||||
@ -536,8 +534,8 @@ bool AddonsManager::install(const Addon &addon)
|
||||
*/
|
||||
bool AddonsManager::uninstall(const Addon &addon)
|
||||
{
|
||||
std::cout << "[addons] Uninstalling <"
|
||||
<< core::stringc(addon.getName()).c_str() << ">\n";
|
||||
Log::info("[AddonsManager]", "Uninstalling <%s>",
|
||||
core::stringc(addon.getName()).c_str());
|
||||
|
||||
// addon is a const reference, and to avoid removing the const, we
|
||||
// find the proper index again to modify the installed state
|
||||
|
@ -208,10 +208,8 @@ void NewsManager::checkRedirect(const XMLNode *xml)
|
||||
{
|
||||
if(UserConfigParams::logAddons())
|
||||
{
|
||||
std::cout << "[Addons] Current server: "
|
||||
<< (std::string)UserConfigParams::m_server_addons
|
||||
<< std::endl
|
||||
<< "[Addons] New server: " << new_server << std::endl;
|
||||
Log::info("[Addons]", "Current server: '%s'\n [Addons] New server: '%s'",
|
||||
UserConfigParams::m_server_addons.c_str(), new_server.c_str());
|
||||
}
|
||||
UserConfigParams::m_server_addons = new_server;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ std::vector<std::string> FileManager::m_root_dirs;
|
||||
|
||||
bool macSetBundlePathIfRelevant(std::string& data_dir)
|
||||
{
|
||||
Log::debug("FileManager", "Checking whether we are using an app bundle... ");
|
||||
Log::debug("[FileManager]", "Checking whether we are using an app bundle... ");
|
||||
// the following code will enable STK to find its data when placed in an
|
||||
// app bundle on mac OS X.
|
||||
// returns true if path is set, returns false if path was not set
|
||||
@ -82,14 +82,14 @@ bool macSetBundlePathIfRelevant(std::string& data_dir)
|
||||
std::string contents = std::string(path) + std::string("/Contents");
|
||||
if(contents.find(".app") != std::string::npos)
|
||||
{
|
||||
Log::debug("FileManager", "yes\n");
|
||||
Log::debug("[FileManager]", "yes");
|
||||
// executable is inside an app bundle, use app bundle-relative paths
|
||||
data_dir = contents + std::string("/Resources/");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::debug("FileManager", "no\n");
|
||||
Log::debug("[FileManager]", "no");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -197,13 +197,13 @@ FileManager::FileManager()
|
||||
// We can't use _() here, since translations will only be initalised
|
||||
// after the filemanager (to get the path to the tranlsations from it)
|
||||
for(unsigned int i=0; i<m_root_dirs.size(); i++)
|
||||
Log::info("FileManager", "Data files will be fetched from: '%s'",
|
||||
Log::info("[FileManager]", "Data files will be fetched from: '%s'",
|
||||
m_root_dirs[i].c_str());
|
||||
Log::info("FileManager", "User directory is '%s'.",
|
||||
Log::info("[FileManager]", "User directory is '%s'.",
|
||||
m_user_config_dir.c_str());
|
||||
Log::info("FileManager", "Addons files will be stored in '%s'.",
|
||||
Log::info("[FileManager]", "Addons files will be stored in '%s'.",
|
||||
m_addons_dir.c_str());
|
||||
Log::info("FileManager", "Screenshots will be stored in '%s'.",
|
||||
Log::info("[FileManager]", "Screenshots will be stored in '%s'.",
|
||||
m_screenshot_dir.c_str());
|
||||
|
||||
/** Now search for the path to all needed subdirectories. */
|
||||
@ -232,16 +232,16 @@ FileManager::FileManager()
|
||||
{
|
||||
if(!dir_found[i])
|
||||
{
|
||||
Log::warn("FileManager", "Directory '%s' not found, aborting.",
|
||||
Log::warn("[FileManager]", "Directory '%s' not found, aborting.",
|
||||
m_subdir_name[i].c_str());
|
||||
was_error = true;
|
||||
}
|
||||
else
|
||||
Log::info("FileManager", "Asset %d will be loaded from '%s'.",
|
||||
Log::info("[FileManager]", "Asset %d will be loaded from '%s'.",
|
||||
i, m_subdir_name[i].c_str());
|
||||
}
|
||||
if(was_error)
|
||||
Log::fatal("FileManager", "Not all assets found - aborting.");
|
||||
Log::fatal("[FileManager]", "Not all assets found - aborting.");
|
||||
|
||||
|
||||
} // FileManager
|
||||
@ -307,14 +307,14 @@ FileManager::~FileManager()
|
||||
if(StringUtils::getExtension(*i)!="zip" &&
|
||||
StringUtils::getExtension(*i)!="part" )
|
||||
{
|
||||
Log::warn("FileManager", "Unexpected tmp file '%s' found.",
|
||||
Log::warn("[FileManager]", "Unexpected tmp file '%s' found.",
|
||||
full_path.c_str());
|
||||
continue;
|
||||
}
|
||||
if(isDirectory(full_path))
|
||||
{
|
||||
// Gee, a .zip file which is a directory - stay away from it
|
||||
Log::warn("FileManager", "'%s' is a directory and will not be deleted.",
|
||||
Log::warn("[FileManager]", "'%s' is a directory and will not be deleted.",
|
||||
full_path.c_str());
|
||||
continue;
|
||||
}
|
||||
@ -324,13 +324,13 @@ FileManager::~FileManager()
|
||||
if(current - mystat.st_ctime <24*3600)
|
||||
{
|
||||
if(UserConfigParams::logAddons())
|
||||
Log::verbose("FileManager", "'%s' is less than 24h old "
|
||||
Log::verbose("[FileManager]", "'%s' is less than 24h old "
|
||||
"and will not be deleted.",
|
||||
full_path.c_str());
|
||||
continue;
|
||||
}
|
||||
if(UserConfigParams::logAddons())
|
||||
Log::verbose("FileManager", "Deleting tmp file'%s'.",full_path.c_str());
|
||||
Log::verbose("[FileManager]", "Deleting tmp file'%s'.",full_path.c_str());
|
||||
removeFile(full_path);
|
||||
|
||||
} // for i in all files in tmp
|
||||
@ -380,7 +380,7 @@ XMLNode *FileManager::createXMLTree(const std::string &filename)
|
||||
{
|
||||
if (UserConfigParams::logMisc())
|
||||
{
|
||||
Log::error("FileManager", "createXMLTree: %s\n", e.what());
|
||||
Log::error("[FileManager]", "createXMLTree: %s", e.what());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -406,7 +406,7 @@ XMLNode *FileManager::createXMLTreeFromString(const std::string & content)
|
||||
{
|
||||
if (UserConfigParams::logMisc())
|
||||
{
|
||||
Log::error("FileManager", "createXMLTreeFromString: %s\n", e.what());
|
||||
Log::error("[FileManager]", "createXMLTreeFromString: %s", e.what());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -532,7 +532,7 @@ std::string FileManager::getAssetChecked(FileManager::AssetType type,
|
||||
|
||||
if(abort_on_error)
|
||||
{
|
||||
Log::fatal("FileManager", "Can not find file '%s' in '%s'",
|
||||
Log::fatal("[FileManager]", "Can not find file '%s' in '%s'",
|
||||
name.c_str(), m_subdir_name[type].c_str());
|
||||
}
|
||||
return "";
|
||||
@ -636,20 +636,20 @@ bool FileManager::checkAndCreateDirectoryP(const std::string &path)
|
||||
if(m_file_system->existFile(io::path(path.c_str())))
|
||||
return true;
|
||||
|
||||
std::cout << "[FileManager] Creating directory(ies) '" << path << "'.\n";
|
||||
Log::info("[FileManager]", "Creating directory(ies) '%s'", path.c_str());
|
||||
|
||||
std::vector<std::string> split = StringUtils::split(path,'/');
|
||||
std::string current_path = "";
|
||||
for (unsigned int i=0; i<split.size(); i++)
|
||||
{
|
||||
current_path += split[i] + "/";
|
||||
std::cout << "[FileManager] Checking for: '"
|
||||
<< current_path << "'.\n";
|
||||
Log::info("[FileManager]", "Checking for: '%s",
|
||||
current_path.c_str());
|
||||
if (!m_file_system->existFile(io::path(current_path.c_str())))
|
||||
{
|
||||
if (!checkAndCreateDirectory(current_path))
|
||||
{
|
||||
Log::error("FileManager", "Can't create dir '%s'",
|
||||
Log::error("[FileManager]", "Can't create dir '%s'",
|
||||
current_path.c_str());
|
||||
break;
|
||||
}
|
||||
@ -684,8 +684,8 @@ void FileManager::checkAndCreateConfigDir()
|
||||
m_user_config_dir = getenv("APPDATA");
|
||||
if(!checkAndCreateDirectory(m_user_config_dir))
|
||||
{
|
||||
std::cerr << "[FileManager] Can't create config dir '"
|
||||
<< m_user_config_dir << "', falling back to '.'.\n";
|
||||
Log::error("[FileManager]", "Can't create config dir '%s"
|
||||
", falling back to '.'.", m_user_config_dir);
|
||||
m_user_config_dir = ".";
|
||||
}
|
||||
}
|
||||
@ -702,8 +702,8 @@ void FileManager::checkAndCreateConfigDir()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr <<
|
||||
"[FileManager] No home directory, this should NOT happen!\n";
|
||||
Log::error("[FileManager]",
|
||||
"No home directory, this should NOT happen!");
|
||||
// Fall back to system-wide app data (rather than
|
||||
// user-specific data), but should not happen anyway.
|
||||
m_user_config_dir = "";
|
||||
@ -721,9 +721,9 @@ void FileManager::checkAndCreateConfigDir()
|
||||
}
|
||||
else if (!getenv("HOME"))
|
||||
{
|
||||
std::cerr
|
||||
<< "[FileManager] No home directory, this should NOT happen "
|
||||
<< "- trying '.' for config files!\n";
|
||||
Log::error("[FileManager]",
|
||||
"No home directory, this should NOT happen "
|
||||
"- trying '.' for config files!");
|
||||
m_user_config_dir = ".";
|
||||
}
|
||||
else
|
||||
@ -733,9 +733,9 @@ void FileManager::checkAndCreateConfigDir()
|
||||
if(!checkAndCreateDirectory(m_user_config_dir))
|
||||
{
|
||||
// If $HOME/.config can not be created:
|
||||
std::cerr << "[FileManager] Cannot create directory '"
|
||||
<< m_user_config_dir <<"', falling back to use '"
|
||||
<< getenv("HOME")<< "'.\n";
|
||||
Log::error("[FileManager]",
|
||||
"Cannot create directory '%s', falling back to use '%s'",
|
||||
m_user_config_dir.c_str(), getenv("HOME"));
|
||||
m_user_config_dir = getenv("HOME");
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ XMLNode::XMLNode(const std::string &filename)
|
||||
{
|
||||
if(!is_first_element)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"More than one root element in '%s' - ignored.\n",
|
||||
Log::warn("[XMLNode]",
|
||||
"More than one root element in '%s' - ignored.",
|
||||
filename.c_str());
|
||||
}
|
||||
readXML(xml);
|
||||
@ -223,8 +223,8 @@ int XMLNode::get(const std::string &attribute, Vec3 *value) const
|
||||
std::vector<std::string> v = StringUtils::split(s,' ');
|
||||
if (v.size() != 3)
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected 3 floating-point values, but found '%s' in file %s\n",
|
||||
s.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected 3 floating-point values, but found '%s' in file %s",
|
||||
s.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -240,8 +240,8 @@ int XMLNode::get(const std::string &attribute, Vec3 *value) const
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected 3 floating-point values, but found '%s' in file %s\n",
|
||||
s.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected 3 floating-point values, but found '%s' in file %s",
|
||||
s.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -305,8 +305,8 @@ int XMLNode::get(const std::string &attribute, int32_t *value) const
|
||||
|
||||
if (!StringUtils::parseString<int>(s, value))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -321,8 +321,8 @@ int XMLNode::get(const std::string &attribute, int64_t *value) const
|
||||
|
||||
if (!StringUtils::parseString<int64_t>(s, value))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -338,8 +338,8 @@ int XMLNode::get(const std::string &attribute, uint16_t *value) const
|
||||
|
||||
if (!StringUtils::parseString<uint16_t>(s, value))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected uint but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected uint but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -354,8 +354,8 @@ int XMLNode::get(const std::string &attribute, uint32_t *value) const
|
||||
|
||||
if (!StringUtils::parseString<unsigned int>(s, value))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected uint but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected uint but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -370,8 +370,8 @@ int XMLNode::get(const std::string &attribute, float *value) const
|
||||
|
||||
if (!StringUtils::parseString<float>(s, value))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected float but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected float but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -429,8 +429,8 @@ int XMLNode::get(const std::string &attribute,
|
||||
float curr;
|
||||
if (!StringUtils::parseString<float>(v[i], &curr))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected float but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||
v[i].c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected float but found '%s' for attribute '%s' of node '%s' in file %s",
|
||||
v[i].c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -460,8 +460,8 @@ int XMLNode::get(const std::string &attribute, std::vector<int> *value) const
|
||||
int val;
|
||||
if (!StringUtils::parseString<int>(v[i], &val))
|
||||
{
|
||||
fprintf(stderr, "[XMLNode] WARNING: Expected int but found '%s' for attribute '%s' of node '%s'\n",
|
||||
v[i].c_str(), attribute.c_str(), m_name.c_str());
|
||||
Log::warn("[XMLNode]", "WARNING: Expected int but found '%s' for attribute '%s' of node '%s'",
|
||||
v[i].c_str(), attribute.c_str(), m_name.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -490,22 +490,22 @@ int XMLNode::get(const std::string &attribute, InterpolationArray *value) const
|
||||
std::vector<std::string> pair = StringUtils::split(pairs[i],':');
|
||||
if(pair.size()!=2)
|
||||
{
|
||||
printf("Incorrect interpolation pair '%s' in '%s'.\n",
|
||||
pairs[i].c_str(), attribute.c_str());
|
||||
printf("Must be x:y.\n");
|
||||
Log::fatal("[XMLNode]", "Incorrect interpolation pair '%s' in '%s'.",
|
||||
pairs[i].c_str(), attribute.c_str());
|
||||
Log::fatal("[XMLNode]", "Must be x:y.");
|
||||
exit(-1);
|
||||
}
|
||||
float x;
|
||||
if(!StringUtils::fromString(pair[0], x))
|
||||
{
|
||||
printf("Incorrect x in pair '%s' of '%s'.\n",
|
||||
Log::fatal("[XMLNode]", "Incorrect x in pair '%s' of '%s'.",
|
||||
pairs[i].c_str(), attribute.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
float y;
|
||||
if(!StringUtils::fromString(pair[1], y))
|
||||
{
|
||||
printf("Incorrect y in pair '%s' in '%s'.\n",
|
||||
Log::fatal("[XMLNode]", "Incorrect y in pair '%s' in '%s'.",
|
||||
pair[1].c_str(), attribute.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
/** Initialises the attachment each kart has.
|
||||
*/
|
||||
|
@ -143,9 +143,9 @@ void Flyable::createPhysics(float forw_offset, const Vec3 &velocity,
|
||||
// Just to get some additional information if the assert is triggered
|
||||
if(isnan(v.getX()) || isnan(v.getY()) || isnan(v.getZ()))
|
||||
{
|
||||
printf("vel %f %f %f v %f %f %f\n",
|
||||
velocity.getX(),velocity.getY(),velocity.getZ(),
|
||||
v.getX(),v.getY(),v.getZ());
|
||||
Log::debug("[Flyable]", "vel %f %f %f v %f %f %f",
|
||||
velocity.getX(),velocity.getY(),velocity.getZ(),
|
||||
v.getX(),v.getY(),v.getZ());
|
||||
}
|
||||
#endif
|
||||
assert(!isnan(v.getX()));
|
||||
|
@ -97,8 +97,8 @@ void ItemManager::loadDefaultItemMeshes()
|
||||
scene::IMesh *mesh = irr_driver->getAnimatedMesh(model_filename);
|
||||
if(!node || model_filename.size()==0 || !mesh)
|
||||
{
|
||||
fprintf(stderr, "Item model '%s' in items.xml could not be loaded "
|
||||
"- aborting", name.c_str());
|
||||
Log::fatal("[ItemManager]", "Item model '%s' in items.xml could not be loaded "
|
||||
"- aborting", name.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
mesh->grab();
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include "utils/log.hpp" //TODO: remove after debugging is done
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
Plunger::Plunger(AbstractKart *kart)
|
||||
: Flyable(kart, PowerupManager::POWERUP_PLUNGER)
|
||||
|
@ -125,8 +125,8 @@ void PowerupManager::loadAllPowerups()
|
||||
LoadPowerup(type, *node);
|
||||
else
|
||||
{
|
||||
printf("Can't find item '%s' from powerup.xml, entry %d/\n",
|
||||
name.c_str(), i+1);
|
||||
Log::fatal("[PowerupManager]", "Can't find item '%s' from powerup.xml, entry %d/",
|
||||
name.c_str(), i+1);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ void PowerupManager::LoadPowerup(PowerupType type, const XMLNode &node)
|
||||
#ifdef DEBUG
|
||||
if (icon_file.size() == 0)
|
||||
{
|
||||
fprintf(stderr, "Cannot load powerup %i, no 'icon' attribute under XML node\n", type);
|
||||
Log::debug("[PowerupManager]", "Cannot load powerup %i, no 'icon' attribute under XML node", type);
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
@ -221,8 +221,9 @@ void PowerupManager::loadWeights(const XMLNode &root,
|
||||
|
||||
if(!node || s=="" || s_multi=="")
|
||||
{
|
||||
printf("No weights found for class '%s' - probabilities will be incorrect.\n",
|
||||
class_name.c_str());
|
||||
Log::error("[PowerupManager]", "No weights found for class '%s'"
|
||||
" - probabilities will be incorrect.",
|
||||
class_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -245,9 +246,9 @@ void PowerupManager::loadWeights(const XMLNode &root,
|
||||
|
||||
if(weight_list.size()!=2*(int)POWERUP_LAST)
|
||||
{
|
||||
printf("Incorrect number of weights found in class '%s':\n",
|
||||
Log::error("[PowerupManager]", "Incorrect number of weights found in class '%s':",
|
||||
class_name.c_str());
|
||||
printf("%d instead of %d - probabilities will be incorrect.\n",
|
||||
Log::error("[PowerupManager]", "%d instead of %d - probabilities will be incorrect.",
|
||||
(int)weight_list.size(), (int)POWERUP_LAST);
|
||||
return;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void RubberBall::computeTarget()
|
||||
if(m_target==m_owner && m_delete_timer < 0)
|
||||
{
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
Log::debug("RubberBall",
|
||||
Log::debug("[RubberBall]",
|
||||
"ball %d removed because owner is target.", m_id);
|
||||
#endif
|
||||
m_delete_timer = m_st_delete_time;
|
||||
@ -171,7 +171,7 @@ void RubberBall::computeTarget()
|
||||
// aim at the owner (the ball is unlikely to hit it), and
|
||||
// this will trigger the usage of the delete time in updateAndDelete
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
Log::debug("RubberBall" "ball %d removed because no more active target.",
|
||||
Log::debug("[RubberBall]" "ball %d removed because no more active target.",
|
||||
m_id);
|
||||
#endif
|
||||
m_delete_timer = m_st_delete_time;
|
||||
@ -312,7 +312,7 @@ bool RubberBall::updateAndDelete(float dt)
|
||||
{
|
||||
hit(NULL);
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
Log::debug("RubberBall", "ball %d deleted.", m_id);
|
||||
Log::debug("[RubberBall]", "ball %d deleted.", m_id);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@ -355,7 +355,7 @@ bool RubberBall::updateAndDelete(float dt)
|
||||
float new_y = getHoT()+height;
|
||||
|
||||
if(UserConfigParams::logFlyable())
|
||||
printf("ball %d: %f %f %f height %f new_y %f gethot %f ",
|
||||
Log::debug("[RubberBall]", "ball %d: %f %f %f height %f new_y %f gethot %f ",
|
||||
m_id, next_xyz.getX(), next_xyz.getY(), next_xyz.getZ(), height, new_y, getHoT());
|
||||
|
||||
// No need to check for terrain height if the ball is low to the ground
|
||||
@ -503,7 +503,7 @@ bool RubberBall::checkTunneling()
|
||||
if(m_tunnel_count > 3)
|
||||
{
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
Log::debug("RubberBall",
|
||||
Log::debug("[RubberBall]",
|
||||
"Ball %d nearly tunneled at %f %f %f -> %f %f %f",
|
||||
m_id, m_previous_xyz.getX(),m_previous_xyz.getY(),
|
||||
m_previous_xyz.getZ(),
|
||||
@ -627,7 +627,7 @@ void RubberBall::updateDistanceToTarget()
|
||||
m_distance_to_target += world->getTrack()->getTrackLength();
|
||||
}
|
||||
if(UserConfigParams::logFlyable())
|
||||
printf("ball %d: target %f %f %f distance_2_target %f",
|
||||
Log::debug("[RubberBall]", "ball %d: target %f %f %f distance_2_target %f",
|
||||
m_id, m_target->getXYZ().getX(),m_target->getXYZ().getY(),
|
||||
m_target->getXYZ().getZ(),m_distance_to_target
|
||||
);
|
||||
@ -657,7 +657,7 @@ void RubberBall::updateDistanceToTarget()
|
||||
{
|
||||
m_delete_timer = m_st_delete_time;
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
Log::debug("RubberBall", "ball %d lost target (overtook?).",
|
||||
Log::debug("[RubberBall]", "ball %d lost target (overtook?).",
|
||||
m_id);
|
||||
#endif
|
||||
|
||||
@ -690,7 +690,7 @@ bool RubberBall::hit(AbstractKart* kart, PhysicalObject* object)
|
||||
{
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
if(kart)
|
||||
Log::debug("RuberBall", "ball %d hit kart.", m_id);
|
||||
Log::debug("[RuberBall]", "ball %d hit kart.", m_id);
|
||||
#endif
|
||||
if(kart && kart!=m_target)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ void AbstractKart::setKartAnimation(AbstractKartAnimation *ka)
|
||||
ka->getName().c_str());
|
||||
else Log::debug("Abstract_Kart", "Setting kart animation to NULL.");
|
||||
if(m_kart_animation) Log::info("Abstract_Kart", "Current kart"
|
||||
"animation is '%s'.\n",
|
||||
"animation is '%s'.",
|
||||
m_kart_animation->getName().c_str());
|
||||
else Log::debug("Abstract_Kart", "Current kart animation is NULL.");
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void AIProperties::load(const XMLNode *ai_node)
|
||||
else
|
||||
{
|
||||
Log::fatal("AIProperties",
|
||||
"Incorrect nitro-usage '%s' in AI '%s'.\n",s.c_str(),
|
||||
"Incorrect nitro-usage '%s' in AI '%s'.",s.c_str(),
|
||||
m_ident.c_str());
|
||||
}
|
||||
// We actually need the square of the distance later
|
||||
@ -102,7 +102,7 @@ void AIProperties::checkAllSet(const std::string &filename) const
|
||||
{
|
||||
#define CHECK_NEG( a,str_a) if(a<=UNDEFINED) { \
|
||||
Log::fatal("AIProperties","Missing default value for" \
|
||||
" '%s' in '%s' 'for AI '%s'.\n", \
|
||||
" '%s' in '%s' 'for AI '%s'.", \
|
||||
str_a, filename.c_str(), m_ident.c_str()); \
|
||||
}
|
||||
CHECK_NEG(m_max_item_angle, "max-item-angle" );
|
||||
@ -118,17 +118,17 @@ void AIProperties::checkAllSet(const std::string &filename) const
|
||||
|
||||
if(m_skid_probability.size()==0)
|
||||
{
|
||||
Log::fatal("AIProperties", "No skid probability defined.\n");
|
||||
Log::fatal("AIProperties", "No skid probability defined.");
|
||||
}
|
||||
|
||||
if(m_speed_cap.size()==0)
|
||||
{
|
||||
Log::fatal("AIProperties", "No speed cap defined.\n");
|
||||
Log::fatal("AIProperties", "No speed cap defined.");
|
||||
}
|
||||
|
||||
if(m_collect_item_probability.size()==0)
|
||||
{
|
||||
Log::fatal("AIProperties", "No collect-item-probability defined.\n");
|
||||
Log::fatal("AIProperties", "No collect-item-probability defined.");
|
||||
}
|
||||
|
||||
} // checkAllSet
|
||||
|
@ -218,7 +218,7 @@ void EndController::handleSteering(float dt)
|
||||
const int next = m_next_node_index[m_track_node];
|
||||
target_point = QuadGraph::get()->getQuadOfNode(next).getCenter();
|
||||
#ifdef AI_DEBUG
|
||||
Log::debug("end_controller.cpp", "- Outside of road: steer to center point.\n");
|
||||
Log::debug("end_controller.cpp", "- Outside of road: steer to center point.");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -255,7 +255,7 @@ void NetworkPlayerController::update(float dt)
|
||||
{
|
||||
// Print a dividing line so that it's easier to see which events
|
||||
// get received in which order in the one frame.
|
||||
Log::debug("PlayerController", "irr_driver", "-------------------------------------\n");
|
||||
Log::debug("PlayerController", "irr_driver", "-------------------------------------");
|
||||
}
|
||||
|
||||
// Don't do steering if it's replay. In position only replay it doesn't
|
||||
|
@ -311,7 +311,7 @@ void PlayerController::update(float dt)
|
||||
{
|
||||
// Print a dividing line so that it's easier to see which events
|
||||
// get received in which order in the one frame.
|
||||
Log::debug("PlayerController", "irr_driver", "-------------------------------------\n");
|
||||
Log::debug("PlayerController", "irr_driver", "-------------------------------------");
|
||||
}
|
||||
|
||||
// Don't do steering if it's replay. In position only replay it doesn't
|
||||
|
@ -198,7 +198,7 @@ void SkiddingAI::reset()
|
||||
{
|
||||
Log::error("SkiddingAI",
|
||||
"Invalid starting position for '%s' - not on track"
|
||||
" - can be ignored.\n",
|
||||
" - can be ignored.",
|
||||
m_kart->getIdent().c_str());
|
||||
m_track_node = QuadGraph::get()->findOutOfRoadSector(m_kart->getXYZ());
|
||||
}
|
||||
@ -401,7 +401,7 @@ void SkiddingAI::handleBraking()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI", "braking: %s ahead of leader.\n",
|
||||
Log::debug("SkiddingAI", "braking: %s ahead of leader.",
|
||||
m_kart->getIdent().c_str());
|
||||
#endif
|
||||
|
||||
@ -421,7 +421,7 @@ void SkiddingAI::handleBraking()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI", "%s not aligned with track.\n",
|
||||
Log::debug("SkiddingAI", "%s not aligned with track.",
|
||||
m_kart->getIdent().c_str());
|
||||
#endif
|
||||
m_controls->m_brake = true;
|
||||
@ -486,7 +486,7 @@ void SkiddingAI::handleSteering(float dt)
|
||||
#ifdef AI_DEBUG
|
||||
m_debug_sphere[0]->setPosition(QuadGraph::get()->getQuadOfNode(next)
|
||||
.getCenter().toIrrVector());
|
||||
Log::debug("skidding_ai","-Outside of road: steer to center point.\n");
|
||||
Log::debug("skidding_ai","-Outside of road: steer to center point.");
|
||||
#endif
|
||||
}
|
||||
//If we are going to crash against a kart, avoid it if it doesn't
|
||||
@ -522,7 +522,7 @@ void SkiddingAI::handleSteering(float dt)
|
||||
#ifdef AI_DEBUG
|
||||
Log::debug("skidding_ai", "- Velocity vector crashes with kart "
|
||||
"and doesn't crashes with road : steer 90 "
|
||||
"degrees away from kart.\n");
|
||||
"degrees away from kart.");
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -701,7 +701,7 @@ void SkiddingAI::handleItemCollectionAndAvoidance(Vec3 *aim_point,
|
||||
}
|
||||
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI", "%s unselects item.\n",
|
||||
Log::debug("SkiddingAI", "%s unselects item.",
|
||||
m_kart->getIdent().c_str());
|
||||
// Otherwise remove the pre-selected item (and start
|
||||
// looking for a new item).
|
||||
@ -771,7 +771,7 @@ void SkiddingAI::handleItemCollectionAndAvoidance(Vec3 *aim_point,
|
||||
.toIrrVector());
|
||||
#endif
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI", "%s selects item type '%d'.\n",
|
||||
Log::debug("SkiddingAI", "%s selects item type '%d'.",
|
||||
m_kart->getIdent().c_str(),
|
||||
item_to_collect->getType());
|
||||
m_item_to_collect = item_to_collect;
|
||||
@ -795,7 +795,7 @@ void SkiddingAI::handleItemCollectionAndAvoidance(Vec3 *aim_point,
|
||||
#endif
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI",
|
||||
"%s adjusts to hit type %d angle %f.\n",
|
||||
"%s adjusts to hit type %d angle %f.",
|
||||
m_kart->getIdent().c_str(),
|
||||
item_to_collect->getType(), angle);
|
||||
}
|
||||
@ -803,7 +803,7 @@ void SkiddingAI::handleItemCollectionAndAvoidance(Vec3 *aim_point,
|
||||
{
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI",
|
||||
"%s won't hit '%d', angle %f.\n",
|
||||
"%s won't hit '%d', angle %f.",
|
||||
m_kart->getIdent().c_str(),
|
||||
item_to_collect->getType(), angle);
|
||||
}
|
||||
@ -1378,7 +1378,7 @@ void SkiddingAI::handleItems(const float dt)
|
||||
break;
|
||||
default:
|
||||
Log::error("SkiddingAI",
|
||||
"Invalid or unhandled powerup '%d' in default AI.\n",
|
||||
"Invalid or unhandled powerup '%d' in default AI.",
|
||||
m_kart->getPowerup()->getType());
|
||||
assert(false);
|
||||
}
|
||||
@ -1699,7 +1699,7 @@ void SkiddingAI::checkCrashes(const Vec3& pos )
|
||||
if(steps<1 || steps>1000)
|
||||
{
|
||||
Log::warn("SkiddingAI",
|
||||
"Incorrect STEPS=%d. kart_length %f velocity %f\n",
|
||||
"Incorrect STEPS=%d. kart_length %f velocity %f",
|
||||
steps, m_kart_length, m_kart->getVelocityLC().getZ());
|
||||
steps=1000;
|
||||
}
|
||||
@ -2181,7 +2181,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
if(m_ai_debug)
|
||||
{
|
||||
if(fabsf(steer_fraction)>=2.5f)
|
||||
Log::debug("SkiddingAI", "%s stops skidding (%f).\n",
|
||||
Log::debug("SkiddingAI", "%s stops skidding (%f).",
|
||||
m_kart->getIdent().c_str(), steer_fraction);
|
||||
}
|
||||
#endif
|
||||
@ -2201,7 +2201,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
#ifdef DEBUG
|
||||
if(m_controls->m_skid && m_ai_debug)
|
||||
{
|
||||
Log::debug("SkiddingAI", "%s stops skidding on straight.\n",
|
||||
Log::debug("SkiddingAI", "%s stops skidding on straight.",
|
||||
m_kart->getIdent().c_str());
|
||||
}
|
||||
#endif
|
||||
@ -2238,7 +2238,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
if(m_controls->m_skid && duration < 1.0f)
|
||||
{
|
||||
if(m_ai_debug)
|
||||
Log::debug("SkiddingAI", "'%s' too short, stop skid.\n",
|
||||
Log::debug("SkiddingAI", "'%s' too short, stop skid.",
|
||||
m_kart->getIdent().c_str());
|
||||
return false;
|
||||
}
|
||||
@ -2254,7 +2254,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
#ifdef DEBUG
|
||||
if(m_controls->m_skid && m_ai_debug)
|
||||
Log::debug("SkiddingAI",
|
||||
"%s skidding against track direction.\n",
|
||||
"%s skidding against track direction.",
|
||||
m_kart->getIdent().c_str());
|
||||
#endif
|
||||
return false;
|
||||
@ -2265,7 +2265,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(!m_controls->m_skid && m_ai_debug)
|
||||
Log::debug("SkiddingAI", "%s start skid, duration %f.\n",
|
||||
Log::debug("SkiddingAI", "%s start skid, duration %f.",
|
||||
m_kart->getIdent().c_str(), duration);
|
||||
#endif
|
||||
return true;
|
||||
@ -2274,7 +2274,7 @@ bool SkiddingAI::doSkid(float steer_fraction)
|
||||
|
||||
#ifdef DEBUG
|
||||
if(m_controls->m_skid && m_ai_debug)
|
||||
Log::debug("SkiddingAI", "%s has no reasons to skid anymore.\n",
|
||||
Log::debug("SkiddingAI", "%s has no reasons to skid anymore.",
|
||||
m_kart->getIdent().c_str());
|
||||
#endif
|
||||
return false;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/log.hpp" //TODO: remove after debugging is done
|
||||
|
||||
/** A static create function that does only create an explosion if
|
||||
* the explosion happens to be close enough to affect the kart.
|
||||
|
@ -198,7 +198,7 @@ void Kart::init(RaceManager::KartType type)
|
||||
|
||||
if(!m_engine_sound)
|
||||
{
|
||||
Log::error("Kart","Could not allocate a sfx object for the kart. Further errors may ensue!\n");
|
||||
Log::error("Kart","Could not allocate a sfx object for the kart. Further errors may ensue!");
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@ Kart::~Kart()
|
||||
if(m_slipstream) delete m_slipstream;
|
||||
if(m_sky_particles_emitter) delete m_sky_particles_emitter;
|
||||
if(m_attachment) delete m_attachment;
|
||||
if (m_stars_effect) delete m_stars_effect;
|
||||
if(m_stars_effect) delete m_stars_effect;
|
||||
|
||||
delete m_shadow;
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/skidding.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -122,7 +123,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
|
||||
// by adding a NULL to the list (which is tested for in all
|
||||
// cases). C++ guarantees that all memory allocated in the
|
||||
// constructor is properly freed.
|
||||
std::cerr << e.what() << std::endl;
|
||||
Log::error("[KartGFX]", "%s",e.what());
|
||||
kind = NULL;
|
||||
emitter = NULL;
|
||||
}
|
||||
|
@ -201,9 +201,9 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
}
|
||||
catch(std::exception& err)
|
||||
{
|
||||
Log::error("KartProperties", "Error while parsing KartProperties '%s':\n",
|
||||
Log::error("[KartProperties]", "Error while parsing KartProperties '%s':",
|
||||
filename.c_str());
|
||||
Log::error("KartProperties", "%s\n", err.what());
|
||||
Log::error("[KartProperties]", "%s", err.what());
|
||||
}
|
||||
if(root) delete root;
|
||||
|
||||
@ -392,15 +392,15 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
engine_node->get("power", &m_engine_power);
|
||||
if(m_engine_power.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Incorrect engine-power specifications for kart '%s'\n",
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect engine-power specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
engine_node->get("max-speed", &m_max_speed);
|
||||
if(m_max_speed.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Incorrect max-speed specifications for kart '%s'\n",
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect max-speed specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
} // if getNode("engine")
|
||||
@ -477,8 +477,8 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
m_terrain_impulse_type = IMPULSE_TO_DRIVELINE;
|
||||
else
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Missing or incorrect value for impulse-type: '%s'.\n",
|
||||
Log::fatal("[KartProperties]",
|
||||
"Missing or incorrect value for impulse-type: '%s'.",
|
||||
s.c_str());
|
||||
}
|
||||
}
|
||||
@ -560,7 +560,7 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
else if (s == "small") m_engine_sfx_type = "engine_small";
|
||||
else
|
||||
{
|
||||
Log::warn("KartProperties", "Kart '%s' has invalid engine '%s'.",
|
||||
Log::warn("[KartProperties]", "Kart '%s' has invalid engine '%s'.",
|
||||
m_name.c_str(), s.c_str());
|
||||
m_engine_sfx_type = "engine_small";
|
||||
}
|
||||
@ -603,32 +603,32 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
{
|
||||
if(m_gear_switch_ratio.size()==0)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Missing default value for 'gear-switch-ratio' in '%s'.\n",
|
||||
Log::fatal("[KartProperties]",
|
||||
"Missing default value for 'gear-switch-ratio' in '%s'.",
|
||||
filename.c_str());
|
||||
}
|
||||
if(m_gear_power_increase.size()==0)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Missing default value for 'gear-power-increase' in '%s'.\n",
|
||||
Log::fatal("[KartProperties]",
|
||||
"Missing default value for 'gear-power-increase' in '%s'.",
|
||||
filename.c_str());
|
||||
}
|
||||
if(m_gear_switch_ratio.size()!=m_gear_power_increase.size()) {
|
||||
Log::error("KartProperties",
|
||||
"Number of entries for 'gear-switch-ratio' and "
|
||||
"'gear-power-increase\n");
|
||||
Log::fatal("KartProperties", "in '%s' must be equal.\n",
|
||||
"'gear-power-increase");
|
||||
Log::fatal("KartProperties", "in '%s' must be equal.",
|
||||
filename.c_str());
|
||||
}
|
||||
if(m_startup_boost.size()!=m_startup_times.size())
|
||||
{
|
||||
Log::error("KartProperties",
|
||||
"Number of entried for 'startup times' and 'startup-boost\n");
|
||||
Log::fatal("KartProperties", "must be identical.\n");
|
||||
Log::error("[KartProperties]",
|
||||
"Number of entried for 'startup times' and 'startup-boost");
|
||||
Log::fatal("KartProperties", "must be identical.");
|
||||
}
|
||||
#define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \
|
||||
Log::fatal("KartProperties", \
|
||||
"Missing default value for '%s' in '%s'.\n", \
|
||||
Log::fatal("[KartProperties]", \
|
||||
"Missing default value for '%s' in '%s'.", \
|
||||
strA,filename.c_str()); \
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ bool KartPropertiesManager::loadKart(const std::string &dir)
|
||||
}
|
||||
catch (std::runtime_error& err)
|
||||
{
|
||||
std::cerr << "Giving up loading '" << config_filename.c_str()
|
||||
<< "' : " << err.what() << std::endl;
|
||||
Log::error("[Kart_Properties_Manager]","Giving up loading '%s': %s",
|
||||
config_filename.c_str(), err.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ bool KartPropertiesManager::loadKart(const std::string &dir)
|
||||
if (kart_properties->getVersion() < stk_config->m_min_kart_version ||
|
||||
kart_properties->getVersion() > stk_config->m_max_kart_version)
|
||||
{
|
||||
Log::warn("Kart_Properties_Manager", "Warning: kart '%s' is not "
|
||||
Log::warn("[Kart_Properties_Manager]", "Warning: kart '%s' is not "
|
||||
"supported by this binary, ignored.",
|
||||
kart_properties->getIdent().c_str());
|
||||
delete kart_properties;
|
||||
@ -304,7 +304,7 @@ void KartPropertiesManager::setUnavailableKarts(std::vector<std::string> karts)
|
||||
{
|
||||
m_kart_available[i] = false;
|
||||
|
||||
Log::error("Kart_Properties_Manager",
|
||||
Log::error("[Kart_Properties_Manager]",
|
||||
"Kart '%s' not available on all clients, disabled.",
|
||||
m_karts_properties[i].getIdent().c_str());
|
||||
} // kart not in list
|
||||
@ -425,10 +425,8 @@ void KartPropertiesManager::getRandomKartList(int count,
|
||||
catch (std::runtime_error& ex)
|
||||
{
|
||||
(void)ex;
|
||||
std::cerr <<
|
||||
"[KartPropertiesManager] getRandomKartList : WARNING, "
|
||||
"can't find kart '"
|
||||
<< existing_karts[i].getKartName() << "'\n";
|
||||
Log::error("[KartPropertiesManager]", "getRandomKartList : WARNING, "
|
||||
"can't find kart '%s'", existing_karts[i].getKartName().c_str());
|
||||
}
|
||||
}
|
||||
for(unsigned int i=0; i<ai_list->size(); i++)
|
||||
@ -441,10 +439,8 @@ void KartPropertiesManager::getRandomKartList(int count,
|
||||
catch (std::runtime_error &ex)
|
||||
{
|
||||
(void)ex;
|
||||
std::cerr <<
|
||||
"[KartPropertiesManager] getRandomKartList : WARNING, "
|
||||
"can't find kart '"
|
||||
<< (*ai_list)[i] << "'\n";
|
||||
Log::error("[KartPropertiesManager]", "getRandomKartList : WARNING, "
|
||||
"can't find kart '%s'",(*ai_list)[i].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ void CutsceneWorld::init()
|
||||
|
||||
if (!StringUtils::fromString(frameStr, frame))
|
||||
{
|
||||
fprintf(stderr, "[CutsceneWorld] Invalid condition '%s'\n",
|
||||
Log::error("[CutsceneWorld]", "Invalid condition '%s'",
|
||||
condition.c_str());
|
||||
continue;
|
||||
}
|
||||
@ -115,7 +115,7 @@ void CutsceneWorld::init()
|
||||
|
||||
if (!StringUtils::fromString(frameStr, frame))
|
||||
{
|
||||
fprintf(stderr, "[CutsceneWorld] Invalid condition '%s'\n",
|
||||
Log::error("[CutsceneWorld]", "Invalid condition '%s'",
|
||||
condition.c_str());
|
||||
continue;
|
||||
}
|
||||
@ -130,7 +130,7 @@ void CutsceneWorld::init()
|
||||
|
||||
if (!StringUtils::fromString(frameStr, frame))
|
||||
{
|
||||
fprintf(stderr, "[CutsceneWorld] Invalid condition '%s'\n",
|
||||
Log::error("[CutsceneWorld]", "Invalid condition '%s'",
|
||||
condition.c_str());
|
||||
continue;
|
||||
}
|
||||
@ -150,7 +150,7 @@ void CutsceneWorld::init()
|
||||
|
||||
if (m_duration <= 0.0f)
|
||||
{
|
||||
fprintf(stderr, "[CutsceneWorld] WARNING: cutscene has no duration\n");
|
||||
Log::error("[CutsceneWorld]", "WARNING: cutscene has no duration");
|
||||
}
|
||||
} // CutsceneWorld
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
&& m_demo_tracks.size() > 0)
|
||||
{
|
||||
if(!track)
|
||||
printf("Invalid demo track identifier '%s'.\n",
|
||||
Log::warn("[DemoWorld]", "Invalid demo track identifier '%s'.",
|
||||
m_demo_tracks[0].c_str());
|
||||
m_demo_tracks.erase(m_demo_tracks.begin());
|
||||
track = track_manager->getTrack(m_demo_tracks[0]);
|
||||
@ -129,7 +129,7 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
// be filled up with all the tracks.
|
||||
if(m_demo_tracks.size()==0)
|
||||
{
|
||||
printf("No valid tracks found, no demo started.\n");
|
||||
Log::warn("[DemoWorld]", "No valid tracks found, no demo started.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ void EasterEggHunt::init()
|
||||
// check for possible problems if AI karts were incorrectly added
|
||||
if(getNumKarts() > race_manager->getNumPlayers())
|
||||
{
|
||||
fprintf(stderr, "No AI exists for this game mode\n");
|
||||
Log::error("EasterEggHunt]", "No AI exists for this game mode");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ void EasterEggHunt::readData(const std::string &filename)
|
||||
|
||||
if(easter->getName()!="EasterEggHunt")
|
||||
{
|
||||
printf("Can't load easter egg file '%s' - no EasterEggHunt element.",
|
||||
Log::error("[EasterEggHunt]", "Can't load easter egg file '%s' - no EasterEggHunt element.",
|
||||
filename.c_str());
|
||||
delete easter;
|
||||
return;
|
||||
@ -121,7 +121,7 @@ void EasterEggHunt::readData(const std::string &filename)
|
||||
const XMLNode *egg = data->getNode(i);
|
||||
if(egg->getName()!="easter-egg")
|
||||
{
|
||||
printf("Unknown node '%s' in easter egg level '%s' - ignored.\n",
|
||||
Log::warn("[EasterEggHunt]", "Unknown node '%s' in easter egg level '%s' - ignored.",
|
||||
egg->getName().c_str(),
|
||||
race_manager->getDifficultyAsString(act_difficulty).c_str());
|
||||
continue;
|
||||
|
@ -108,19 +108,19 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
AbstractKart *kart = getKartAtPosition(position_to_remove);
|
||||
if(!kart || kart->isEliminated())
|
||||
{
|
||||
fprintf(stderr,"Problem with removing leader: position %d not found\n",
|
||||
Log::error("[FTL]", "Problem with removing leader: position %d not found",
|
||||
position_to_remove);
|
||||
for(unsigned int i=0; i<m_karts.size(); i++)
|
||||
{
|
||||
fprintf(stderr,"kart %d: eliminated %d position %d\n",
|
||||
i,m_karts[i]->isEliminated(), m_karts[i]->getPosition());
|
||||
Log::error("[FTL]", "kart %u: eliminated %d position %d",
|
||||
i, m_karts[i]->isEliminated(), m_karts[i]->getPosition());
|
||||
} // for i
|
||||
} //
|
||||
else
|
||||
{
|
||||
if(UserConfigParams::m_ftl_debug)
|
||||
{
|
||||
printf("[ftl] Eliminiating kart '%s' at position %d.\n",
|
||||
Log::debug("[FTL", "Eliminiating kart '%s' at position %d.",
|
||||
kart->getIdent().c_str(), position_to_remove);
|
||||
}
|
||||
eliminateKart(kart->getWorldKartId());
|
||||
|
@ -208,10 +208,10 @@ void LinearWorld::update(float dt)
|
||||
{
|
||||
if(pos_used[m_karts[i]->getPosition()]!=-99)
|
||||
{
|
||||
for(unsigned int j =0; j<kart_amount; j++)
|
||||
for(unsigned int j=0; j<kart_amount; j++)
|
||||
{
|
||||
printf("kart id=%d, position=%d, finished=%d, laps=%d, "
|
||||
"distanceDownTrack=%f overallDistance=%f %s\n",
|
||||
Log::verbose("[LinearWorld]", "kart id=%u, position=%d, finished=%d, laps=%d, "
|
||||
"distanceDownTrack=%f overallDistance=%f %s",
|
||||
j, m_karts[j]->getPosition(),
|
||||
m_karts[j]->hasFinishedRace(),
|
||||
m_kart_info[j].m_race_lap,
|
||||
@ -553,9 +553,9 @@ float LinearWorld::estimateFinishTimeForKart(AbstractKart* kart)
|
||||
#ifdef DEBUG
|
||||
if(kart_info.m_overall_distance > full_distance)
|
||||
{
|
||||
printf("WARNING: full distance < distance covered for kart '%s':\n",
|
||||
Log::debug("[LinearWorld]", "Full distance < distance covered for kart '%s':",
|
||||
kart->getIdent().c_str());
|
||||
printf("%f < %f\n", full_distance, kart_info.m_overall_distance);
|
||||
Log::debug("[LinearWorld]", "%f < %f", full_distance, kart_info.m_overall_distance);
|
||||
}
|
||||
#endif
|
||||
// Avoid potential problems (floating point issues, coding bug?) if a
|
||||
@ -699,29 +699,29 @@ void LinearWorld::updateRacePosition()
|
||||
rank_changed |= kart->getPosition()!=p;
|
||||
if (!setKartPosition(i,p))
|
||||
{
|
||||
std::cerr << "ERROR, same rank used twice!!\n";
|
||||
Log::error("[LinearWorld]", "Same rank used twice!!");
|
||||
|
||||
std::cerr << "Info used to decide ranking :\n";
|
||||
Log::debug("[LinearWorld]", "Info used to decide ranking :");
|
||||
for (unsigned int d=0; d<kart_amount; d++)
|
||||
{
|
||||
std::cerr << " kart " << m_karts[d]->getIdent()
|
||||
<< " has finished(" << m_karts[d]->hasFinishedRace()
|
||||
<< "), is at lap (" << getLapForKart(d)
|
||||
<< "), is at distance("
|
||||
<< m_kart_info[d].m_overall_distance
|
||||
<< "), is eliminated(" << m_karts[d]->isEliminated()
|
||||
<< ")" << std::endl;
|
||||
Log::debug("[LinearWorld]", "Kart %s has finished (%d), is at lap (%u),"
|
||||
"is at distance (%u), is eliminated(%d)",
|
||||
m_karts[d]->getIdent().c_str(),
|
||||
m_karts[d]->hasFinishedRace(),
|
||||
getLapForKart(d),
|
||||
m_kart_info[d].m_overall_distance,
|
||||
m_karts[d]->isEliminated());
|
||||
}
|
||||
|
||||
std::cerr << "Who has each ranking so far :\n";
|
||||
Log::debug("[LinearWorld]", "Who has each ranking so far :");
|
||||
for (unsigned int d=0; d<i; d++)
|
||||
{
|
||||
std::cerr << " " << m_karts[d]->getIdent() << " has rank "
|
||||
<< m_karts[d]->getPosition() << std::endl;
|
||||
Log::debug("[LinearWorld]", "%s has rank %d", m_karts[d]->getIdent().c_str(),
|
||||
m_karts[d]->getPosition());
|
||||
}
|
||||
|
||||
std::cerr << " --> And " << kart->getIdent()
|
||||
<< " is being set at rank " << p << std::endl;
|
||||
Log::debug("[LinearWorld]", " --> And %s is being set at rank %d",
|
||||
kart->getIdent().c_str(), p);
|
||||
history->Save();
|
||||
assert(false);
|
||||
}
|
||||
@ -749,17 +749,18 @@ void LinearWorld::updateRacePosition()
|
||||
#ifdef DEBUG_KART_RANK
|
||||
if(rank_changed)
|
||||
{
|
||||
std::cout << "Counting laps at "<<getTime()<<" seconds.\n";
|
||||
Log::debug("[LinearWorld]", "Counting laps at %u seconds.", getTime());
|
||||
for (unsigned int i=0; i<kart_amount; i++)
|
||||
{
|
||||
AbstractKart* kart = m_karts[i];
|
||||
std::cout << "counting karts ahead of " << kart->getIdent()
|
||||
<< " (laps " << m_kart_info[i].m_race_lap
|
||||
<< ", progress " << m_kart_info[i].m_overall_distance
|
||||
<< " finished " << kart->hasFinishedRace()
|
||||
<< " eliminated " << kart->isEliminated()
|
||||
<< " initial position "<< kart->getInitialPosition()
|
||||
<< ").\n";
|
||||
Log::debug("[LinearWorld]", "counting karts ahead of %s (laps %u,"
|
||||
" progress %u, finished %d, eliminated %d, initial position %u.",
|
||||
kart->getIdent().c_str(),
|
||||
m_kart_info[i].m_race_lap,
|
||||
m_kart_info[i].m_overall_distance,
|
||||
kart->hasFinishedRace(),
|
||||
kart->isEliminated(),
|
||||
kart->getInitialPosition());
|
||||
// Karts that are either eliminated or have finished the
|
||||
// race already have their (final) position assigned. If
|
||||
// these karts would get their rank updated, it could happen
|
||||
@ -776,36 +777,36 @@ void LinearWorld::updateRacePosition()
|
||||
if(j == my_id) continue;
|
||||
if(m_karts[j]->isEliminated())
|
||||
{
|
||||
std::cout << " " << p << " : " << m_karts[j]->getIdent()
|
||||
<< " because it is eliminated.\n";
|
||||
Log::debug("[LinearWorld]", " %u: %s because it is eliminated.",
|
||||
p, m_karts[j]->getIdent().c_str());
|
||||
continue;
|
||||
}
|
||||
if(!kart->hasFinishedRace() && m_karts[j]->hasFinishedRace())
|
||||
{
|
||||
p++;
|
||||
std::cout << " " << p << " : " << m_karts[j]->getIdent()
|
||||
<< " because it has finished the race.\n";
|
||||
Log::debug("[LinearWorld]", " %u: %s because it has finished the race.",
|
||||
p, m_karts[j]->getIdent().c_str());
|
||||
continue;
|
||||
}
|
||||
if(m_kart_info[j].m_overall_distance > my_distance)
|
||||
{
|
||||
p++;
|
||||
std::cout << " " << p << " : " << m_karts[j]->getIdent()
|
||||
<< " because it is ahead "
|
||||
<< m_kart_info[j].m_overall_distance <<".\n";
|
||||
Log::debug("[LinearWorld]", " %u: %s because it is ahead %u.",
|
||||
p, m_karts[j]->getIdent().c_str(),
|
||||
m_kart_info[j].m_overall_distance);
|
||||
continue;
|
||||
}
|
||||
if(m_kart_info[j].m_overall_distance == my_distance &&
|
||||
m_karts[j]->getInitialPosition()<kart->getInitialPosition())
|
||||
{
|
||||
p++;
|
||||
std::cout << " " << p << " : " << m_karts[j]->getIdent()
|
||||
<< " has same distance, but started ahead "
|
||||
<< m_karts[j]->getInitialPosition()<<".\n";
|
||||
Log::debug("[LinearWorld]"," %u: %s has same distance, but started ahead %d",
|
||||
p, m_karts[j]->getIdent().c_str(),
|
||||
m_karts[j]->getInitialPosition());
|
||||
}
|
||||
} // next kart j
|
||||
} // for i<kart_amount
|
||||
std::cout << "-------------------------------------------\n";
|
||||
Log::debug("LinearWorld]", "-------------------------------------------");
|
||||
} // if rank_changed
|
||||
#endif
|
||||
#endif
|
||||
|
@ -68,8 +68,8 @@ void OverWorld::enterOverWorld()
|
||||
|
||||
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
|
||||
{
|
||||
Log::warn("overworld", "cannot find kart '%s', "
|
||||
"will revert to default\n",
|
||||
Log::warn("[overworld]", "cannot find kart '%s', "
|
||||
"will revert to default",
|
||||
UserConfigParams::m_default_kart.c_str());
|
||||
|
||||
UserConfigParams::m_default_kart.revertToDefaults();
|
||||
|
@ -76,7 +76,7 @@ void SoccerWorld::init()
|
||||
// check for possible problems if AI karts were incorrectly added
|
||||
if(getNumKarts() > race_manager->getNumPlayers())
|
||||
{
|
||||
fprintf(stderr, "No AI exists for this game mode\n");
|
||||
Log::error("[SoccerWorld]", "No AI exists for this game mode");
|
||||
exit(1);
|
||||
}
|
||||
m_goal_target = race_manager->getMaxGoal();
|
||||
@ -85,7 +85,7 @@ void SoccerWorld::init()
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Called then a battle is restarted.
|
||||
/** Called when a battle is restarted.
|
||||
*/
|
||||
void SoccerWorld::reset()
|
||||
{
|
||||
@ -391,8 +391,8 @@ void SoccerWorld::moveKartAfterRescue(AbstractKart* kart)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "WARNING: invalid position after rescue for kart %s on track %s.\n",
|
||||
(kart->getIdent().c_str()), m_track->getIdent().c_str());
|
||||
Log::warn("[SoccerWorld]", " Invalid position after rescue for kart %s on track %s.",
|
||||
kart->getIdent().c_str(), m_track->getIdent().c_str());
|
||||
}
|
||||
} // moveKartAfterRescue
|
||||
|
||||
|
@ -61,7 +61,7 @@ void ThreeStrikesBattle::init()
|
||||
// check for possible problems if AI karts were incorrectly added
|
||||
if(getNumKarts() > race_manager->getNumPlayers())
|
||||
{
|
||||
Log::fatal("Three Strikes Battle", "No AI exists for this game mode");
|
||||
Log::fatal("[Three Strikes Battle]", "No AI exists for this game mode");
|
||||
}
|
||||
m_kart_info.resize(m_karts.size());
|
||||
} // ThreeStrikesBattle
|
||||
|
@ -332,7 +332,7 @@ Controller* World::loadAIController(AbstractKart *kart)
|
||||
controller = new SkiddingAI(kart);
|
||||
break;
|
||||
default:
|
||||
Log::warn("World", "Unknown AI, using default.");
|
||||
Log::warn("[World]", "Unknown AI, using default.");
|
||||
controller = new SkiddingAI(kart);
|
||||
break;
|
||||
}
|
||||
@ -529,12 +529,12 @@ void World::resetAllKarts()
|
||||
|
||||
if (!kart_over_ground)
|
||||
{
|
||||
Log::error("World",
|
||||
Log::error("[World]",
|
||||
"No valid starting position for kart %d on track %s.",
|
||||
(int)(i-m_karts.begin()), m_track->getIdent().c_str());
|
||||
if (UserConfigParams::m_artist_debug_mode)
|
||||
{
|
||||
Log::warn("World", "Activating fly mode.");
|
||||
Log::warn("[World]", "Activating fly mode.");
|
||||
(*i)->flyUp();
|
||||
continue;
|
||||
}
|
||||
@ -580,14 +580,14 @@ void World::resetAllKarts()
|
||||
&normal);
|
||||
if(!material)
|
||||
{
|
||||
Log::error("World",
|
||||
Log::error("[World]",
|
||||
"No valid starting position for kart %d "
|
||||
"on track %s.",
|
||||
(int)(i-m_karts.begin()),
|
||||
m_track->getIdent().c_str());
|
||||
if (UserConfigParams::m_artist_debug_mode)
|
||||
{
|
||||
Log::warn("World", "Activating fly mode.");
|
||||
Log::warn("[World]", "Activating fly mode.");
|
||||
(*i)->flyUp();
|
||||
continue;
|
||||
}
|
||||
@ -755,7 +755,7 @@ void World::updateWorld(float dt)
|
||||
|
||||
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
|
||||
{
|
||||
Log::warn("World",
|
||||
Log::warn("[World]",
|
||||
"Cannot find kart '%s', will revert to default.",
|
||||
UserConfigParams::m_default_kart.c_str());
|
||||
UserConfigParams::m_default_kart.revertToDefaults();
|
||||
@ -930,10 +930,10 @@ void World::updateHighscores(int* best_highscore_rank, int* best_finish_time,
|
||||
// the kart location data is wrong
|
||||
|
||||
#ifdef DEBUG
|
||||
Log::error("World", "Incorrect kart positions:");
|
||||
Log::error("[World]", "Incorrect kart positions:");
|
||||
for (unsigned int i=0; i<m_karts.size(); i++ )
|
||||
{
|
||||
Log::error("World", "i=%d position %d.",i,
|
||||
Log::error("[World]", "i=%d position %d.",i,
|
||||
m_karts[i]->getPosition());
|
||||
}
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "race/history.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -85,22 +86,22 @@ bool WorldWithRank::setKartPosition(unsigned int kart_id,
|
||||
assert(m_position_setting_initialised);
|
||||
if(m_position_used[position-1])
|
||||
{
|
||||
std::cerr << "== TWO KARTS ARE BEING GIVEN THE SAME POSITION!! ==\n";
|
||||
Log::error("[WorldWithRank]", "== TWO KARTS ARE BEING GIVEN THE SAME POSITION!! ==");
|
||||
for (unsigned int j=0; j < m_position_index.size(); j++)
|
||||
{
|
||||
if (!m_position_used[j])
|
||||
{
|
||||
std::cout << " No kart is yet set at position " << j+1
|
||||
<< std::endl;
|
||||
Log::warn("WorldWithRank]", "No kart is yet set at position %u", j+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " Kart " << m_position_index[j]
|
||||
<< " is at position " << j << std::endl;
|
||||
Log::warn("WorldWithRank]", "Kart %u is at position %u",
|
||||
m_position_index[j], j);
|
||||
}
|
||||
}
|
||||
std::cout << "Kart " << kart_id << " is being given position "
|
||||
<< position << ", but this position is already taken\n";
|
||||
Log::warn("WorldWithRank]", "Kart %u is being given position %u,"
|
||||
"but this position is already taken",
|
||||
kart_id, position);
|
||||
return false;
|
||||
}
|
||||
m_position_used[position-1] = true;
|
||||
|
@ -73,7 +73,7 @@ void* STKHost::receive_data(void* self)
|
||||
}
|
||||
}
|
||||
myself->m_listening = false;
|
||||
delete myself->m_listening_thread;
|
||||
free(myself->m_listening_thread);
|
||||
myself->m_listening_thread = NULL;
|
||||
Log::info("STKHost", "Listening has been stopped");
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user