mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
let the past begone in cvs land. welcome to igit igit!
This commit is contained in:
commit
4e601cf1c7
509 changed files with 77963 additions and 0 deletions
35
world/drivers/ldmud/library/attic.c
Normal file
35
world/drivers/ldmud/library/attic.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
// attic:
|
||||
|
||||
#if 0
|
||||
|
||||
void shout(string s) {
|
||||
filter_array(users(), lambda(({'u}),({#'&&,
|
||||
({#'environment, 'u}),
|
||||
({#'!=, 'u, ({#'this_player})}),
|
||||
({#'tell_object, 'u, to_string(s)})
|
||||
})));
|
||||
}
|
||||
|
||||
/*
|
||||
* Function name: all_environment
|
||||
* Description: Gives an array of all containers which an object is in, i.e.
|
||||
* match in matchbox in bigbox in chest in room, would for the
|
||||
* match give: matchbox, bigbox, chest, room
|
||||
* Arguments: ob: The object
|
||||
* Returns: The array of containers.
|
||||
*/
|
||||
public object *
|
||||
all_environment(object ob)
|
||||
{
|
||||
object *r;
|
||||
|
||||
if (!ob || !environment(ob)) return 0;
|
||||
if (!environment(environment(ob)))
|
||||
return ({ environment(ob) });
|
||||
r = ({ ob = environment(ob) });
|
||||
while (environment(ob))
|
||||
r = r + ({ ob = environment(ob) });
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
93
world/drivers/ldmud/library/classic.i
Normal file
93
world/drivers/ldmud/library/classic.i
Normal file
|
@ -0,0 +1,93 @@
|
|||
// $Id: classic.i,v 1.4 2007/09/05 11:04:25 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
/*
|
||||
* This is a mudlib file. Copy it to /obj/simul_efun.c, or
|
||||
* wherever the get_simul_efun() in master.c says.
|
||||
* The functions defined in this file should only be replacements of efuns
|
||||
* no longer supported. Don't use these functions any longer, use the
|
||||
* replacement instead.
|
||||
*/
|
||||
|
||||
#include DRIVER_PATH "sys/erq.h"
|
||||
|
||||
#pragma strong_types
|
||||
#pragma save_types
|
||||
|
||||
int file_time(string path)
|
||||
{
|
||||
mixed *vec;
|
||||
|
||||
PROTECT("FILE_TIME")
|
||||
|
||||
set_this_object(previous_object());
|
||||
if (sizeof(vec=get_dir(path,4))) return vec[0];
|
||||
}
|
||||
|
||||
#ifdef __EFUN_DEFINED(snoop)__
|
||||
mixed snoop(mixed snoopee) {
|
||||
# if 0
|
||||
int result;
|
||||
|
||||
if (snoopee && query_snoop(snoopee)) {
|
||||
write("Busy.\n");
|
||||
return 0;
|
||||
}
|
||||
result = snoopee ? efun::snoop(this_player(), snoopee)
|
||||
: efun::snoop(this_player());
|
||||
switch (result) {
|
||||
case -1:
|
||||
write("Busy.\n");
|
||||
case 0:
|
||||
write("Failed.\n");
|
||||
case 1:
|
||||
write("Ok.\n");
|
||||
}
|
||||
if (result > 0) return snoopee;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
string query_host_name() { return __HOST_NAME__; }
|
||||
|
||||
#if 0 // ndef NO_MAPPINGS
|
||||
mapping m_delete(mapping m, mixed key) {
|
||||
return efun::m_delete(copy_mapping(m), key);
|
||||
}
|
||||
|
||||
nomask void set_this_player() {}
|
||||
|
||||
void shout(string s) {
|
||||
filter_array(users(), lambda(({'u}),({#'&&,
|
||||
({#'environment, 'u}),
|
||||
({#'!=, 'u, ({#'this_player})}),
|
||||
({#'tell_object, 'u, to_string(s)})
|
||||
})));
|
||||
}
|
||||
|
||||
/*
|
||||
* Function name: all_environment
|
||||
* Description: Gives an array of all containers which an object is in, i.e.
|
||||
* match in matchbox in bigbox in chest in room, would for the
|
||||
* match give: matchbox, bigbox, chest, room
|
||||
* Arguments: ob: The object
|
||||
* Returns: The array of containers.
|
||||
*/
|
||||
public object *
|
||||
all_environment(object ob)
|
||||
{
|
||||
object *r;
|
||||
|
||||
if (!ob || !environment(ob)) return 0;
|
||||
if (!environment(environment(ob)))
|
||||
return ({ environment(ob) });
|
||||
r = ({ ob = environment(ob) });
|
||||
while (environment(ob))
|
||||
r = r + ({ ob = environment(ob) });
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
string version() { return __VERSION__; }
|
||||
|
124
world/drivers/ldmud/library/library.c
Normal file
124
world/drivers/ldmud/library/library.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
// $Id: library.c,v 1.43 2007/10/08 07:27:59 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
#ifndef __PIKE__
|
||||
|
||||
#include "/local/config.h"
|
||||
#include "/local/hosts.h"
|
||||
//#include NET_PATH "include/proto.h"
|
||||
#include NET_PATH "include/net.h"
|
||||
#include DRIVER_PATH "include/driver.h"
|
||||
#include <sandbox.h>
|
||||
|
||||
#include <driver.h>
|
||||
|
||||
#ifdef PRO_PATH
|
||||
inherit PRO_PATH "library2";
|
||||
inherit PRO_PATH "http/library2";
|
||||
#else
|
||||
# ifdef SANDBOX
|
||||
inherit NET_PATH "library/sandbox";
|
||||
# endif
|
||||
inherit NET_PATH "library/base64";
|
||||
inherit NET_PATH "library/dns";
|
||||
inherit NET_PATH "library/htbasics";
|
||||
inherit NET_PATH "library/json";
|
||||
inherit NET_PATH "library/profiles";
|
||||
# ifdef JABBER_PATH // supposed to change
|
||||
inherit NET_PATH "library/sasl";
|
||||
# endif
|
||||
inherit NET_PATH "library/share";
|
||||
inherit NET_PATH "library/signature";
|
||||
# ifdef __TLS__
|
||||
inherit NET_PATH "library/tls";
|
||||
# endif
|
||||
inherit NET_PATH "library/text";
|
||||
inherit NET_PATH "library/time";
|
||||
inherit NET_PATH "library/url";
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
||||
|
||||
// the system master object
|
||||
volatile object master;
|
||||
|
||||
volatile int shutdown_in_progress = 0;
|
||||
|
||||
volatile string logpath;
|
||||
|
||||
#ifndef __PIKE__
|
||||
|
||||
#ifdef MUD
|
||||
# include "/include/auto.h"
|
||||
# include "/sys/library.c"
|
||||
#endif
|
||||
|
||||
#include NET_PATH "library/admin.c"
|
||||
#ifndef PRO_PATH
|
||||
# include NET_PATH "library/legal.c"
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
||||
|
||||
// added sprintf-support -lynx
|
||||
//
|
||||
// if the driver has no varargs support,
|
||||
// "varargs" should be defined as empty string (see interface.h)
|
||||
//
|
||||
#ifdef varargs
|
||||
void log_file(string file,string str,
|
||||
vamixed a,vamixed b,vamixed c,vamixed d,
|
||||
vamixed e,vamixed f,vamixed g,vamixed h)
|
||||
#else
|
||||
void log_file(string file, string str, varargs mixed* args) // proto.h!
|
||||
#endif
|
||||
{
|
||||
#if 0 //def COMPAT_FLAG
|
||||
// if (sizeof(regexp(({file}), "/")) || file[0] == '.' || strlen(file) > 30 )
|
||||
if (file[0] == '/' || strstr(file, "..") >= 0) {
|
||||
write("Illegal file name to log_file("+file+")\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
PROTECT("LOG_FILE")
|
||||
#ifdef varargs
|
||||
if (a) str = sprintf(str, a,b,c,d,e,f,g,h);
|
||||
#else
|
||||
if (args && sizeof(args)) str = apply(#'sprintf, str, args);
|
||||
#endif
|
||||
#if defined(MUD) && __EFUN_DEFINED__(set_this_object)
|
||||
// we don't need this type of security in a regular psyced
|
||||
if (previous_object()) set_this_object(previous_object());
|
||||
#endif
|
||||
#ifdef SLAVE
|
||||
unless (logpath) {
|
||||
logpath = "/log/"+ __HOST_IP_NUMBER__ +"-"+ query_udp_port() +"/";
|
||||
mkdir(logpath);
|
||||
mkdir(logpath + "place");
|
||||
}
|
||||
write_file(logpath + file +".log", str);
|
||||
#else
|
||||
write_file("/log/"+ file +".log", str);
|
||||
#endif
|
||||
D3( debug_message(file +"## "+ str) );
|
||||
//#ifdef PSYC_SYNCHRONIZE
|
||||
// synchro_report("_notice_system_psyced", str,
|
||||
// ([ "_file": file ]) );
|
||||
//#endif
|
||||
}
|
||||
|
||||
#ifndef __PIKE__
|
||||
|
||||
#include "classic.i"
|
||||
#ifdef USE_LIVING
|
||||
# include "living.i"
|
||||
#endif
|
||||
|
||||
#include NET_PATH "library.i"
|
||||
|
||||
#ifdef PRO_PATH
|
||||
# include PRO_PATH "library.i"
|
||||
#else
|
||||
# include NET_PATH "library/library2.i"
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
152
world/drivers/ldmud/library/living.i
Normal file
152
world/drivers/ldmud/library/living.i
Normal file
|
@ -0,0 +1,152 @@
|
|||
// $Id: living.i,v 1.16 2007/09/18 09:49:17 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// i shouldnt be using this old code for finding people..
|
||||
// then again does it really harm?
|
||||
// at least we throw out the living() lpmud things..
|
||||
// why does it do the recursive call_out? just because of eval_cost?
|
||||
// then we dont need that either..
|
||||
//
|
||||
// no, we don't need the whole cleaning thing, and we don't need
|
||||
// the ability to handle several objects by the same living_name
|
||||
// either. time to get rid of living.i for psyced. -lynX 2005
|
||||
//
|
||||
// instead, we could use availability here.
|
||||
|
||||
#define living(O) objectp(O)
|
||||
|
||||
#ifdef USE_LIVING
|
||||
#define TIME_CLEAN_LIVING 60 * 60 * 4
|
||||
volatile mapping living_name_m;
|
||||
#endif
|
||||
volatile mapping name_living_m;
|
||||
|
||||
void start_simul_efun() {
|
||||
PROTECT("START_SIMUL_EFUN")
|
||||
|
||||
name_living_m = ([]);
|
||||
#ifdef USE_LIVING
|
||||
living_name_m = ([]);
|
||||
if (find_call_out("clean_simul_efun") < 0)
|
||||
call_out("clean_simul_efun", TIME_CLEAN_LIVING / 2);
|
||||
this_object()->start_simul_efun_dr();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_LIVING
|
||||
static void clean_name_living_m(string *keys, int left) {
|
||||
int i, j;
|
||||
mixed a;
|
||||
|
||||
PROTECT("CLEAN_NAME_LIVING")
|
||||
if (left) {
|
||||
if (pointerp(a = name_living_m[keys[--left]]) && member(a, 0)>= 0) {
|
||||
i = sizeof(a);
|
||||
do {
|
||||
if (a[--i])
|
||||
a[<++j] = a[i];
|
||||
} while (i);
|
||||
name_living_m[keys[left]] = a = j > 1 ? a[<j..] : a[<1];
|
||||
}
|
||||
if (!a)
|
||||
efun::m_delete(name_living_m, keys[left]);
|
||||
call_out("clean_name_living_m", 1, keys, left);
|
||||
} else {
|
||||
// apparently no problem.. this stuff seems to be working
|
||||
P2(("clean_name_living_m ended with %O people\n",
|
||||
sizeof(name_living_m)))
|
||||
}
|
||||
}
|
||||
|
||||
static void clean_simul_efun() {
|
||||
PROTECT("CLEAN_SIMUL_EFUN")
|
||||
/* There might be destructed objects as keys. */
|
||||
//
|
||||
// actually there never should.. so it should be okay to turn off
|
||||
// the whole clean_simul_efun() thing -lynX 2005
|
||||
|
||||
m_indices(living_name_m);
|
||||
remove_call_out("clean_simul_efun");
|
||||
PT(("clean_name_living_m started for %O people\n", sizeof(name_living_m)))
|
||||
if (find_call_out("clean_name_living_m") < 0) {
|
||||
call_out(
|
||||
"clean_name_living_m",
|
||||
1,
|
||||
m_indices(name_living_m),
|
||||
sizeof(name_living_m)
|
||||
);
|
||||
}
|
||||
call_out("clean_simul_efun", TIME_CLEAN_LIVING);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* disable symbol_function('set_living_name, SIMUL_EFUN_OBJECT) */
|
||||
void register_person(string name, object o) {
|
||||
string old;
|
||||
mixed a;
|
||||
int i;
|
||||
|
||||
PROTECT("SET_LIVING_NAME") // do we need that for protected sefuns?
|
||||
#ifdef USE_LIVING
|
||||
if (old = living_name_m[o]) {
|
||||
if (pointerp(a = name_living_m[old])) {
|
||||
a[member(a, o)] = 0;
|
||||
} else {
|
||||
efun::m_delete(name_living_m, old);
|
||||
}
|
||||
}
|
||||
living_name_m[o] = name;
|
||||
if (a = name_living_m[name]) {
|
||||
if (!pointerp(a)) {
|
||||
name_living_m[name] = ({a, o});
|
||||
return;
|
||||
}
|
||||
/* Try to reallocate entry from destructed object */
|
||||
if ((i = member(a, 0)) >= 0) {
|
||||
a[i] = o;
|
||||
return;
|
||||
}
|
||||
name_living_m[name] = a + ({o});
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
name_living_m[name] = o;
|
||||
}
|
||||
|
||||
// was: find_living()
|
||||
// .... the lowercazed optimization actually doesn't
|
||||
// help, there is hardly a use for it.. so it may disappear again.
|
||||
varargs object find_person(string name, int lowercazed) {
|
||||
mixed *a, r;
|
||||
int i;
|
||||
|
||||
if (!lowercazed) name = lower_case(name);
|
||||
r = name_living_m[name];
|
||||
#ifdef USE_LIVING
|
||||
if (pointerp(r)) {
|
||||
if ( !living(r = (a = r)[0])) {
|
||||
for (i = sizeof(a); --i;) {
|
||||
if (living(a[<i])) {
|
||||
r = a[<i];
|
||||
a[<i] = a[0];
|
||||
return a[0] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
return living(r) && r;
|
||||
#else
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
int amount_people() { return sizeof(name_living_m); }
|
||||
object* objects_people() {
|
||||
PROTECT("OBJECTS_PEOPLE")
|
||||
#ifdef USE_LIVING
|
||||
return m_indices(living_name_m);
|
||||
#else
|
||||
return m_values(name_living_m);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue