# HG changeset patch # User Medo # Date 1340830339 -7200 # Node ID 6171f0bad318c730a0ccf2c361266eb37033f591 # Parent d1db8aaa8edca727342337083268bb7877a922be frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib files that did not have their license fixed already. diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/cmdlineClient.c --- a/project_files/frontlib/cmdlineClient.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/cmdlineClient.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "frontlib.h" #include "util/logging.h" #include "util/buffer.h" @@ -9,6 +28,7 @@ #include "ipc/mapconn.h" #include "ipc/gameconn.h" #include "net/netconn.h" +#include "base64/base64.h" #include #include @@ -42,7 +62,6 @@ printf("\n"); } - // Destroy the connection object (this will end the "tick" loop below) flib_mapconn_destroy(mapconn); mapconn = NULL; } @@ -51,13 +70,14 @@ flib_log_i("Connection closed. Reason: %i", reason); flib_gameconn_destroy(gameconn); gameconn = NULL; + if(netconn) { + flib_netconn_send_roundfinished(netconn, reason==GAME_END_FINISHED); + } } // Callback function that will be called on error static void handleMapFailure(void *context, const char *errormessage) { flib_log_e("Map rendering failed: %s", errormessage); - - // Destroy the connection object (this will end the "tick" loop below) flib_mapconn_destroy(mapconn); mapconn = NULL; } @@ -73,39 +93,13 @@ static void startEngineGame(int port) { char cmdbuffer[255]; char argbuffer[255]; + char base64PlayerName[255]; + base64_encode(nickname, strlen(nickname), base64PlayerName, sizeof(base64PlayerName)); snprintf(cmdbuffer, 255, "%shwengine.exe", ENGINE_DIR); - snprintf(argbuffer, 255, "%s 1024 768 32 %i 0 0 0 10 10 %s 0 0 TWVkbzQy 0 0 en.txt", CONFIG_DIR, port, DATA_DIR); + snprintf(argbuffer, 255, "%s 1024 768 32 %i 0 0 0 10 10 %s 0 0 %s 0 0 en.txt", CONFIG_DIR, port, DATA_DIR, base64PlayerName); ShellExecute(NULL, NULL, cmdbuffer, argbuffer, NULL, SW_HIDE); } -void testMapPreview() { - // Create a map description and check that there was no error - flib_map *map = flib_map_create_maze("This is the seed value", "Jungle", MAZE_SIZE_SMALL_TUNNELS); - assert(map); - - // Create a new connection to the engine and check that there was no error - flib_mapconn *mapConnection = flib_mapconn_create(map); - assert(mapConnection); - - // We don't need the map description anymore - flib_map_release(map); - map = NULL; - - // Register the callback functions - flib_mapconn_onFailure(mapConnection, &handleMapFailure, &mapConnection); - flib_mapconn_onSuccess(mapConnection, &handleMapGenerated, &mapConnection); - - // Start the engine process and tell it which port the frontlib is listening on - startEngineMap(flib_mapconn_getport(mapConnection)); - - // Usually, flib_mapconn_tick will be called in an event loop that runs several - // times per second. It handles I/O operations and progress, and calls - // callbacks when something interesting happens. - while(mapConnection) { - flib_mapconn_tick(mapConnection); - } -} - void handleNetDisconnect(void *context, int reason, const char *message) { printf("Disconnected: %s", message); flib_netconn_destroy(netconn); @@ -115,21 +109,25 @@ void printRoomList() { const flib_roomlist *roomlist = flib_netconn_get_roomlist(netconn); if(roomlist) { - for(int i=0; iroomCount; i++) { - if(i>0) { - printf(", "); + if(roomlist->roomCount>0) { + for(int i=0; iroomCount; i++) { + if(i>0) { + printf(", "); + } + flib_room *room = roomlist->rooms[i]; + printf("%s", room->name); } - flib_room *room = roomlist->rooms[i]; - printf("%s", room->name); + } else { + puts("Unfortunately, there are no rooms at the moment."); } - puts("\n"); } else { puts("Sorry, due to an error the room list is not available."); } + puts("\n"); } void printTeamList() { - flib_gamesetup *setup = flib_netconn_create_gameSetup(netconn); + flib_gamesetup *setup = flib_netconn_create_gamesetup(netconn); if(setup) { puts("The following teams are in this room:"); for(int i=0; iteamlist->teamCount; i++) { @@ -146,7 +144,7 @@ } void handleNetConnected(void *context) { - printf("You enter a strange house inhabited by dozens of hedgehogs. There are many rooms in here:\n"); + printf("You enter the lobby of a strange house inhabited by hedgehogs. Looking around, you see hallways branching off to these rooms:\n"); printRoomList(); printf("\n\nNow, you can chat by just entering text, or join a room with /join ."); printf(" You can also /quit or let me /describe . Once in a room, you can /add and set yourself /ready. You can also /list the available rooms (in the lobby) or the teams (in a room).\n"); @@ -154,6 +152,9 @@ } void handleChat(void *context, const char *nick, const char *msg) { + if(gameconn) { + flib_gameconn_send_chatmsg(gameconn, nick, msg); + } printf("%s: %s\n", nick, msg); } @@ -212,8 +213,10 @@ } void handleRunGame(void *context) { - flib_gamesetup *gamesetup = flib_netconn_create_gameSetup(netconn); - if(gamesetup) { + flib_gamesetup *gamesetup = flib_netconn_create_gamesetup(netconn); + if(gameconn) { + flib_log_e("Request to start game, but a game is already running."); + } else if(gamesetup) { gameconn = flib_gameconn_create(nickname, gamesetup, true); flib_gameconn_onEngineMessage(gameconn, handleEmFromEngine, NULL); flib_gameconn_onDisconnect(gameconn, onGameDisconnect, NULL); @@ -237,6 +240,9 @@ } void handleMessage(void *context, int type, const char *msg) { + if(gameconn) { + flib_gameconn_send_textmsg(gameconn, 1, msg); + } printf("*** %s\n", msg); } @@ -256,6 +262,8 @@ flib_mapconn_onFailure(mapconn, handleMapFailure, NULL); startEngineMap(flib_mapconn_getport(mapconn)); } + } else if(map->mapgen == MAPGEN_NAMED) { + printf("The map %s has been selected.\n", map->name); } } diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/frontlib.c --- a/project_files/frontlib/frontlib.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/frontlib.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "frontlib.h" #include "util/logging.h" #include diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/frontlib.h --- a/project_files/frontlib/frontlib.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/frontlib.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /* * Public header file for the hedgewars frontent networking library. * diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/hwconsts.c --- a/project_files/frontlib/hwconsts.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/hwconsts.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "hwconsts.h" const uint32_t flib_teamcolor_defaults[] = HW_TEAMCOLOR_ARRAY; diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/gameconn.c --- a/project_files/frontlib/ipc/gameconn.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/gameconn.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "gameconn.h" #include "ipcbase.h" #include "ipcprotocol.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/gameconn.h --- a/project_files/frontlib/ipc/gameconn.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/gameconn.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef GAMECONN_H_ #define GAMECONN_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/ipcbase.c --- a/project_files/frontlib/ipc/ipcbase.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/ipcbase.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "ipcbase.h" #include "../util/logging.h" #include "../util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/ipcbase.h --- a/project_files/frontlib/ipc/ipcbase.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/ipcbase.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,7 +1,25 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /* * Low-level protocol support for the IPC connection to the engine. */ - #ifndef IPCBASE_H_ #define IPCBASE_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/ipcprotocol.c --- a/project_files/frontlib/ipc/ipcprotocol.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/ipcprotocol.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,6 +1,26 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "ipcprotocol.h" #include "../util/util.h" #include "../util/logging.h" +#include "../md5/md5.h" #include #include @@ -161,6 +181,19 @@ || flib_ipc_append_message(vec, "eammreinf %s", set->crateammo); } +static void calculateMd5Hex(const char *in, char out[33]) { + if(!log_badparams_if(!in)) { + md5_state_t md5state; + uint8_t md5bytes[16]; + md5_init(&md5state); + md5_append(&md5state, (unsigned char*)in, strlen(in)); + md5_finish(&md5state, md5bytes); + for(int i=0;iownerName ? team->ownerName : "00000000000000000000000000000000"; + char md5Hex[33]; + calculateMd5Hex(team->ownerName ? team->ownerName : "", md5Hex); if(team->colorIndex<0 || team->colorIndex>=flib_teamcolor_defaults_len) { flib_log_e("Color index out of bounds for team %s: %i", team->name, team->colorIndex); error = true; } else { - error |= flib_ipc_append_message(tempvector, "eaddteam %s %"PRIu32" %s", hash, flib_teamcolor_defaults[team->colorIndex], team->name); + error |= flib_ipc_append_message(tempvector, "eaddteam %s %"PRIu32" %s", md5Hex, flib_teamcolor_defaults[team->colorIndex], team->name); } if(team->remoteDriven) { @@ -215,16 +248,6 @@ return result; } -static bool getGameMod(const flib_cfg *conf, const char *name) { - for(int i=0; imeta->modCount; i++) { - if(!strcmp(conf->meta->mods[i].name, name)) { - return conf->mods[i]; - } - } - flib_log_e("Unable to find game mod %s", name); - return false; -} - int flib_ipc_append_fullconfig(flib_vector *vec, const flib_gamesetup *setup, bool netgame) { int result = -1; flib_vector *tempvector = flib_vector_create(); @@ -242,9 +265,9 @@ } if(setup->gamescheme) { error |= flib_ipc_append_gamescheme(tempvector, setup->gamescheme); - sharedAmmo = getGameMod(setup->gamescheme, "sharedammo"); + sharedAmmo = flib_cfg_get_mod(setup->gamescheme, "sharedammo"); // Shared ammo has priority over per-hog ammo - perHogAmmo = !sharedAmmo && getGameMod(setup->gamescheme, "perhogammo"); + perHogAmmo = !sharedAmmo && flib_cfg_get_mod(setup->gamescheme, "perhogammo"); } if(setup->teamlist->teams && setup->teamlist->teamCount>0) { int *clanColors = flib_calloc(setup->teamlist->teamCount, sizeof(int)); diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/ipcprotocol.h --- a/project_files/frontlib/ipc/ipcprotocol.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/ipcprotocol.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef IPCPROTOCOL_H_ #define IPCPROTOCOL_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/mapconn.c --- a/project_files/frontlib/ipc/mapconn.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/mapconn.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "mapconn.h" #include "ipcbase.h" #include "ipcprotocol.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/ipc/mapconn.h --- a/project_files/frontlib/ipc/mapconn.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/ipc/mapconn.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef IPC_MAPCONN_H_ #define IPC_MAPCONN_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/cfg.c --- a/project_files/frontlib/model/cfg.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/cfg.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "cfg.h" #include "../util/inihelper.h" @@ -194,3 +213,23 @@ flib_cfg_destroy(cfg); } } + +bool flib_cfg_get_mod(flib_cfg *cfg, const char *name) { + for(int i=0; imeta->modCount; i++) { + if(!strcmp(cfg->meta->mods[i].name, name)) { + return cfg->mods[i]; + } + } + flib_log_e("Unable to find game mod %s", name); + return false; +} + +int flib_cfg_get_setting(flib_cfg *cfg, const char *name, int def) { + for(int i=0; imeta->settingCount; i++) { + if(!strcmp(cfg->meta->settings[i].name, name)) { + return cfg->settings[i]; + } + } + flib_log_e("Unable to find game setting %s", name); + return def; +} diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/cfg.h --- a/project_files/frontlib/model/cfg.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/cfg.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Data structures for game scheme information. */ @@ -86,4 +105,14 @@ */ void flib_cfg_release(flib_cfg* cfg); +/** + * Retrieve a mod setting by its name. If the mod is not found, logs an error and returns false. + */ +bool flib_cfg_get_mod(flib_cfg *cfg, const char *name); + +/** + * Retrieve a game setting by its name. If the setting is not found, logs an error and returns def. + */ +int flib_cfg_get_setting(flib_cfg *cfg, const char *name, int def); + #endif /* CFG_H_ */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/gamesetup.c --- a/project_files/frontlib/model/gamesetup.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/gamesetup.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "gamesetup.h" #include diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/gamesetup.h --- a/project_files/frontlib/model/gamesetup.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/gamesetup.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * A complete game configuration that contains all settings for a * local or networked game. diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/map.c --- a/project_files/frontlib/model/map.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/map.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "map.h" #include "../util/inihelper.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/map.h --- a/project_files/frontlib/model/map.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/map.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef MODEL_MAP_H_ #define MODEL_MAP_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/mapcfg.c --- a/project_files/frontlib/model/mapcfg.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/mapcfg.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "mapcfg.h" #include "../util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/mapcfg.h --- a/project_files/frontlib/model/mapcfg.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/mapcfg.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /* * Data structure and functions for accessing the map.cfg of named maps. */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/roomlist.c --- a/project_files/frontlib/model/roomlist.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/roomlist.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "roomlist.h" #include "../util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/roomlist.h --- a/project_files/frontlib/model/roomlist.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/roomlist.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Models the list of rooms on a server for netplay. */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/schemelist.c --- a/project_files/frontlib/model/schemelist.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/schemelist.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "schemelist.h" #include "../util/inihelper.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/schemelist.h --- a/project_files/frontlib/model/schemelist.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/schemelist.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Functions for managing a list of schemes. * This is in here because the scheme config file of the QtFrontend (which we are staying compatble with) contains diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/team.c --- a/project_files/frontlib/model/team.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/team.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "team.h" #include "../util/inihelper.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/team.h --- a/project_files/frontlib/model/team.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/team.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * This file defines a data structure for a hedgewars team. * diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/teamlist.c --- a/project_files/frontlib/model/teamlist.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/teamlist.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "teamlist.h" #include "../util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/teamlist.h --- a/project_files/frontlib/model/teamlist.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/teamlist.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef TEAMLIST_H_ #define TEAMLIST_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/weapon.c --- a/project_files/frontlib/model/weapon.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/weapon.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "weapon.h" #include "../util/inihelper.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/model/weapon.h --- a/project_files/frontlib/model/weapon.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/model/weapon.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef MODEL_WEAPON_H_ #define MODEL_WEAPON_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netbase.c --- a/project_files/frontlib/net/netbase.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netbase.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "netbase.h" #include "../util/buffer.h" #include "../util/logging.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netbase.h --- a/project_files/frontlib/net/netbase.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netbase.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /* * Low-level protocol support for the network connection */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netconn.c --- a/project_files/frontlib/net/netconn.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netconn.c Wed Jun 27 22:52:19 2012 +0200 @@ -175,7 +175,7 @@ } } -flib_gamesetup *flib_netconn_create_gameSetup(flib_netconn *conn) { +flib_gamesetup *flib_netconn_create_gamesetup(flib_netconn *conn) { flib_gamesetup *result = NULL; if(!conn) { flib_log_e("null parameter in flib_netconn_create_gameSetup"); @@ -193,7 +193,7 @@ flib_team *copy = flib_team_copy(conn->teamlist.teams[i]); if(copy) { flib_team_set_weaponset(copy, conn->weaponset); - flib_team_set_health(copy, conn->scheme->settings[2]); // TODO by name + flib_team_set_health(copy, flib_cfg_get_setting(conn->scheme, "health", 100)); flib_teamlist_insert(result->teamlist, copy, result->teamlist->teamCount); } flib_team_release(copy); diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netconn.h --- a/project_files/frontlib/net/netconn.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netconn.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef NETCONN_H_ #define NETCONN_H_ @@ -75,9 +94,9 @@ * Returns NULL if the room state does not contain enough information * for a complete game setup, or if an error occurs. * - * The new gamesetup must be destroyed TODO function for that... + * The new gamesetup must be destroyed with flib_gamesetup_destroy(). */ -flib_gamesetup *flib_netconn_create_gameSetup(flib_netconn *conn); +flib_gamesetup *flib_netconn_create_gamesetup(flib_netconn *conn); /** * quitmsg may be null @@ -87,15 +106,16 @@ /** * Send a teamchat message, forwarded from the engine. Only makes sense ingame. - * The server does not send a reply. TODO figure out details + * The server does not send a reply. In contrast to a Chat message, the server + * automatically converts this into an engine message and passes it on to the other + * clients. */ int flib_netconn_send_teamchat(flib_netconn *conn, const char *msg); /** - * Note: Most other functions in this lib accept UTF-8, but the password needs to be - * sent as latin1 + * Send the password in reply to a password request. */ -int flib_netconn_send_password(flib_netconn *conn, const char *latin1Passwd); +int flib_netconn_send_password(flib_netconn *conn, const char *passwd); /** * Request a different nickname. @@ -118,20 +138,21 @@ int flib_netconn_send_createRoom(flib_netconn *conn, const char *room); /** - * Rename the current room. Only makes sense in room state and if you are chief. - * TODO: reply + * Rename the current room. Only makes sense in room state and if you are chief. If the action succeeds, you will + * receive an onRoomUpdate callback containing the change. */ int flib_netconn_send_renameRoom(flib_netconn *conn, const char *roomName); /** - * Leave the room for the lobby. Only makes sense in room state. - * TODO: reply, TODO can you send a message? + * Leave the room for the lobby. Only makes sense in room state. msg can be NULL if you don't want to + * send a message. The server always accepts a part message, so once you send it off, you can just + * assume that you are back in the lobby. */ -int flib_netconn_send_leaveRoom(flib_netconn *conn); +int flib_netconn_send_leaveRoom(flib_netconn *conn, const char *msg); /** - * Change your "ready" status in the room. Only makes sense when in room state. - * TODO: reply + * Change your "ready" status in the room. Only makes sense when in room state. If the action succeeds, you will + * receive an onReadyState callback containing the change. */ int flib_netconn_send_toggleReady(flib_netconn *conn); @@ -144,13 +165,14 @@ /** * Remove the team with the name teamname. Only makes sense when in room state. - * TODO: reply + * The server does not send a reply on success. */ int flib_netconn_send_removeTeam(flib_netconn *conn, const char *teamname); /** - * Send an engine message. Only makes sense when ingame. - * TODO: reply + * Send an engine message. Only makes sense when ingame. In a networked game, you have to + * pass all the engine messages from the engine here, and they will be spread to all other + * clients in the game to keep the game in sync. */ int flib_netconn_send_engineMessage(flib_netconn *conn, const uint8_t *message, size_t size); @@ -233,7 +255,8 @@ int flib_netconn_send_scheme(flib_netconn *conn, const flib_cfg *scheme); /** - * Inform the server that the round has ended. TODO: Figure out details + * Inform the server that the round has ended. Call this when the engine + * has disconnected, passing 1 if the round ended normally, 0 otherwise. */ int flib_netconn_send_roundfinished(flib_netconn *conn, bool withoutError); @@ -261,7 +284,7 @@ /** * Signal that you want to start the game. Only makes sense in room state and if you are chief. - * TODO figure out details + * TODO details */ int flib_netconn_send_startGame(flib_netconn *conn); @@ -366,7 +389,7 @@ /** * You just left the lobby and entered a room. * If chief is true, you can and should send a full configuration for the room now. - * This consists of TODO + * This consists of ammo, scheme, script and map, where map apparently has to come last. */ void flib_netconn_onEnterRoom(flib_netconn *conn, void (*callback)(void *context, bool chief), void *context); @@ -414,7 +437,7 @@ /** * The game is starting. Fire up the engine and join in! - * TODO: How? + * You can let the netconn generate the right game setup using flib_netconn_create_gamesetup */ void flib_netconn_onRunGame(flib_netconn *conn, void (*callback)(void *context), void *context); diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netconn_callbacks.c --- a/project_files/frontlib/net/netconn_callbacks.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netconn_callbacks.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "netconn_internal.h" #include "../util/logging.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netconn_internal.h --- a/project_files/frontlib/net/netconn_internal.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netconn_internal.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Common definitions needed by netconn functions, to allow splitting them into several files. */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netconn_send.c --- a/project_files/frontlib/net/netconn_send.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netconn_send.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "netconn_internal.h" #include "../util/logging.h" @@ -68,14 +87,14 @@ return result; } -int flib_netconn_send_password(flib_netconn *conn, const char *latin1Passwd) { +int flib_netconn_send_password(flib_netconn *conn, const char *passwd) { int result = -1; - if(!log_badparams_if(!conn || !latin1Passwd)) { + if(!log_badparams_if(!conn || !passwd)) { md5_state_t md5state; uint8_t md5bytes[16]; char md5hex[33]; md5_init(&md5state); - md5_append(&md5state, (unsigned char*)latin1Passwd, strlen(latin1Passwd)); + md5_append(&md5state, (unsigned char*)passwd, strlen(passwd)); md5_finish(&md5state, md5bytes); for(int i=0;i + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "netprotocol.h" #include "../util/util.h" @@ -79,7 +98,6 @@ return result; } -// TODO: Test with empty map int flib_netmsg_to_drawnmapdata(char *netmsg, uint8_t** outbuf, size_t *outlen) { int result = -1; diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/net/netprotocol.h --- a/project_files/frontlib/net/netprotocol.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/net/netprotocol.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef NETPROTOCOL_H_ #define NETPROTOCOL_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/socket.c --- a/project_files/frontlib/socket.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/socket.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "socket.h" #include "util/logging.h" #include "util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/socket.h --- a/project_files/frontlib/socket.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/socket.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /* * Sockets for TCP networking. * diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/test.c.nocompile --- a/project_files/frontlib/test.c.nocompile Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/test.c.nocompile Wed Jun 27 22:52:19 2012 +0200 @@ -1,4 +1,23 @@ -#include "frontlib.h" +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + #include "frontlib.h" #include "util/logging.h" #include "util/buffer.h" #include "util/util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/buffer.c --- a/project_files/frontlib/util/buffer.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/buffer.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "buffer.h" #include "logging.h" #include "util.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/buffer.h --- a/project_files/frontlib/util/buffer.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/buffer.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef BUFFER_H_ #define BUFFER_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/inihelper.c --- a/project_files/frontlib/util/inihelper.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/inihelper.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "inihelper.h" #include "../iniparser/dictionary.h" #include "../iniparser/iniparser.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/inihelper.h --- a/project_files/frontlib/util/inihelper.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/inihelper.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Convenience interface for ini reading/writing. * diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/list.h --- a/project_files/frontlib/util/list.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/list.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Simple dynamic array manipulation functions. */ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/logging.c --- a/project_files/frontlib/util/logging.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/logging.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "logging.h" #include diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/logging.h --- a/project_files/frontlib/util/logging.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/logging.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef LOGGING_H_ #define LOGGING_H_ diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/refcounter.c --- a/project_files/frontlib/util/refcounter.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/refcounter.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "refcounter.h" #include "logging.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/refcounter.h --- a/project_files/frontlib/util/refcounter.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/refcounter.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + /** * Helper functions for reference counted structs. * diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/util.c --- a/project_files/frontlib/util/util.c Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/util.c Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "util.h" #include "logging.h" diff -r d1db8aaa8edc -r 6171f0bad318 project_files/frontlib/util/util.h --- a/project_files/frontlib/util/util.h Wed Jun 27 18:04:17 2012 +0200 +++ b/project_files/frontlib/util/util.h Wed Jun 27 22:52:19 2012 +0200 @@ -1,3 +1,22 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (C) 2012 Simeon Maxein + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef FLIB_UTIL_H_ #define FLIB_UTIL_H_