本文整理汇总了C++中LMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ LMsg函数的具体用法?C++ LMsg怎么用?C++ LMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FL_DBG
bool Instance::process_movement() {
FL_DBG(_log, "Moving...");
ActionInfo* info = m_activity->m_actioninfo;
// timeslice for this movement
unsigned int timedelta = m_activity->m_timeprovider->getGameTime() - info->m_prev_call_time;
FL_DBG(_log, LMsg("timedelta ") << timedelta << " prevcalltime " << info->m_prev_call_time);
// how far we can travel
double distance_to_travel = (static_cast<double>(timedelta) / 1000.0) * info->m_speed;
FL_DBG(_log, LMsg("dist ") << distance_to_travel);
Location nextLocation = m_location;
info->m_pather_session_id = info->m_pather->getNextLocation(
this, *info->m_target,
distance_to_travel, nextLocation, *m_facinglocation,
info->m_pather_session_id);
m_location.getLayer()->getInstanceTree()->removeInstance(this);
m_location = nextLocation;
//ExactModelCoordinate a = nextLocation.getMapCoordinates();
//ExactModelCoordinate b = m_actioninfo->m_target->getMapCoordinates();
m_location.getLayer()->getInstanceTree()->addInstance(this);
// return if we are close enough to target to stop
if (info->m_pather_session_id == -1) {
return true;
}
return false;
}
示例2: VFSSource
DAT2::DAT2(VFS* vfs, const std::string& file)
: VFSSource(vfs), m_datpath(file), m_data(vfs->open(file)), m_filelist() {
FL_LOG(_log, LMsg("MFFalloutDAT2")
<< "loading: " << file
<< " filesize: " << m_data->getDataLength());
m_data->setIndex(m_data->getDataLength() - 8);
uint32_t fileListLength = m_data->read32Little();
uint32_t archiveSize = m_data->read32Little();
FL_LOG(_log, LMsg("MFFalloutDAT2")
<< "FileListLength: " << fileListLength
<< " ArchiveSize: " << archiveSize);
if (archiveSize != m_data->getDataLength())
throw InvalidFormat("size mismatch");
m_data->setIndex( archiveSize - fileListLength - 8);
m_filecount = m_data->read32Little();
m_currentIndex = m_data->getCurrentIndex();
FL_LOG(_log, LMsg("MFFalloutDAT2 FileCount: ") << m_filecount);
// Do not read the complete file list at startup.
// Instead read a chunk each frame.
m_timer.setInterval(0);
m_timer.setCallback( boost::bind( &DAT2::readFileEntry, this) );
m_timer.start();
}
示例3: alcOpenDevice
void SoundManager::init() {
m_device = alcOpenDevice(NULL);
if (!m_device || alcGetError(m_device) != ALC_NO_ERROR) {
FL_ERR(_log, LMsg() << "Could not open audio device - deactivating audio module");
m_device = NULL;
return;
}
m_context = alcCreateContext(m_device, NULL);
if (!m_context || alcGetError(m_device) != ALC_NO_ERROR) {
FL_ERR(_log, LMsg() << "Couldn't create audio context - deactivating audio module");
m_device = NULL;
return;
}
alcMakeContextCurrent(m_context);
if (alcGetError(m_device) != ALC_NO_ERROR) {
FL_ERR(_log, LMsg() << "Couldn't change current audio context - deactivating audio module");
m_device = NULL;
return;
}
// set listener position
alListener3f(AL_POSITION, 0.0, 0.0, 0.0);
ALfloat vec1[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
alListenerfv(AL_ORIENTATION, vec1);
// set volume
alListenerf(AL_GAIN, m_volume);
}
示例4: FL_WARN
VFSSource* VFS::createSource(const std::string& path) {
if (hasSource(path)) {
FL_WARN(_log, LMsg(path) << " is already used as VFS source");
return 0;
}
type_providers::const_iterator end = m_providers.end();
for (type_providers::const_iterator i = m_providers.begin(); i != end; ++i) {
VFSSourceProvider* provider = *i;
if (!provider->isReadable(path))
continue;
try {
VFSSource* source = provider->createSource(path);
return source;
} catch (const Exception& ex) {
FL_WARN(_log, LMsg(provider->getName()) << " thought it could load " << path << " but didn't succeed (" << ex.what() << ")");
continue;
} catch (...) {
FL_WARN(_log, LMsg(provider->getName()) << " thought it could load " << path << " but didn't succeed (unknown exception)");
continue;
}
}
FL_WARN(_log, LMsg("no provider for ") << path << " found");
return 0;
}
示例5: VFSSource
DAT1::DAT1(VFS* vfs, const std::string& file) : VFSSource(vfs), m_datpath(file), m_data(vfs->open(file)) {
FL_LOG(_log, LMsg("MFFalloutDAT1")
<< "loading: " << file
<< " filesize: " << m_data->getDataLength());
m_data->setIndex(0);
const uint32_t dircount = m_data->read32Big();
m_data->moveIndex(4*3);
FL_LOG(_log, LMsg("MFFalloutDAT1")
<< "number of directories " << dircount);
// Sanity check. Each dir entry needs min. 16 bytes.
if( dircount*16 > m_data->getDataLength() ) {
throw InvalidFormat("directory count larger than filesize.");
}
std::list<std::string> dir_names;
for (uint32_t i = 0; i < dircount; ++i) {
std::string name = readString();
if (name == ".") {
name = "";
}
dir_names.push_back(name);
}
for(std::list<std::string>::iterator i= dir_names.begin(); i!= dir_names.end(); ++i)
loadFileList(*i);
}
示例6: CellGrid
HexGrid::HexGrid(bool allow_diagonals): CellGrid(allow_diagonals) {
FL_DBG(_log, "Constructing new HexGrid");
FL_DBG(_log, LMsg("HEX_WIDTH ") << HEX_WIDTH);
FL_DBG(_log, LMsg("HEX_TO_EDGE ") << HEX_TO_EDGE);
FL_DBG(_log, LMsg("HEX_TO_CORNER ") << HEX_TO_CORNER);
FL_DBG(_log, LMsg("HEX_EDGE_HALF ") << HEX_EDGE_HALF);
FL_DBG(_log, LMsg("VERTICAL_MULTIP ") << VERTICAL_MULTIP);
}
示例7: CellGrid
HexGrid::HexGrid(bool axial):
CellGrid(),
m_axial(axial) {
FL_DBG(_log, "Constructing new HexGrid");
FL_DBG(_log, LMsg("HEX_WIDTH ") << HEX_WIDTH);
FL_DBG(_log, LMsg("HEX_TO_EDGE ") << HEX_TO_EDGE);
FL_DBG(_log, LMsg("HEX_TO_CORNER ") << HEX_TO_CORNER);
FL_DBG(_log, LMsg("HEX_EDGE_HALF ") << HEX_EDGE_HALF);
FL_DBG(_log, LMsg("VERTICAL_MULTIP ") << VERTICAL_MULTIP);
}
示例8: MarkRoutine
void MarkRoutine()
{
int x, y;
if (InitOverlayPage(sizeof(*markdata), &MarkLf, 1))
return;
flayer->l_encoding = fore->w_encoding;
flayer->l_mode = 1;
markdata = (struct markdata *)flayer->l_data;
markdata->md_user = D_user; /* XXX: Correct? */
markdata->md_window = fore;
markdata->second = 0;
markdata->rep_cnt = 0;
markdata->append_mode = 0;
markdata->write_buffer = 0;
markdata->nonl = 0;
markdata->left_mar = 0;
markdata->right_mar = fore->w_width - 1;
markdata->hist_offset = fore->w_histheight;
x = fore->w_x;
y = D2W(fore->w_y);
if (x >= fore->w_width)
x = fore->w_width - 1;
LGotoPos(flayer, x, W2D(y));
LMsg(0, "Copy mode - Column %d Line %d(+%d) (%d,%d)",
x + 1, W2D(y + 1), fore->w_histheight, fore->w_width, fore->w_height);
markdata->cx = markdata->x1 = x;
markdata->cy = markdata->y1 = y;
flayer->l_x = x;
flayer->l_y = W2D(y);
}
示例9: assert
void DAT2::readFileEntry() const {
assert( m_filecount != 0);
// Load more items per call,
// otherwise it takes _ages_ until everything is in.
uint32_t load_per_cycle = 50;
if( load_per_cycle > m_filecount )
load_per_cycle = m_filecount;
m_filecount -= load_per_cycle;
// Save the old index in an exception save way.
IndexSaver isaver(m_data.get());
// Move index to file list and read the entries.
m_data->setIndex(m_currentIndex);
RawDataDAT2::s_info info;
while( load_per_cycle-- ) {
uint32_t namelen = m_data->read32Little();
info.name = fixPath(m_data->readString(namelen));
info.type = m_data->read8();
info.unpackedLength = m_data->read32Little();
info.packedLength = m_data->read32Little();
info.offset = m_data->read32Little();
m_filelist.insert(std::make_pair(info.name, info));
}
m_currentIndex = m_data->getCurrentIndex();
// Finally log on completion and stop the timer.
if( m_filecount == 0 ) {
FL_LOG(_log, LMsg("MFFalloutDAT2, All file entries in '") << m_datpath << "' loaded.");
m_timer.stop();
}
}
示例10: FL_LOG
DAT2::type_filelist::const_iterator DAT2::findFileEntry(const std::string& path) const {
// Either the normalization is bogus, or we have to do
// it here, too. Otherwise we can't load the files returned
// by listFiles.
std::string name = path;
// Normalize the path
if (name.find("./") == 0) {
name.erase(0, 2);
}
type_filelist::const_iterator i = m_filelist.find(name);
// We might have another chance to find the file
// if the number of file entries not zero.
if ( m_filecount && i == m_filelist.end()) {
FL_LOG(_log, LMsg("MFFalloutDAT2")
<< "Missing '" << name
<< "' in partially(" << m_filecount <<") loaded "<< m_datpath);
while( m_filecount && i == m_filelist.end()) {
readFileEntry();
i = m_filelist.find(name);
}
}
return i;
}
示例11: getXZigzagOffset
ExactModelCoordinate HexGrid::toExactLayerCoordinates(const ExactModelCoordinate& map_coord) {
ExactModelCoordinate layer_coords = m_inverse_matrix * map_coord;
layer_coords.y /= VERTICAL_MULTIP;
layer_coords.x -= getXZigzagOffset(layer_coords.y);
FL_DBG(_log, LMsg("mapcoords ") << map_coord << " converted to layer: " << layer_coords);
return layer_coords;
}
示例12: tranformed_coords
ExactModelCoordinate HexGrid::toMapCoordinates(const ExactModelCoordinate& layer_coords) {
ExactModelCoordinate tranformed_coords(layer_coords);
tranformed_coords.x += getXZigzagOffset(layer_coords.y);
tranformed_coords.y *= VERTICAL_MULTIP;
ExactModelCoordinate result = m_matrix * tranformed_coords;
FL_DBG(_log, LMsg("layercoords ") << layer_coords << " converted to map: " << result);
return result;
}
示例13: createSource
void VFS::addNewSource(const std::string& path) {
VFSSource* source = createSource(path);
if (source) {
addSource(source);
} else {
FL_WARN(_log, LMsg("Failed to add new VFS source: ") << path);
}
}
示例14: initializeChanges
void Instance::move(const std::string& action_name, const Location& target, const double speed) {
initializeChanges();
initializeAction(action_name);
m_activity->m_actioninfo->m_target = new Location(target);
m_activity->m_actioninfo->m_speed = speed;
setFacingLocation(target);
FL_DBG(_log, LMsg("starting action ") << action_name << " from" << m_location << " to " << target << " with speed " << speed);
}
示例15: orientation
bool CellGrid::ptInTriangle(const ExactModelCoordinate& pt, const ExactModelCoordinate& pt1, const ExactModelCoordinate& pt2, const ExactModelCoordinate& pt3) {
double o1 = orientation(pt1, pt2, pt);
double o2 = orientation(pt2, pt3, pt);
double o3 = orientation(pt3, pt1, pt);
bool result = (o1 == o2) && (o2 == o3);
FL_DBG(_log, LMsg("ptInTriangle, pt=") << pt << " pt1=" << pt1 << " pt2=" << pt2 << " pt3=" << pt3 << " in=" << result);
return result;
}