ante-cvs Mailing List for ANT-Engine
Brought to you by:
roguestar191
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(74) |
Dec
(38) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(20) |
Feb
(80) |
Mar
(140) |
Apr
(32) |
May
(10) |
Jun
(3) |
Jul
(2) |
Aug
(1) |
Sep
(3) |
Oct
(5) |
Nov
|
Dec
(12) |
| 2007 |
Jan
(47) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rog...@us...> - 2009-04-01 09:10:33
|
Revision: 499
http://ante.svn.sourceforge.net/ante/?rev=499&view=rev
Author: roguestar191
Date: 2009-04-01 09:10:27 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
make scripts compile with 4.3.2
Modified Paths:
--------------
trunk/ant/skills/fcgi/fsocket.cpp
trunk/ant/skills/fcgi/fsocket.h
trunk/ant/skills/include/strhelp.h
trunk/ant/skills/include/strhelp.hpp
Modified: trunk/ant/skills/fcgi/fsocket.cpp
===================================================================
--- trunk/ant/skills/fcgi/fsocket.cpp 2009-04-01 02:37:58 UTC (rev 498)
+++ trunk/ant/skills/fcgi/fsocket.cpp 2009-04-01 09:10:27 UTC (rev 499)
@@ -1,4 +1,11 @@
#include "fsocket.h"
+#include <memory.h>
+#include <stdio.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <cstdlib>
+#include <cstring>
+#include <algorithm>
//Sockets need to idle out after just a few seconds of no input..
Sockets::Sockets(const char *port, TimerControl*tin) {
timer = tin;
Modified: trunk/ant/skills/fcgi/fsocket.h
===================================================================
--- trunk/ant/skills/fcgi/fsocket.h 2009-04-01 02:37:58 UTC (rev 498)
+++ trunk/ant/skills/fcgi/fsocket.h 2009-04-01 09:10:27 UTC (rev 499)
@@ -16,6 +16,7 @@
#include <exception> //exceptions
#include <memory> //memory stuff (NEW / DELETE / uhh
#include "socketimer.h"
+
class asock {
public:
asock() { sock = 0; ptr = NULL; }
Modified: trunk/ant/skills/include/strhelp.h
===================================================================
--- trunk/ant/skills/include/strhelp.h 2009-04-01 02:37:58 UTC (rev 498)
+++ trunk/ant/skills/include/strhelp.h 2009-04-01 09:10:27 UTC (rev 499)
@@ -4,6 +4,7 @@
#include <iostream>
#include <string>
#include <vector>
+#include <algorithm>
inline void replaceAll(std::string&in,std::string from, std::string to) {
size_t find = in.find(from);
while(find != std::string::npos) {
Modified: trunk/ant/skills/include/strhelp.hpp
===================================================================
--- trunk/ant/skills/include/strhelp.hpp 2009-04-01 02:37:58 UTC (rev 498)
+++ trunk/ant/skills/include/strhelp.hpp 2009-04-01 09:10:27 UTC (rev 499)
@@ -4,6 +4,7 @@
#include <iostream>
#include <string>
#include <vector>
+#include <algorithm>
inline void replaceAll(std::string&in,std::string from, std::string to) {
size_t find = in.find(from);
while(find != std::string::npos) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2009-04-01 02:38:07
|
Revision: 498
http://ante.svn.sourceforge.net/ante/?rev=498&view=rev
Author: roguestar191
Date: 2009-04-01 02:37:58 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
Make compile with gcc 4.3.2
Modified Paths:
--------------
trunk/ant/ConfigFileParser.cpp
trunk/ant/cache.cpp
trunk/ant/cgiscript.cpp
trunk/ant/command.cpp
trunk/ant/command.h
trunk/ant/forum.cpp
trunk/ant/functors.h
trunk/ant/help.cpp
trunk/ant/httpd.cpp
trunk/ant/mud.h
trunk/ant/script.h
trunk/ant/socket.cpp
trunk/ant/socket.h
trunk/ant/tools.h
Modified: trunk/ant/ConfigFileParser.cpp
===================================================================
--- trunk/ant/ConfigFileParser.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/ConfigFileParser.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -22,6 +22,8 @@
#include "ConfigFileParser.h"
#include "tools.h"
#include "Logger.h"
+#include <stdio.h>
+#include <stdlib.h>
/*
* A static instance for this component.
Modified: trunk/ant/cache.cpp
===================================================================
--- trunk/ant/cache.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/cache.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -10,6 +10,7 @@
#include <iostream>
#include "Logger.h"
#include "ConfigFileParser.h"
+#include <langinfo.h>
inline void sreplace(std::string &in) {
size_t x = 0;
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/cgiscript.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -587,7 +587,7 @@
if(target.compare("this") != 0 && d.size() < 5) {
return "Target != this and no skill knowledge amount given";
}
- if(d.size() >=4)
+if(d.size() >=4) {
if(target.compare("this") == 0) { // {{{
std::string& amount = d[4];
std::string acmd;
@@ -617,6 +617,7 @@
return x->skills.setSkill(acmd);
} // }}}
} //}}}
+}
object&obj = *static_cast<object*>(callera);
std::string mytype = obj.myTypes();
if(d.size() >=4) {
Modified: trunk/ant/command.cpp
===================================================================
--- trunk/ant/command.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/command.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -21,6 +21,12 @@
#include "help.h" // helpsystem
Help Helper;
bool isWebbInput = false;
+// Add command overload for std::String {{{
+void commandI::addCommand(TFunctor *f, std::string *str) {
+ this->addCommand(f, const_cast<char *>(str->c_str()));
+}
+// }}}
+
// {{{ command interpretor constructor
commandI::commandI(mud *world_in) : object() {
//ALL commands must be first defined as a VIRTUAL function in object.h
@@ -290,7 +296,7 @@
}
// }}}
// {{{ addCommand - Add a command to the interpreter
-void commandI::addCommand(TFunctor *com, char *name){
+void commandI::addCommand(TFunctor *com, const char *name){
coms *newOne = new coms(com);
//use new() to make sure it doesn't get deleted when addCommad
//returns.
@@ -1388,7 +1394,7 @@
};
// }}}
// set a menu {{{
-std::string commandI::setMenu(char *name_in) {
+std::string commandI::setMenu(const char *name_in) {
std::string name;
name.append(name_in);
if(name[0] == 32) name.replace(0, 1, "");
Modified: trunk/ant/command.h
===================================================================
--- trunk/ant/command.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/command.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -76,7 +76,7 @@
class menu {
public:
menu() { selected = false; noescape = false; autoselect = false; defaultInput = false;};
- menu(char *n_in, char *d_in, char *e_in) {
+ menu(const char *n_in, const char *d_in, const char *e_in) {
selected = false;
noescape = false;
autoselect = false;
@@ -139,8 +139,8 @@
//if args is not supplied it assumes your function
//has no arguements (not even a void)
void help(std::vector<std::string *>*d); //help command, should read a help file
- void addCommand(TFunctor *com, char *name); //add a downcasted Functor, with an ACCESS NAMC and an enumerated ARGS type (see tools.h)
-
+ void addCommand(TFunctor *com, const char *name); //add a downcasted Functor, with an ACCESS NAMC and an enumerated ARGS type (see tools.h)
+ void addCommand(TFunctor *com, std::string *name);
void dummy(std::vector<std::string *> *d, int &sock_in);// {return;}; //first thing to be added to the vecto
void prompt();
void pcommands();//lists all the commands to the socket
@@ -162,7 +162,7 @@
//the args added at addMenu are appended when the
//menuitem is called
bool callMenu(std::string &name, std::string &args, std::string &s2manip);
- std::string setMenu(char *name); //force a menu set.
+ std::string setMenu(const char *name); //force a menu set.
std::string displaymenu(); //utility to display the current menu
void breakmenu(); //utility to force a break from all menus
virtual std::string display(std::string &s); //display info, defined in mob.cpp
Modified: trunk/ant/forum.cpp
===================================================================
--- trunk/ant/forum.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/forum.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -2,6 +2,7 @@
#include "tools.h"
#include <vector>
#include "mob.h"
+#include <algorithm>
extern ssize_t msend(int &socket, const char *buf, size_t size, int opts);
bool forum::forum::UserStack::find(std::string &cookie) {
for(std::vector<forum::forum::UserStack::User>::iterator iter =
Modified: trunk/ant/functors.h
===================================================================
--- trunk/ant/functors.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/functors.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -20,6 +20,9 @@
#ifdef FUNCTORS_INC
#else
#define FUNCTORS_INC 1
+#include <stdio.h>
+#include <stdlib.h>
+
class TFunctor {
public:
Attributes attribs;
Modified: trunk/ant/help.cpp
===================================================================
--- trunk/ant/help.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/help.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -1,6 +1,10 @@
#include "help.h"
#include "tools.h"
#include <iomanip>
+#include <algorithm>
+#include <stdio.h>
+#include <stdlib.h>
+
class Helper {
friend class Help;
public:
Modified: trunk/ant/httpd.cpp
===================================================================
--- trunk/ant/httpd.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/httpd.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -1122,7 +1122,7 @@
} catch (const char *msg) {
std::string error; error.append( msg );
error.append("<BR>");
- char *bmp = "BADPASS";
+ const char *bmp = "BADPASS";
if(memcmp(bmp, msg, 7) == 0) {
std::string code;
std::string content_type;
Modified: trunk/ant/mud.h
===================================================================
--- trunk/ant/mud.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/mud.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -29,6 +29,12 @@
#include "objects.h" //objects.h doesn't have to include anything.
//but everything must include mud.h because
#include "forum.h" //of that
+#include <stdio.h>
+#include <stdlib.h>
+#include <cstdlib>
+#include <cstring>
+#include <algorithm>
+
//#include "phpscript.h"
//class phpCom;
class login {
Modified: trunk/ant/script.h
===================================================================
--- trunk/ant/script.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/script.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -8,6 +8,8 @@
#include <cstdlib>
#include <stdio.h>
#include <assert.h>
+#include <memory.h>
+#include <algorithm>
extern char* itoa( int value, char* result, int base=10);
extern char* ltoa( long long int value, char* result, int base=10);
// Large introduction comments {{{
Modified: trunk/ant/socket.cpp
===================================================================
--- trunk/ant/socket.cpp 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/socket.cpp 2009-04-01 02:37:58 UTC (rev 498)
@@ -159,8 +159,8 @@
#define ERROR(s) {printf("%d-",errno); perror(s); return false;}
#define ERROR2(s) {printf("%d-",errno); perror(s); return;}
//create the socket handeler.. do nothing else {{{
-playersocket::playersocket(char *port) {
- DEFAULT_SERVER_PORT = port;
+playersocket::playersocket(const char *port) {
+ DEFAULT_SERVER_PORT = const_cast<char *>(port);
maxfd = 10000; // about 9000 max connections?
// serverorclient = true;
sockVec = new std::vector<playersocket::sockholder>();
Modified: trunk/ant/socket.h
===================================================================
--- trunk/ant/socket.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/socket.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -105,7 +105,7 @@
std::vector<playersocket::sockholder> *sockVec;
public: //create the server object
size_t getSize() { return sockVec->size(); };
- playersocket(char *port);
+ playersocket(const char *port);
playersocket(bool clientmode);
~playersocket();
std::string getSockAddr(int socket);
Modified: trunk/ant/tools.h
===================================================================
--- trunk/ant/tools.h 2008-05-03 19:27:27 UTC (rev 497)
+++ trunk/ant/tools.h 2009-04-01 02:37:58 UTC (rev 498)
@@ -123,7 +123,7 @@
bool writeFile(std::string filename, std::string &buf, bool data=true);
bool fileExists(std::string filename, bool data=true);
std::string readFile(std::string filename, bool data=true, void *httpdobj = NULL);
- void rawWrite(std::string fname, char *data, bool data=true); // don't use
+ void rawWrite(std::string fname, char *data, bool datab=true); // don't use
std::vector<char> rawread(std::string fname, bool data=true);
};
extern gtools Utils; //a global object based on that class
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-05-03 19:27:27
|
Revision: 497
http://ante.svn.sourceforge.net/ante/?rev=497&view=rev
Author: roguestar191
Date: 2008-05-03 12:27:27 -0700 (Sat, 03 May 2008)
Log Message:
-----------
Updated Todo, added timeout to select in fcgi modules to use way less cpu while both inactive and active, still needs more
Modified Paths:
--------------
trunk/ant/skills/fcgi/fsocket.cpp
trunk/ant/todo
Modified: trunk/ant/skills/fcgi/fsocket.cpp
===================================================================
--- trunk/ant/skills/fcgi/fsocket.cpp 2008-05-03 19:20:34 UTC (rev 496)
+++ trunk/ant/skills/fcgi/fsocket.cpp 2008-05-03 19:27:27 UTC (rev 497)
@@ -69,7 +69,7 @@
}
struct timeval timeout;
timeout.tv_sec = 0;
- timeout.tv_usec = 0;
+ timeout.tv_usec = 100;
fd_set rmask;
FD_ZERO(&rmask);
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2008-05-03 19:20:34 UTC (rev 496)
+++ trunk/ant/todo 2008-05-03 19:27:27 UTC (rev 497)
@@ -1,3 +1,16 @@
+
+Fix up fcgi modules remove sleeps/nanosleeps make select() timeout for 100ms,
+
+Make fcgi modules use 0.0% cpu while sleeping
+
+Move httpd core to fcgi module - remove from ant core. (Easier additions, fix's, and removal if people don't want it)
+
+Move login menu-system and user system to fcgi scripts (Including rooms, races, classes, levels, charactor data in general)
+
+test, test, test, add more features, cool features!
+
+
+
NEEDS FINISHED FIRST
Step 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-05-03 19:20:41
|
Revision: 496
http://ante.svn.sourceforge.net/ante/?rev=496&view=rev
Author: roguestar191
Date: 2008-05-03 12:20:34 -0700 (Sat, 03 May 2008)
Log Message:
-----------
Removed antweb branch
Removed Paths:
-------------
branches/initial/
tags/import/
trunk/antweb/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-04-01 00:13:29
|
Revision: 495
http://ante.svn.sourceforge.net/ante/?rev=495&view=rev
Author: roguestar191
Date: 2008-03-31 17:13:32 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
changed nread to ssize_t and removed nread = -1
Modified Paths:
--------------
trunk/ant/socket.cpp
trunk/ant/socket.h
Modified: trunk/ant/socket.cpp
===================================================================
--- trunk/ant/socket.cpp 2008-04-01 00:04:49 UTC (rev 494)
+++ trunk/ant/socket.cpp 2008-04-01 00:13:32 UTC (rev 495)
@@ -584,6 +584,7 @@
//set up our packet to return:
pls *Packet = new pls();
+ ssize_t nread = 0;
timeout.tv_sec = 0;
timeout.tv_usec = 250000;
//2 second timeout before sending the telnet welcome message
@@ -743,10 +744,11 @@
try {
nread = read(fd, buf, bufs-1);
} catch(std::string in) {
- nread = -1;
+// nread = -1;
+ goto endread;
}
if(nread == 0) { // {{{
- char *buf2 = new char[2];// = (char *)malloc(bufs);
+ char *buf2 = new char[2];// = (char *)malloc(bufs);
memset(buf, 0, bufs);
memset(buf2, 0, 2);
// {{{ if someone disconnects
@@ -887,6 +889,7 @@
Packet->packets.push_back(foundsome);// }}}
if((*(iter)).idletime!=0)(*(iter)).idletime=0;
}
+ endread:
memset(buf, 0, bufs);
delete[] buf;
if(!justSet){
Modified: trunk/ant/socket.h
===================================================================
--- trunk/ant/socket.h 2008-04-01 00:04:49 UTC (rev 494)
+++ trunk/ant/socket.h 2008-04-01 00:13:32 UTC (rev 495)
@@ -78,7 +78,6 @@
fd_set tempset;
struct timeval timeout2;
int length;
- int nread;
int fd;
int maxfd;
int nfound;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-04-01 00:04:55
|
Revision: 494
http://ante.svn.sourceforge.net/ante/?rev=494&view=rev
Author: roguestar191
Date: 2008-03-31 17:04:49 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
if nread > 0 to avoid std::string::append(buf, -nread);
Modified Paths:
--------------
trunk/ant/socket.cpp
Modified: trunk/ant/socket.cpp
===================================================================
--- trunk/ant/socket.cpp 2008-03-09 03:57:44 UTC (rev 493)
+++ trunk/ant/socket.cpp 2008-04-01 00:04:49 UTC (rev 494)
@@ -873,7 +873,7 @@
}
delete[] buf2;
} // }}}
- } else {
+ } else if(nread > 0){
pls::APacket foundsome; // {{{
foundsome.buf.clear(); //make sure it's clean
int x = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-03-09 03:57:59
|
Revision: 493
http://ante.svn.sourceforge.net/ante/?rev=493&view=rev
Author: roguestar191
Date: 2008-03-08 19:57:44 -0800 (Sat, 08 Mar 2008)
Log Message:
-----------
Allow multi-word usernames and channel names
Modified Paths:
--------------
trunk/ant/skills/comms/roomtalk.cpp
trunk/ant/skills/comms/roomtalkf.cpp
Modified: trunk/ant/skills/comms/roomtalk.cpp
===================================================================
--- trunk/ant/skills/comms/roomtalk.cpp 2008-03-07 23:25:56 UTC (rev 492)
+++ trunk/ant/skills/comms/roomtalk.cpp 2008-03-09 03:57:44 UTC (rev 493)
@@ -75,7 +75,7 @@
std::string username = readStdin(g_fs, currequest, true);
trim(username);
std::ostringstream nout;
- nout << "%printroom " << username << " " << accessword << " <BR>" << arguments << " <BR>"<< std::endl;
+ nout << "%printroom \"" << username << "\" \"" << accessword << "\" <BR>" << arguments << " <BR>"<< std::endl;
std::cerr << "Nout: " << nout.str();
// Print out the printroom callback formatted properly, to print to the room that username is standing in.
g_fs->Stdout2(nout.str(), currequest);
Modified: trunk/ant/skills/comms/roomtalkf.cpp
===================================================================
--- trunk/ant/skills/comms/roomtalkf.cpp 2008-03-07 23:25:56 UTC (rev 492)
+++ trunk/ant/skills/comms/roomtalkf.cpp 2008-03-09 03:57:44 UTC (rev 493)
@@ -18,6 +18,6 @@
out.close();
arguments += argc;
std::string username = readResponse();
- std::cout << "%printroom " << username << " " << accessword << " <BR>" << arguments << "<BR>"<< std::endl;
+ std::cout << "%printroom \"" << username << "\" \"" << accessword << "\" <BR>" << arguments << "<BR>"<< std::endl;
return 0;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2008-03-07 23:25:52
|
Revision: 492
http://ante.svn.sourceforge.net/ante/?rev=492&view=rev
Author: roguestar191
Date: 2008-03-07 15:25:56 -0800 (Fri, 07 Mar 2008)
Log Message:
-----------
commented 2 lines in httpd.cpp to get shtick working again
Modified Paths:
--------------
trunk/ant/httpd.cpp
trunk/ant/mud.cpp
trunk/ant/socket.cpp
trunk/ant/socket.h
Modified: trunk/ant/httpd.cpp
===================================================================
--- trunk/ant/httpd.cpp 2007-08-15 06:29:58 UTC (rev 491)
+++ trunk/ant/httpd.cpp 2008-03-07 23:25:56 UTC (rev 492)
@@ -823,9 +823,10 @@
closeit = false;
getHeader.append(httpHeader(code_out, 0, true, contentheader,&cacheout, &cookiecontent));
socket = sock_in; //change the socket so all
- std::vector<int>::iterator iter = msocket.begin();
- msocket.push_back((*(iter)));
- (*(iter)) = sock_in;
+ // if(msocket.size() == 0) msocket.push_back(sock_in);
+ //std::vector<int>::iterator iter = msocket.begin();
+ // msocket.push_back((*(iter)));
+ // (*(iter)) = sock_in;
//new prints go to this one by default unless
//the request comes from another port
} //all print requests without a socket
Modified: trunk/ant/mud.cpp
===================================================================
--- trunk/ant/mud.cpp 2007-08-15 06:29:58 UTC (rev 491)
+++ trunk/ant/mud.cpp 2008-03-07 23:25:56 UTC (rev 492)
@@ -946,6 +946,7 @@
remplayer.buf = "fcgi request destruction";
//if(remplayer.rem)
datafromall->packets.push_back(remplayer); //else dend--;
+ //continue; // ?
}
}
@@ -1636,13 +1637,17 @@
}
std::vector<object *>::iterator iter;
std::string buf2;
+ buf2.reserve(buf->size());
+ for(size_t c = 0, e = buf->size(); c != e; c++) buf2 += (*buf)[c];
+//std::copy(buf->begin(), buf->end(), buf2.begin());
+// buf2.append( *buf);
if(p_in->myType != TYPE_PLAYER) return;
// int sock = p_in->msocket;
- for(iter = Players.begin(); iter < Players.end(); iter++) {
+ for(iter = Players.begin(); iter != Players.end(); iter++) {
if((*(iter)) == p_in) {
mob *p = static_cast<mob *>(*(iter));
- buf2.clear();
- buf2.append((*(buf)));
+ // buf2.clear();
+ // buf2.append((*(buf)));
// try sending to web clients{{{
if(p->webb) {
if(sock_in != 0) {
@@ -1666,11 +1671,11 @@
} else if(p->canSend(p->socket)) {
try {
std::string buf3;
- if(p->headersent(p->socket)) {
- buf3.append(colorBuf(&buf2, p));
- } else {
- buf3.append(buf2);
- }
+ if(p->headersent(p->socket)) {
+ buf3.append(colorBuf(&buf2, p));
+ } else {
+ buf3.append(buf2);
+ }
Logger::log1 << "Printed: " << sock_in << " " << buf3;
msend(p->socket, buf3.c_str(), buf3.size(), 0);
return;
@@ -1690,6 +1695,7 @@
return;
} catch(...) {
Logger::log1 << "Trying to recover from a sigpipe most likely!!\n\r";
+ return;
}
}
// }}}
Modified: trunk/ant/socket.cpp
===================================================================
--- trunk/ant/socket.cpp 2007-08-15 06:29:58 UTC (rev 491)
+++ trunk/ant/socket.cpp 2008-03-07 23:25:56 UTC (rev 492)
@@ -877,7 +877,8 @@
pls::APacket foundsome; // {{{
foundsome.buf.clear(); //make sure it's clean
int x = 0;
- for(;x < nread; x++) foundsome.buf += buf[x];
+ //for(;x < nread; x++) foundsome.buf += buf[x];
+ foundsome.buf.append(buf, nread);
foundsome.socket = fd;
foundsome.deleter = false;
foundsome.pl = (*(iter)).player;
Modified: trunk/ant/socket.h
===================================================================
--- trunk/ant/socket.h 2007-08-15 06:29:58 UTC (rev 491)
+++ trunk/ant/socket.h 2008-03-07 23:25:56 UTC (rev 492)
@@ -25,40 +25,40 @@
class mob;
class FastCGIPacket;
class pls {
- public:
- class APacket {
- public:
- APacket(){socket = 0; deleter = false; buf.erase(); pl = NULL;fpack = NULL;rem=false;rmplayer = NULL;};
- ~APacket(){};
- APacket(const APacket &in) {
- socket = in.socket;
- deleter = in.deleter;
- if(in.buf.size() > 0)
- buf = in.buf;
- pl = in.pl;
- fpack = in.fpack;
- rem = in.rem;
- rmplayer = in.rmplayer;
- }
- std::string buf;
- int socket;
- bool deleter;
- mob *pl;
- mob *rmplayer;
- FastCGIPacket *fpack;
- bool rem;
- };
- std::vector<APacket> packets;
- pls() {};
- ~pls() {for(std::vector<APacket>::iterator iter = packets.begin();
- iter < packets.end(); iter = packets.begin()) {
- packets.erase(iter);
- }};
- pls(const pls &in) {
- for(std::vector<APacket>::const_iterator iter = in.packets.begin(); iter < in.packets.end(); iter++) {
- packets.push_back((*(iter)));
- }
- };
+public:
+ class APacket {
+ public:
+ APacket(){socket = 0; deleter = false; buf.erase(); pl = NULL;fpack = NULL;rem=false;rmplayer = NULL;};
+ ~APacket(){};
+ APacket(const APacket &in) {
+ socket = in.socket;
+ deleter = in.deleter;
+ if(in.buf.size() > 0)
+ buf = in.buf;
+ pl = in.pl;
+ fpack = in.fpack;
+ rem = in.rem;
+ rmplayer = in.rmplayer;
+ }
+ std::string buf;
+ int socket;
+ bool deleter;
+ mob *pl;
+ mob *rmplayer;
+ FastCGIPacket *fpack;
+ bool rem;
+ };
+ std::vector<APacket> packets;
+ pls() {};
+ ~pls() {for(std::vector<APacket>::iterator iter = packets.begin();
+ iter < packets.end(); iter = packets.begin()) {
+ packets.erase(iter);
+ }};
+ pls(const pls &in) {
+ for(std::vector<APacket>::const_iterator iter = in.packets.begin(); iter < in.packets.end(); iter++) {
+ packets.push_back((*(iter)));
+ }
+ };
};
extern int defaultBufSiz;
struct isSOpen {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-08-15 06:29:58
|
Revision: 491
http://ante.svn.sourceforge.net/ante/?rev=491&view=rev
Author: roguestar191
Date: 2007-08-14 23:29:58 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
inventory control script
Added Paths:
-----------
trunk/ant/skills/commands/invcontrol.cpp
Added: trunk/ant/skills/commands/invcontrol.cpp
===================================================================
--- trunk/ant/skills/commands/invcontrol.cpp (rev 0)
+++ trunk/ant/skills/commands/invcontrol.cpp 2007-08-15 06:29:58 UTC (rev 491)
@@ -0,0 +1,228 @@
+// strhelp has readResponse(), strcpy
+#include "../include/strhelp.h"
+#include "../fcgi/fcgi.h"
+
+#include <sstream>
+#include <fstream>
+std::string username;
+char* ltoa( long long int value, char* result, int base) {
+ // check that the base if valid
+ if (base < 2 || base > 16) { *result = 0; return result; }
+ char* out = result;
+ long long int quotient = value;
+ do {
+ *out = "0123456789abcdef"[ std::abs( quotient % base ) ];
+ ++out;
+ quotient /= base;
+ } while ( quotient );
+ // Only apply negative sign for base 10
+ if ( value < 0 && base == 10) *out++ = '-';
+ std::reverse( result, out );
+ *out = 0;
+ return result;
+}
+
+
+FCGIServer *g_fs;
+int currequest;
+bool isGet(std::string &com) {
+ if(com.find("get") != std::string::npos) return true;
+ return false;
+}
+bool isDrop(std::string &com) {
+ if(com.find("drop") != std::string::npos) return true;
+ return false;
+}
+bool isWear(std::string &com) {
+ if(com.find("wear") != std::string::npos) return true;
+ return false;
+}
+bool isRemove(std::string &com) {
+ if(com.find("remove") != std::string::npos) return true;
+ return false;
+}
+bool isInventory(std::string &com) {
+ if(com.find("inventory") != std::string::npos) return true;
+ return false;
+}
+bool isEquipment(std::string &com) {
+ if(com.find("equipment") != std::string::npos) return true;
+ return false;
+}
+int mode(std::string &com) {
+ if(isGet(com)) return -1;
+ if(isDrop(com)) return 0;
+ if(isWear(com)) return 1;
+ if(isRemove(com)) return 2;
+ if(isInventory(com)) return 3;
+ if(isEquipment(com)) return 4;
+ return -2;
+}
+
+void Do_Get(std::string &arg) {
+ std::string output;
+ if(arg.compare("nonefound") == 0) {
+ output = "%print Get what?<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ return;
+ }
+ output = "%get "; output += arg;
+ g_fs->Stdout2(output, currequest);
+ output = readStdin(g_fs, currequest, true);
+ trim(output);
+ if(output.compare("Failed") == 0) {
+ output = "%print You don't see a ";
+ output += arg;
+ output += " here.<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ } else {
+ output = "%printroom ";
+
+ output += username;
+ output += " get <BR><S-NAME> <CHAN> a ";
+ output += arg;
+ output += "<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ }
+}
+void Do_Wear(std::string &arg) {
+
+}
+void Do_Remove(std::string &arg) {
+
+}
+void Do_Drop(std::string &arg) {
+ std::string output;
+ if(arg.compare("nonefound") == 0) {
+ output = "%print Drop what?<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ return;
+ }
+ output = "%drop "; output += arg;
+ g_fs->Stdout2(output, currequest);
+ output = readStdin(g_fs, currequest, true);
+ trim(output);
+ if(output.compare("Failed") == 0) {
+ output = "%print You don't have a ";
+ output += arg; output += "<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ } else {
+ output = "%printroom ";
+ output += username;
+ output += " drop <BR><S-NAME> <CHAN> a ";
+ output += arg;
+ output += "<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ }
+
+}
+std::string buildItemString(std::vector<std::string> &ivec) {
+ std::string output;
+ std::vector<std::string>::iterator iter = ivec.begin(), end = ivec.end();
+ for(;iter!=end;iter++) {
+ output += (*(iter));
+ output += "<BR>";
+ }
+ return output;
+}
+
+void Do_Inventory(std::string &arg) {
+ std::string output = "%display INVENTORY\n";
+ g_fs->Stdout2(output, currequest);
+ output = readStdin(g_fs, currequest, true);
+ trim(output);
+ if(output.compare("You don't have anything!") == 0) {
+ output = "%print You don't have anything!<BR>\n";
+ g_fs->Stdout2(output, currequest);
+ return;
+ }
+ replaceAll(output, "<QUO>", "\"");
+ replaceAll(output, "\"\"", "\" \"");
+ std::vector<std::string> ivec = strToVec(output);
+ output = "%print You are carrying ";
+ char res[100];
+ memset(res, '\0', 99);
+ output += ltoa( ivec.size(), res, 10);
+ output += " items<BR>";
+ output += buildItemString(ivec);
+ output += "\n";
+ g_fs->Stdout2(output, currequest);
+}
+void Do_Equipment(std::string &arg) {
+
+}
+
+void Do_Request(std::string &com, std::string &argument) {
+ int m = mode(com);
+ if(m == -2) return;
+ if(m == -1) Do_Get(argument);
+ else if(m == 0) Do_Drop(argument);
+ else if(m == 1) Do_Wear(argument);
+ else if(m == 2) Do_Remove(argument);
+ else if(m == 3) Do_Inventory(argument);
+ else if(m == 4) Do_Equipment(argument);
+}
+int main(int argc, const char *argv[]) {
+/* Handle Arguments */
+ const char *port = "6000";
+ if(argc != 3) {
+ goto errexit;
+ } else {
+ if(memcmp(argv[1], "-p", 2) != 0) goto errexit;
+ std::string test = argv[2];
+ for(size_t s = 0, e= test.size(); s != e; s++) {
+ if(!isdigit(test[s])) goto errexit;
+ }
+ port = argv[2];
+ }
+ goto norm;
+ errexit:
+ std::cerr << "Usage: Programname -p PORT#" << std::endl;
+ return 0;
+ norm:
+/* Arguments handled */
+/* StartFCGIServer */
+ FCGIServer *fs = new FCGIServer(port);
+/* Set global fcgi server pointer */
+ g_fs = fs;
+/* Create a vector to store clients*/
+ std::vector<FCGIRet> clients;
+/* Don't ever stop running, until we're killed */
+ while(true) {
+ /* Poll the server for connections */
+ clients = g_fs->Connections();
+ /* If no new connections are found and there's no data on existing connections */
+ if(clients.size() == 0) continue;
+ /* Create iterators to scroll through the clients */
+ std::vector<FCGIRet>::iterator iter = clients.begin(), end = clients.end();
+ /* Scroll through the clients */
+ for(;iter!=end;iter++) {
+ /* Set the current request number */
+ currequest = (*(iter)).requestid;
+ /* If the master server has sent the notification that it's done sending params variables */
+ if((*(iter)).isparams) {
+ std::cerr << "Found something..\n";
+ /* Start the request */
+ {
+ // print out some scripting commands, all will "provoke" the server into giving a response
+ std::string out = "\n%getaccess\n%skargs\n%username\n";
+ g_fs->Stdout2(out,currequest);
+ }
+ std::cerr << "Current Request: " << currequest << std::endl;
+ // read the first response (%getaccess)
+ std::string accessword = readStdin(g_fs, currequest, true);
+ // get rdif of \r\n
+ trim(accessword);
+ std::string argc = readStdin(g_fs, currequest, true);
+ trim(argc);
+ replaceAll(argc, "<QUO>", "\\\"");// This isn't necessary here, but done to show that the engine translates \" to <QUO> so it can easily pass through multiple parsers without the \'s being stripped every time and eventually making the quote disappear
+ username = readStdin(g_fs, currequest, true);
+ trim(username);
+ Do_Request(accessword, argc);
+ g_fs->endRequest(currequest);
+ }// if((*(iter)).isparams) {
+ }// for(;iter!=end;iter++) {
+ }// while(true) {
+ delete fs;
+ return 0;
+};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-08-15 06:24:51
|
Revision: 490
http://ante.svn.sourceforge.net/ante/?rev=490&view=rev
Author: roguestar191
Date: 2007-08-14 23:24:49 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
Added missing strhelp files
Added Paths:
-----------
trunk/ant/skills/include/strhelp.cpp
trunk/ant/skills/include/strhelp.h
Added: trunk/ant/skills/include/strhelp.cpp
===================================================================
--- trunk/ant/skills/include/strhelp.cpp (rev 0)
+++ trunk/ant/skills/include/strhelp.cpp 2007-08-15 06:24:49 UTC (rev 490)
@@ -0,0 +1,29 @@
+#include "strhelp.h"
+
+std::string strcpy(std::string &in) {
+ std::string ret;
+ for(size_t x = 0, end = in.size(); x < end; x++) ret += in[x];
+ return ret;
+}
+void trim(std::string&in) {
+ std::string ret;
+ for(size_t x = 0, end = in.size(); x < end; x++) {
+ if(in[x] != '\r' && in[x] != '\n') ret += in[x];
+ }
+ in.erase();
+ in = strcpy(ret);
+}
+
+std::string readResponse() {
+ std::cout.flush();
+ std::string response;
+ char buffer = 0;
+ while((buffer = std::cin.get()) != '\n') {
+ response += buffer;
+ }
+ trim(response);
+ return response;
+};
+
+
+
Added: trunk/ant/skills/include/strhelp.h
===================================================================
--- trunk/ant/skills/include/strhelp.h (rev 0)
+++ trunk/ant/skills/include/strhelp.h 2007-08-15 06:24:49 UTC (rev 490)
@@ -0,0 +1,75 @@
+#ifdef STRHELP_INC
+#else
+#define STRHELP_INC 1
+#include <iostream>
+#include <string>
+#include <vector>
+inline void replaceAll(std::string&in,std::string from, std::string to) {
+ size_t find = in.find(from);
+ while(find != std::string::npos) {
+ in.replace(find, from.size(), to);
+ find = in.find(from, find+to.size());
+ }
+}
+
+std::string strcpy(std::string &in);
+void trim(std::string&in);
+std::string readResponse();
+inline void strcpy(std::string &to, std::string &from) {
+ for(size_t scroller = 0, end = from.size(); scroller != end; scroller++) {
+ to += from[scroller];
+ }
+}
+inline void strcpy2(std::string &to, std::string from) {
+ for(size_t scroller = 0, end = from.size(); scroller != end; scroller++) {
+ to += from[scroller];
+ }
+}
+inline std::vector<std::string> strToVec(std::string &in, bool newl = false, char sep=' ') {
+ std::vector<std::string> strvec;
+ {
+ std::string::const_iterator scroller = in.begin(), end = in.end();
+ //size_t last = 0, next = 0;
+ bool quote = false;
+ bool escape = false;
+ std::string temp;
+ for(scroller = in.begin(); scroller < end; scroller++)
+ {
+ if(escape) {
+ temp += *scroller;
+ escape = false;
+ continue;
+ }
+ if(*scroller == '\\') { escape = true; continue; };
+ if(*scroller=='\"') {
+ if(quote) {
+ quote = false;
+ } else {
+ quote = true;
+ }
+ continue;
+ }
+ if(*scroller==sep && !quote) {
+ if(temp.size() > 0)
+ strvec.push_back(temp);
+ temp.erase();
+ continue;
+ } if( !newl && (*scroller != '\r' && *scroller != '\n'))
+ temp += *scroller;
+ else if(newl){ if(*scroller == '\r') continue; if(*scroller == '\n') { temp.append("\r\n"); continue; } else temp += *scroller;}
+
+ }
+ if(temp.size() > 0) strvec.push_back(temp);
+ }
+ if(strvec.size() == 0) {
+ std::string mpty = "\r\n";
+ strvec.push_back(mpty);
+ }
+ return strvec;
+}
+inline void lower(std::string&what) {
+std::transform(what.begin(), what.end(), what.begin(),static_cast < int(*)(int) > (tolower));
+
+}
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-06-05 08:32:38
|
Revision: 489
http://svn.sourceforge.net/ante/?rev=489&view=rev
Author: roguestar191
Date: 2007-06-05 01:32:39 -0700 (Tue, 05 Jun 2007)
Log Message:
-----------
Added move to autorun autokill list
Modified Paths:
--------------
trunk/ant/autorun
trunk/ant/data/config
Modified: trunk/ant/autorun
===================================================================
--- trunk/ant/autorun 2007-02-08 22:30:37 UTC (rev 488)
+++ trunk/ant/autorun 2007-06-05 08:32:39 UTC (rev 489)
@@ -22,6 +22,7 @@
killall croome
killall totalaccess
killall wander
+ killall move
# Ya... Need a pid reporter for modules to kill the pids directly, these killalls are uuugly ><
# All fcgi children will write their pid to a file, and remove their pid
# when they exit or crash or are killed.
Modified: trunk/ant/data/config
===================================================================
--- trunk/ant/data/config 2007-02-08 22:30:37 UTC (rev 488)
+++ trunk/ant/data/config 2007-06-05 08:32:39 UTC (rev 489)
@@ -1,4 +1,4 @@
-LOG_LEVEL=1
+LOG_LEVEL=0
To disable it, set it to 0.
For minimul messages set it to 0.
Setting it higher than 0 _will_ cause a slowdown, only set it up
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-02-08 22:30:37
|
Revision: 488
http://svn.sourceforge.net/ante/?rev=488&view=rev
Author: roguestar191
Date: 2007-02-08 14:30:37 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Added preliminary udp support to newcore
Modified Paths:
--------------
trunk/ant/newcore/servercore/core.cpp
trunk/ant/newcore/sockets/socket.h
trunk/ant/newcore/sockets/sockets.cpp
Modified: trunk/ant/newcore/servercore/core.cpp
===================================================================
--- trunk/ant/newcore/servercore/core.cpp 2007-01-25 10:19:15 UTC (rev 487)
+++ trunk/ant/newcore/servercore/core.cpp 2007-02-08 22:30:37 UTC (rev 488)
@@ -2,19 +2,20 @@
#include <string>
#include <vector>
#include <iostream>
+#include <arpa/inet.h>
void outputAll(std::string output, Socket_Handler&socks) {
std::vector<Sock_Holder>::iterator iter = socks.sockets.begin(), end = socks.sockets.end();
while(iter!=end) {
- std::cout << "Writing: " << (*(iter)).socket << " " << output.size() << " "<< output ;
- write((*(iter)).socket,output.c_str(), output.size());
+ std::cout << "Writing: " << inet_ntoa( (*(struct sockaddr_in*)&(*(iter)).socket).sin_addr) << " " << output.size() << " "<< output ;
+ sendto(socks.ssd ,output.c_str(), output.size(),0, &(*(iter)).socket, sizeof(struct sockaddr));
iter++;
}
}
int main() {
- Socket_Handler s ("9393"); // binds the port, set by the global value char *DEFAULT_SERVER_PORT
+ Socket_Handler s ("4420"); // binds the port, set by the global value char *DEFAULT_SERVER_PORT
// s short for server
while(1) {
std::vector<Packet_>*o = s.Listen();
Modified: trunk/ant/newcore/sockets/socket.h
===================================================================
--- trunk/ant/newcore/sockets/socket.h 2007-01-25 10:19:15 UTC (rev 487)
+++ trunk/ant/newcore/sockets/socket.h 2007-02-08 22:30:37 UTC (rev 488)
@@ -9,8 +9,8 @@
class Sock_Holder
{
public:
- Sock_Holder(int);
- int socket;
+ Sock_Holder(struct sockaddr);
+ struct sockaddr socket;
bool playerOrFCGI;
void *ptr;
};
Modified: trunk/ant/newcore/sockets/sockets.cpp
===================================================================
--- trunk/ant/newcore/sockets/sockets.cpp 2007-01-25 10:19:15 UTC (rev 487)
+++ trunk/ant/newcore/sockets/sockets.cpp 2007-02-08 22:30:37 UTC (rev 488)
@@ -30,9 +30,9 @@
{
port = p;
sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = INADDR_ANY;
sa.sin_port = htons((u_short) atoi(port) );
- if ((ssd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ sa.sin_addr.s_addr = INADDR_ANY;
+ if ((ssd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
ERROR ("socket");
int opt = 1;
// {{{ set some options on the server socket
@@ -56,27 +56,45 @@
exit(0);
ERROR ("bind");
}
- listen(ssd,5);
-};
+// listen(ssd,5);
+}
Socket_Handler::~Socket_Handler() {
- std::vector<Sock_Holder>::iterator iter = sockets.begin(), end = sockets.end();
- for(;iter!=end;iter++) close((*(iter)).socket);
+ close(ssd);
}
int maxfd = 0;
+void* sockets_contains(std::vector<Sock_Holder>&s, Sock_Holder&l) {
+ std::vector<Sock_Holder>::iterator iter = s.begin(), end = s.end();
+ while(iter !=end) if( memcmp( &(*(iter)).socket, &l, sizeof(struct sockaddr) ) == 0) return &(*(iter));
+ return NULL;
+}
+#define MAXBUFLEN 100
std::vector<Packet_>* Socket_Handler::Listen()
{
- FD_ZERO(&mask);
- std::vector<Sock_Holder>::iterator iter =sockets.begin();
- for(;iter != sockets.end();iter++){
- FD_SET((*iter).socket, &mask);
- if(maxfd < (*(iter)).socket) { maxfd = (*(iter)).socket;}
-
- }
- FD_SET(ssd, &mask);
- if(maxfd < ssd) maxfd = ssd;
- int numfound = select(maxfd+1,&mask,NULL, NULL, NULL);
- if(numfound == 0) return NULL;
+// FD_ZERO(&mask);
+// std::vector<Sock_Holder>::iterator iter =sockets.begin();
+// for(;iter != sockets.end();iter++){
+// FD_SET((*iter).socket, &mask);
+// if(maxfd < (*(iter)).socket) { maxfd = (*(iter)).socket;}
+//
+// }
+// FD_SET(ssd, &mask);
+// if(maxfd < ssd) maxfd = ssd;
+ struct sockaddr_in their_addr;
+ socklen_t addr_len = sizeof(struct sockaddr);
+ char buf[MAXBUFLEN];
+ memset(buf, 0, MAXBUFLEN-1);
+ int numread = recvfrom(ssd,buf, MAXBUFLEN-1, 0,(struct sockaddr*)&their_addr, &addr_len);
+
+ if(numread == 0) return NULL;
std::vector<Packet_>*ret = new std::vector<Packet_>;
+ Packet_ apack;
+ Sock_Holder s( *(struct sockaddr*)&their_addr);
+ void *ptr;
+ if(!(ptr = sockets_contains(sockets, s)) ) { sockets.push_back(s); ptr= &sockets[sockets.size()-1]; };
+ apack.socket = (Sock_Holder*) ptr;
+ return ret;
+};
+/*
int newsocket = 0;
if(FD_ISSET(ssd, &mask)) {
struct sockaddr_in caller;
@@ -112,8 +130,8 @@
}
return ret; // for now
}
-
-Sock_Holder::Sock_Holder(int sock)
+*/
+Sock_Holder::Sock_Holder(struct sockaddr sock)
{
socket = sock;
ptr = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-25 10:19:17
|
Revision: 487
http://svn.sourceforge.net/ante/?rev=487&view=rev
Author: roguestar191
Date: 2007-01-25 02:19:15 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
Remove fast-cgi requests related to an object when it's destroyed
Modified Paths:
--------------
trunk/ant/objects.cpp
Modified: trunk/ant/objects.cpp
===================================================================
--- trunk/ant/objects.cpp 2007-01-25 09:16:28 UTC (rev 486)
+++ trunk/ant/objects.cpp 2007-01-25 10:19:15 UTC (rev 487)
@@ -923,6 +923,7 @@
}
*/
+extern void AbortFCGI(void*ptr, void*ptr2);
object::~object() {
std::vector<object*>::iterator iter = snooping.begin(), end = snooping.end();
while(iter!=end) {
@@ -936,6 +937,7 @@
}
while(snoopers.size() != 0) snoopers.pop_back();
while(snooping.size() != 0) snooping.pop_back();
+ AbortFCGI(this,NULL);
}
bool object::Tickme() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-25 09:16:27
|
Revision: 486
http://svn.sourceforge.net/ante/?rev=486&view=rev
Author: roguestar191
Date: 2007-01-25 01:16:28 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
Removed unused cout
Modified Paths:
--------------
trunk/ant/areas.cpp
Modified: trunk/ant/areas.cpp
===================================================================
--- trunk/ant/areas.cpp 2007-01-25 08:41:50 UTC (rev 485)
+++ trunk/ant/areas.cpp 2007-01-25 09:16:28 UTC (rev 486)
@@ -68,7 +68,6 @@
};
bool Area::players() {
if(playerl.size() != 0) return true;
- std::cout << "Not in area list\n";
std::vector<Room *>::iterator iter = rooms.begin();
size_t size = rooms.size();
while(size != 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-25 08:41:51
|
Revision: 485
http://svn.sourceforge.net/ante/?rev=485&view=rev
Author: roguestar191
Date: 2007-01-25 00:41:50 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
cleanups of ticking, still needs overhaul, see todo
Modified Paths:
--------------
trunk/ant/areas.cpp
trunk/ant/cgiscript.cpp
trunk/ant/objects.cpp
trunk/ant/objects.h
trunk/ant/todo
Modified: trunk/ant/areas.cpp
===================================================================
--- trunk/ant/areas.cpp 2007-01-24 09:49:52 UTC (rev 484)
+++ trunk/ant/areas.cpp 2007-01-25 08:41:50 UTC (rev 485)
@@ -67,15 +67,16 @@
return true;
};
bool Area::players() {
- if(playerl.size() > 0) return true;
+ if(playerl.size() != 0) return true;
+ std::cout << "Not in area list\n";
std::vector<Room *>::iterator iter = rooms.begin();
size_t size = rooms.size();
-
while(size != 0) {
- if((*(iter))->players.size() != 0) return true;
+ if((*(iter))->players.size() != 0) return true;
iter++;
size--;
}
+
return false;
}
std::string Area::saveMe() {
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 09:49:52 UTC (rev 484)
+++ trunk/ant/cgiscript.cpp 2007-01-25 08:41:50 UTC (rev 485)
@@ -1,8 +1,21 @@
#include "mob.h"
#include "cgiscript.h"
#include "phpscript.h"
+
+void CopyStrvecToTickvec(std::vector<tick_script>&out, std::vector<std::string> in) {
+ std::vector<std::string>::iterator iter = in.begin(), end = in.end();
+ while(iter!=end) {
+ std::string dou = (*(iter));
+ tick_script d = dou;
+ out.push_back(d);
+ iter++;
+ }
+}
+
extern phpCom com;
extern bool COPYTRIG;
+
+
namespace FH {
SFunctor<loaderhelper>* addS;
SFunctor<loaderhelper>* print;
@@ -905,7 +918,7 @@
} else obj->FullyPlaying = false;
return "Success";
} else if(name.compare("tickscripts") ==0) {
-obj->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(obj->tickscripts, strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
obj->arbscripts = strToVec(restofit);
@@ -982,7 +995,7 @@
return "Failed";
} // }}}
else if(name.compare("tickscripts") ==0) {
- (*(iter))->tickscripts = strToVec(restofit);
+ CopyStrvecToTickvec((*(iter))->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
(*(iter))->arbscripts = strToVec(restofit);
@@ -1010,7 +1023,7 @@
return "Success";
}
else if(name.compare("tickscripts") ==0) {
-obj->area_in->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(obj->area_in->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
obj->area_in->arbscripts = strToVec(restofit);
@@ -1029,7 +1042,7 @@
m->room_in->Name.append(restofit);
return "Success";
}else if(name.compare("tickscripts") ==0) {
-obj->room_in->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(obj->room_in->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
obj->room_in->arbscripts = strToVec(restofit);
@@ -1050,7 +1063,7 @@
return "Success";
}
else if(name.compare("tickscripts") ==0) {
-m->editingbp->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(m->editingbp->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
m->editingbp->arbscripts = strToVec(restofit);
@@ -1102,7 +1115,7 @@
ret += " not found!";
return ret;
}else if(name.compare("tickscripts") ==0) {
-m->editingRace->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(m->editingRace->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
m->editingRace->arbscripts = strToVec(restofit);
@@ -1133,7 +1146,7 @@
}
return "Success";
}else if(name.compare("tickscripts") ==0) {
-m->modifyingexit->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(m->modifyingexit->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
m->modifyingexit->arbscripts = strToVec(restofit);
@@ -1178,7 +1191,7 @@
}
return "Success";
}else if(name.compare("tickscripts") ==0) {
-m->modifyingitem->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(m->modifyingitem->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
m->modifyingitem->arbscripts = strToVec(restofit);
@@ -1234,7 +1247,7 @@
} else return "Only players can be immortal!";
}else if(name.compare("tickscripts") ==0) {
-m->editingmob->tickscripts = strToVec(restofit);
+CopyStrvecToTickvec(m->editingmob->tickscripts , strToVec(restofit));
return "Success";
} else if(name.compare("arbscripts") == 0) {
m->editingmob->arbscripts = strToVec(restofit);
Modified: trunk/ant/objects.cpp
===================================================================
--- trunk/ant/objects.cpp 2007-01-24 09:49:52 UTC (rev 484)
+++ trunk/ant/objects.cpp 2007-01-25 08:41:50 UTC (rev 485)
@@ -192,66 +192,66 @@
}
// }}}
+int tickscriptModeRev(std::string &in) {
+ size_t find = in.find("always;");
+ if(find == 0) {
+ in.replace(0, 7, "");
+ return -1;
+ }
+ find = in.find("area;");
+ if(find == 0) {
+ in.replace(0, 5, "");
+ return 0;
+ }
+ find = in.find("room;");
+ if(find == 0) {
+ in.replace(0, 5, "");
+ }
+ return 1;
+}
bool object::TickScript() {// {{{
// std::string type = myTypes();
if(myType == TYPE_MOB || myType == TYPE_PLAYER) {
if(room_in != NULL) {
Room *room = static_cast<Room*>(room_in);
if(room->area_in->players()) {
- if(tickscripts.size() > 0)
- for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++) {
- object::input((*(iter)), 0, false);
- }
+ if(tickscripts.size() != 0) for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++) object::input((*(iter)).script, 0, false);
}
}
+ return true;
}
if(myType == TYPE_ITEM) {
- Item &i = *static_cast<Item*>(this);
- if(i.room_in!= NULL) {
- for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++) {
- std::string cpy = (*(iter));
- size_t x = cpy.find("always;");
- if(x != std::string::npos) {
- x+=7;
- cpy.replace(0, x, "");
- object::input(cpy,0,false);
- } else {
- x = cpy.find("area;");
- if(x != std::string::npos) {
- if(i.room_in->area_in->players()) {
- x+=5;
- cpy.replace(0, x, "");
- object::input(cpy,0,false);
- }
- } else {
- if(i.room_in->players.size() > 0)
- object::input(cpy, 0, false);
- }
- }
+ if(room_in!= NULL) {
+ for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++) {
+ if((*(iter)).mode == -2) (*(iter)).mode = tickscriptModeRev((*(iter)).script);
+ if((*(iter)).mode == -1) object::input((*(iter)).script,0,false);
+ else if((*(iter)).mode == 0) {
+ if(room_in->area_in->players()) object::input((*(iter)).script,0,false);
+ } else if(room_in->players.size() > 0) object::input((*(iter)).script, 0, false);
}
}
return true;
}
if(myType == TYPE_AREA) {
Area&a = *static_cast<Area*>(this);
- if(a.players()) {
- for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++)object::input((*(iter)),0,false);
- }
+ if(a.players()) for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++)object::input((*(iter)).script,0,false);
return true;
}
if(myType == TYPE_ROOM) {
Room&r = *static_cast<Room*>(this);
- if(r.players.size() > 0) for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++)object::input((*(iter)),0,false);
+ if(r.players.size() != 0) for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++)object::input((*(iter)).script,0,false);
return true;
}
if(myType==TYPE_BODYPART) {
BodyPart&bp = *static_cast<BodyPart*>(this);
- if(bp.mymob != NULL) for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++)object::input((*(iter)),0,false);
+ if(bp.mymob != NULL) for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++)object::input((*(iter)).script,0,false);
+
+ return true;
}
if(myType==TYPE_EXIT) {
// anexit&ex = *static_cast<anexit*>(this);
- if(room_in != NULL) if(room_in->players.size() > 0) for(std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter<end;iter++)object::input((*(iter)),0,false);
+ if(room_in != NULL) if(room_in->players.size() != 0) for(std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end(); iter!=end;iter++)object::input((*(iter)).script,0,false);
return true;
}
return true;
@@ -306,12 +306,13 @@
std::cout << "WTH.. How did I move to a null room\n";
it->room_in = oroom;
- }
+ } else it->area_in = static_cast<Area *>(it->room_in->area_in);
if(it->FullyPlaying) {
//player
- it->room_in->players.push_back(it);
+ it->room_in->addPlayer(it);
+// it->room_in->players.push_back(it);
} else {
//mobile
if(it->myType == TYPE_MOB)
@@ -800,8 +801,11 @@
editingmob = in.editingmob;
{
+ {
+ std::vector<tick_script>::const_iterator iter,end;
+ if(in.tickscripts.size() > 0) for(iter = in.tickscripts.begin(), end = in.tickscripts.end(); iter<end;iter++) tickscripts.push_back((*(iter)));
+ }
std::vector<std::string>::const_iterator iter,end;
- if(in.tickscripts.size() > 0) for(iter = in.tickscripts.begin(), end = in.tickscripts.end(); iter<end;iter++) tickscripts.push_back((*(iter)));
if(in.arbscripts.size() >0) for(iter = in.arbscripts.begin(), end = in.arbscripts.end();iter<end;iter++) arbscripts.push_back((*(iter)));
}
FullyPlaying = in.FullyPlaying;
@@ -958,15 +962,17 @@
};
std::string object::saveMe() {
+// Don't use this.. use saveMe2(std::string)...
+
//this function just puts the description and name in to an std::string
//and returns it, the object itself is responsible for writing (
//ok, so I need a write() routine like print1.)
std::ostringstream rstring;
rstring << "<TYPE>" << myType << "</TYPE>" << "<NAME>" << Name << "</NAME>" << "<DESC>" << Description << "</DESC>" << "<FDESC>" << frontdesc << "</FDESC>" << "<VARDATA>" << vardata << "</VARDATA>";
if(tickscripts.size() > 0) {
- std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end();
+ std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end();
for(;iter<end;iter++) {
- rstring << "<TICKSCRIPT>" << (*(iter))<< "</TICKSCRIPT>";
+ rstring << "<TICKSCRIPT>" << (*(iter)).script << "</TICKSCRIPT>";
}
}
if(arbscripts.size() > 0) {
@@ -979,6 +985,14 @@
if(FullyPlaying) rstring << "<FULLYPLAYING>";
return rstring.str();
};
+
+std::string tickscriptMode(int mode) {
+ if(mode == -2) return "";
+ if(mode == -1) return "always;";
+ if(mode == 0) return "area;";
+ if(mode == 1) return "room;";
+ throw "UNKNOWN TICKSCRIPT MODE U GOT A MEMLEAK UNLESS YOU'RE CHANGING TICKSCRIPTS THEn LOOK AT line 1001 OBJECTS.CPP.";
+}
std::string object::saveMe2(std::string &marker) {
std::string ret;;
ret.append("<TYPE");
@@ -1019,9 +1033,9 @@
ret.append(marker);
ret.append(">");
if(tickscripts.size() > 0) {
- std::vector<std::string>::iterator iter = tickscripts.begin(), end = tickscripts.end();
+ std::vector<tick_script>::iterator iter = tickscripts.begin(), end = tickscripts.end();
for(;iter<end;iter++) {
- ret += "<TICKSCRIPT"; ret+=marker;ret +=">"; ret+=(*(iter));ret+="</TICKSCRIPT";ret+=marker;ret+=">";
+ ret += "<TICKSCRIPT"; ret+=marker;ret +=">";ret+=tickscriptMode((*(iter)).mode); ret+=(*(iter)).script;ret+="</TICKSCRIPT";ret+=marker;ret+=">";
}
}
if(arbscripts.size() > 0) {
@@ -1103,7 +1117,9 @@
y = sfind(d,"</TICKSCRIPT>");
while(x != std::string::npos && y != std::string::npos) {
x+= 12;
- tickscripts.push_back(d.substr(x,y-x));
+ std::string nt = d.substr(x,y-x);
+ tick_script nts(nt);
+ tickscripts.push_back(nts);
y+=13;
x-=12;
d.replace(x, y-x, "");
@@ -1222,7 +1238,9 @@
y = sfind(d,two.c_str());
while(x != std::string::npos && y != std::string::npos) {
x+= one.size();
- tickscripts.push_back(d.substr(x,y-x));
+ std::string ts = d.substr(x, y-x);
+ tick_script nts = ts;
+ tickscripts.push_back(nts);
y+=two.size();
x-=one.size();
d.replace(x, y-x, "");
Modified: trunk/ant/objects.h
===================================================================
--- trunk/ant/objects.h 2007-01-24 09:49:52 UTC (rev 484)
+++ trunk/ant/objects.h 2007-01-25 08:41:50 UTC (rev 485)
@@ -42,7 +42,16 @@
//class anexit;
class Item;
class mob;
-
+class tick_script {
+ public:
+ tick_script(std::string &in) { script = in; mode = -2; }
+ tick_script(const tick_script &old) { script = old.script, mode = old.mode; };
+ int mode; // -1 is always, 0 area, 1 room
+ std::string script;
+ void operator=(std::string &in) {
+ mode = -1, script = in;
+ }
+};
class object : public base {
bool isloggedin; //this is private
public:
@@ -78,7 +87,7 @@
std::string Description; // a description for any object
std::string frontdesc; //front description in look
std::string vardata; // this can hold anything, scripts will use it to hold stuff like health/mana/etc, for anything that inherits object.
- std::vector<std::string> tickscripts;
+ std::vector<tick_script> tickscripts;
std::vector<std::string> arbscripts;
int mode; //decipher mode, login/whatever, use enums below. Barely used now but it is used
bool deleteme; // Mark for deletion
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2007-01-24 09:49:52 UTC (rev 484)
+++ trunk/ant/todo 2007-01-25 08:41:50 UTC (rev 485)
@@ -5,6 +5,9 @@
On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned. all banned ip's related to the username should be unbanned.
+Ticking has to be optimized, right now, everything ticks all at once, every 2 seconds everything all ticks. They shouldn't all be ticked at the same time however, the server should tick 5, maybe 10 items, do another read loop, tick 5 or 10 more, and so on, and only tick each one once every two seconds - To do this select() may need to be used in non-blocking mode with nanosleep thrown in the way the fcgi-modules do it..
+
+
Step 2
memtests, test mud, release 1.0
---------------------------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 09:49:52
|
Revision: 484
http://svn.sourceforge.net/ante/?rev=484&view=rev
Author: roguestar191
Date: 2007-01-24 01:49:52 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
fastcgi script documentation update
Modified Paths:
--------------
trunk/ant/httpd/aski.html
Modified: trunk/ant/httpd/aski.html
===================================================================
--- trunk/ant/httpd/aski.html 2007-01-24 09:29:42 UTC (rev 483)
+++ trunk/ant/httpd/aski.html 2007-01-24 09:49:52 UTC (rev 484)
@@ -170,8 +170,8 @@
etc.<br>
<hr>
%modify
-<hr>
-// From HERE **************************************************
+<hr><br>
+// From HERE **************************************************<br>
Modify can be used to modify any part of the game state.<br><br>
Modify can be called by rooms and mobs/players.<br><br>
@@ -185,27 +185,27 @@
description // the players description<br><br>
Example:<Br>
-%modify Rogue room "area::roomname"
+%modify Rogue room "area::roomname"<br><br>
-This will be used to make "ships", "portal rooms", and the like.
-// To HERE *****************************************************
-/|\/|\Is depricated. Everything can use %setmodify and modify from items to mobs to exits to bodyparts.
+This will be used to make "ships", "portal rooms", and the like.<br>
+// To HERE *****************************************************<br>
+/|\/|\Is depricated. Everything can use %setmodify and modify from items to mobs to exits to bodyparts.<br><br>
Rooms still have the same behavior as above as it's the only way to "change the room" of the player from a room, this may be changed
<br><br>
almost everything must be %setmodified before it can be changed.<br>
Example:<br>(This was in php, but php is no longer used, the c/c++ is very similar however, enough that these examples still suffice)<br>
-%setmodify Rogue<br>
+print("%setmodify Rogue");<br>
$response = trim(fgets($STDIN));//trim removes \n\r, fgets = read()<br>
if($response == "Success mob")<Br>
-%modify mob immortal true<br><br>
+print("%modify mob immortal true")<br><br>
Example2:<br>
-%setmodify "a giant longsword"<br>
+print("%setmodify \"a giant longsword\"");<br>
$response = trim(fgets($STDIN));<br>
if($response == "Success item")<br>
-%modify item Name<br><br>
+print("%modify item Name");<br><br>
the modify/setmodify system is designed to work along with the defaultinput callback to replace the in-game menusystem with scripts.<br>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 09:29:46
|
Revision: 483
http://svn.sourceforge.net/ante/?rev=483&view=rev
Author: roguestar191
Date: 2007-01-24 01:29:42 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
Updated cgiscript documentation
Modified Paths:
--------------
trunk/ant/httpd/aski.html
trunk/ant/main.cpp
Modified: trunk/ant/httpd/aski.html
===================================================================
--- trunk/ant/httpd/aski.html 2007-01-24 09:05:33 UTC (rev 482)
+++ trunk/ant/httpd/aski.html 2007-01-24 09:29:42 UTC (rev 483)
@@ -90,7 +90,8 @@
</th>
</tr>
<tr><th>%move<td>arg1: who to move in this room or "this"; arg2: direction<td>move someone or something around</th></tr>
-<tr><td>%give<td>args: from to itemname location, ex: give roger george diamond inventory to give goeorge the diamond from rogers inventory.<td>for giving things either target may be "this"</tr></th>
+<tr><th>%give<td>args: from to itemname location, ex: give roger george diamond inventory to give goeorge the diamond from rogers inventory.<td>for giving things either target may be "this"</tr></th>
+<tr><th>%snoop<td>1arg: player or Item in your room to snoop<td>see what the target sees</th></tr>
</table>
<hr>
World Editing callbacks.
Modified: trunk/ant/main.cpp
===================================================================
--- trunk/ant/main.cpp 2007-01-24 09:05:33 UTC (rev 482)
+++ trunk/ant/main.cpp 2007-01-24 09:29:42 UTC (rev 483)
@@ -134,6 +134,8 @@
Utils.writeFile("pidlist",pidlist,false);
};
extern void setsignals();
+ #include <sys/types.h>
+ #include <sys/wait.h>
int main(int argc, char *argv[])
{
@@ -205,7 +207,8 @@
std::string started = "echo $(ps -A | grep ";
started += startcmd;
started += " ) Copyover $(date) > ./curpid";
- system(started.c_str());
+ system(started.c_str());int x;
+ waitpid(-1, &x, 0);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 09:05:34
|
Revision: 482
http://svn.sourceforge.net/ante/?rev=482&view=rev
Author: roguestar191
Date: 2007-01-24 01:05:33 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
yaf for items (yet another fix)
Modified Paths:
--------------
trunk/ant/rooms.cpp
Modified: trunk/ant/rooms.cpp
===================================================================
--- trunk/ant/rooms.cpp 2007-01-24 08:42:10 UTC (rev 481)
+++ trunk/ant/rooms.cpp 2007-01-24 09:05:33 UTC (rev 482)
@@ -195,6 +195,7 @@
}
end = items.size();
std::vector<Item*>::iterator iter = items.begin();
+ size_t oldsize = items.size();
while(end != 0) {
if(!(*(iter))->immortal) {
if(!(*(iter))->exists && (*(iter))->canrepop) {
@@ -208,6 +209,15 @@
(*(iter))->Tick();
}
} else (*(iter))->immortal = false;
+ if(oldsize != items.size() ){
+ // diff is
+ size_t diff = oldsize-items.size();
+ end -=diff;
+ diff = items.size()-end;
+ iter = items.begin();
+ while(diff!=0) iter++, diff--;
+ oldsize = items.size();
+ }
iter++;
end--;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 08:42:10
|
Revision: 481
http://svn.sourceforge.net/ante/?rev=481&view=rev
Author: roguestar191
Date: 2007-01-24 00:42:10 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
clean of snoop, todo is getting small
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/command.cpp
trunk/ant/mud.cpp
trunk/ant/objects.cpp
trunk/ant/todo
trunk/ant/tools.cpp
trunk/ant/tools.h
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/cgiscript.cpp 2007-01-24 08:42:10 UTC (rev 481)
@@ -512,25 +512,7 @@
}
return false;
}
-bool isInOVec(std::vector<object*>&vec, object*ithis) {
- std::vector<object*>::iterator iter = vec.begin(), end = vec.end();
- while(iter != end) {
- if((*(iter)) == ithis) return true;
- iter++;
- }
- return false;
-}
-void remFromOVec(std::vector<object*>&vec, object*ithis) {
- std::vector<object*>::iterator iter = vec.begin(), end = vec.end();
- while(iter != end) {
- if((*(iter)) == ithis) { vec.erase(iter); return; }
- iter++;
- }
- return;
-}
-void addToOVec(std::vector<object*>&vec, object*ithis) {
- vec.push_back(ithis);
-}
+
extern void replaceAll(std::string &in, std::string from, std::string to);
std::string loaderhelper::printToAllBut(std::vector<std::string>&d, void*callera) {
if(d.size() < 3) return "";
Modified: trunk/ant/command.cpp
===================================================================
--- trunk/ant/command.cpp 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/command.cpp 2007-01-24 08:42:10 UTC (rev 481)
@@ -581,6 +581,14 @@
breaker = false; //reset our exit bool
+ if(snoopers.size() != 0) {
+ std::vector<object*>::iterator iter = snoopers.begin(), end = snoopers.end();
+ while(iter!=end) {
+ mudg->print1((*(iter)), incommand, (*(iter))->socket);
+ iter++;
+ }
+ }
+
//now make what 1CSTRARRAY relies on
// std::string newincommand;
//append incommand
Modified: trunk/ant/mud.cpp
===================================================================
--- trunk/ant/mud.cpp 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/mud.cpp 2007-01-24 08:42:10 UTC (rev 481)
@@ -1627,7 +1627,7 @@
//mud::print1(object *p_in,string *buf,sock_in) prints the string to the object on the sock_in {{{
//sock_in should default to 0
void mud::print1(object *p_in, std::string *buf, int sock_in) {
- if(p_in->snooping.size() != 0) {
+ if(p_in->snoopers.size() != 0) {
std::vector<object*>::iterator iter = p_in->snoopers.begin(), end = p_in->snoopers.end();
while(iter!=end) {
this->print1((*(iter)), buf, (*(iter))->socket);
Modified: trunk/ant/objects.cpp
===================================================================
--- trunk/ant/objects.cpp 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/objects.cpp 2007-01-24 08:42:10 UTC (rev 481)
@@ -920,7 +920,18 @@
}
*/
object::~object() {
-
+ std::vector<object*>::iterator iter = snooping.begin(), end = snooping.end();
+ while(iter!=end) {
+ remFromOVec((*(iter))->snoopers, this);
+ iter++;
+ }
+ iter = snoopers.begin(), end = snoopers.end();
+ while(iter!=end) {
+ remFromOVec((*(iter))->snooping, this);
+ iter++;
+ }
+ while(snoopers.size() != 0) snoopers.pop_back();
+ while(snooping.size() != 0) snooping.pop_back();
}
bool object::Tickme() {
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/todo 2007-01-24 08:42:10 UTC (rev 481)
@@ -1,12 +1,6 @@
NEEDS FINISHED FIRST
Step 1
-Make a fcgi script to do wear/remove/display EQUIPMENT to replace the in game command equivilents just removed - Server support is already in place
-
-Add basic give module to exploit give callback - put in skills/commands/invcontrol.cpp
-
-Add snoop ability and callback to enable/disable (1st priority)
-
Add username/IP-(un)ban script callback (2nd priority)(Module not needed, those who should have access to this should have access to totalaccess script)
On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned. all banned ip's related to the username should be unbanned.
@@ -35,9 +29,15 @@
This Seems to not be a problem with ant.
-------------------------------------
-Not in any order
+Not in any order non-core stuff
-------------------------------------
+--Most important--
+Make a fcgi script to do wear/remove/display EQUIPMENT to replace the in game command equivilents just removed - Server support is already in place
+Add basic give module to exploit give callback - put in skills/commands/invcontrol.cpp
+
+--After that--
+
Add pipes, memory shared files, whatever alternatives to tcp can be found for simple ipc to suppliment tcp for fcgi modules (So we don't need to muck around with tcp ports..)
Add pid based control for fcgi children to fcgi object.. - See autorun
Modified: trunk/ant/tools.cpp
===================================================================
--- trunk/ant/tools.cpp 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/tools.cpp 2007-01-24 08:42:10 UTC (rev 481)
@@ -324,6 +324,29 @@
}
return std::string::npos;
}
+
+
+bool isInOVec(std::vector< object* >&vec, object* ithis) {
+ std::vector< object* >::iterator iter = vec.begin(), end = vec.end();
+ while(iter != end) {
+ if((*(iter)) == ithis) return true;
+ iter++;
+ }
+ return false;
+}
+void remFromOVec(std::vector<object*>&vec, object*ithis) {
+ std::vector<object*>::iterator iter = vec.begin(), end = vec.end();
+ while(iter != end) {
+ if((*(iter)) == ithis) { vec.erase(iter); return; }
+ iter++;
+ }
+ return;
+}
+void addToOVec(std::vector<object*>&vec, object*ithis) {
+ vec.push_back(ithis);
+}
+
+
/*
// this was actually slower...
static std::string seqbuf;// = somevars::seqbuf;
Modified: trunk/ant/tools.h
===================================================================
--- trunk/ant/tools.h 2007-01-24 08:19:13 UTC (rev 480)
+++ trunk/ant/tools.h 2007-01-24 08:42:10 UTC (rev 481)
@@ -227,4 +227,11 @@
}
return strvec;
}
+class object;
+bool isInOVec(std::vector< object* >&vec, object* ithis);
+void remFromOVec(std::vector<object*>&vec, object*ithis);
+void addToOVec(std::vector<object*>&vec, object*ithis);
+
+
#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 08:19:12
|
Revision: 480
http://svn.sourceforge.net/ante/?rev=480&view=rev
Author: roguestar191
Date: 2007-01-24 00:19:13 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
Test snoop and fix to item movement
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/cgiscript.h
trunk/ant/mud.cpp
trunk/ant/objects.cpp
trunk/ant/objects.h
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 07:07:02 UTC (rev 479)
+++ trunk/ant/cgiscript.cpp 2007-01-24 08:19:13 UTC (rev 480)
@@ -34,6 +34,7 @@
SFunctor<loaderhelper>* give;
SFunctor<loaderhelper>* gotoo;
SFunctor<loaderhelper>* printtoallbut;
+ SFunctor<loaderhelper>* snoop;
};
loaderhelper::loaderhelper() {
@@ -66,7 +67,10 @@
FH::give=new SFunctor<loaderhelper>(this, &loaderhelper::give);
FH::move=new SFunctor<loaderhelper>(this, &loaderhelper::move);
FH::gotoo=new SFunctor<loaderhelper>(this, &loaderhelper::gotoo);
+ FH::snoop=new SFunctor<loaderhelper>(this, &loaderhelper::snoop);
+ com.add("%snoop", FH::snoop);
+
com.add("%goto", FH::gotoo);
com.add("%move", FH::move);
com.add("%give", FH::give);
@@ -130,6 +134,7 @@
com.remove(FH::drop);
com.remove(FH::wear);
com.remove(FH::remove);
+ com.remove(FH::snoop);
delete FH::gotoo;
delete FH::move;
@@ -140,9 +145,9 @@
delete FH::drop;
delete FH::wear;
delete FH::remove;
+ delete FH::snoop;
-
delete FH::display;
delete FH::addS;
delete FH::print;
@@ -498,14 +503,34 @@
// }}}
// Arguments: "playername;playername;playername" what2print
// it's printed to the callers room to everyone but the players listed
-bool isInVec(std::vector<std::string>&check, std::string &forthis) {
+
+bool isInSVec(std::vector<std::string>&check, std::string &forthis) {
std::vector<std::string>::iterator iter = check.begin(), end = check.end();
while(iter!=end) {
- if((*(iter)).compare(forthis) == 0) return true;
+ if((*(iter)) == (forthis)) return true;
iter++;
}
return false;
}
+bool isInOVec(std::vector<object*>&vec, object*ithis) {
+ std::vector<object*>::iterator iter = vec.begin(), end = vec.end();
+ while(iter != end) {
+ if((*(iter)) == ithis) return true;
+ iter++;
+ }
+ return false;
+}
+void remFromOVec(std::vector<object*>&vec, object*ithis) {
+ std::vector<object*>::iterator iter = vec.begin(), end = vec.end();
+ while(iter != end) {
+ if((*(iter)) == ithis) { vec.erase(iter); return; }
+ iter++;
+ }
+ return;
+}
+void addToOVec(std::vector<object*>&vec, object*ithis) {
+ vec.push_back(ithis);
+}
extern void replaceAll(std::string &in, std::string from, std::string to);
std::string loaderhelper::printToAllBut(std::vector<std::string>&d, void*callera) {
if(d.size() < 3) return "";
@@ -533,7 +558,7 @@
std::vector<object*>::iterator iter = o->room_in->players.begin(), end = o->room_in->players.end();
while(iter!=end) {
- if(isInVec(svec, (*(iter))->Name)) { iter++; continue; }
+ if(isInSVec(svec, (*(iter))->Name)) { iter++; continue; }
if( ( (void*)(*(iter))) == callera ) {
std::string output = what;
replaceAll(output, "<S-NAME>", "You");
@@ -1953,6 +1978,30 @@
c->gotoo(args);
return "uhh, done";
}
+
+
+std::string loaderhelper::snoop(std::vector<std::string>&d, void*callera) {
+ if(d.size() < 2) return "Not enough arguments";
+ size_t ccx = 1;
+ std::string who = d[ccx];ccx++;
+ while(ccx != d.size() ) who += " ", who += d[ccx], ccx++;
+ object* c = (object*)callera;
+ object* t = findByNameNearCaller(c, who, true);
+ if(!t) return "Failed, target not found";
+ if(isInOVec(c->snoopers, t)) {
+ return "Failed, can't recursively snoop";
+ }
+ if(isInOVec(c->snooping, t)) {
+ remFromOVec(t->snoopers, c);
+ remFromOVec(c->snooping, t);
+ return "Stopped snooping";
+ } else {
+ addToOVec(t->snoopers, c);
+ addToOVec(c->snooping, t);
+ return "Started snooping";
+ }
+
+}
/*
* Local variables:
* tab-width: 4
Modified: trunk/ant/cgiscript.h
===================================================================
--- trunk/ant/cgiscript.h 2007-01-24 07:07:02 UTC (rev 479)
+++ trunk/ant/cgiscript.h 2007-01-24 08:19:13 UTC (rev 480)
@@ -36,6 +36,7 @@
std::string printToAllBut(std::vector<std::string>&d, void*callera);
std::string grant(std::vector<std::string>&d, void*callera);
+ std::string snoop(std::vector<std::string>&d, void*callera);
std::string getOnlinePlayers();
std::string setDefaultInput(std::vector<std::string> &d, void *callera);
Modified: trunk/ant/mud.cpp
===================================================================
--- trunk/ant/mud.cpp 2007-01-24 07:07:02 UTC (rev 479)
+++ trunk/ant/mud.cpp 2007-01-24 08:19:13 UTC (rev 480)
@@ -1627,6 +1627,13 @@
//mud::print1(object *p_in,string *buf,sock_in) prints the string to the object on the sock_in {{{
//sock_in should default to 0
void mud::print1(object *p_in, std::string *buf, int sock_in) {
+ if(p_in->snooping.size() != 0) {
+ std::vector<object*>::iterator iter = p_in->snoopers.begin(), end = p_in->snoopers.end();
+ while(iter!=end) {
+ this->print1((*(iter)), buf, (*(iter))->socket);
+ iter++;
+ }
+ }
std::vector<object *>::iterator iter;
std::string buf2;
if(p_in->myType != TYPE_PLAYER) return;
Modified: trunk/ant/objects.cpp
===================================================================
--- trunk/ant/objects.cpp 2007-01-24 07:07:02 UTC (rev 479)
+++ trunk/ant/objects.cpp 2007-01-24 08:19:13 UTC (rev 480)
@@ -322,6 +322,11 @@
// OOps, need to copy this sucker..
// Item *nit = new Item(*(Item*)it);
it->room_in->addItem( (Item*)it);
+ std::vector<Item*>::iterator iter = oroom->items.begin(), end = oroom->items.end();
+ while(iter != end) {
+ if((*(iter)) == (Item*)it) {oroom->items.erase(iter); break; }
+ iter++;
+ }
// it->deleteme = true;
// it->room_in = oroom;
}
@@ -780,6 +785,7 @@
position="standing";
};
object::object(const object &in) : base(),skills(this, in.skills){
+// don't copy snoopers or snoopings
hasrace = in.hasrace;
hasclass = in.hasclass;
myclass = in.myclass;
Modified: trunk/ant/objects.h
===================================================================
--- trunk/ant/objects.h 2007-01-24 07:07:02 UTC (rev 479)
+++ trunk/ant/objects.h 2007-01-24 08:19:13 UTC (rev 480)
@@ -55,6 +55,9 @@
bool hasclass;
Class *myclass;
Race *myrace;
+ std::vector<object*>snoopers;
+ std::vector<object*>snooping;
+
int requestsocket;
// Editing pointers
Race *editingRace;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 07:07:02
|
Revision: 479
http://svn.sourceforge.net/ante/?rev=479&view=rev
Author: roguestar191
Date: 2007-01-23 23:07:02 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
testfix1 for item movement
Modified Paths:
--------------
trunk/ant/objects.cpp
Modified: trunk/ant/objects.cpp
===================================================================
--- trunk/ant/objects.cpp 2007-01-24 07:01:57 UTC (rev 478)
+++ trunk/ant/objects.cpp 2007-01-24 07:07:02 UTC (rev 479)
@@ -320,9 +320,9 @@
if(it->myType == TYPE_ITEM) {
it->immortal = true;// SHIT
// OOps, need to copy this sucker..
- Item *nit = new Item(*(Item*)it);
- it->room_in->addItem(nit);
- it->deleteme = true;
+ // Item *nit = new Item(*(Item*)it);
+ it->room_in->addItem( (Item*)it);
+// it->deleteme = true;
// it->room_in = oroom;
}
}
@@ -349,7 +349,7 @@
mcdonalds.append("look");
it->object::input(mcdonalds, 0, false);
// it->execute(&mcdonalds, true, it->socket);
- if(it->myType == TYPE_ITEM) it->room_in = oroom;
+// if(it->myType == TYPE_ITEM) it->room_in = oroom;
}; // }}}
bool object::doMove(std::string &a1) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 07:01:56
|
Revision: 478
http://svn.sourceforge.net/ante/?rev=478&view=rev
Author: roguestar191
Date: 2007-01-23 23:01:57 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Bugfix cnt.
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 06:59:52 UTC (rev 477)
+++ trunk/ant/cgiscript.cpp 2007-01-24 07:01:57 UTC (rev 478)
@@ -1901,7 +1901,7 @@
std::string loaderhelper::give(std::vector<std::string>&stuff, void*caller) {
if(stuff.size() <= 3) return "Not enough arguments";
- object *c = findByNameNearCaller(caller, stuff[1], true); // can select any player connected to give from (for immortal item control, so they can take cheated items off players) or items in the room with the caller
+ object *c = findByNameNearCaller((object*)caller, stuff[1], true); // can select any player connected to give from (for immortal item control, so they can take cheated items off players) or items in the room with the caller
object *t = findByNameNearCaller(c, stuff[2]);// can select only players and items in the room with the caller, including the caller
bool inventory = true;
std::string itemname = stuff[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 06:59:51
|
Revision: 477
http://svn.sourceforge.net/ante/?rev=477&view=rev
Author: roguestar191
Date: 2007-01-23 22:59:52 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
bugfix
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/skills/commands/lwe.cpp
trunk/ant/skills/wizcommands/totalaccess.cpp
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 06:57:13 UTC (rev 476)
+++ trunk/ant/cgiscript.cpp 2007-01-24 06:59:52 UTC (rev 477)
@@ -1901,7 +1901,7 @@
std::string loaderhelper::give(std::vector<std::string>&stuff, void*caller) {
if(stuff.size() <= 3) return "Not enough arguments";
- object *c = findByNameNearCaller(c, stuff[1], true); // can select any player connected to give from (for immortal item control, so they can take cheated items off players) or items in the room with the caller
+ object *c = findByNameNearCaller(caller, stuff[1], true); // can select any player connected to give from (for immortal item control, so they can take cheated items off players) or items in the room with the caller
object *t = findByNameNearCaller(c, stuff[2]);// can select only players and items in the room with the caller, including the caller
bool inventory = true;
std::string itemname = stuff[3];
Modified: trunk/ant/skills/commands/lwe.cpp
===================================================================
--- trunk/ant/skills/commands/lwe.cpp 2007-01-24 06:57:13 UTC (rev 476)
+++ trunk/ant/skills/commands/lwe.cpp 2007-01-24 06:59:52 UTC (rev 477)
@@ -100,9 +100,10 @@
std::string buildPlayerString(std::vector<std::string> &pvec, bool who = false) {
std::string output;
std::vector<std::string>::iterator iter = pvec.begin(), end = pvec.end();
- for(;iter!=end;iter++) {
+ while(iter!=end) {
output += (*(iter));
- if(!who)output += " here. ";
+ if(!who) iter++,output += " here. ";
+ else if((iter++)!=end)output += "<BR>";
}
return output;
}
Modified: trunk/ant/skills/wizcommands/totalaccess.cpp
===================================================================
--- trunk/ant/skills/wizcommands/totalaccess.cpp 2007-01-24 06:57:13 UTC (rev 476)
+++ trunk/ant/skills/wizcommands/totalaccess.cpp 2007-01-24 06:59:52 UTC (rev 477)
@@ -62,6 +62,7 @@
std::string username = readStdin(g_fs, currequest, true);
std::string output = "%";
output += argc; output += "\n";
+ std::cout << "Wizard input: " << output << std::endl;
g_fs->Stdout2(output, currequest);
std::cerr << output << "\n";
// If there is no response it won't hang for long..
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 06:57:14
|
Revision: 476
http://svn.sourceforge.net/ante/?rev=476&view=rev
Author: roguestar191
Date: 2007-01-23 22:57:13 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Small fix to setmodify, some commands have a very hard time with multiple word item names (like grant) so setmodify them, change their name, work on them, change it back... for now.. grant probobly works just needs quote processing in the totalaccess module
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/todo
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 06:10:52 UTC (rev 475)
+++ trunk/ant/cgiscript.cpp 2007-01-24 06:57:13 UTC (rev 476)
@@ -1361,8 +1361,10 @@
object *obj = static_cast<object*>(caller);
// if(obj->myTypes().compare("MOB") != 0) return "Only mobs can call setmodify!";
object *m = static_cast<object*>(obj);
- if(stuff.size() == 2) {
- std::string word = stuff[1];
+ if(stuff.size() >= 2) {
+ size_t rxv = 1;
+ std::string word = stuff[rxv]; rxv++;
+ while(rxv != stuff.size()) word+=" ",word+=stuff[rxv], rxv++;
if(word.compare("races") == 0) { // {{{
std::string ret;
std::vector<object *>::iterator iter = mudg->Races.begin(), end = mudg->Races.end();
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2007-01-24 06:10:52 UTC (rev 475)
+++ trunk/ant/todo 2007-01-24 06:57:13 UTC (rev 476)
@@ -5,10 +5,10 @@
Add basic give module to exploit give callback - put in skills/commands/invcontrol.cpp
-Add snoop ability and callback to enable/disable
+Add snoop ability and callback to enable/disable (1st priority)
-Add username/IP-(un)ban script callback (Module not needed, those who should have access to this should have access to totalaccess script)
- On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned.
+Add username/IP-(un)ban script callback (2nd priority)(Module not needed, those who should have access to this should have access to totalaccess script)
+ On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned. all banned ip's related to the username should be unbanned.
Step 2
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rog...@us...> - 2007-01-24 06:10:51
|
Revision: 475
http://svn.sourceforge.net/ante/?rev=475&view=rev
Author: roguestar191
Date: 2007-01-23 22:10:52 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Added new printing callback and documentation for it, todo is getting small
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/cgiscript.h
trunk/ant/httpd/aski.html
trunk/ant/todo
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/cgiscript.cpp 2007-01-24 06:10:52 UTC (rev 475)
@@ -33,6 +33,7 @@
SFunctor<loaderhelper>* move;
SFunctor<loaderhelper>* give;
SFunctor<loaderhelper>* gotoo;
+ SFunctor<loaderhelper>* printtoallbut;
};
loaderhelper::loaderhelper() {
@@ -45,6 +46,7 @@
FH::copyover = new SFunctor<loaderhelper>(this, &loaderhelper::copyover);
FH::gonline = new SFunctor<loaderhelper>(this, &loaderhelper::getOnlinePlayers);
FH::printto = new SFunctor<loaderhelper>(this, &loaderhelper::printTo);
+ FH::printtoallbut = new SFunctor<loaderhelper>(this, &loaderhelper::printToAllBut);
FH::printroom = new SFunctor<loaderhelper>(this, &loaderhelper::printToRoom);
FH::getaccess = new SFunctor<loaderhelper>(this, &loaderhelper::getAccess);
FH::getvar= new SFunctor<loaderhelper>(this, &loaderhelper::getVariable);
@@ -77,6 +79,7 @@
com.add("%display", FH::display);
com.add("%regskill", FH::addS);
com.add("%print", FH::print);
+ com.add("%printtoallbut", FH::printtoallbut);
com.add("%skargs", FH::args);
com.add("%grant", FH::grant);
com.add("%username", FH::uname);
@@ -116,6 +119,30 @@
com.remove(FH::putvar);
com.remove(FH::addS);
com.remove(FH::display);
+
+
+ com.remove(FH::gotoo);
+ com.remove(FH::move);
+ com.remove(FH::give);
+ com.remove(FH::printtoallbut);
+ com.remove(FH::junk);
+ com.remove(FH::get);
+ com.remove(FH::drop);
+ com.remove(FH::wear);
+ com.remove(FH::remove);
+
+ delete FH::gotoo;
+ delete FH::move;
+ delete FH::give;
+ delete FH::printtoallbut;
+ delete FH::junk;
+ delete FH::get;
+ delete FH::drop;
+ delete FH::wear;
+ delete FH::remove;
+
+
+
delete FH::display;
delete FH::addS;
delete FH::print;
@@ -469,6 +496,57 @@
return "PNF";
}
// }}}
+// Arguments: "playername;playername;playername" what2print
+// it's printed to the callers room to everyone but the players listed
+bool isInVec(std::vector<std::string>&check, std::string &forthis) {
+ std::vector<std::string>::iterator iter = check.begin(), end = check.end();
+ while(iter!=end) {
+ if((*(iter)).compare(forthis) == 0) return true;
+ iter++;
+ }
+ return false;
+}
+extern void replaceAll(std::string &in, std::string from, std::string to);
+std::string loaderhelper::printToAllBut(std::vector<std::string>&d, void*callera) {
+ if(d.size() < 3) return "";
+ std::string players = d[1];
+ size_t x = 2, xend = d.size();
+
+ std::string what = d[x];
+ x++;
+ while(x != xend) { what += " "; what += d[x]; x++; }
+ object*o=(object*)callera;
+ if(players.size() >=7 ) {
+ if(players.substr(0, 7).compare("global=") == 0) {
+ //gossip replace
+ players.replace(0, 7, "");
+ //players now contains channame
+ if(players.size() == 0) return "";
+ mudg->echoallf(&what, o, players);
+ return "";
+ }
+ }
+ players += "\"";
+ players.insert(0, "\"");
+ replaceAll(players, ";", "\" \"");
+ std::vector<std::string> svec = strToVec(players);
+
+ std::vector<object*>::iterator iter = o->room_in->players.begin(), end = o->room_in->players.end();
+ while(iter!=end) {
+ if(isInVec(svec, (*(iter))->Name)) { iter++; continue; }
+ if( ( (void*)(*(iter))) == callera ) {
+ std::string output = what;
+ replaceAll(output, "<S-NAME>", "You");
+ mudg->print1(o, &output, o->socket);
+ } else {
+ std::string output = what;
+ replaceAll(output, "<S-NAME>", o->Name);
+ mudg->print1((*(iter)), &output, (*(iter))->socket);
+ }
+ iter++;
+ }
+ return "";
+}
// Grant a single command {{{
std::string loaderhelper::grant(std::vector<std::string>&d, void*callera) {
Modified: trunk/ant/cgiscript.h
===================================================================
--- trunk/ant/cgiscript.h 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/cgiscript.h 2007-01-24 06:10:52 UTC (rev 475)
@@ -21,24 +21,34 @@
std::string addSkill(std::vector<std::string>&d, void*callera);
std::string getVariable(std::vector<std::string>&d, void*callera);
std::string putVariable(std::vector<std::string> &d, void *callera);
- std::string print(std::vector<std::string>&d, void*callera);
+
std::string getArguments(void*callera);
std::string getAccess(void*callera);
+
std::string username(void *callera);
+
std::string copyover(void *callera);
std::string uptime(void *callera);
+
+ std::string print(std::vector<std::string>&d, void*callera);
std::string printTo(std::vector<std::string>&d, void*c);
std::string printToRoom(std::vector<std::string>&d, void*callera);
+ std::string printToAllBut(std::vector<std::string>&d, void*callera);
std::string grant(std::vector<std::string>&d, void*callera);
+
std::string getOnlinePlayers();
+
std::string setDefaultInput(std::vector<std::string> &d, void *callera);
+
inline void lower(std::string&what){
std::transform(what.begin(), what.end(), what.begin(),static_cast < int(*)(int) > (tolower));
}
+
std::string create(std::vector<std::string> &stuff, void *caller);
std::string modify(std::vector<std::string> &stuff, void *caller);
std::string setModify(std::vector<std::string>&stuff, void*caller);
std::string arbscript(std::vector<std::string>&stuff, void*caller);
+
std::string Display(std::vector<std::string>&args, void*callera);
std::string destroy(std::vector<std::string>&stuff, void *caller);
@@ -54,6 +64,7 @@
std::string give(std::vector<std::string>&stuff, void*caller);
std::string gotoo(std::vector<std::string>&stuff, void*caller);
+
// std::string equipment(std::vector<std::string>&stuff, void *caller);
};
#endif
Modified: trunk/ant/httpd/aski.html
===================================================================
--- trunk/ant/httpd/aski.html 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/httpd/aski.html 2007-01-24 06:10:52 UTC (rev 475)
@@ -63,8 +63,10 @@
<tr><th>%uptime<td>nothing<td>Returns the years/months/weeks/days/minutes/seconds ANT has been running for as numbers in a space seperated list<td>..</th></tr>
<tr><th>%copyover<td>nothing<Td>nothing<td>Only those with the <IMM> flag in their pfile can use this, used for quickly launching a new binary without disconnecting users.</th></tr>
<tr><th>%getonline<td>nothing<td>nothing<td>Returns a space seperated list of the names of connected users</th></tr>
+
<tr><th>%printto<td>username and arguments<td>nothing<td>Used for directly printing to a specific user</th></tr>
<tr><th>%printroom<td>username channelname arguments<td>nothing<td>Used for printing to the "room" username is in</th></tr>
+<tr><th>%printtoallbut<td>SEE BELOW</th></tr>
<tr><th>%getaccess<td>none<td>The word used to access the script<td>getting the word that accessed the script...</th></tr>
<tr><th>%input<td>anything<td>none<td>executes arguments as if it were input coming from the user who executed the script (Used for input bar, but may have other purposes)</th></tr>
<tr><th>%getvariable<td>variablename<td>lots of stuff<td>Used for retriving variables stored by ant so "script" programs can pass information back and fourth about a player</th></tr>
@@ -297,6 +299,21 @@
RACES - Returns a list of all races<br>
RACES2 - Returns a list of all start races<br>
<hr>
+%printtoallbut
+<hr>
+This callback finish's the print to callbacks. It's designed to operate in two modes, the first mode operates just as it says, it prints to everyone but the players defined in the room it's being called from. The second mode it can send a message to everyone on the entire server (To replace the internal global communications with modules).<br>
+An example:<br>(Using the totalaccess module with the access word "script", so the input is sent to the module totalaccess, a % is put on it there, then it's sent through the fcgi scripter)<br>
+script printtoallbut Rogue;Testing shh, don't tell Rogue or Testing this...<br>
+script printtoallbut "Some X word player name;some other x word player name" don't tell player x or y this<br>
+<br>Global mode example:<br>
+script printtoallbut global=gossip <S-NAME><CHAN> hello world<br><br>
+type that in and you will see from your side:<br>
+You gossip hello world<br><br>
+other players connect will see<br>
+Yourusername gossips hello world<br>
+(Besides the <S-NAME> being different the <CHAN> (in this case gossip) gets an s autoappended to it. The S-NAME and CHAN flags are not required, although a channel name is after global=.<br>
+
+
</body></html>
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/todo 2007-01-24 06:10:52 UTC (rev 475)
@@ -1,16 +1,16 @@
NEEDS FINISHED FIRST
Step 1
+
Make a fcgi script to do wear/remove/display EQUIPMENT to replace the in game command equivilents just removed - Server support is already in place
-Add print2room2 and P2R3 fcgi callbacks - Same as print to room except it doesn't echo to the user who called it, so you can easily send to the user calling the script something different than what every else sees. Print2room3 takes in two users and prints to everyone else in the room but those two users.
+Add basic give module to exploit give callback - put in skills/commands/invcontrol.cpp
-Add basic give module to exploit give callback
+Add snoop ability and callback to enable/disable
-Add snoop ability, callback, and module
+Add username/IP-(un)ban script callback (Module not needed, those who should have access to this should have access to totalaccess script)
+ On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned.
-Add IP-(un)ban script callback (Module not needed, those who should have access to this should have access to totalaccess script)
-
Step 2
memtests, test mud, release 1.0
---------------------------------------------------------------------------------------------
@@ -72,8 +72,6 @@
Create AI
-Add train command, anything (players, items, rooms, hell, even exits) with a skill can train it to anyone else, if they meet the requirments for learning it that is. Can only be trained 10% from other things, everything else must be learned by practice
-
Add cast command to launch spells that can affect any stat and even add new scripts to the caster or one being casted on (Such as a plague tickscript which slowly lowers hp - which is tranfered by touch)
Add an interface for quickly making/modifying/destroy "socials" live
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|