本文整理匯總了C++中ERRORLOG函數的典型用法代碼示例。如果您正苦於以下問題:C++ ERRORLOG函數的具體用法?C++ ERRORLOG怎麽用?C++ ERRORLOG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ERRORLOG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: find_and_load_lif_files
/**
* Searches levels folder for LIF files and adds them to campaign levels list.
*/
TbBool find_and_load_lif_files(void)
{
struct TbFileFind fileinfo;
unsigned char *buf;
char *fname;
short result;
int rc;
long i;
buf = LbMemoryAlloc(MAX_LIF_SIZE);
if (buf == NULL)
{
ERRORLOG("Can't allocate memory for .LIF files parsing.");
return false;
}
result = false;
fname = prepare_file_path(FGrp_VarLevels,"*.lif");
rc = LbFileFindFirst(fname, &fileinfo, 0x21u);
while (rc != -1)
{
fname = prepare_file_path(FGrp_VarLevels,fileinfo.Filename);
i = LbFileLength(fname);
if ((i < 0) || (i >= MAX_LIF_SIZE))
{
WARNMSG("File \"%s\" too long (Max size %d)", fileinfo.Filename, MAX_LIF_SIZE);
} else
if (LbFileLoadAt(fname, buf) != i)
{
WARNMSG("Unable to read .LIF file, \"%s\"", fileinfo.Filename);
} else
{
buf[i] = '\0';
if (level_lif_file_parse(fileinfo.Filename, (char *)buf, i))
result = true;
}
rc = LbFileFindNext(&fileinfo);
}
LbFileFindEnd(&fileinfo);
LbMemoryFree(buf);
return result;
}
示例2: Instrument
Instrument* Instrument::load_from( XMLNode* node, const QString& dk_path, const QString& dk_name )
{
int id = node->read_int( "id", EMPTY_INSTR_ID, false, false );
if ( id==EMPTY_INSTR_ID ) return 0;
Instrument* instrument = new Instrument( id, node->read_string( "name", "" ), 0 );
instrument->set_drumkit_name( dk_name );
instrument->set_volume( node->read_float( "volume", 1.0f ) );
instrument->set_muted( node->read_bool( "isMuted", false ) );
instrument->set_pan_l( node->read_float( "pan_L", 1.0f ) );
instrument->set_pan_r( node->read_float( "pan_R", 1.0f ) );
// may not exist, but can't be empty
instrument->set_filter_active( node->read_bool( "filterActive", true, false ) );
instrument->set_filter_cutoff( node->read_float( "filterCutoff", 1.0f, true, false ) );
instrument->set_filter_resonance( node->read_float( "filterResonance", 0.0f, true, false ) );
instrument->set_random_pitch_factor( node->read_float( "randomPitchFactor", 0.0f, true, false ) );
float attack = node->read_float( "Attack", 0.0f, true, false );
float decay = node->read_float( "Decay", 0.0f, true, false );
float sustain = node->read_float( "Sustain", 1.0f, true, false );
float release = node->read_float( "Release", 1000.0f, true, false );
instrument->set_adsr( new ADSR( attack, decay, sustain, release ) );
instrument->set_gain( node->read_float( "gain", 1.0f, true, false ) );
instrument->set_mute_group( node->read_int( "muteGroup", -1, true, false ) );
instrument->set_midi_out_channel( node->read_int( "midiOutChannel", -1, true, false ) );
instrument->set_midi_out_note( node->read_int( "midiOutNote", MIDI_MIDDLE_C, true, false ) );
instrument->set_stop_notes( node->read_bool( "isStopNote", true ,false ) );
for ( int i=0; i<MAX_FX; i++ ) {
instrument->set_fx_level( node->read_float( QString( "FX%1Level" ).arg( i+1 ), 0.0 ), i );
}
int n = 0;
XMLNode layer_node = node->firstChildElement( "layer" );
while ( !layer_node.isNull() ) {
if ( n >= MAX_LAYERS ) {
ERRORLOG( QString( "n >= MAX_LAYERS (%1)" ).arg( MAX_LAYERS ) );
break;
}
instrument->set_layer( InstrumentLayer::load_from( &layer_node, dk_path ), n );
n++;
layer_node = layer_node.nextSiblingElement( "layer" );
}
return instrument;
}
示例3: good_wait_in_exit_door
short good_wait_in_exit_door(struct Thing *thing)
{
struct CreatureControl *cctrl;
struct Thing *tmptng;
// Debug code to find incorrect states
if (!is_hero_thing(thing))
{
ERRORLOG("Non hero thing %s index %d, owner %d - reset",
thing_model_name(thing), (int)thing->index, (int)thing->owner);
set_start_state(thing);
erstat_inc(ESE_BadCreatrState);
return 0;
}
//return _DK_good_wait_in_exit_door(thing);
cctrl = creature_control_get_from_thing(thing);
if (cctrl->field_282 <= 0)
return 0;
cctrl->field_282--;
if (cctrl->field_282 == 0)
{
tmptng = find_base_thing_on_mapwho(TCls_Object, 49, thing->mappos.x.stl.num, thing->mappos.y.stl.num);
if (!thing_is_invalid(tmptng))
{
if (cctrl->byte_8A == tmptng->creation_turn)
{
remove_thing_from_creature_controlled_limbo(thing);
set_start_state(thing);
return 1;
}
}
thing->creature.gold_carried = 0;
tmptng = thing_get(cctrl->dragtng_idx);
TRACE_THING(tmptng);
if (!thing_is_invalid(tmptng))
{
delete_thing_structure(tmptng, 0);
}
kill_creature(thing, INVALID_THING, -1, CrDed_NoEffects|CrDed_NotReallyDying);
}
return 0;
}
示例4: good_back_at_start
short good_back_at_start(struct Thing *thing)
{
// Debug code to find incorrect states
if (!is_hero_thing(thing))
{
ERRORLOG("Non hero thing %ld, %s, owner %ld - reset",(long)thing->index,thing_model_name(thing),(long)thing->owner);
set_start_state(thing);
return false;
}
//return _DK_good_back_at_start(thing);
if (thing->creature.gold_carried <= 0)
{
set_start_state(thing);
return 1;
}
SubtlCodedCoords stl_num;
long m,n;
stl_num = get_subtile_number(thing->mappos.x.stl.num,thing->mappos.y.stl.num);
m = ACTION_RANDOM(AROUND_MAP_LENGTH);
for (n=0; n < AROUND_MAP_LENGTH; n++)
{
struct Map *mapblk;
mapblk = get_map_block_at_pos(stl_num+around_map[m]);
// Per-block code
if ((mapblk->flags & MapFlg_IsTall) == 0)
{
MapSubtlCoord stl_x, stl_y;
stl_x = stl_num_decode_x(stl_num+around_map[m]);
stl_y = stl_num_decode_y(stl_num+around_map[m]);
if (setup_person_move_to_position(thing, stl_x, stl_y, NavRtF_Default)) {
thing->continue_state = CrSt_GoodDropsGold;
return 1;
}
}
// Per-block code ends
m = (m + 1) % AROUND_MAP_LENGTH;
}
set_start_state(thing);
return 1;
}
示例5: is_door_built
/**
* Returns if the door was at least one built by a player.
*/
TbBool is_door_built(PlayerNumber plyr_idx, long door_idx)
{
struct Dungeon *dungeon;
dungeon = get_players_num_dungeon(plyr_idx);
// Check if the player even have a dungeon
if (dungeon_invalid(dungeon)) {
return false;
}
// Player must have dungeon heart to build anything
if (!player_has_heart(plyr_idx)) {
return false;
}
if ((door_idx <= 0) || (door_idx >= DOOR_TYPES_COUNT)) {
ERRORLOG("Incorrect door %d (player %d)",(int)door_idx, (int)plyr_idx);
return false;
}
if ((dungeon->door_build_flags[door_idx] & MnfBldF_Built) != 0) {
return true;
}
return false;
}
示例6: is_trap_placeable
/**
* Returns if the trap can be placed by a player.
* Checks only if it's available and if the player is 'alive'.
* Doesn't check if map position is on correct spot.
*/
TbBool is_trap_placeable(PlayerNumber plyr_idx, long tngmodel)
{
struct Dungeon *dungeon;
dungeon = get_players_num_dungeon(plyr_idx);
// Check if the player even have a dungeon
if (dungeon_invalid(dungeon)) {
return false;
}
// Player must have dungeon heart to place traps
if (!player_has_heart(plyr_idx)) {
return false;
}
if ((tngmodel <= 0) || (tngmodel >= TRAP_TYPES_COUNT)) {
ERRORLOG("Incorrect trap %d (player %d)",(int)tngmodel, (int)plyr_idx);
return false;
}
if (dungeon->trap_amount_placeable[tngmodel] > 0) {
return true;
}
return false;
}
示例7: creature_control_get_from_thing
struct Thing *get_group_last_member(struct Thing *thing)
{
struct Thing *ctng;
struct CreatureControl *cctrl;
long k;
ctng = thing;
cctrl = creature_control_get_from_thing(ctng);
k = 0;
while (cctrl->next_in_group > 0)
{
ctng = thing_get(cctrl->next_in_group);
cctrl = creature_control_get_from_thing(ctng);
k++;
if (k > CREATURES_COUNT)
{
ERRORLOG("Infinite loop detected when sweeping creatures group");
break;
}
}
return ctng;
}
示例8: creature_choose_room_for_lair_site
short creature_choose_room_for_lair_site(struct Thing *thing)
{
TRACE_THING(thing);
//return _DK_creature_choose_room_for_lair_site(thing);
struct Room *room;
room = get_best_new_lair_for_creature(thing);
if (room_is_invalid(room))
{
update_cannot_find_room_wth_spare_capacity_event(thing->owner, thing, RoK_LAIR);
set_start_state(thing);
return 0;
}
if (!setup_head_for_random_unused_lair_slab(thing, room))
{
ERRORLOG("Chosen lair is not valid, internal inconsistency.");
set_start_state(thing);
return 0;
}
thing->continue_state = CrSt_CreatureAtNewLair;
return 1;
}
示例9: switch
void TransportInfo::printInfo()
{
switch ( m_status ) {
case STOPPED:
INFOLOG( "status = STOPPED" );
break;
case ROLLING:
INFOLOG( "status = ROLLING" );
break;
case BAD:
INFOLOG( "status = BAD" );
break;
default:
ERRORLOG( "status = unknown" );
}
INFOLOG( QString( "frames = %1" ).arg( m_nFrames ) );
INFOLOG( QString( "tickSize = %1" ).arg( m_nTickSize ) );
}
示例10: is_trap_buildable
/**
* Returns if the trap can be manufactured by a player.
* Checks only if it's set as buildable in level script.
* Doesn't check if player has workshop or workforce for the task.
*/
TbBool is_trap_buildable(PlayerNumber plyr_idx, long tngmodel)
{
struct Dungeon *dungeon;
dungeon = get_players_num_dungeon(plyr_idx);
// Check if the player even have a dungeon
if (dungeon_invalid(dungeon)) {
return false;
}
// Player must have dungeon heart to build anything
if (!player_has_heart(plyr_idx)) {
return false;
}
if ((tngmodel <= 0) || (tngmodel >= TRAP_TYPES_COUNT)) {
ERRORLOG("Incorrect trap %d (player %d)",(int)tngmodel, (int)plyr_idx);
return false;
}
if ((dungeon->trap_build_flags[tngmodel] & MnfBldF_Manufacturable) != 0) {
return true;
}
return false;
}
示例11: load_map_wlb_file
TbBool load_map_wlb_file(unsigned long lv_num)
{
struct SlabMap *slb;
unsigned long x,y;
unsigned char *buf;
unsigned long i;
unsigned long n;
unsigned long nfixes;
long fsize;
SYNCDBG(7,"Starting");
nfixes = 0;
fsize = map_tiles_y*map_tiles_x;
buf = load_single_map_file_to_buffer(lv_num,"wlb",&fsize,LMFF_Optional);
if (buf == NULL)
return false;
i = 0;
for (y=0; y < map_tiles_y; y++)
for (x=0; x < map_tiles_x; x++)
{
slb = get_slabmap_block(x,y);
n = (buf[i] << 3);
n = slb->field_5 ^ ((slb->field_5 ^ n) & 0x18);
slb->field_5 = n;
n &= (0x08|0x10);
if ((n != 0x10) || (slb->kind != SlbT_WATER))
if ((n != 0x08) || (slb->kind != SlbT_LAVA))
if (((n == 0x10) || (n == 0x08)) && (slb->kind != SlbT_BRIDGE))
{
nfixes++;
slb->field_5 &= ~(0x08|0x10);
}
i++;
}
LbMemoryFree(buf);
if (nfixes > 0)
{
ERRORLOG("WLB file is muddled - Fixed values for %lu tiles",nfixes);
}
return true;
}
示例12: delaunay_seeded
long delaunay_seeded(long start_x, long start_y, long end_x, long end_y)
{
long tri_idx,cor_idx;
long tri_id2,cor_id2;
long count;
NAVIDBG(19,"Starting");
//return _DK_delaunay_seeded(start_x, start_y, end_x, end_y);
tags_init();
delaunay_init();
delaunay_stack_point(start_x, start_y);
delaunay_stack_point(start_x, end_y);
delaunay_stack_point(end_x, start_y);
delaunay_stack_point(end_x, end_y);
count = 0;
while (ix_delaunay > 0)
{
ix_delaunay--;
tri_idx = delaunay_stack[ix_delaunay];
for (cor_idx=0; cor_idx < 3; cor_idx++)
{
if (!optimise_heuristic(tri_idx, cor_idx))
continue;
count++;
edge_rotateAC(tri_idx, cor_idx);
if (ix_delaunay+4 >= DELAUNAY_COUNT)
{
ERRORLOG("stack full");
return count;
}
for (cor_id2=0; cor_id2 < 3; cor_id2++)
{
tri_id2 = Triangles[tri_idx].tags[cor_id2];
if (tri_id2 == -1)
continue;
delaunay_add_triangle(tri_id2);
}
}
}
return count;
}
示例13: load_continue_game
short load_continue_game(void)
{
unsigned char buf[14];
unsigned char bonus[20];
char cmpgn_fname[CAMPAIGN_FNAME_LEN];
long lvnum;
long i;
if (!read_continue_game_part(buf,0,14))
{
WARNLOG("Can't read continue game file head");
return false;
}
i = (char *)&game.campaign_fname[0] - (char *)&game;
read_continue_game_part((unsigned char *)cmpgn_fname,i,CAMPAIGN_FNAME_LEN);
cmpgn_fname[CAMPAIGN_FNAME_LEN-1] = '\0';
if (!change_campaign(cmpgn_fname))
{
ERRORLOG("Unable to load campaign");
return false;
}
lvnum = ((struct Game *)buf)->continue_level_number;
if (!is_singleplayer_like_level(lvnum))
{
WARNLOG("Level number in continue file is incorrect");
return false;
}
set_continue_level_number(lvnum);
LbMemorySet(bonus, 0, sizeof(bonus));
i = (char *)&game.intralvl.bonuses_found[0] - (char *)&game;
read_continue_game_part(bonus,i,16);
for (i=0; i < BONUS_LEVEL_STORAGE_COUNT; i++)
game.intralvl.bonuses_found[i] = bonus[i];
LbStringCopy(game.campaign_fname,campaign.fname,sizeof(game.campaign_fname));
update_extra_levels_visibility();
i = (char *)&game.intralvl_transfered_creature - (char *)&game.intralvl.bonuses_found[0];
game.intralvl_transfered_creature.model = bonus[i];
game.intralvl_transfered_creature.explevel = bonus[i+1];
return true;
}
示例14: load_action_point_file
TbBool load_action_point_file(LevelNumber lv_num)
{
struct InitActionPoint iapt;
unsigned long i;
long k;
long total;
unsigned char *buf;
long fsize;
SYNCDBG(5,"Starting");
fsize = 4;
buf = load_single_map_file_to_buffer(lv_num,"apt",&fsize,LMFF_None);
if (buf == NULL)
return false;
i = 0;
total = llong(&buf[i]);
i += 4;
// Validate total amount of action points
if ((total < 0) || (total > (fsize-4)/sizeof(struct InitActionPoint)))
{
total = (fsize-4)/sizeof(struct InitActionPoint);
WARNMSG("Bad amount of action points in APT file; corrected to %ld.",total);
}
if (total > ACTN_POINTS_COUNT-1)
{
WARNMSG("Only %d action points supported, APT file has %ld.",ACTN_POINTS_COUNT-1,total);
total = ACTN_POINTS_COUNT-1;
}
// Create action points
for (k=0; k < total; k++)
{
LbMemoryCopy(&iapt, &buf[i], sizeof(struct InitActionPoint));
if (actnpoint_create_actnpoint(&iapt) == INVALID_ACTION_POINT)
{
ERRORLOG("Cannot allocate action point %d during APT load",k);
}
i += sizeof(struct InitActionPoint);
}
LbMemoryFree(buf);
return true;
}
示例15: lightning_modify_palette
void lightning_modify_palette(struct Thing *thing)
{
struct PlayerInfo *myplyr;
myplyr = get_my_player();
if (thing->health == 0)
{
PaletteSetPlayerPalette(myplyr, engine_palette);
myplyr->field_3 &= ~Pf3F_Unkn08;
return;
}
if (myplyr->acamera == NULL)
{
ERRORLOG("No active camera");
return;
}
if (((thing->health % 8) != 7) && (thing->health != 1) && (ACTION_RANDOM(4) != 0))
{
if ((myplyr->field_3 & Pf3F_Unkn08) != 0)
{
if (get_2d_box_distance(&myplyr->acamera->mappos, &thing->mappos) < 11520)
{
PaletteSetPlayerPalette(myplyr, engine_palette);
myplyr->field_3 &= ~Pf3F_Unkn08;
}
}
return;
}
if ((myplyr->view_mode != PVM_ParchFadeIn) && (myplyr->view_mode != PVM_ParchFadeOut) && (myplyr->view_mode != PVM_ParchmentView))
{
if ((myplyr->field_3 & Pf3F_Unkn08) == 0)
{
if (get_2d_box_distance(&myplyr->acamera->mappos, &thing->mappos) < 11520)
{
PaletteSetPlayerPalette(myplyr, lightning_palette);
myplyr->field_3 |= Pf3F_Unkn08;
}
}
}
}