reduce proc calls

This commit is contained in:
D3athrow
2015-08-22 13:40:22 -05:00
parent b889795a17
commit 6dfe7c3dff
5 changed files with 215 additions and 125 deletions

View File

@@ -6,15 +6,35 @@
/*
* print a warning message to world.log
*/
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr].")
/proc/warning(msg)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/warning() called tick#: [world.time]")
world.log << html_decode("## WARNING: [msg]")
/* see setup.dm
#define WARNING(MSG) world << "##WARNING: [MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr]."
#define warning(msg) world.log << "## WARNING: [msg]"
#define testing(msg) world.log << "## TESTING: [msg]"
#define log_game(text) diary << html_decode("\[[time_stamp()]]GAME: [text]")
//print a testing-mode debug message to world.log
/proc/testing(msg)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/testing() called tick#: [world.time]")
world.log << html_decode("## TESTING: [msg]")
#define log_vote(text) diary << html_decode("\[[time_stamp()]]VOTE: [text]")
#define log_access(text) diary << html_decode("\[[time_stamp()]]ACCESS: [text]")
#define log_say(text) diary << html_decode("\[[time_stamp()]]SAY: [text]")
#define log_ooc(text) diary << html_decode("\[[time_stamp()]]OOC: [text]")
#define log_whisper(text) diary << html_decode("\[[time_stamp()]]WHISPER: [text]")
#define log_cultspeak(text) diary << html_decode("\[[time_stamp()]]CULT: [text]")
#define log_narspeak(text) diary << html_decode("\[[time_stamp()]]NARSIE: [text]")
#define log_emote(text) diary << html_decode("\[[time_stamp()]]EMOTE: [text]")
#define log_attack(text) diaryofmeanpeople << html_decode("\[[time_stamp()]]ATTACK: [text]")
#define log_adminsay(text) diary << html_decode("\[[time_stamp()]]ADMINSAY: [text]")
#define log_adminwarn(text) diary << html_decode("\[[time_stamp()]]ADMINWARN: [text]")
#define log_pda(text) diary << html_decode("\[[time_stamp()]]PDA: [text]")
*/
/proc/log_admin(raw_text)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_admin() called tick#: [world.time]")
@@ -38,63 +58,7 @@
C << "DEBUG: [text]"
/proc/log_game(text)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_game() called tick#: [world.time]")
if (config.log_game)
diary << html_decode("\[[time_stamp()]]GAME: [text]")
/proc/log_vote(text)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_vote() called tick#: [world.time]")
if (config.log_vote)
diary << html_decode("\[[time_stamp()]]VOTE: [text]")
/proc/log_access(text)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_access() called tick#: [world.time]")
if (config.log_access)
diary << html_decode("\[[time_stamp()]]ACCESS: [text]")
/proc/log_say(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_say() called tick#: [world.time]")
if (config.log_say)
diary << html_decode("\[[time_stamp()]]SAY: [text]")
/proc/log_ooc(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_ooc() called tick#: [world.time]")
if (config.log_ooc)
diary << html_decode("\[[time_stamp()]]OOC: [text]")
/proc/log_whisper(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_whisper() called tick#: [world.time]")
if (config.log_whisper)
diary << html_decode("\[[time_stamp()]]WHISPER: [text]")
/proc/log_cultspeak(text)
if (config.log_whisper)
diary << html_decode("\[[time_stamp()]]CULT: [text]")
/proc/log_narspeak(text)
if (config.log_whisper)
diary << html_decode("\[[time_stamp()]]NARSIE: [text]")
/proc/log_emote(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_emote() called tick#: [world.time]")
if (config.log_emote)
diary << html_decode("\[[time_stamp()]]EMOTE: [text]")
/proc/log_attack(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_attack() called tick#: [world.time]")
if (config.log_attack)
diaryofmeanpeople << html_decode("\[[time_stamp()]]ATTACK: [text]")
/proc/log_adminsay(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_adminsay() called tick#: [world.time]")
if (config.log_adminchat)
diary << html_decode("\[[time_stamp()]]ADMINSAY: [text]")
/proc/log_adminwarn(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_adminwarn() called tick#: [world.time]")
if (config.log_adminwarn)
diary << html_decode("\[[time_stamp()]]ADMINWARN: [text]")
/proc/log_adminghost(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_adminghost() called tick#: [world.time]")
@@ -108,10 +72,6 @@
diary << html_decode("\[[time_stamp()]]GHOST: [text]")
message_admins("\[GHOST\] [text]")
/proc/log_pda(text)
// //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/log_pda() called tick#: [world.time]")
if (config.log_pda)
diary << html_decode("\[[time_stamp()]]PDA: [text]")
/**
* Helper proc to log attacks or similar events between two mobs.

View File

@@ -688,9 +688,11 @@
switch(S.initialize())
if(INIT_NO_AREA)
if(S.is_special())
warning("Invalid or missing starting area for [S.name] ([S.type]) [S.linked_area ? "- \"[S.linked_area]\" was given as a starting area." : ""]")
var/msg = S.linked_area ? "- \"[S.linked_area]\" was given as a starting area." : ""
warning("Invalid or missing starting area for [S.name] ([S.type]) [msg]")
else
world.log << "Invalid or missing starting area for [S.name] ([S.type]) [S.linked_area ? "- \"[S.linked_area]\" was given as a starting area." : ""]"
var/msg = S.linked_area ? "- \"[S.linked_area]\" was given as a starting area." : ""
world.log << "Invalid or missing starting area for [S.name] ([S.type]) [msg]"
if(INIT_NO_PORT)
if(S.is_special())
warning("Couldn't find a shuttle docking port for [S.name] ([S.type]).")

View File

@@ -154,22 +154,22 @@ var/global/list/organ_damage_overlays = list(
set invisibility = 0
//set background = 1
#ifdef PROFILE_LIFE
debug_life("Started", "Starting Life() cycle [cycle]")
#endif
if(monkeyizing)
return
if(!loc)
return //Fixing a null error that occurs when the mob isn't found in the world -- TLE
#ifdef PROFILE_LIFE
debug_life("Called Super", "Successfully called parent.")
#endif
if(do_deferred_species_setup)
DeferredSpeciesSetup()
do_deferred_species_setup=0
#ifdef PROFILE_LIFE
debug_life("Species Setup", "Successfully setup species if necessary.")
#endif
//Apparently, the person who wrote this code designed it so that blinded
//get reset each cycle and then get activated later in the code.
//Very ugly. I dont care. Moving this stuff here so its easy to find it.
@@ -181,8 +181,9 @@ var/global/list/organ_damage_overlays = list(
life_tick++
var/datum/gas_mixture/environment = loc.return_air()
#ifdef PROFILE_LIFE
debug_life("Setup Environment", "We have a location and returned air into [environment]")
#endif
in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0 //Nice runtime operator
if(in_stasis)
@@ -192,9 +193,13 @@ var/global/list/organ_damage_overlays = list(
if(stat != DEAD && !in_stasis)
if(air_master.current_cycle % 4 == 2 || failed_last_breath) //First, resolve location and get a breath
#ifdef PROFILE_LIFE
profile_life_start()
#endif
breathe() //Only try to take a breath every 4 ticks, unless suffocating
#ifdef PROFILE_LIFE
profile_life_end("breathe")
#endif
last_processed = "Breathe"
else //Still give containing object the chance to interact
@@ -202,168 +207,255 @@ var/global/list/organ_damage_overlays = list(
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
last_processed = "Interacted with our container"
#ifdef PROFILE_LIFE
debug_life("Handle Breath", "We tried to breathe OR handled an internal object.")
#endif
if(check_mutations)
testing("Updating [src.real_name]'s mutations: "+english_list(mutations))
domutcheck(src,null,MUTCHK_FORCED)
#ifdef PROFILE_LIFE
profile_life_start()
#endif
update_mutations()
#ifdef PROFILE_LIFE
profile_life_end("update_mutations")
#endif
check_mutations = 0
#ifdef PROFILE_LIFE
debug_life("Check Mutations", "Successfully checked mutations.")
#endif
//Updates the number of stored chemicals for powers
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_changeling()
#ifdef PROFILE_LIFE
profile_life_end("handle_changeling")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle Ling", "Successfully handled changeling datum")
#endif
//Mutations and radiation
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_mutations_and_radiation()
#ifdef PROFILE_LIFE
profile_life_end("handle_body_temperature")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle Mut and Rads", "Successfully handled mutations and radiation")
#endif
//Chemicals in the body
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_chemicals_in_body()
#ifdef PROFILE_LIFE
profile_life_end("handle_chemicals_in_body")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle Chems", "Successfully handled internal chemicals")
#endif
//Disabilities
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_disabilities()
#ifdef PROFILE_LIFE
profile_life_end("handle_disabilities")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle disabilities", "Successfully handled disabilities")
#endif
//??? debug_life("Handle organs", "Successfully handled organs")
//Random events (vomiting etc)
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_random_events()
#ifdef PROFILE_LIFE
profile_life_end("handle_random_events")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle random events", "Successfully handled random events")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_virus_updates()
#ifdef PROFILE_LIFE
profile_life_end("handle_virus_updates")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle Virus", "Successfully handled virus updates")
#endif
//Stuff in the stomach
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_stomach()
#ifdef PROFILE_LIFE
profile_life_end("handle_stomach")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle stomach", "Successfully handled stomach")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_shock()
#ifdef PROFILE_LIFE
profile_life_end("handle_shock")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle shock", "Successfully handled shock")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_pain()
#ifdef PROFILE_LIFE
debug_life("Handle pain", "Successfully handled pain")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_medical_side_effects()
#ifdef PROFILE_LIFE
profile_life_end("handle_medical_side_effects")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle side effects", "Successfully handled medical side effects")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_equipment()
#ifdef PROFILE_LIFE
profile_life_end("handle_equipment")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle equip", "Successfully handled equipment")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_stasis_bag()
#ifdef PROFILE_LIFE
profile_life_end("handle_stasis_bag")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle stasis", "Successfully handled stasis")
#endif
if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle
#ifdef PROFILE_LIFE
debug_life("DEAD", "We have been dead for too long, we stop here.")
#endif
cycle = "DEAD"
return //We go ahead and process them 5 times for HUD images and other stuff though.
#ifdef PROFILE_LIFE
//Handle temperature/pressure differences between body and environment
profile_life_start()
#endif
handle_environment(environment)
#ifdef PROFILE_LIFE
profile_life_end("handle_environment")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle enviroment", "Successfully handled enviroment")
#endif
#ifdef PROFILE_LIFE
//Check if we're on fire
profile_life_start()
#endif
handle_fire()
#ifdef PROFILE_LIFE
profile_life_end("handle_fire")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle fire", "Successfully handled fire")
#endif
#ifdef PROFILE_LIFE
//Status updates, death etc.
profile_life_start()
#endif
handle_regular_status_updates() //Optimized a bit
#ifdef PROFILE_LIFE
profile_life_end("handle_regular_status_updates")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle Regular Status Updates", "Successfully handled regular status updates")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
update_canmove()
#ifdef PROFILE_LIFE
profile_life_end("handle_canmove")
#endif
#ifdef PROFILE_LIFE
debug_life("update canmove", "Successfully updated canmove")
#endif
//Update our name based on whether our face is obscured/disfigured
name = get_visible_name()
#ifdef PROFILE_LIFE
debug_life("get visible name", "Successfully got our visible name")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_regular_hud_updates()
#ifdef PROFILE_LIFE
profile_life_end("handle_regular_hud_updates")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle HUD", "Successfully handled hud update")
#endif
#ifdef PROFILE_LIFE
profile_life_start()
#endif
pulse = handle_pulse()
#ifdef PROFILE_LIFE
profile_life_end("handle_pulse")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle pulse", "Successfully handled pulse")
#endif
#ifdef PROFILE_LIFE
//Grabbing
profile_life_start()
#endif
for(var/obj/item/weapon/grab/G in src)
G.process()
#ifdef PROFILE_LIFE
profile_life_end("\[grabs\]")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle grabs", "Successfully handled grabs")
#endif
if(mind && mind.vampire)
#ifdef PROFILE_LIFE
profile_life_start()
#endif
handle_vampire()
#ifdef PROFILE_LIFE
profile_life_end("handle_vampire")
#endif
#ifdef PROFILE_LIFE
debug_life("Handle vampire", "Successfully handled vampire")
#endif
if(update_overlays)
update_overlays = 0
#ifdef PROFILE_LIFE
profile_life_start()
#endif
UpdateDamageIcon()
#ifdef PROFILE_LIFE
profile_life_end("UpdateDamageIcon")
#endif
cycle++
..()

View File

@@ -18,7 +18,8 @@
return
var/turf/T = get_turf(src)
log_say("[key_name(src)] (@[!T ? "Nullspace" : "[T.x],[T.y],[T.z]"]) Damage Control: [message]")
var/msg = !T ? "Nullspace" : "[T.x],[T.y],[T.z]"
log_say("[key_name(src)] (@[msg]) Damage Control: [message]")
var/interior_message = say_quote(message)

View File

@@ -1244,3 +1244,38 @@ var/proccalls = 1
//For mob/proc/show_message (code/modules/mob/mob.dm @ 248)
#define MESSAGE_SEE 1 //Visible message
#define MESSAGE_HEAR 2 //Hearable message
/*
*
*
* Logging define
*
*
*/
#define WARNING(MSG) world << "##WARNING: [MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr]."
#define warning(msg) world.log << "## WARNING: [msg]"
#define testing(msg) world.log << "## TESTING: [msg]"
#define log_game(text) diary << html_decode("\[[time_stamp()]]GAME: [text]")
#define log_vote(text) diary << html_decode("\[[time_stamp()]]VOTE: [text]")
#define log_access(text) diary << html_decode("\[[time_stamp()]]ACCESS: [text]")
#define log_say(text) diary << html_decode("\[[time_stamp()]]SAY: [text]")
#define log_ooc(text) diary << html_decode("\[[time_stamp()]]OOC: [text]")
#define log_whisper(text) diary << html_decode("\[[time_stamp()]]WHISPER: [text]")
#define log_cultspeak(text) diary << html_decode("\[[time_stamp()]]CULT: [text]")
#define log_narspeak(text) diary << html_decode("\[[time_stamp()]]NARSIE: [text]")
#define log_emote(text) diary << html_decode("\[[time_stamp()]]EMOTE: [text]")
#define log_attack(text) diaryofmeanpeople << html_decode("\[[time_stamp()]]ATTACK: [text]")
#define log_adminsay(text) diary << html_decode("\[[time_stamp()]]ADMINSAY: [text]")
#define log_adminwarn(text) diary << html_decode("\[[time_stamp()]]ADMINWARN: [text]")
#define log_pda(text) diary << html_decode("\[[time_stamp()]]PDA: [text]")