add of WOL quickmatch maps into bnmaps.conf and coded support for using them
This commit is contained in:
parent
f6b2b75145
commit
7af1cd6537
5 changed files with 179 additions and 30 deletions
|
@ -288,3 +288,31 @@ W3XP at2v2v2 Maps\FrozenThrone\(6)RuinsOfStratholme.w3x
|
|||
W3XP at2v2v2 Maps\FrozenThrone\(6)Typhoon.w3x
|
||||
W3XP at2v2v2 Maps\FrozenThrone\(6)UpperKingdom.w3x
|
||||
W3XP at2v2v2 Maps\FrozenThrone\(8)Mur'gulOasis.w3x
|
||||
|
||||
######### COMMAND & CONQUER: RED ALERT 2 ############
|
||||
RAL2 1v1 eb2.map
|
||||
RAL2 1v1 mp02t2.map
|
||||
RAL2 1v1 mp06mw.map
|
||||
RAL2 1v1 mp06t2.map
|
||||
RAL2 1v1 mp08mw.map
|
||||
RAL2 1v1 mp08t2.map
|
||||
RAL2 1v1 mp11t2.map
|
||||
RAL2 1v1 mp14mv.map
|
||||
RAL2 1v1 mp14t2.map
|
||||
RAL2 1v1 mp21s2.map
|
||||
RAL2 1v1 mp24t2.map
|
||||
RAL2 1v1 mp29mw.map
|
||||
RAL2 1v1 mp29u2.map
|
||||
RAL2 1v1 mp31s2.map
|
||||
RAL2 1v1 mp09du.map
|
||||
RAL2 1v1 mp09t3.map
|
||||
RAL2 1v1 mp18s3.map
|
||||
|
||||
######### COMMAND & CONQUER: YURI'S REVENGE #########
|
||||
YURI 1v1 xgrinder.map
|
||||
YURI 1v1 xeb1.map
|
||||
YURI 1v1 xeb1mw.map
|
||||
YURI 1v1 xeb2.map
|
||||
YURI 1v1 xeb3.map
|
||||
YURI 1v1 xeb4.map
|
||||
YURI 1v1 xeb5.map
|
||||
|
|
|
@ -242,13 +242,16 @@ static const char * _get_map_from_prefs(int queue, t_uint32 cur_prefs, t_clientt
|
|||
char *res_maps[32];
|
||||
char clienttag_str[5];
|
||||
|
||||
if (clienttag == CLIENTTAG_WARCRAFT3_UINT)
|
||||
default_map = "Maps\\(8)PlainsOfSnow.w3m";
|
||||
else if (clienttag == CLIENTTAG_WAR3XP_UINT)
|
||||
default_map = "Maps\\(8)PlainsOfSnow.w3m";
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid clienttag : %s", tag_uint_to_str(clienttag_str,clienttag));
|
||||
return "Maps\\(8)PlainsOfSnow.w3m";
|
||||
switch (clienttag) {
|
||||
case CLIENTTAG_WARCRAFT3_UINT:
|
||||
default_map = "Maps\\(8)PlainsOfSnow.w3m";
|
||||
break;
|
||||
case CLIENTTAG_WAR3XP_UINT:
|
||||
default_map = "Maps\\(8)PlainsOfSnow.w3m";
|
||||
break;
|
||||
default:
|
||||
ERROR1("invalid clienttag: %s", tag_uint_to_str(clienttag_str,clienttag));
|
||||
return "Maps\\(8)PlainsOfSnow.w3m";
|
||||
}
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
|
@ -2020,6 +2023,43 @@ extern int handle_anongame_join(t_connection * c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern const char * anongame_get_map_from_prefs(int queue, t_clienttag clienttag)
|
||||
{
|
||||
int i, j = 0;
|
||||
const char *default_map, *selected;
|
||||
char *res_maps[32];
|
||||
char clienttag_str[5];
|
||||
|
||||
switch (clienttag) {
|
||||
case CLIENTTAG_REDALERT2_UINT:
|
||||
default_map = "eb2.map";
|
||||
break;
|
||||
case CLIENTTAG_YURISREV_UINT:
|
||||
default_map = "xgrinder.map";
|
||||
break;
|
||||
default:
|
||||
ERROR1("invalid clienttag: %s", tag_uint_to_str(clienttag_str,clienttag));
|
||||
return "eb2.map";
|
||||
}
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
res_maps[i] = NULL;
|
||||
|
||||
for (i = 0; i < maplists_get_totalmaps_by_queue(clienttag, queue); i++) {
|
||||
res_maps[j++] = maplists_get_map(queue, clienttag, i + 1);
|
||||
}
|
||||
|
||||
i = std::rand() % j;
|
||||
if (res_maps[i])
|
||||
selected = res_maps[i];
|
||||
else
|
||||
selected = default_map;
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got map %s from prefs", selected);
|
||||
return selected;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -130,6 +130,8 @@ extern void anongame_set_joined(t_anongame * a, char joined);
|
|||
extern int handle_w3route_packet(t_connection * c, t_packet const * const packet);
|
||||
extern int handle_anongame_join(t_connection * c);
|
||||
|
||||
/* Currently used by WOL RAL2 and YURI clients*/
|
||||
extern const char * anongame_get_map_from_prefs(int queue, t_clienttag clienttag);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,10 +41,17 @@ namespace bnetd
|
|||
|
||||
static char * maplist_war3[MAXMAPS];
|
||||
static char * maplist_w3xp[MAXMAPS];
|
||||
static char * maplist_ral2[MAXMAPS];
|
||||
static char * maplist_yuri[MAXMAPS];
|
||||
static int number_maps_war3 = 0;
|
||||
static int number_maps_w3xp = 0;
|
||||
static int number_maps_ral2 = 0;
|
||||
static int number_maps_yuri = 0;
|
||||
static char maplists_war3[ANONGAME_TYPES][MAXMAPS_PER_QUEUE+1];
|
||||
static char maplists_w3xp[ANONGAME_TYPES][MAXMAPS_PER_QUEUE+1];
|
||||
static char maplists_ral2[ANONGAME_TYPES][MAXMAPS_PER_QUEUE+1];
|
||||
static char maplists_yuri[ANONGAME_TYPES][MAXMAPS_PER_QUEUE+1];
|
||||
|
||||
|
||||
static int _maplists_type_get_queue(const char * type);
|
||||
static const char * _maplists_queue_get_type(int queue);
|
||||
|
@ -132,6 +139,48 @@ static void _maplists_add_map(t_clienttag clienttag, char * mapname, int queue)
|
|||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
else if (clienttag==CLIENTTAG_REDALERT2_UINT) {
|
||||
for (j = 0; j < number_maps_ral2; j++) {
|
||||
if (std::strcmp(maplist_ral2[j], mapname) == 0) { /* already in list */
|
||||
in_list = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_list)
|
||||
maplist_ral2[number_maps_ral2++] = xstrdup(mapname);
|
||||
|
||||
if (maplists_ral2[queue][0] < MAXMAPS_PER_QUEUE) {
|
||||
maplists_ral2[queue][0]++;
|
||||
maplists_ral2[queue][(int)maplists_ral2[queue][0]] = j;
|
||||
} else {
|
||||
eventlog(eventlog_level_error,__FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
else if (clienttag==CLIENTTAG_YURISREV_UINT) {
|
||||
for (j = 0; j < number_maps_yuri; j++) {
|
||||
if (std::strcmp(maplist_yuri[j], mapname) == 0) { /* already in list */
|
||||
in_list = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_list)
|
||||
maplist_yuri[number_maps_yuri++] = xstrdup(mapname);
|
||||
|
||||
if (maplists_yuri[queue][0] < MAXMAPS_PER_QUEUE) {
|
||||
maplists_yuri[queue][0]++;
|
||||
maplists_yuri[queue][(int)maplists_ral2[queue][0]] = j;
|
||||
} else {
|
||||
eventlog(eventlog_level_error,__FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
else eventlog(eventlog_level_error,__FUNCTION__,"invalid clienttag: %s",tag_uint_to_str(clienttag_str,clienttag));
|
||||
}
|
||||
|
@ -222,12 +271,19 @@ extern int anongame_maplists_create(void)
|
|||
/* used by the MAPS section */
|
||||
extern int maplists_get_totalmaps(t_clienttag clienttag)
|
||||
{
|
||||
if (clienttag==CLIENTTAG_WARCRAFT3_UINT)
|
||||
return number_maps_war3;
|
||||
|
||||
if (clienttag==CLIENTTAG_WAR3XP_UINT)
|
||||
return number_maps_w3xp;
|
||||
|
||||
switch (clienttag) {
|
||||
case CLIENTTAG_WARCRAFT3_UINT:
|
||||
return number_maps_war3;
|
||||
case CLIENTTAG_WAR3XP_UINT:
|
||||
return number_maps_w3xp;
|
||||
case CLIENTTAG_REDALERT2_UINT:
|
||||
return number_maps_ral2;
|
||||
case CLIENTTAG_YURISREV_UINT:
|
||||
return number_maps_yuri;
|
||||
default:
|
||||
ERROR0("Unknown clienttag");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -247,12 +303,19 @@ extern void maplists_add_maps_to_packet(t_packet * packet, t_clienttag clienttag
|
|||
/* used by TYPE section */
|
||||
extern int maplists_get_totalmaps_by_queue(t_clienttag clienttag, int queue)
|
||||
{
|
||||
if (clienttag==CLIENTTAG_WARCRAFT3_UINT)
|
||||
return maplists_war3[queue][0];
|
||||
|
||||
if (clienttag==CLIENTTAG_WAR3XP_UINT)
|
||||
return maplists_w3xp[queue][0];
|
||||
|
||||
switch (clienttag) {
|
||||
case CLIENTTAG_WARCRAFT3_UINT:
|
||||
return maplists_war3[queue][0];
|
||||
case CLIENTTAG_WAR3XP_UINT:
|
||||
return maplists_w3xp[queue][0];
|
||||
case CLIENTTAG_REDALERT2_UINT:
|
||||
return maplists_ral2[queue][0];
|
||||
case CLIENTTAG_YURISREV_UINT:
|
||||
return maplists_yuri[queue][0];
|
||||
default:
|
||||
ERROR0("Unknown clienttag");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -273,12 +336,19 @@ extern void maplists_add_map_info_to_packet(t_packet * rpacket, t_clienttag clie
|
|||
/* used by _get_map_from_prefs() */
|
||||
extern char * maplists_get_map(int queue, t_clienttag clienttag, int mapnumber)
|
||||
{
|
||||
if (clienttag==CLIENTTAG_WARCRAFT3_UINT)
|
||||
return maplist_war3[(int)maplists_war3[queue][mapnumber]];
|
||||
if (clienttag==CLIENTTAG_WAR3XP_UINT)
|
||||
return maplist_w3xp[(int)maplists_w3xp[queue][mapnumber]];
|
||||
|
||||
return NULL;
|
||||
switch (clienttag) {
|
||||
case CLIENTTAG_WARCRAFT3_UINT:
|
||||
return maplist_war3[(int)maplists_war3[queue][mapnumber]];
|
||||
case CLIENTTAG_WAR3XP_UINT:
|
||||
return maplist_w3xp[(int)maplists_w3xp[queue][mapnumber]];
|
||||
case CLIENTTAG_REDALERT2_UINT:
|
||||
return maplist_ral2[(int)maplists_ral2[queue][mapnumber]];
|
||||
case CLIENTTAG_YURISREV_UINT:
|
||||
return maplist_yuri[(int)maplists_yuri[queue][mapnumber]];
|
||||
default:
|
||||
ERROR0("Unknown clienttag");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern void anongame_maplists_destroy()
|
||||
|
@ -290,6 +360,10 @@ extern void anongame_maplists_destroy()
|
|||
xfree((void *)maplist_war3[i]);
|
||||
if (maplist_w3xp[i])
|
||||
xfree((void *)maplist_w3xp[i]);
|
||||
if (maplist_ral2[i])
|
||||
xfree((void *)maplist_ral2[i]);
|
||||
if (maplist_yuri[i])
|
||||
xfree((void *)maplist_yuri[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
#include "common/eventlog.h"
|
||||
#include "common/tag.h"
|
||||
#include "common/list.h"
|
||||
#include "common/anongame_protocol.h"
|
||||
|
||||
#include "irc.h"
|
||||
#include "handle_wol.h"
|
||||
#include "connection.h"
|
||||
#include "channel.h"
|
||||
#include "anongame.h"
|
||||
#include "common/setup_after.h"
|
||||
|
||||
namespace pvpgn
|
||||
|
@ -66,7 +68,7 @@ static const t_wol_anongame_tag_table_row t_wol_anongame_tag_table[] =
|
|||
{ MATCHTAG_COUNTRY , _handle_country_tag },
|
||||
{ MATCHTAG_COLOUR , _handle_colour_tag },
|
||||
|
||||
{ NULL , NULL }
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static int anongame_wol_set_playersetting(t_anongame_wol_player * player, char const * tag, char * param)
|
||||
|
@ -342,6 +344,7 @@ static int anongame_wol_trystart(t_anongame_wol_player const * player1)
|
|||
t_connection * conn_pl1;
|
||||
t_connection * conn_pl2;
|
||||
char const * channelname;
|
||||
const char * mapname;
|
||||
t_clienttag ctag;
|
||||
|
||||
std::memset(temp,0,sizeof(temp));
|
||||
|
@ -379,10 +382,11 @@ static int anongame_wol_trystart(t_anongame_wol_player const * player1)
|
|||
case CLIENTTAG_REDALERT2_UINT:
|
||||
random = rand();
|
||||
if (std::strcmp(channelname , RAL2_CHANNEL_FFA) == 0) {
|
||||
DEBUG0("Generating FFA game for Red Alert 2");
|
||||
mapname = anongame_get_map_from_prefs(ANONGAME_TYPE_1V1, ctag);
|
||||
DEBUG0("Generating SOLO game for Red Alert 2");
|
||||
|
||||
/* We have madatory of game */
|
||||
snprintf(_temp, sizeof(_temp), ":Start %u,0,0,10000,0,1,0,1,1,0,1,x,2,1,165368,eb3.map,1:",random);
|
||||
snprintf(_temp, sizeof(_temp), ":Start %u,0,0,10000,0,1,0,1,1,0,1,x,2,1,165368,%s,1:", random, mapname);
|
||||
std::strcat(temp,_temp);
|
||||
|
||||
/* GameHost informations */
|
||||
|
@ -403,10 +407,11 @@ static int anongame_wol_trystart(t_anongame_wol_player const * player1)
|
|||
random = rand();
|
||||
|
||||
if (std::strcmp(channelname , YURI_CHANNEL_FFA) == 0) {
|
||||
DEBUG0("Generating FFA game for Yuri's Revenge");
|
||||
mapname = anongame_get_map_from_prefs(ANONGAME_TYPE_1V1, ctag);
|
||||
DEBUG0("Generating SOLO game for Yuri's Revenge");
|
||||
|
||||
/* We have madatory of game */
|
||||
snprintf(_temp, sizeof(_temp), ":Start %u,0,0,10000,0,0,1,1,1,0,3,0,x,2,1,163770,xgrinder.map,1:",random);
|
||||
snprintf(_temp, sizeof(_temp), ":Start %u,0,0,10000,0,0,1,1,1,0,3,0,x,2,1,163770,%s,1:", random, mapname);
|
||||
std::strcat(temp,_temp);
|
||||
|
||||
/* GameHost informations */
|
||||
|
|
Loading…
Reference in a new issue