X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=0a0c7580c460bd184622b944a91fb6e14d09b052;hp=88050961f227a372b6fcfdd17d5fc1d509e901a4;hb=2fe0fbc2a34fd4b50081f1829931dea3ca2c4c1c;hpb=57562a0f29074feea1dc01ddf1b1d5e4e6d59730 diff --git a/src/init.c b/src/init.c index 88050961..0a0c7580 100644 --- a/src/init.c +++ b/src/init.c @@ -44,11 +44,11 @@ struct IconFileInfo static int sound_process_id = 0; -static void InitServer(void); static void InitLevelAndPlayerInfo(void); +static void InitNetworkServer(void); static void InitDisplay(void); static void InitSound(void); -static void InitSoundProcess(void); +static void InitSoundServer(void); static void InitWindow(int, char **); static void InitGfx(void); static void LoadGfx(int, struct PictureFileInfo *); @@ -57,11 +57,10 @@ static void InitElementProperties(void); void OpenAll(int argc, char *argv[]) { InitLevelAndPlayerInfo(); - InitServer(); InitCounter(); InitSound(); - InitSoundProcess(); + InitSoundServer(); InitJoystick(); InitRND(NEW_RANDOMIZE); @@ -78,6 +77,8 @@ void OpenAll(int argc, char *argv[]) InitElementProperties(); DrawMainMenu(); + + InitNetworkServer(); } void InitLevelAndPlayerInfo() @@ -91,19 +92,25 @@ void InitLevelAndPlayerInfo() LoadPlayerInfo(PLAYER_LEVEL); /* level specific info */ } -void InitServer() +void InitNetworkServer() { + int nr_wanted; + standalone = FALSE; - networking = !standalone; if (standalone) return; + nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED); + if (!ConnectToServer(server_host, server_port)) Error(ERR_EXIT, "cannot connect to multiplayer server"); SendToServer_Nickname(local_player->alias_name); SendToServer_ProtocolVersion(); + + if (nr_wanted) + SendToServer_NrWanted(nr_wanted); } void InitSound() @@ -154,7 +161,7 @@ void InitSound() } } -void InitSoundProcess() +void InitSoundServer() { if (sound_status==SOUND_OFF) return;