$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
00001 // _________ __ __ 00002 // / _____// |_____________ _/ |______ ____ __ __ ______ 00003 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ 00004 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ | 00005 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > 00006 // \/ \/ \//_____/ \/ 00007 // ______________________ ______________________ 00008 // T H E W A R B E G I N S 00009 // Stratagus - A free fantasy real time strategy game engine 00010 // 00012 // 00013 // (c) Copyright 1998-2007 by Lutz Sammer and Jimmy Salmon 00014 // 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; only version 2 of the License. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00029 00030 #ifndef __STRATAGUS_H__ 00031 #define __STRATAGUS_H__ 00032 00034 00035 /*============================================================================ 00036 == Config definitions 00037 ============================================================================*/ 00038 00039 // Dynamic loading. 00040 //#define DYNAMIC_LOAD 00041 00042 /*============================================================================ 00043 == Compiler repairs 00044 ============================================================================*/ 00045 00046 #ifdef _MSC_VER 00047 00048 #define WIN32_LEAN_AND_MEAN 00049 #define NOUSER 00050 #define NOMINMAX // do not use min, max as macro 00051 00052 #pragma warning(disable:4244) 00053 #pragma warning(disable:4761) 00054 #pragma warning(disable:4786) 00055 00056 #define inline __inline 00057 #ifndef __func__ 00058 #define __func__ __FUNCTION__ 00059 #endif 00060 00061 #define snprintf _snprintf 00062 #if !(_MSC_VER >= 1500 && _MSC_VER < 1600) 00063 #define vsnprintf _vsnprintf 00064 #endif 00065 #define unlink _unlink 00066 #define strdup _strdup 00067 #define strcasecmp _stricmp 00068 #define strncasecmp _strnicmp 00069 00070 #endif // } _MSC_VER 00071 00072 00073 /*============================================================================ 00074 == Macro 00075 ============================================================================*/ 00076 00077 // To remove warning for unused variable. 00078 #ifdef __GNUC__ 00079 #define UNUSED(var) do {__typeof__ (&var) __attribute__ ((unused)) __tmp = &var; } while(0) 00080 #else 00081 #define UNUSED(var) (var) 00082 #endif 00083 00084 #ifdef __GNUC__ 00085 #define PRINTF_VAARG_ATTRIBUTE(a, b) __attribute__((format (printf, a, b))) 00086 #else 00087 #define PRINTF_VAARG_ATTRIBUTE(a, b) 00088 #endif 00089 00090 /*============================================================================ 00091 == Debug definitions 00092 ============================================================================*/ 00093 00099 #define _C_ , 00100 00101 extern void PrintLocation(const char *file, int line, const char *funcName); 00102 00104 #define PrintFunction() PrintLocation(__FILE__, __LINE__, __func__); 00105 00106 #ifdef DEBUG // { 00107 00108 extern void AbortAt(const char *file, int line, const char *funcName, const char *conditionStr); 00109 extern void PrintOnStdOut(const char *format, ...); 00110 00114 #define Assert(cond) \ 00115 do { if (!(cond)) { AbortAt(__FILE__, __LINE__, __func__, #cond); }} while (0) 00116 00120 #define DebugPrint(args) \ 00121 do { PrintFunction(); PrintOnStdOut(args); } while (0) 00122 00123 #else // }{ DEBUG 00124 00125 #define Assert(cond) /* disabled */ 00126 #define DebugPrint(args) /* disabled */ 00127 00128 #endif 00129 00130 #ifdef REFS_DEBUG // { 00131 00135 #define RefsAssert(cond) \ 00136 do { if (!(cond)) { AbortAt(__FILE__, __LINE__, __func__, #cond); } } while (0) 00137 #else // }{ REFS_DEBUG 00138 00139 #define RefsAssert(cond) /* disabled */ 00140 00141 #endif // } !REFS_DEBUG 00142 00143 /*============================================================================ 00144 == Definitions 00145 ============================================================================*/ 00146 00147 #include <string.h> 00148 00149 #ifndef __UTIL_H__ 00150 #include "util.h" 00151 #endif 00152 00153 inline char *new_strdup(const char *str) 00154 { 00155 int len = strlen(str) + 1; 00156 char *newstr = new char[len]; 00157 strcpy_s(newstr, len, str); 00158 return newstr; 00159 } 00160 00161 /*---------------------------------------------------------------------------- 00162 -- General 00163 ----------------------------------------------------------------------------*/ 00164 00166 extern const char NameLine[]; 00167 00168 /*---------------------------------------------------------------------------- 00169 -- Some limits 00170 ----------------------------------------------------------------------------*/ 00171 00172 #define PlayerMax 16 00173 #define UnitTypeMax 2048 00174 #define UpgradeMax 2048 00175 #define MAX_RACES 8 00176 00178 #define FRAMES_PER_SECOND 30 // 1/30s 00180 #define CYCLES_PER_SECOND 30 // 1/30s 0.33ms 00181 00182 /*---------------------------------------------------------------------------- 00183 -- stratagus.c 00184 ----------------------------------------------------------------------------*/ 00185 00186 class Parameters 00187 { 00188 public: 00189 void SetDefaultValues(); 00190 00191 const std::string &GetUserDirectory() { return UserDirectory; } 00192 00193 private: 00194 void SetUserDirectory(); 00195 00196 public: 00197 std::string applicationName; 00198 std::string luaStartFilename; 00199 std::string luaEditorStartFilename; 00200 std::string LocalPlayerName; 00201 private: 00202 std::string UserDirectory; 00203 public: 00204 static Parameters Instance; 00205 }; 00206 00207 extern std::string StratagusLibPath; 00208 extern std::string MenuRace; 00209 00210 extern unsigned long GameCycle; 00211 extern unsigned long FastForwardCycle; 00212 00213 extern void Exit(int err); 00214 extern void ExitFatal(int err); 00215 00216 extern void UpdateDisplay(); 00217 extern void DrawMapArea(); 00218 extern void GameMainLoop(); 00219 00221 00222 #endif // !__STRATAGUS_H__