|
Galactic Bloodshed
|
#include "gb/GB_server.h"#include <arpa/inet.h>#include <fcntl.h>#include <netinet/in.h>#include <sys/select.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/time.h>#include <unistd.h>#include <boost/algorithm/string.hpp>#include <boost/format.hpp>#include <cctype>#include <cerrno>#include <csignal>#include <cstdio>#include <cstdlib>#include <cstring>#include <ctime>#include <deque>#include <exception>#include <iostream>#include <sstream>#include <string>#include <unordered_map>#include <vector>#include "gb/buffers.h"#include "gb/build.h"#include "gb/commands/analysis.h"#include "gb/commands/autoreport.h"#include "gb/commands/capital.h"#include "gb/commands/capture.h"#include "gb/commands/colonies.h"#include "gb/commands/dock.h"#include "gb/commands/enslave.h"#include "gb/commands/examine.h"#include "gb/commands/fix.h"#include "gb/commands/governors.h"#include "gb/commands/grant.h"#include "gb/commands/highlight.h"#include "gb/commands/orbit.h"#include "gb/commands/production.h"#include "gb/commands/relation.h"#include "gb/commands/rst.h"#include "gb/commands/scrap.h"#include "gb/commands/tech_status.h"#include "gb/commands/toggle.h"#include "gb/commands/toxicity.h"#include "gb/commands/zoom.h"#include "gb/config.h"#include "gb/cs.h"#include "gb/declare.h"#include "gb/defense.h"#include "gb/dissolve.h"#include "gb/doturncmd.h"#include "gb/explore.h"#include "gb/files.h"#include "gb/files_shl.h"#include "gb/fire.h"#include "gb/fuel.h"#include "gb/globals.h"#include "gb/land.h"#include "gb/launch.h"#include "gb/load.h"#include "gb/map.h"#include "gb/mobiliz.h"#include "gb/move.h"#include "gb/name.h"#include "gb/order.h"#include "gb/power.h"#include "gb/powercmd.h"#include "gb/prof.h"#include "gb/races.h"#include "gb/ships.h"#include "gb/shlmisc.h"#include "gb/sql/sql.h"#include "gb/survey.h"#include "gb/tech.h"#include "gb/tele.h"#include "gb/tweakables.h"#include "gb/utils/rand.h"#include "gb/vars.h"#include "gb/victory.h"Go to the source code of this file.
Classes | |
| class | TextBlock |
| class | DescriptorData |
Namespaces | |
| anonymous_namespace{GB_server.cc} | |
Macros | |
| #define | MAX_COMMAND_LEN 512 |
Typedefs | |
| using | CommandFunction = void(*)(const command_t &, GameObj &) |
Functions | |
| static double | GetComplexity (const ShipType) |
| static void | set_signals () |
| static void | queue_string (DescriptorData &, const std::string &) |
| static void | add_to_queue (std::deque< TextBlock > &, const std::string &) |
| static void | help (const command_t &, GameObj &) |
| static void | process_command (DescriptorData &, const command_t &argv) |
| static int | shovechars (int, Db &) |
| static void | GB_time (const command_t &, GameObj &) |
| static void | GB_schedule (const command_t &, GameObj &) |
| static void | do_update (bool=false) |
| static void | do_segment (int, int) |
| static int | make_socket (int) |
| static void | shutdownsock (DescriptorData &) |
| static void | load_race_data () |
| static void | load_star_data () |
| static void | make_nonblocking (int) |
| static struct timeval | update_quotas (struct timeval, struct timeval) |
| static int | process_output (DescriptorData &) |
| static void | welcome_user (DescriptorData &) |
| static int | flush_queue (std::deque< TextBlock > &, int) |
| static void | process_commands () |
| static int | do_command (DescriptorData &, const char *) |
| static void | goodbye_user (DescriptorData &) |
| static void | dump_users (DescriptorData &) |
| static void | close_sockets (int) |
| static int | process_input (DescriptorData &) |
| static void | force_output () |
| static void | help_user (GameObj &) |
| static int | msec_diff (struct timeval, struct timeval) |
| static struct timeval | msec_add (struct timeval, int) |
| static void | save_command (DescriptorData &, const std::string &) |
| static void | strstr_to_queue (DescriptorData &) |
| static int | ShipCompare (const void *, const void *) |
| static void | SortShips () |
| static void | check_connect (DescriptorData &, const char *) |
| static struct timeval | timeval_sub (struct timeval now, struct timeval then) |
| std::tuple< std::string, std::string > | anonymous_namespace{GB_server.cc}::parse_connect (const std::string &message) |
| Parse input string for player and governor password. More... | |
| std::string | anonymous_namespace{GB_server.cc}::do_prompt (DescriptorData &d) |
| Create a prompt that shows the current AP and location of the player. More... | |
| int | main (int argc, char **argv) |
| void | notify_race (const player_t race, const std::string &message) |
| bool | notify (const player_t race, const governor_t gov, const std::string &message) |
| void | d_think (const player_t Playernum, const governor_t Governor, const std::string &message) |
| void | d_broadcast (const player_t Playernum, const governor_t Governor, const std::string &message) |
| void | d_shout (const player_t Playernum, const governor_t Governor, const std::string &message) |
| void | d_announce (const player_t Playernum, const governor_t Governor, const starnum_t star, const std::string &message) |
| void | do_next_thing () |
| void | kill_ship (int Playernum, Ship *ship) |
| void | compute_power_blocks () |
| void | insert_sh_univ (struct stardata *sdata, Ship *s) |
| void | insert_sh_star (startype *star, Ship *s) |
| void | insert_sh_plan (Planet *pl, Ship *s) |
| void | insert_sh_ship (Ship *s, Ship *s2) |
| void | remove_sh_star (Ship &s) |
| Remove a ship from the list of ships orbiting the star. More... | |
| void | remove_sh_plan (Ship &s) |
| Remove a ship from the list of ships orbiting the planet. More... | |
| void | remove_sh_ship (Ship &s, Ship &host) |
| Remove a ship from the list of ships in the ship. More... | |
| void | warn_race (const player_t who, const std::string &message) |
| void | warn (const player_t who, const governor_t governor, const std::string &message) |
| void | warn_star (const player_t a, const starnum_t star, const std::string &message) |
| void | notify_star (const player_t a, const governor_t g, const starnum_t star, const std::string &message) |
| void | adjust_morale (Race *winner, racetype *loser, int amount) |
Variables | |
| static int | shutdown_flag = 0 |
| static int | update_flag = 0 |
| static time_t | last_update_time |
| static time_t | last_segment_time |
| static unsigned int | nupdates_done |
| static char | start_buf [128] |
| static char | update_buf [128] |
| static char | segment_buf [128] |
| static std::list< DescriptorData > | descriptor_list |
| static const std::unordered_map< std::string, CommandFunction > | commands |
| #define MAX_COMMAND_LEN 512 |
Definition at line 199 of file GB_server.cc.
| using CommandFunction = void (*)(const command_t &, GameObj &) |
Definition at line 203 of file GB_server.cc.
|
static |
Definition at line 793 of file GB_server.cc.
Definition at line 1681 of file GB_server.cc.
|
static |
Definition at line 1026 of file GB_server.cc.
|
static |
Definition at line 1217 of file GB_server.cc.
| void compute_power_blocks | ( | ) |
Definition at line 1469 of file GB_server.cc.
| void d_announce | ( | const player_t | Playernum, |
| const governor_t | Governor, | ||
| const starnum_t | star, | ||
| const std::string & | message | ||
| ) |
Definition at line 596 of file GB_server.cc.
| void d_broadcast | ( | const player_t | Playernum, |
| const governor_t | Governor, | ||
| const std::string & | message | ||
| ) |
Definition at line 577 of file GB_server.cc.
| void d_shout | ( | const player_t | Playernum, |
| const governor_t | Governor, | ||
| const std::string & | message | ||
| ) |
Definition at line 587 of file GB_server.cc.
| void d_think | ( | const player_t | Playernum, |
| const governor_t | Governor, | ||
| const std::string & | message | ||
| ) |
Definition at line 567 of file GB_server.cc.
|
static |
Main processing loop. When command strings are sent from the client, they are processed here. Responses are sent back to the client via notify.
Definition at line 986 of file GB_server.cc.
| void do_next_thing | ( | ) |
Definition at line 728 of file GB_server.cc.
|
static |
Definition at line 1164 of file GB_server.cc.
|
static |
Definition at line 1092 of file GB_server.cc.
|
static |
Definition at line 1230 of file GB_server.cc.
|
static |
Definition at line 799 of file GB_server.cc.
|
static |
Definition at line 859 of file GB_server.cc.
Definition at line 1353 of file GB_server.cc.
Definition at line 1342 of file GB_server.cc.
|
static |
Definition at line 1615 of file GB_server.cc.
|
static |
Definition at line 913 of file GB_server.cc.
Definition at line 1372 of file GB_server.cc.
|
static |
Definition at line 895 of file GB_server.cc.
Definition at line 1516 of file GB_server.cc.
Definition at line 1522 of file GB_server.cc.
Definition at line 1510 of file GB_server.cc.
Definition at line 1504 of file GB_server.cc.
| void kill_ship | ( | int | Playernum, |
| Ship * | ship | ||
| ) |
Definition at line 1398 of file GB_server.cc.
|
static |
Definition at line 1296 of file GB_server.cc.
|
static |
Definition at line 1310 of file GB_server.cc.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 445 of file GB_server.cc.
|
static |
Definition at line 864 of file GB_server.cc.
|
static |
Definition at line 735 of file GB_server.cc.
|
static |
Definition at line 623 of file GB_server.cc.
|
static |
Definition at line 618 of file GB_server.cc.
| bool notify | ( | const player_t | race, |
| const governor_t | gov, | ||
| const std::string & | message | ||
| ) |
Definition at line 555 of file GB_server.cc.
| void notify_race | ( | const player_t | race, |
| const std::string & | message | ||
| ) |
Definition at line 546 of file GB_server.cc.
| void notify_star | ( | const player_t | a, |
| const governor_t | g, | ||
| const starnum_t | star, | ||
| const std::string & | message | ||
| ) |
Definition at line 1672 of file GB_server.cc.
|
static |
Definition at line 1273 of file GB_server.cc.
|
static |
Definition at line 956 of file GB_server.cc.
|
static |
Definition at line 922 of file GB_server.cc.
|
static |
Definition at line 832 of file GB_server.cc.
|
static |
Definition at line 816 of file GB_server.cc.
| void remove_sh_plan | ( | Ship & | s | ) |
Remove a ship from the list of ships orbiting the planet.
Definition at line 1563 of file GB_server.cc.
Remove a ship from the list of ships in the ship.
Definition at line 1592 of file GB_server.cc.
| void remove_sh_star | ( | Ship & | s | ) |
Remove a ship from the list of ships orbiting the star.
Definition at line 1534 of file GB_server.cc.
|
static |
Definition at line 918 of file GB_server.cc.
|
static |
Definition at line 544 of file GB_server.cc.
|
static |
Definition at line 1644 of file GB_server.cc.
|
static |
Definition at line 633 of file GB_server.cc.
|
static |
Definition at line 781 of file GB_server.cc.
|
static |
Definition at line 1650 of file GB_server.cc.
|
static |
Definition at line 825 of file GB_server.cc.
|
static |
Definition at line 608 of file GB_server.cc.
|
static |
Definition at line 768 of file GB_server.cc.
| void warn | ( | const player_t | who, |
| const governor_t | governor, | ||
| const std::string & | message | ||
| ) |
Definition at line 1660 of file GB_server.cc.
| void warn_race | ( | const player_t | who, |
| const std::string & | message | ||
| ) |
Definition at line 1655 of file GB_server.cc.
Definition at line 1666 of file GB_server.cc.
|
static |
Definition at line 871 of file GB_server.cc.
|
static |
Definition at line 205 of file GB_server.cc.
|
static |
Definition at line 201 of file GB_server.cc.
|
static |
Definition at line 95 of file GB_server.cc.
|
static |
Definition at line 94 of file GB_server.cc.
|
static |
Definition at line 96 of file GB_server.cc.
|
static |
Definition at line 100 of file GB_server.cc.
|
static |
Definition at line 91 of file GB_server.cc.
|
static |
Definition at line 98 of file GB_server.cc.
|
static |
Definition at line 99 of file GB_server.cc.
|
static |
Definition at line 92 of file GB_server.cc.
1.8.13