本文整理汇总了C++中previous_object函数的典型用法代码示例。如果您正苦于以下问题:C++ previous_object函数的具体用法?C++ previous_object怎么用?C++ previous_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了previous_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gateway
varargs string gateway(mixed args){
string pass_hash, who, password, ip;
string ret = "";
int max_tries = 3;
int no_user = 0;
if(ENABLE_CREWEB){
ip = previous_object()->GetIp();
if(!args || !stringp(args)) args = "123456789101112";
if(sscanf(args,"%s&%s",who, password) != 2){
ret = "<br>";
}
else {
who = lower_case(who);
if(!strsrch(who,"username=")) who = replace_string(who,"username=","",1);
if(!strsrch(password,"password=")) password = replace_string(password,"password=","",1);
if(!ret && !user_exists(who)){
no_user = 1;
}
else {
if(!Tries) Tries = ([]);
if(!Tries[ip]) Tries[ip] = 0;
if(no_user) pass_hash = alpha_crypt(32);
else pass_hash = PLAYERS_D->GetPlayerData(who,"Password");
if(pass_hash != crypt(password, pass_hash)){
Tries[ip]++;
ret = "Fail! Tries left: "+(max_tries - Tries[ip])+"<br>";
if(Tries[ip] >= max_tries){
previous_object()->eventBlockIp();
Tries[ip] = 0;
}
}
else {
string shibboleth = alpha_crypt(32);
string packet=who+"."+shibboleth;
WEB_SESSIONS_D->StartSession(ip,who,shibboleth);
ret = "Login successful<br>";
Tries[ip] = 0;
ret += "<meta http-equiv=\"Set-Cookie\" content=\"creweb="+packet+";path=/\">";
ret += "<META http-equiv=\"refresh\" content=\"1;URL=creweb.html\">";
return ret;
}
}
}
ret += "Log in to CreWeb using your mud username and mud password.<br><br>";
ret += "<FORM ACTION=\"login.html\" METHOD=POST>";
ret += "username: <INPUT TYPE=TEXT NAME=\"username\" MAXLENGTH=32><BR>";
ret += "password: <INPUT TYPE=PASSWORD NAME=\"password\" MAXLENGTH=32>";
ret += "<P><INPUT TYPE=SUBMIT VALUE=\"submit\">";
ret += "</FORM>";
ret += "<br>";
}
else {
示例2: init
void init()
{
::init();
if( !previous_object()
|| !userp(previous_object())
|| wizardp(previous_object()) ) return;
call_out( "death_stage", 3, previous_object(), 0 );
}
示例3: player_died
player_died() {
looser=previous_object()->query_name();
loos=previous_object();
remove_call_out("duel_end");
remove_call_out("duel_end");
remove_call_out("duel_end");
call_out("duel_end",3);
}
示例4: init
void init() {
::init();
if (!interactive(previous_object())) return 0;
if ("/secure/master"->high_programmer(geteuid(previous_object())))
add_action("do_banish", "banish"); /* Site banishing... */
add_action("do_access", "access"); /* Show the current access list. */
add_action("do_suspend", "suspend");
add_action("do_unsuspend", "unsuspend");
} /* init() */
示例5: delete_access
// delete() uses delete_access(entry) rather than set_access(entry,0) because
// that is The Right Thing (tm) to do.
nomask int delete_access(string entry)
{
string eff_user;
eff_user = ( previous_object() ? geteuid( previous_object() ) : geteuid() );
if( eff_user != geteuid() && eff_user != ROOT_UID ) return 0; // Fail.
map_delete( perms, entry );
}
示例6: secure
int secure()
{
if (!previous_object()) return 0;
if (geteuid(previous_object())==ROOTID) return 1;
if (geteuid(previous_object()) != geteuid(this_interactive())) return 0;
if (this_interactive() != this_player()) return 0;
if (!ARCH_SECURITY) return 0;
return 1;
}
示例7: query_temp_ob_data
mapping query_temp_ob_data() {
if(!adminp(geteuid(previous_object())) &&
geteuid(previous_object()) != ROOT_UID) return 0;
#ifdef SECURE
return copy(tmp_ob_data);
#else
return tmp_ob_data;
#endif
}
示例8: shutdown
void shutdown(int code)
{
object me = previous_object(1);
object mob = previous_object(0);
if( wiz_level(me) >= 5
|| strcmp(file_name(mob), "/obj/npc/demogorgon") != -1 )
efun::shutdown(code);
}
示例9: cmd_destold
int cmd_destold(string str) {
object ob, act_ob, *obs;
string msg, opt;
int clean, global, l, s;
act_ob = previous_object();
seteuid(geteuid(act_ob));
notify_fail( SYNTAX );
if (!str || str == "") return 0;
#ifdef GUEST_NO_DEST
if (getuid(previous_object()) == "guest") {
write ("Guest is not permitted to dest objects.\n") ;
return 1 ;
}
#endif
if (str == "all")
return dest_all(act_ob, 0);
if (sscanf(str, "-%s %s", opt, str) == 2) {
if (strsrch(opt, 'a') != -1) clean = 1;
if (strsrch(opt, 'g') != -1) global = 1;
}
if (global) {
if (!adminp(geteuid(act_ob))) {
write("Global Dest: Permission denied.\n");
return 1;
}
str = resolv_path("cwd", str);
l = strlen(str);
obs = objects();
s = sizeof(obs);
write("Global destructing: " + str + "\n");
cnt = 0;
while (s--) {
if (!obs[s]) continue;
if (strncmp(file_name(obs[s]), str, l) == 0) {
if (clean)
dest_all(obs[s], 1);
cnt++;
if (obs[s]) {
catch(obs[s]->remove());
destruct(obs[s]);
}
}
}
write("object(s) destructed: " + cnt + "\n");
} else {
if (!(ob = get_object(str))) {
示例10: teleport_to
int teleport_to(string place) {
object destination =
load_object(resolve_path(previous_object()->query_cwd(), place));
if (!destination) {
return error_out("Could not load object " + place);
}
return teleport(previous_object(), destination);
}
示例11: main
int main(string arg)
{
string name = previous_object()->query_name();
ACCOUNT_D->set_offline(name);
write("Bye.\n");
say((string)previous_object()->query_name()
+ " leaves this reality.\n");
previous_object()->remove();
return 1;
}
示例12: add_point
void add_point( string wizname, int amount, string reason ) {
if( getuid(previous_object()) != "root" ) return;
if( amount > 100 ) raise_error( "/daemon/point: Hard limit, can't add more than 100 points at a time. Sorry." );
wizpoints[wizname] += amount;
if( wizpoints[wizname] > 0 ) {
log_file( "points", as_string(previous_object()) + " added " + amount + " points to " + wizname + ", total " + wizpoints[wizname] + ": " + reason + ".\n" );
if( !weekpoints[wizname] )
weekpoints[wizname] = ({ });
示例13: valid_compile_to_c
/*
* $Locker: $
* $Id: valid_to_c.c,v 1.1 1998/01/06 05:12:03 ceres Exp $
* $Log: valid_to_c.c,v $
* Revision 1.1 1998/01/06 05:12:03 ceres
* Initial revision
*
*/
int valid_compile_to_c() {
if (previous_object() == this_object())
return 1;
if (previous_object() != find_object("/secure/cmds/creator/compile"))
return 0;
if (!interactive(previous_object(1)))
return 0;
if (!this_object()->query_lord(previous_object(-1)))
return 0;
return 1;
} /* valid_compile_to_c() */
示例14: disable_player
nomask void disable_player(string type)
{
if( geteuid(previous_object())!=ROOT_UID
&& previous_object()!=this_object()) return;
set("disable_type", type);
set_temp("disabled", 1);
disable_commands();
enable_commands(); // enable command again so this object would be
// marked living again. block command in alias.c
// instead of here.
}
示例15: zap_shadow
void zap_shadow(object ob) {
/* Just in case there is more than one on us... */
if (interactive(previous_object())) {
destruct(this_object());
return ;
}
if (previous_object() == foll) {
destruct(this_object());
return ;
}
me->zap_shadow();
} /* zap_shadow() */