544 |
ReplyOccupant(r, p, ROOM + SubmitPoll, "\n"); |
ReplyOccupant(r, p, ROOM + SubmitPoll, "\n"); |
545 |
ReplyOccupant(r, p, ROOM + Poll, s); |
ReplyOccupant(r, p, ROOM + Poll, s); |
546 |
s += "\n"; |
s += "\n"; |
547 |
NotifyOccupants(r, ROOM + Poll, s, -1); |
NotifyOccupants(r, ROOM + Poll, s, p); |
548 |
|
|
549 |
return COM_OK; |
return COM_OK; |
550 |
} |
} |
966 |
return COM_OK; |
return COM_OK; |
967 |
} |
} |
968 |
|
|
969 |
|
//not a room-level command, so gov't doesn't apply |
970 |
|
int com_roomlistpolls(int p, param_list param){ |
971 |
|
|
972 |
|
int r = param[0].val.integer; |
973 |
|
|
974 |
|
// lookup room |
975 |
|
std::map<int, room>::iterator rmi = rarray.find(r); |
976 |
|
if(rmi == rarray.end()) return COM_NOSUCHROOM; |
977 |
|
room& rm = rmi->second; |
978 |
|
|
979 |
|
//reply with list of polls |
980 |
|
for(std::map<int, poll>::iterator pi = rm.polls.begin(); |
981 |
|
pi != rm.polls.end(); ++pi) { |
982 |
|
|
983 |
|
std::stringstream ss; |
984 |
|
std::string s; |
985 |
|
|
986 |
|
//poll number |
987 |
|
ss << pi->first; |
988 |
|
s += ss.str(); |
989 |
|
s += " "; |
990 |
|
ss.str(""); |
991 |
|
//duration |
992 |
|
ss << pi->second.duration; |
993 |
|
s += ss.str(); |
994 |
|
s += " "; |
995 |
|
ss.str(""); |
996 |
|
//question |
997 |
|
s += "\""; |
998 |
|
s += pi->second.question; |
999 |
|
s += "\" "; |
1000 |
|
//options |
1001 |
|
for(std::map<int, std::string>::iterator si = pi->second.opts.begin(); |
1002 |
|
si != pi->second.opts.end(); si++) { |
1003 |
|
s += "\""; |
1004 |
|
s += si->second; |
1005 |
|
s += "\" "; |
1006 |
|
} |
1007 |
|
|
1008 |
|
ReplyOccupant(r, p, ROOM + Poll, s); |
1009 |
|
|
1010 |
|
} |
1011 |
|
|
1012 |
|
return COM_OK; |
1013 |
|
} |
1014 |
|
|
1015 |
//For all the game related commands: |
//For all the game related commands: |
1016 |
//Fun to mess with, but let's leave them on |
//Fun to mess with, but let's leave them on |
1017 |
int com_roomlistgames(int p, param_list param) |
int com_roomlistgames(int p, param_list param) |
1131 |
//desc |
//desc |
1132 |
s += i->second.description; |
s += i->second.description; |
1133 |
s += "\n"; |
s += "\n"; |
|
s += "\n"; |
|
1134 |
|
|
1135 |
ReplyOccupant(r, p, ROOM + ListOpenGames, s); |
ReplyOccupant(r, p, ROOM + ListOpenGames, s); |
1136 |
} |
} |