updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / 8kingdoms / fixes.diff
blob00a2b07f6f224944277e5a61dc2bc832e6f6e14a
1 diff -ruN 8Kingdoms-1.1.0-orig/8Kingdoms.cpp 8Kingdoms-1.1.0/8Kingdoms.cpp
2 --- 8Kingdoms-1.1.0-orig/8Kingdoms.cpp 2007-07-22 03:32:48.000000000 +0200
3 +++ 8Kingdoms-1.1.0/8Kingdoms.cpp 2009-11-02 20:20:09.000000000 +0100
4 @@ -25,6 +25,7 @@
6 //rozhrani
7 #include <sstream>
8 +#include <tcl.h>
10 #include "common/Interface.h"
11 #include "common/Msg.h"
12 @@ -470,6 +471,8 @@
14 int main(int argc, char** argv){
16 + Tcl_FindExecutable(argv[0]);
18 try{
19 //parametry z prikazoveho radku
20 TCommandLine::parseCommandLine(argc, argv);
21 diff -ruN 8Kingdoms-1.1.0-orig/ai/Diplomacy/diplomacy.cpp 8Kingdoms-1.1.0/ai/Diplomacy/diplomacy.cpp
22 --- 8Kingdoms-1.1.0-orig/ai/Diplomacy/diplomacy.cpp 2007-07-22 03:32:49.000000000 +0200
23 +++ 8Kingdoms-1.1.0/ai/Diplomacy/diplomacy.cpp 2009-11-02 20:20:09.000000000 +0100
24 @@ -245,7 +245,11 @@
25 void CDiplomacyEngine::setOtherRelationshipPropertiesByIDs(TRelationshipProperties & relshp_prop,int dip1,int dip2)
27 DiplomatRelations[dip1][dip2].relationship_properties.offer_seen_by_enemy=relshp_prop.offer_seen_by_enemy;
28 + if (relshp_prop.belief>MAXIMAL_BELIEF)
29 + relshp_prop.belief=MAXIMAL_BELIEF;
30 DiplomatRelations[dip1][dip2].relationship_properties.belief=relshp_prop.belief;
31 + if (relshp_prop.guess_belief>MAXIMAL_BELIEF)
32 + relshp_prop.guess_belief=MAXIMAL_BELIEF;
33 DiplomatRelations[dip1][dip2].relationship_properties.guess_belief=relshp_prop.guess_belief;
36 @@ -993,6 +997,11 @@
38 if ((i!=dipid) && (DiplomatRecords[i].slotused))
40 + // FOR SOME REASON belief can grow over MAXIMAL_BELIEF (tho it should not) - btw. the highest interval <ALLY_TRUCE_BORDER,MAXIMAL_BELIEF> represents alliance
41 + if (DiplomatRelations[dipid][i].relationship_properties.guess_belief>MAXIMAL_BELIEF)
42 + DiplomatRelations[dipid][i].relationship_properties.guess_belief=MAXIMAL_BELIEF;
43 + if (DiplomatRelations[dipid][i].relationship_properties.belief>MAXIMAL_BELIEF)
44 + DiplomatRelations[dipid][i].relationship_properties.belief=MAXIMAL_BELIEF;
45 TRelationship believedrs=getBeliefRelationship(DiplomatRelations[dipid][i].relationship_properties.belief);
46 if (DiplomatRelations[dipid][i].rs!=believedrs)
48 diff -ruN 8Kingdoms-1.1.0-orig/ai/MapAnalyzer/mapanalyzer.cpp 8Kingdoms-1.1.0/ai/MapAnalyzer/mapanalyzer.cpp
49 --- 8Kingdoms-1.1.0-orig/ai/MapAnalyzer/mapanalyzer.cpp 2007-07-22 03:32:49.000000000 +0200
50 +++ 8Kingdoms-1.1.0/ai/MapAnalyzer/mapanalyzer.cpp 2009-11-02 20:20:09.000000000 +0100
51 @@ -9,6 +9,8 @@
54 #include "ai/MapAnalyzer/mapanalyzer.h"
55 +#include <limits.h>
57 using namespace World;
59 namespace ai_ns
60 diff -ruN 8Kingdoms-1.1.0-orig/ai/Strategizer/attacks.cpp 8Kingdoms-1.1.0/ai/Strategizer/attacks.cpp
61 --- 8Kingdoms-1.1.0-orig/ai/Strategizer/attacks.cpp 2007-07-22 03:32:49.000000000 +0200
62 +++ 8Kingdoms-1.1.0/ai/Strategizer/attacks.cpp 2009-11-02 20:20:09.000000000 +0100
63 @@ -9,6 +9,7 @@
66 #include "ai/Strategizer/attacks.h"
67 +#include <limits.h>
69 using namespace World;
71 diff -ruN 8Kingdoms-1.1.0-orig/ai/ai_makra.h 8Kingdoms-1.1.0/ai/ai_makra.h
72 --- 8Kingdoms-1.1.0-orig/ai/ai_makra.h 2007-07-22 03:32:49.000000000 +0200
73 +++ 8Kingdoms-1.1.0/ai/ai_makra.h 2009-11-02 20:20:09.000000000 +0100
74 @@ -11,8 +11,8 @@
75 #ifndef __PETR_ZITA_AI_MAKRA__
76 #define __PETR_ZITA_AI_MAKRA__
78 -#define PRIORITY_AI_FLOODFILL 1
79 -#define PRIORITY_AI_ALLOC 1
80 +#define PRIORITY_AI_FLOODFILL 10
81 +#define PRIORITY_AI_ALLOC 10
83 /** Makro urcujici, zdali se ma volat tah umele inteligence - ma ciste ladici vyznam. */
84 #define AI_STRATEGIZER_ENABLED
85 diff -ruN 8Kingdoms-1.1.0-orig/common/TCL/tcl_script.cpp 8Kingdoms-1.1.0/common/TCL/tcl_script.cpp
86 --- 8Kingdoms-1.1.0-orig/common/TCL/tcl_script.cpp 2007-07-22 03:32:50.000000000 +0200
87 +++ 8Kingdoms-1.1.0/common/TCL/tcl_script.cpp 2009-11-02 20:20:09.000000000 +0100
88 @@ -12,34 +12,96 @@
89 #include "common/TCL/tcl_struct.h"
90 #include "world/useful.h"
91 #include "world/typedefs.h"
92 +#include "world/rules.h"
94 using namespace std;
96 +/* We can get called from multiple threads, protected against reentrance
97 + through locks. But locks are not enough. Tcl is thread aware and does not
98 + allow an interpreter to be called from another thread then it is created.
99 + With Tcl-8.4 things work even when violating this Tcl thread model rule, but
100 + thats pure luck on our side.
102 + However with Tcl-8.5 calling an interpreter from another thread then it is
103 + created really no longer works. Under pthread using OS we solve this by
104 + using a per thread variable for the interpreter and creating an interpreter
105 + for each thread. Under non pthread OS we keep relying on our luck, so
106 + Tcl-8.5 may not be used there! */
108 +#ifdef __unix__
109 +/* interpreter destructor for the per thread interpreter */
110 +static void interpreter_destructor(void *_interpreter)
112 + Tcl_DeleteInterp((Tcl_Interp *)_interpreter);
114 +#endif
116 TTCL_Interpreter::TTCL_Interpreter()
118 - _interpreter = Tcl_CreateInterp();
119 +#ifdef __unix__
120 + pthread_key_create(&_interpreter_key, interpreter_destructor);
121 + _rules = NULL;
122 +#else
123 + _interpreter = Tcl_CreateInterp();
124 +#endif
127 TTCL_Interpreter::~TTCL_Interpreter()
129 +#ifdef __unix__
130 + pthread_key_delete(_interpreter_key);
131 +#else
132 Tcl_DeleteInterp(_interpreter);
133 //KMemFree(_interpreter);
134 +#endif
137 +Tcl_Interp *TTCL_Interpreter::getInterpreter()
139 +#ifdef __unix__
140 + Tcl_Interp *_interpreter =
141 + (Tcl_Interp *)pthread_getspecific(_interpreter_key);
143 + if (!_interpreter)
145 + _interpreter = Tcl_CreateInterp();
146 + pthread_setspecific(_interpreter_key, _interpreter);
148 + if (_rules)
150 + _rules->writeToTCL(*this);
151 + Tcl_CreateCommand(_interpreter, "KSendMessage", _TCLSendMessageProc,
152 + NULL, NULL);
153 + TTCL_Script script(this);
154 + script.loadStruct(_init_script);
155 + script.run();
158 +#endif
159 + return _interpreter;
162 -void TTCL_Interpreter::init(TCL_SCRIPT * init_script)
163 +void TTCL_Interpreter::init(World::TRules * rules,
164 + Tcl_CmdProc * TCLSendMessageProc, TCL_SCRIPT * init_script)
166 +#ifdef __unix__
167 + _rules = rules;
168 + _TCLSendMessageProc = TCLSendMessageProc;
169 + _init_script = init_script;
170 +#else
171 + rules->writeToTCL(*this);
172 + Tcl_CreateCommand(getInterpreter(), "KSendMessage", TCLSendMessageProc,
173 + NULL, NULL);
174 TTCL_Script script(this);
175 script.loadStruct(init_script);
176 script.run();
177 +#endif
180 bool TTCL_Interpreter::setVar(const char * name, const TCL_VAR_TYPE type, void * value)
182 - if (_interpreter == NULL)
183 - THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
185 // odstraneni predchoziho vyskytu promenne
186 - Tcl_UnsetVar(_interpreter, name, 0);
187 + Tcl_UnsetVar(getInterpreter(), name, 0);
189 // nastaveni nove hodnoty
190 bool result;
191 @@ -48,7 +110,7 @@
192 switch (type) {
193 case TVT_STRING:
194 // STRING
195 - result = (Tcl_SetVar(_interpreter, name, (const char *)value, 0) != NULL);
196 + result = (Tcl_SetVar(getInterpreter(), name, (const char *)value, 0) != NULL);
197 break;
198 case TVT_INT:
199 // INT
200 @@ -56,7 +118,7 @@
201 snprintf(s, 255, "%d", *(int *)value);
203 // ulozim cislo do TCL
204 - result = (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
205 + result = (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
206 break;
207 case TVT_FLOAT:
208 // FLOAT
209 @@ -64,7 +126,7 @@
210 snprintf(s, 255, "%f", *(float *)value);
212 // ulozim cislo do TCL
213 - result = (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
214 + result = (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
215 break;
216 case TVT_FLOAT_LIST:
218 @@ -153,11 +215,8 @@
220 bool TTCL_Interpreter::getVar(const char * name, const TCL_VAR_TYPE type, void * value)
222 - if (_interpreter == NULL)
223 - THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
225 // nacteni objektu z TCL
226 - Tcl_Obj * tcl_obj = Tcl_GetVar2Ex(_interpreter, name, NULL, TCL_LEAVE_ERR_MSG);
227 + Tcl_Obj * tcl_obj = Tcl_GetVar2Ex(getInterpreter(), name, NULL, TCL_LEAVE_ERR_MSG);
229 // promennou se nepodarilo nacist (a pritom to nebylo asociativni pole)
230 if ((tcl_obj == NULL) && (type != TVT_INT_ARRAY) && (type != TVT_FLOAT_ARRAY) && (type != TVT_STRING_ARRAY)) {
231 @@ -173,14 +232,14 @@
232 return true;
233 break;
234 case TVT_INT:
235 - if (Tcl_GetIntFromObj(_interpreter, tcl_obj, (int *)value) == TCL_OK)
236 + if (Tcl_GetIntFromObj(getInterpreter(), tcl_obj, (int *)value) == TCL_OK)
237 return true;
238 else
239 return false;
240 break;
241 case TVT_FLOAT:
242 double _value;
243 - if (Tcl_GetDoubleFromObj(_interpreter, tcl_obj, &_value) == TCL_OK) {
244 + if (Tcl_GetDoubleFromObj(getInterpreter(), tcl_obj, &_value) == TCL_OK) {
245 // pretypovani na float
246 *(float *)value = (float)_value;
247 return true;
248 @@ -415,7 +474,7 @@
249 char s[MAX_STRLEN];
251 snprintf(s, MAX_STRLEN, "%d", value);
252 - return (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
253 + return (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
256 bool TTCL_Interpreter::setConstDouble(const char * name, const double value)
257 @@ -423,29 +482,21 @@
258 char s[MAX_STRLEN];
260 snprintf(s, MAX_STRLEN, "%.2f", value);
261 - return (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
262 + return (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
265 int TTCL_Interpreter::eval(const char * code)
267 - if (_interpreter == NULL)
268 - THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
270 - int result = Tcl_Eval(_interpreter, code);
271 + int result = Tcl_Eval(getInterpreter(), code);
272 if (result == TCL_ERROR) {
273 - THROW(E_8K_TCL_Error, Tcl_GetStringResult(_interpreter));
274 + THROW(E_8K_TCL_Error, Tcl_GetStringResult(getInterpreter()));
276 return result;
279 const char * TTCL_Interpreter::getError()
281 - return Tcl_GetStringResult(_interpreter);
284 -Tcl_Command TTCL_Interpreter::createCommand(const char * tclName, Tcl_CmdProc * cName, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)
286 - return Tcl_CreateCommand(_interpreter, tclName, cName, clientData, deleteProc);
287 + return Tcl_GetStringResult(getInterpreter());
290 void TTCL_Interpreter::setResult(TCL_VAR_TYPE type, void * value)
291 @@ -455,21 +506,21 @@
292 switch (type) {
293 case TVT_STRING:
294 // STRING
295 - Tcl_SetResult(_interpreter, (char *)value, NULL);
296 + Tcl_SetResult(getInterpreter(), (char *)value, NULL);
297 break;
298 case TVT_INT:
299 // INT
300 // prevedu cislo na string
301 snprintf(s, MAX_STRLEN, "%d", *(int *)value);
303 - Tcl_SetResult(_interpreter, s, NULL);
304 + Tcl_SetResult(getInterpreter(), s, NULL);
305 break;
306 case TVT_FLOAT:
307 // FLOAT
308 // prevedu cislo na string
309 snprintf(s, MAX_STRLEN, "%f", *(float *)value);
311 - Tcl_SetResult(_interpreter, s, NULL);
312 + Tcl_SetResult(getInterpreter(), s, NULL);
313 break;
314 default:
315 THROW(E_8K_TCL_UnknownType, "");
316 diff -ruN 8Kingdoms-1.1.0-orig/common/TCL/tcl_script.h 8Kingdoms-1.1.0/common/TCL/tcl_script.h
317 --- 8Kingdoms-1.1.0-orig/common/TCL/tcl_script.h 2007-07-22 03:32:50.000000000 +0200
318 +++ 8Kingdoms-1.1.0/common/TCL/tcl_script.h 2009-11-02 20:20:09.000000000 +0100
319 @@ -9,6 +9,9 @@
321 #include <map>
322 #include <tcl.h>
323 +#ifdef __unix__
324 +#include <pthread.h>
325 +#endif
326 #include "common/TCL/tcl_var.h"
328 /// pocet desetinnych mist, pouzitych pri konverzi cisel do TCL
329 @@ -172,6 +175,11 @@
330 char * code;
333 +namespace World
335 + class TRules;
338 /** Interpret skriptu jazyka TCL
339 Objektovy "obal" puvodnich TCL struktur.
341 @@ -184,16 +192,26 @@
342 class TTCL_Interpreter
344 private:
345 +#ifdef __unix__
346 + pthread_key_t _interpreter_key;
347 + TCL_SCRIPT * _init_script;
348 + Tcl_CmdProc * _TCLSendMessageProc;
349 + World::TRules * _rules;
350 +#else
351 Tcl_Interp * _interpreter;
352 +#endif
353 + Tcl_Interp *getInterpreter();
355 public:
356 TTCL_Interpreter();
357 ~TTCL_Interpreter();
360 /** Inicializace prostredi TCL interpreteru.
361 Nastaveni globalnich promennych, inkluze knihoven a definice spolecnych
362 funkci.
364 - void init(TCL_SCRIPT * init_script);
365 + void init(World::TRules * rules, Tcl_CmdProc * TCLSendMessageProc,
366 + TCL_SCRIPT * init_script);
368 /** Ulozeni promenne do prostredi TCL interpretu
369 @param name jmeno promenne
370 @@ -256,15 +274,6 @@
372 const char * getError();
374 - /** Nastaveni uzivatelske funkce.
375 - Umozni asociovat volani funkce z TCL s funkci v C
376 - @param tclName jmeno funkce v TCL, jejiz volani chceme obsluhovat sami
377 - @param cName funkce z C, ktera bude realizovat telo funkce z TCL
378 - @param clientData arbitrary one-word value to pass to proc and deleteProc.
379 - @param deleteProc procedure to call before cmdName is deleted from the interpreter; allows for command-specific cleanup. If NULL, then no procedure is called before the command is deleted.
380 - */
381 - Tcl_Command createCommand(const char * tclName, Tcl_CmdProc * cName, ClientData clientData = NULL, Tcl_CmdDeleteProc * deleteProc = NULL);
383 /// Nastaveni navratove hodnoty funkce
384 void setResult(TCL_VAR_TYPE type, void * value);
386 diff -ruN 8Kingdoms-1.1.0-orig/common/TCL/tcl_struct.cpp 8Kingdoms-1.1.0/common/TCL/tcl_struct.cpp
387 --- 8Kingdoms-1.1.0-orig/common/TCL/tcl_struct.cpp 2007-07-22 03:32:50.000000000 +0200
388 +++ 8Kingdoms-1.1.0/common/TCL/tcl_struct.cpp 2009-11-02 20:20:09.000000000 +0100
389 @@ -6,6 +6,7 @@
392 #include <stdio.h>
393 +#include <string.h>
394 #include "common/compatibility.h"
395 #include "common/types.h"
396 #include "tcl_struct.h"
397 diff -ruN 8Kingdoms-1.1.0-orig/common/rm/rmconf.cpp 8Kingdoms-1.1.0/common/rm/rmconf.cpp
398 --- 8Kingdoms-1.1.0-orig/common/rm/rmconf.cpp 2007-07-22 03:32:51.000000000 +0200
399 +++ 8Kingdoms-1.1.0/common/rm/rmconf.cpp 2009-11-02 20:20:09.000000000 +0100
400 @@ -108,7 +108,7 @@
401 if (retvalue!=0) // chyba pri cteni fajlu files.xml
403 GLOBALLOGID(PRIORITY_MISSING_FILE,"files.xml is missing or is damaged",XML_DIR);
404 - THROW(E_8K_RM,"files.xml is corrupted");
405 + THROW(E_8K_RM,"files.xml cannot be found or is corrupted or is missing");
408 // ziskani profilu
409 diff -ruN 8Kingdoms-1.1.0-orig/common/rm/rmmap.cpp 8Kingdoms-1.1.0/common/rm/rmmap.cpp
410 --- 8Kingdoms-1.1.0-orig/common/rm/rmmap.cpp 2007-07-22 03:32:51.000000000 +0200
411 +++ 8Kingdoms-1.1.0/common/rm/rmmap.cpp 2009-11-02 20:20:09.000000000 +0100
412 @@ -1855,6 +1855,12 @@
413 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->rs,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"state",0,NULL);
414 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->offeredrs,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"offered",0,NULL);
415 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.offer_seen_by_enemy,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"delivered",0,NULL);
416 + if ((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief>10000)
418 + printf("This should not occure!!");
419 + GLOBALLOGID(PRIORITY_FATAL,"Strange belief value role %i, belief %i",ii,(*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief);
422 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"belief",0,NULL);
423 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.guess_belief,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"guessBelief",0,NULL);
425 diff -ruN 8Kingdoms-1.1.0-orig/common/xml/strda.cpp 8Kingdoms-1.1.0/common/xml/strda.cpp
426 --- 8Kingdoms-1.1.0-orig/common/xml/strda.cpp 2007-07-22 03:32:52.000000000 +0200
427 +++ 8Kingdoms-1.1.0/common/xml/strda.cpp 2009-11-02 20:20:09.000000000 +0100
428 @@ -25,10 +25,10 @@
429 size_t j=count;
430 for (k=0;k<j;k++)
432 - (*big)[i+k]=smallstr[k];
433 + (*big)[(int)(i+k)]=smallstr[(int)k];
435 if (terminate)
436 - (*big)[i+k]=0;
437 + (*big)[(int)(i+k)]=0;
440 void addtoda(DA<char> *big,const char *smallstr,int terminate)
441 @@ -38,10 +38,10 @@
442 size_t j=strlen(smallstr);
443 for (k=0;k<j;k++)
445 - (*big)[i+k]=smallstr[k];
446 + (*big)[(int)(i+k)]=smallstr[(int)k];
448 if (terminate)
449 - (*big)[i+k]=0;
450 + (*big)[(int)(i+k)]=0;
453 void addtodawcs(DA<wchar_t> *big,const wchar_t *smallstr,int terminate)
454 @@ -51,10 +51,10 @@
455 size_t j=wcslen(smallstr);
456 for (k=0;k<j;k++)
458 - (*big)[i+k]=smallstr[k];
459 + (*big)[(int)(i+k)]=smallstr[(int)k];
461 if (terminate)
462 - (*big)[i+k]=0;
463 + (*big)[(int)(i+k)]=0;
466 void addtodastr(DA<char> *big,const char *smallstr,int terminate)
467 @@ -64,10 +64,10 @@
468 size_t j=strlen(smallstr);
469 for (k=0;k<j;k++)
471 - (*big)[i+k]=smallstr[k];
472 + (*big)[(int)(i+k)]=smallstr[(int)k];
474 if (terminate)
475 - (*big)[i+k]=0;
476 + (*big)[(int)(i+k)]=0;
479 void addtostr(char **big,const char *smallstr,int terminate)
480 @@ -77,10 +77,10 @@
481 size_t j=strlen(smallstr);
482 for (k=0;k<j;k++)
484 - (*big)[i+k]=smallstr[k];
485 + (*big)[(int)(i+k)]=smallstr[(int)k];
487 if (terminate)
488 - (*big)[i+k]=0;
489 + (*big)[(int)(i+k)]=0;
492 size_t newandstrcpy(char ** output, const char * input)
493 diff -ruN 8Kingdoms-1.1.0-orig/common/xml/xml.cpp 8Kingdoms-1.1.0/common/xml/xml.cpp
494 --- 8Kingdoms-1.1.0-orig/common/xml/xml.cpp 2007-07-22 03:32:52.000000000 +0200
495 +++ 8Kingdoms-1.1.0/common/xml/xml.cpp 2009-11-02 20:20:09.000000000 +0100
496 @@ -1939,12 +1939,12 @@
500 -int TXMLdata::getData(char * data2,int size,int *ids,char ** tags, int number)
501 +int TXMLdata::getData(char * data2,size_t size,int *ids,char ** tags, int number)
502 // getData tentokrat s argumenty pole
504 if (number>0) // nema smysl se ptat na koren nebo neco co by melo byt nad
506 - int a;
507 + size_t a;
508 xmlcontainer * xc=0;// = (xmlcontainer*) KMemAlloc(sizeof(xmlcontainer));
509 int result=this->getTag(&xc,ids,tags,number);
510 if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) )
511 @@ -1964,7 +1964,7 @@
512 a=-1;
513 if (size>0) // zjistim kam dat posledni 0 - tesne za vraceny retezec
515 - int n;
516 + size_t n;
517 if (a<(size-1))
518 n=a;
519 else
520 @@ -1976,7 +1976,7 @@
521 if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) && (xc->content!=NULL) && ((*(xc->content))[ids[number-1]]->data!=NULL))
523 // KMemFree(xc);
524 - return (a);
525 + return ((int)a);
527 else
529 @@ -1990,7 +1990,7 @@
533 -int TXMLdata::getData(char * data2,int size, char * firsttag, int firstid,...)
534 +int TXMLdata::getData(char * data2,size_t size, char * firsttag, int firstid,...)
535 // varci data urcena cestou
537 // v tuto chvili neni jeste dobre mit daTags v debug okne ;D ... neni to inicializovane
538 @@ -2104,7 +2104,7 @@
540 break;
542 - if ((result)>=size) // v result neni koncova 0
543 + if ((result)>=(int)size) // v result neni koncova 0
545 if ((size!=0) && ((*data2)!=NULL))
546 KMemFree(*data2);
547 @@ -2113,7 +2113,7 @@
548 done=-1;
550 else
551 - done=size;
552 + done=(int)size;
553 } while (done==-1);
556 diff -ruN 8Kingdoms-1.1.0-orig/common/xml/xml.h 8Kingdoms-1.1.0/common/xml/xml.h
557 --- 8Kingdoms-1.1.0-orig/common/xml/xml.h 2007-07-22 03:32:52.000000000 +0200
558 +++ 8Kingdoms-1.1.0/common/xml/xml.h 2009-11-02 20:20:09.000000000 +0100
559 @@ -124,7 +124,7 @@
560 @param firstid id prvniho nekorenoveho tagu na ceste k mistu kam se vklada
561 @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size) bez koncove 0
563 - int getData(char * data2,int size, char * firsttag,int firstid,...);
564 + int getData(char * data2,size_t size, char * firsttag,int firstid,...);
566 /** Ziska cely obsah tagu v podobe retezce.
567 Posledni parametr musi byt NULL, strida se vzdy tag a jeho id.
568 @@ -160,7 +160,7 @@
569 @param number delka cesty bez korenoveho tagu (take pocet prvku pole tags a ids)
570 @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size)
572 - int getData(char * data2,int size,int *ids,char ** tags, int number);
573 + int getData(char * data2,size_t size,int *ids,char ** tags, int number);
575 /** Ziska okaz primo na data ulozena v xml.
576 Tato funkce se musi pouzivat s opatrnosti pouze na cteni dat. Posledni parametr musi byt NULL.
577 diff -ruN 8Kingdoms-1.1.0-orig/gui/contexts/Game.cpp 8Kingdoms-1.1.0/gui/contexts/Game.cpp
578 --- 8Kingdoms-1.1.0-orig/gui/contexts/Game.cpp 2007-07-22 03:32:57.000000000 +0200
579 +++ 8Kingdoms-1.1.0/gui/contexts/Game.cpp 2009-11-02 20:20:09.000000000 +0100
580 @@ -3216,7 +3216,7 @@
581 else
582 ei = GAME_EVENT(iPlayerOnTurn, eitUnitMembersDied, hid, rmtxti->getWChar(wtemp, LABEL_MAX_LENGTH, TEXT_EVENT_UNHEALEDMEN));
583 ei->data1 = (void*)u;
584 - ei->data2 = *((void**)&count);
585 + ei->data2 = (void*)count;
587 else{
588 u->membersDied(count);
589 diff -ruN 8Kingdoms-1.1.0-orig/gui/engine/AdvGeom.cpp 8Kingdoms-1.1.0/gui/engine/AdvGeom.cpp
590 --- 8Kingdoms-1.1.0-orig/gui/engine/AdvGeom.cpp 2007-07-22 03:32:58.000000000 +0200
591 +++ 8Kingdoms-1.1.0/gui/engine/AdvGeom.cpp 2009-11-02 20:30:18.000000000 +0100
592 @@ -18,6 +18,7 @@
594 #include <GL/gl.h>
595 #include <assert.h>
596 +#include <stdio.h>
598 /*****************************************************************************/
600 diff -ruN 8Kingdoms-1.1.0-orig/gui/engine/Effects.cpp 8Kingdoms-1.1.0/gui/engine/Effects.cpp
601 --- 8Kingdoms-1.1.0-orig/gui/engine/Effects.cpp 2007-07-22 03:32:58.000000000 +0200
602 +++ 8Kingdoms-1.1.0/gui/engine/Effects.cpp 2009-11-02 20:20:09.000000000 +0100
603 @@ -22,6 +22,7 @@
604 #include <GL/gl.h>
605 #include <assert.h>
606 #include <stdlib.h>
607 +#include <limits.h>
609 using namespace std;
611 diff -ruN 8Kingdoms-1.1.0-orig/gui/model/UnitFormation.cpp 8Kingdoms-1.1.0/gui/model/UnitFormation.cpp
612 --- 8Kingdoms-1.1.0-orig/gui/model/UnitFormation.cpp 2007-07-22 03:32:58.000000000 +0200
613 +++ 8Kingdoms-1.1.0/gui/model/UnitFormation.cpp 2009-11-02 20:20:09.000000000 +0100
614 @@ -148,8 +148,9 @@
615 //vypocti polohy pro cleny
616 TUnitMemberPosition ump;
617 vumpPositions_c = 0;
618 - getUnitMemberDim(0, &ump.p2fDim);
619 int size = (int)unit->vMembers.size();
620 + if (size)
621 + getUnitMemberDim(0, &ump.p2fDim);
622 for(int i = 0; i < size; i++)
624 findFreeMemberPosition(vumpPositions_c, &(ump.p2fPos), &(ump.p2fDir));
625 diff -ruN 8Kingdoms-1.1.0-orig/net/comm.h 8Kingdoms-1.1.0/net/comm.h
626 --- 8Kingdoms-1.1.0-orig/net/comm.h 2007-07-22 03:32:59.000000000 +0200
627 +++ 8Kingdoms-1.1.0/net/comm.h 2009-11-02 20:20:09.000000000 +0100
628 @@ -194,7 +194,7 @@
629 int ping_time;
631 /** Maximalni doba, po kterou se neprijal ping */
632 - int max_timeout;
633 + unsigned int max_timeout;
637 diff -ruN 8Kingdoms-1.1.0-orig/net/netinit.cpp 8Kingdoms-1.1.0/net/netinit.cpp
638 --- 8Kingdoms-1.1.0-orig/net/netinit.cpp 2007-07-22 03:32:59.000000000 +0200
639 +++ 8Kingdoms-1.1.0/net/netinit.cpp 2009-11-02 20:20:09.000000000 +0100
640 @@ -325,7 +325,7 @@
641 if (freeprofilename==0) // pokud takovy profil neni uz pripojen
643 net_server->startPing(from);
644 - KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&from)));
645 + KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)from);
647 else
649 @@ -379,8 +379,8 @@
650 int from = new_connection_info->msgFrom();
651 net_server->stopAnnouncingMissingPlayers();
652 net_server->startPing(from);
653 - KSendMessage(RQUEUE,MSG_CLIENT_HAS_RECONNECTED,MOD_NET,BROADCAST,*((void**)(&from)));
654 - KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&from)));
655 + KSendMessage(RQUEUE,MSG_CLIENT_HAS_RECONNECTED,MOD_NET,BROADCAST,(void*)from);
656 + KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)from);
660 @@ -435,9 +435,9 @@
661 net_client->addClientInfo(ni);
663 if (msgId==MSG_CLIENT_RECONNECTION_INFO)
664 - KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&(ni->clientid))));
665 + KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_REPORT,MOD_NET,BROADCAST,(void*)(ni->clientid));
666 else
667 - KSendMessage(RQUEUE,MSG_NEW_CONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&(ni->clientid))));
668 + KSendMessage(RQUEUE,MSG_NEW_CONNECTION_REPORT,MOD_NET,BROADCAST,(void*)(ni->clientid));
670 delete(new_connetion_info);
671 KMemFree(ni);
672 @@ -489,7 +489,7 @@
674 net_client->removeClientInfo(who);
676 - KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&who)));
677 + KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_REPORT,MOD_NET,BROADCAST,(void*)who);
678 delete(message);
680 break;
681 diff -ruN 8Kingdoms-1.1.0-orig/net/queue.h 8Kingdoms-1.1.0/net/queue.h
682 --- 8Kingdoms-1.1.0-orig/net/queue.h 2007-07-22 03:32:59.000000000 +0200
683 +++ 8Kingdoms-1.1.0/net/queue.h 2009-11-02 20:20:09.000000000 +0100
684 @@ -32,7 +32,7 @@
685 char * data; ///< Vlasni data
686 mysocket to; ///< Adresat
687 struct TMessageBody * next; ///< Ukazatel na dalsi zpravu v seznamu
688 - int part_sent; ///< Jak velka cast byla poslana
689 + size_t part_sent; ///< Jak velka cast byla poslana
690 size_t len; ///< Velikost
693 diff -ruN 8Kingdoms-1.1.0-orig/net/server.cpp 8Kingdoms-1.1.0/net/server.cpp
694 --- 8Kingdoms-1.1.0-orig/net/server.cpp 2007-07-22 03:32:59.000000000 +0200
695 +++ 8Kingdoms-1.1.0/net/server.cpp 2009-11-02 20:20:09.000000000 +0100
696 @@ -259,7 +259,7 @@
698 // In case in profile is set to announce and is not currently announcing
700 - KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&id)));
701 + KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)id);
703 else
705 @@ -345,7 +345,7 @@
706 // printf("Socket se zavrel - klient %i\n",i);
707 if (that->status!=STATUS_ENDING)
709 - KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,*((void**)(&i)));
710 + KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,(void*)i);
711 that->clientDisconnected(i);
714 @@ -415,7 +415,7 @@
715 #ifdef WIN32
716 int sin_size = sizeof(struct sockaddr_in); // Windows chteji do accept int
717 #else
718 - size_t sin_size = sizeof(struct sockaddr_in);
719 + socklen_t sin_size = sizeof(struct sockaddr_in);
720 #endif
722 int s;
723 @@ -655,8 +655,8 @@
724 GLOBALLOGID(PRIORITY_NEW_CONNECTION, "Server - A local client having id %i has connected, free space: %i",(*client)->clientid,this->getFreeClientCount());
725 // printf("\nKlient se pripojil id %i, port %i, volne: %i",(*client)->clientid,(*client)->fd,this->getFreeClientCount());
727 - KSendMessage(RQUEUE,MSG_LOCAL_CLIENT_ADDED,MOD_NET,MOD_NET,*((void**)(&((*client)->clientid))));
728 - KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&((*client)->clientid))));
729 + KSendMessage(RQUEUE,MSG_LOCAL_CLIENT_ADDED,MOD_NET,MOD_NET,(void*)((*client)->clientid));
730 + KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)((*client)->clientid));
732 this->unlock();
733 return 1;
734 @@ -818,7 +818,7 @@
735 mysocket fd;
736 j=0;
737 int set=0;
738 - int msglen3;
739 + size_t msglen3;
740 server.sin_family = AF_INET;
741 server.sin_port = htons(80);
742 server.sin_addr = *((struct in_addr *)he->h_addr);
743 @@ -1223,7 +1223,7 @@
745 that->unlock();
746 if (that->status!=STATUS_ENDING)
747 - KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,*((void**)(&i)));
748 + KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,(void*)i);
749 else
750 return 0;
751 that->lock();
752 diff -ruN 8Kingdoms-1.1.0-orig/res/xml/scripts/unit_recruit_elite.xml 8Kingdoms-1.1.0/res/xml/scripts/unit_recruit_elite.xml
753 --- 8Kingdoms-1.1.0-orig/res/xml/scripts/unit_recruit_elite.xml 2007-07-22 03:33:11.000000000 +0200
754 +++ 8Kingdoms-1.1.0/res/xml/scripts/unit_recruit_elite.xml 2009-11-02 20:20:09.000000000 +0100
755 @@ -60,7 +60,7 @@
756 # pomocna promenna pro uchovani poctu zbyvajicich zivotu
757 set missing_lives [expr $max_lives - $unit(lives)];
759 - if {$unit_types($unit(type), cure_cost) > 0} {
760 + if {($unit_types($unit(type), cure_cost) > 0) && ($unit(level) > 0)} {
761 # pomocna promenna pro uchovani maximalniho poctu zivotu, na ktere
762 # ma hrac penize
763 set money [expr floor($player(money) / ($unit(level) * $unit_types($unit(type), cure_cost)))];
764 diff -ruN 8Kingdoms-1.1.0-orig/world/players/player.cpp 8Kingdoms-1.1.0/world/players/player.cpp
765 --- 8Kingdoms-1.1.0-orig/world/players/player.cpp 2007-07-22 03:33:12.000000000 +0200
766 +++ 8Kingdoms-1.1.0/world/players/player.cpp 2009-11-02 20:20:09.000000000 +0100
767 @@ -72,6 +72,10 @@
768 if (_data->game_data.relations[i] != NULL) {
769 package->setInt(_data->game_data.relations[i]->rs, "relations", 0, "relationship", i, "rs", 0, NULL);
770 package->setInt(_data->game_data.relations[i]->offeredrs, "relations", 0, "relationship", i, "offeredrs", 0, NULL);
771 + // this was missing!!
772 + package->setInt(_data->game_data.relations[i]->relationship_properties.belief, "relations", 0, "relationship", i, "belief", 0, NULL);
773 + package->setInt(_data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy, "relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL);
774 + package->setInt(_data->game_data.relations[i]->relationship_properties.guess_belief, "relations", 0, "relationship", i, "guess_belief", 0, NULL);
778 @@ -119,6 +123,10 @@
779 _data->game_data.relations[i] = (ai_ns::diplomacy_ns::TDipRelation *)KMemAlloc(sizeof(ai_ns::diplomacy_ns::TDipRelation));
780 _data->game_data.relations[i]->rs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "rs", 0, NULL);
781 _data->game_data.relations[i]->offeredrs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offeredrs", 0, NULL);
782 + // this was missing!!
783 + _data->game_data.relations[i]->relationship_properties.belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "belief", 0, NULL);
784 + _data->game_data.relations[i]->relationship_properties.guess_belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "guess_belief", 0, NULL);
785 + _data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL);
788 else {
789 @@ -204,7 +212,7 @@
790 info[it->first]->stats = it->second->data().statistics;
791 for (i = 1; i <= MAX_PLAYERS; i++) {
792 if (it->second->data().game_data.relations[i]) {
793 - *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
794 + *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
796 else {
797 info[it->first]->relations[i] = NULL;
798 diff -ruN 8Kingdoms-1.1.0-orig/world/world_client.cpp 8Kingdoms-1.1.0/world/world_client.cpp
799 --- 8Kingdoms-1.1.0-orig/world/world_client.cpp 2007-07-22 03:33:12.000000000 +0200
800 +++ 8Kingdoms-1.1.0/world/world_client.cpp 2009-11-02 20:20:09.000000000 +0100
801 @@ -107,13 +107,7 @@
802 world->init();
804 // inicializace negine
805 - engine->init(world);
807 - // registrace zprav z TCL
808 - engine->interpreter.createCommand("KSendMessage", (Tcl_CmdProc *)World::WorldClient_SendMessage);
810 - // inkluze knihoven pro TCL (spusteni inicializacniho skriptu)
811 - engine->interpreter.init(world->rules->scripts[TS_INIT]);
812 + engine->init(world, (Tcl_CmdProc *)World::WorldClient_SendMessage);
815 // svet je pripraven
816 @@ -321,6 +315,7 @@
818 if (world_client[i]->state == WCS_GAME_ENDED && action_type == AT_ENDGAME) {
819 // zprava o ukonceni hry pro jiz ukoncenou hru - ignoruji
820 + world_client_mutex.unlock();
821 break;
823 else if (!(((action_type == AT_GAME_START) && (world_client[i]->state >= WCS_WORLD_INITIALIZED) && (world_client[i]->state < WCS_GAME_STARTED))
824 @@ -328,6 +323,7 @@
825 (world_client[i]->state == WCS_GAME_STARTED)
826 )) {
827 // zprava prisla v nevhodnou chvili - ignoruji
828 + world_client_mutex.unlock();
829 break;
832 diff -ruN 8Kingdoms-1.1.0-orig/world/world_engine.cpp 8Kingdoms-1.1.0/world/world_engine.cpp
833 --- 8Kingdoms-1.1.0-orig/world/world_engine.cpp 2007-07-22 03:33:12.000000000 +0200
834 +++ 8Kingdoms-1.1.0/world/world_engine.cpp 2009-11-02 20:20:09.000000000 +0100
835 @@ -30,11 +30,10 @@
839 -void TWorldEngine::init(TWorld * world)
840 +void TWorldEngine::init(TWorld * world, Tcl_CmdProc *TCLSendMessageProc)
842 - // zapis pravidel do prostredi TCL interpreteru
843 - if (world->rules)
844 - world->rules->writeToTCL(interpreter);
845 + interpreter.init(world->rules, TCLSendMessageProc,
846 + world->rules->scripts[TS_INIT]);
849 int TWorldEngine::lock()
850 @@ -1210,7 +1209,10 @@
853 if (!can_move)
855 + unlock();
856 return ERR_NotOperational;
859 TPacket_RCT_UNIT_MOVE * packet = new TPacket_RCT_UNIT_MOVE();
860 packet->unit_id = unit_id;
861 @@ -1853,14 +1855,18 @@
862 // zaznamenam do statistik
863 _world.players.townCaptured(town_occupied->new_player_id, town_occupied->former_player_id);
865 - // dam o tom vedet diplomacii
866 - if (former_player_id != 0) {
867 - TPacket_Diplomacy_ConquerCity conquerCity;
868 - conquerCity.attacked_diplomat_world_id = former_player_id;
869 - conquerCity.attacking_diplomat_world_id = new_player_id;
870 - conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
871 + // if the player is not dead or was not neutral, inform Diplomacy
872 + if (former_player_id != 0)
874 + if (_world.players[former_player_id]->data().game_data.state != PS_DEFEATED)
876 + TPacket_Diplomacy_ConquerCity conquerCity;
877 + conquerCity.attacked_diplomat_world_id = former_player_id;
878 + conquerCity.attacking_diplomat_world_id = new_player_id;
879 + conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
881 - KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
882 + KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
887 diff -ruN 8Kingdoms-1.1.0-orig/world/world_engine.h 8Kingdoms-1.1.0/world/world_engine.h
888 --- 8Kingdoms-1.1.0-orig/world/world_engine.h 2007-07-22 03:33:12.000000000 +0200
889 +++ 8Kingdoms-1.1.0/world/world_engine.h 2009-11-02 20:20:09.000000000 +0100
890 @@ -45,7 +45,7 @@
891 ~TWorldEngine();
893 /** Inicializace */
894 - void init(TWorld * world);
895 + void init(TWorld * world, Tcl_CmdProc *TCLSendMessageProc);
897 /// Zamceni mutexu
898 int lock();
899 diff -ruN 8Kingdoms-1.1.0-orig/world/world_server.cpp 8Kingdoms-1.1.0/world/world_server.cpp
900 --- 8Kingdoms-1.1.0-orig/world/world_server.cpp 2007-07-22 03:33:12.000000000 +0200
901 +++ 8Kingdoms-1.1.0/world/world_server.cpp 2009-11-02 20:20:09.000000000 +0100
902 @@ -87,13 +87,7 @@
903 world.init();
905 // inicializace world_engine
906 - engine.init(&world);
908 - // registrace zprav z TCL
909 - engine.interpreter.createCommand("KSendMessage", (Tcl_CmdProc *)WorldServer_SendMessage);
911 - // inkluze knihoven pro TCL (spusteni inicializacniho skriptu)
912 - engine.interpreter.init(world.rules->scripts[TS_INIT]);
913 + engine.init(&world, (Tcl_CmdProc *)WorldServer_SendMessage);
916 void TWorldServer::shutdown()
917 @@ -2032,7 +2026,7 @@
919 for (int i = 0; i < MAX_PLAYERS; i++)
921 - if (game_start_disconnections[i] == ((int) p))
922 + if (game_start_disconnections[i] == ((long) p))
924 game_start_disconnections[i] = 0;
925 break;
926 @@ -2043,7 +2037,7 @@
927 else if (world_server->state == WSS_GAME_STARTED)
929 // Hra jiz bezi, tedy doslo k znovu pripojeni
930 - int client_id = (int)p;
931 + int client_id = (long)p;
932 for (TPlayerIterator it = world_server->world.players.begin(); it != world_server->world.players.end(); it++)
934 int temp=it->second->data().client_data.oldclient_id;
935 @@ -2099,7 +2093,7 @@
936 // Az skonci nahravani hry, odpojeni klienta se vyresi dodatecne
937 for (int i = 0; i < MAX_PLAYERS; i++)
938 if (game_start_disconnections[i] == 0)
939 - game_start_disconnections[i] = (int)p;
940 + game_start_disconnections[i] = (long)p;
941 break;
943 else if (world_server->state < WSS_GAME_STARTED) {
944 @@ -2110,7 +2104,7 @@
946 else if (world_server->state == WSS_GAME_STARTED) {
947 // Hra jiz bezi
948 - int client_id = (int)p;
949 + int client_id = (long)p;
950 for (TPlayerIterator it = world_server->world.players.begin(); it != world_server->world.players.end(); it++) {
951 if (it->second->data().client_data.client_id == client_id) {
952 // odpojil se hrac it->first