Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef639e5182 | ||
|
|
f5e793ef3a | ||
|
|
5c82407819 |
13 changed files with 7035 additions and 1 deletions
148
8Kingdoms-1.1.0-64bit.patch
Normal file
148
8Kingdoms-1.1.0-64bit.patch
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
diff -ur 8Kingdoms-1.1.0/gui/contexts/Game.cpp 8Kingdoms-1.1.0.new/gui/contexts/Game.cpp
|
||||
--- 8Kingdoms-1.1.0/gui/contexts/Game.cpp 2007-07-22 03:32:57.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/gui/contexts/Game.cpp 2007-11-24 22:44:14.000000000 +0100
|
||||
@@ -3216,7 +3216,7 @@
|
||||
else
|
||||
ei = GAME_EVENT(iPlayerOnTurn, eitUnitMembersDied, hid, rmtxti->getWChar(wtemp, LABEL_MAX_LENGTH, TEXT_EVENT_UNHEALEDMEN));
|
||||
ei->data1 = (void*)u;
|
||||
- ei->data2 = *((void**)&count);
|
||||
+ ei->data2 = (void*)count;
|
||||
}
|
||||
else{
|
||||
u->membersDied(count);
|
||||
diff -ur 8Kingdoms-1.1.0/net/netinit.cpp 8Kingdoms-1.1.0.new/net/netinit.cpp
|
||||
--- 8Kingdoms-1.1.0/net/netinit.cpp 2007-07-22 03:32:59.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/net/netinit.cpp 2007-11-24 22:43:29.000000000 +0100
|
||||
@@ -325,7 +325,7 @@
|
||||
if (freeprofilename==0) // pokud takovy profil neni uz pripojen
|
||||
{
|
||||
net_server->startPing(from);
|
||||
- KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&from)));
|
||||
+ KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)from);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -379,8 +379,8 @@
|
||||
int from = new_connection_info->msgFrom();
|
||||
net_server->stopAnnouncingMissingPlayers();
|
||||
net_server->startPing(from);
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_HAS_RECONNECTED,MOD_NET,BROADCAST,*((void**)(&from)));
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&from)));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_HAS_RECONNECTED,MOD_NET,BROADCAST,(void*)from);
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)from);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,9 +435,9 @@
|
||||
net_client->addClientInfo(ni);
|
||||
}
|
||||
if (msgId==MSG_CLIENT_RECONNECTION_INFO)
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&(ni->clientid))));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_RECONNECTION_REPORT,MOD_NET,BROADCAST,(void*)(ni->clientid));
|
||||
else
|
||||
- KSendMessage(RQUEUE,MSG_NEW_CONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&(ni->clientid))));
|
||||
+ KSendMessage(RQUEUE,MSG_NEW_CONNECTION_REPORT,MOD_NET,BROADCAST,(void*)(ni->clientid));
|
||||
|
||||
delete(new_connetion_info);
|
||||
KMemFree(ni);
|
||||
@@ -489,7 +489,7 @@
|
||||
{
|
||||
net_client->removeClientInfo(who);
|
||||
}
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_REPORT,MOD_NET,BROADCAST,*((void**)(&who)));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_REPORT,MOD_NET,BROADCAST,(void*)who);
|
||||
delete(message);
|
||||
}
|
||||
break;
|
||||
diff -ur 8Kingdoms-1.1.0/net/server.cpp 8Kingdoms-1.1.0.new/net/server.cpp
|
||||
--- 8Kingdoms-1.1.0/net/server.cpp 2007-07-22 03:32:59.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/net/server.cpp 2007-11-24 22:42:03.000000000 +0100
|
||||
@@ -259,7 +259,7 @@
|
||||
|
||||
// In case in profile is set to announce and is not currently announcing
|
||||
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&id)));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_DISCONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,7 +345,7 @@
|
||||
// printf("Socket se zavrel - klient %i\n",i);
|
||||
if (that->status!=STATUS_ENDING)
|
||||
{
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,*((void**)(&i)));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,(void*)i);
|
||||
that->clientDisconnected(i);
|
||||
}
|
||||
}
|
||||
@@ -655,8 +655,8 @@
|
||||
GLOBALLOGID(PRIORITY_NEW_CONNECTION, "Server - A local client having id %i has connected, free space: %i",(*client)->clientid,this->getFreeClientCount());
|
||||
// printf("\nKlient se pripojil id %i, port %i, volne: %i",(*client)->clientid,(*client)->fd,this->getFreeClientCount());
|
||||
|
||||
- KSendMessage(RQUEUE,MSG_LOCAL_CLIENT_ADDED,MOD_NET,MOD_NET,*((void**)(&((*client)->clientid))));
|
||||
- KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,*((void**)(&((*client)->clientid))));
|
||||
+ KSendMessage(RQUEUE,MSG_LOCAL_CLIENT_ADDED,MOD_NET,MOD_NET,(void*)((*client)->clientid));
|
||||
+ KSendMessage(RQUEUE,MSG_NEW_CONNECTION_ACCEPTED,MOD_NET,MOD_NET,(void*)((*client)->clientid));
|
||||
|
||||
this->unlock();
|
||||
return 1;
|
||||
@@ -1223,7 +1223,7 @@
|
||||
{
|
||||
that->unlock();
|
||||
if (that->status!=STATUS_ENDING)
|
||||
- KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,*((void**)(&i)));
|
||||
+ KSendMessage(RQUEUE,MSG_CLIENT_HAS_DISCONNECTED,MOD_NET,BROADCAST,(void*)i);
|
||||
else
|
||||
return 0;
|
||||
that->lock();
|
||||
diff -ur 8Kingdoms-1.1.0/world/world_server.cpp 8Kingdoms-1.1.0.new/world/world_server.cpp
|
||||
--- 8Kingdoms-1.1.0/world/world_server.cpp 2007-07-22 03:33:12.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/world/world_server.cpp 2007-11-24 22:45:14.000000000 +0100
|
||||
@@ -2032,7 +2032,7 @@
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
- if (game_start_disconnections[i] == ((int) p))
|
||||
+ if (game_start_disconnections[i] == ((long) p))
|
||||
{
|
||||
game_start_disconnections[i] = 0;
|
||||
break;
|
||||
@@ -2043,7 +2043,7 @@
|
||||
else if (world_server->state == WSS_GAME_STARTED)
|
||||
{
|
||||
// Hra jiz bezi, tedy doslo k znovu pripojeni
|
||||
- int client_id = (int)p;
|
||||
+ int client_id = (long)p;
|
||||
for (TPlayerIterator it = world_server->world.players.begin(); it != world_server->world.players.end(); it++)
|
||||
{
|
||||
int temp=it->second->data().client_data.oldclient_id;
|
||||
@@ -2099,7 +2099,7 @@
|
||||
// Az skonci nahravani hry, odpojeni klienta se vyresi dodatecne
|
||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||
if (game_start_disconnections[i] == 0)
|
||||
- game_start_disconnections[i] = (int)p;
|
||||
+ game_start_disconnections[i] = (long)p;
|
||||
break;
|
||||
}
|
||||
else if (world_server->state < WSS_GAME_STARTED) {
|
||||
@@ -2110,7 +2110,7 @@
|
||||
}
|
||||
else if (world_server->state == WSS_GAME_STARTED) {
|
||||
// Hra jiz bezi
|
||||
- int client_id = (int)p;
|
||||
+ int client_id = (long)p;
|
||||
for (TPlayerIterator it = world_server->world.players.begin(); it != world_server->world.players.end(); it++) {
|
||||
if (it->second->data().client_data.client_id == client_id) {
|
||||
// odpojil se hrac it->first
|
||||
diff -up 8Kingdoms-1.1.0/net/server.cpp~ 8Kingdoms-1.1.0/net/server.cpp
|
||||
--- 8Kingdoms-1.1.0/net/server.cpp~ 2007-11-24 22:57:18.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/net/server.cpp 2007-11-24 22:57:18.000000000 +0100
|
||||
@@ -415,7 +415,7 @@ int accept_thread(void * data)
|
||||
#ifdef WIN32
|
||||
int sin_size = sizeof(struct sockaddr_in); // Windows chteji do accept int
|
||||
#else
|
||||
- size_t sin_size = sizeof(struct sockaddr_in);
|
||||
+ socklen_t sin_size = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
|
||||
int s;
|
||||
13
8Kingdoms-1.1.0-crash.patch
Normal file
13
8Kingdoms-1.1.0-crash.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
--- 8Kingdoms-1.1.0/gui/model/UnitFormation.cpp~ 2008-01-03 20:51:33.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/gui/model/UnitFormation.cpp 2008-01-03 20:51:33.000000000 +0100
|
||||
@@ -148,8 +148,9 @@ void TFormation::setStandardFormation(P2
|
||||
//vypocti polohy pro cleny
|
||||
TUnitMemberPosition ump;
|
||||
vumpPositions_c = 0;
|
||||
- getUnitMemberDim(0, &ump.p2fDim);
|
||||
int size = (int)unit->vMembers.size();
|
||||
+ if (size)
|
||||
+ getUnitMemberDim(0, &ump.p2fDim);
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
findFreeMemberPosition(vumpPositions_c, &(ump.p2fPos), &(ump.p2fDir));
|
||||
308
8Kingdoms-1.1.0-cvs-fixes.patch
Normal file
308
8Kingdoms-1.1.0-cvs-fixes.patch
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
--- 8Kingdoms-1.1.0/ai/Diplomacy/diplomacy.cpp 2007-07-22 03:32:49.000000000 +0200
|
||||
+++ kralovstvi/ai/Diplomacy/diplomacy.cpp 2007-08-27 07:28:48.000000000 +0200
|
||||
@@ -245,7 +245,11 @@
|
||||
void CDiplomacyEngine::setOtherRelationshipPropertiesByIDs(TRelationshipProperties & relshp_prop,int dip1,int dip2)
|
||||
{
|
||||
DiplomatRelations[dip1][dip2].relationship_properties.offer_seen_by_enemy=relshp_prop.offer_seen_by_enemy;
|
||||
+ if (relshp_prop.belief>MAXIMAL_BELIEF)
|
||||
+ relshp_prop.belief=MAXIMAL_BELIEF;
|
||||
DiplomatRelations[dip1][dip2].relationship_properties.belief=relshp_prop.belief;
|
||||
+ if (relshp_prop.guess_belief>MAXIMAL_BELIEF)
|
||||
+ relshp_prop.guess_belief=MAXIMAL_BELIEF;
|
||||
DiplomatRelations[dip1][dip2].relationship_properties.guess_belief=relshp_prop.guess_belief;
|
||||
}
|
||||
|
||||
@@ -993,6 +997,11 @@
|
||||
{
|
||||
if ((i!=dipid) && (DiplomatRecords[i].slotused))
|
||||
{
|
||||
+ // FOR SOME REASON belief can grow over MAXIMAL_BELIEF (tho it should not) - btw. the highest interval <ALLY_TRUCE_BORDER,MAXIMAL_BELIEF> represents alliance
|
||||
+ if (DiplomatRelations[dipid][i].relationship_properties.guess_belief>MAXIMAL_BELIEF)
|
||||
+ DiplomatRelations[dipid][i].relationship_properties.guess_belief=MAXIMAL_BELIEF;
|
||||
+ if (DiplomatRelations[dipid][i].relationship_properties.belief>MAXIMAL_BELIEF)
|
||||
+ DiplomatRelations[dipid][i].relationship_properties.belief=MAXIMAL_BELIEF;
|
||||
TRelationship believedrs=getBeliefRelationship(DiplomatRelations[dipid][i].relationship_properties.belief);
|
||||
if (DiplomatRelations[dipid][i].rs!=believedrs)
|
||||
{
|
||||
--- 8Kingdoms-1.1.0/ai/ai_makra.h 2007-07-22 03:32:49.000000000 +0200
|
||||
+++ kralovstvi/ai/ai_makra.h 2007-07-26 09:10:48.000000000 +0200
|
||||
@@ -11,8 +11,8 @@
|
||||
#ifndef __PETR_ZITA_AI_MAKRA__
|
||||
#define __PETR_ZITA_AI_MAKRA__
|
||||
|
||||
-#define PRIORITY_AI_FLOODFILL 1
|
||||
-#define PRIORITY_AI_ALLOC 1
|
||||
+#define PRIORITY_AI_FLOODFILL 10
|
||||
+#define PRIORITY_AI_ALLOC 10
|
||||
|
||||
/** Makro urcujici, zdali se ma volat tah umele inteligence - ma ciste ladici vyznam. */
|
||||
#define AI_STRATEGIZER_ENABLED
|
||||
--- 8Kingdoms-1.1.0/common/rm/rmconf.cpp 2007-07-22 03:32:51.000000000 +0200
|
||||
+++ kralovstvi/common/rm/rmconf.cpp 2007-07-26 09:10:34.000000000 +0200
|
||||
@@ -108,7 +108,7 @@
|
||||
if (retvalue!=0) // chyba pri cteni fajlu files.xml
|
||||
{
|
||||
GLOBALLOGID(PRIORITY_MISSING_FILE,"files.xml is missing or is damaged",XML_DIR);
|
||||
- THROW(E_8K_RM,"files.xml is corrupted");
|
||||
+ THROW(E_8K_RM,"files.xml cannot be found or is corrupted or is missing");
|
||||
}
|
||||
|
||||
// ziskani profilu
|
||||
--- 8Kingdoms-1.1.0/common/rm/rmmap.cpp 2007-07-22 03:32:51.000000000 +0200
|
||||
+++ kralovstvi/common/rm/rmmap.cpp 2007-08-27 07:28:48.000000000 +0200
|
||||
@@ -1855,6 +1855,12 @@
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
+ if ((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief>10000)
|
||||
+ {
|
||||
+ printf("This should not occure!!");
|
||||
+ GLOBALLOGID(PRIORITY_FATAL,"Strange belief value role %i, belief %i",ii,(*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief);
|
||||
+ }
|
||||
+
|
||||
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);
|
||||
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);
|
||||
}
|
||||
--- 8Kingdoms-1.1.0/common/xml/strda.cpp 2007-07-22 03:32:52.000000000 +0200
|
||||
+++ kralovstvi/common/xml/strda.cpp 2007-08-16 18:26:32.000000000 +0200
|
||||
@@ -25,10 +25,10 @@
|
||||
size_t j=count;
|
||||
for (k=0;k<j;k++)
|
||||
{
|
||||
- (*big)[i+k]=smallstr[k];
|
||||
+ (*big)[(int)(i+k)]=smallstr[(int)k];
|
||||
}
|
||||
if (terminate)
|
||||
- (*big)[i+k]=0;
|
||||
+ (*big)[(int)(i+k)]=0;
|
||||
}
|
||||
|
||||
void addtoda(DA<char> *big,const char *smallstr,int terminate)
|
||||
@@ -38,10 +38,10 @@
|
||||
size_t j=strlen(smallstr);
|
||||
for (k=0;k<j;k++)
|
||||
{
|
||||
- (*big)[i+k]=smallstr[k];
|
||||
+ (*big)[(int)(i+k)]=smallstr[(int)k];
|
||||
}
|
||||
if (terminate)
|
||||
- (*big)[i+k]=0;
|
||||
+ (*big)[(int)(i+k)]=0;
|
||||
}
|
||||
|
||||
void addtodawcs(DA<wchar_t> *big,const wchar_t *smallstr,int terminate)
|
||||
@@ -51,10 +51,10 @@
|
||||
size_t j=wcslen(smallstr);
|
||||
for (k=0;k<j;k++)
|
||||
{
|
||||
- (*big)[i+k]=smallstr[k];
|
||||
+ (*big)[(int)(i+k)]=smallstr[(int)k];
|
||||
}
|
||||
if (terminate)
|
||||
- (*big)[i+k]=0;
|
||||
+ (*big)[(int)(i+k)]=0;
|
||||
}
|
||||
|
||||
void addtodastr(DA<char> *big,const char *smallstr,int terminate)
|
||||
@@ -64,10 +64,10 @@
|
||||
size_t j=strlen(smallstr);
|
||||
for (k=0;k<j;k++)
|
||||
{
|
||||
- (*big)[i+k]=smallstr[k];
|
||||
+ (*big)[(int)(i+k)]=smallstr[(int)k];
|
||||
}
|
||||
if (terminate)
|
||||
- (*big)[i+k]=0;
|
||||
+ (*big)[(int)(i+k)]=0;
|
||||
}
|
||||
|
||||
void addtostr(char **big,const char *smallstr,int terminate)
|
||||
@@ -77,10 +77,10 @@
|
||||
size_t j=strlen(smallstr);
|
||||
for (k=0;k<j;k++)
|
||||
{
|
||||
- (*big)[i+k]=smallstr[k];
|
||||
+ (*big)[(int)(i+k)]=smallstr[(int)k];
|
||||
}
|
||||
if (terminate)
|
||||
- (*big)[i+k]=0;
|
||||
+ (*big)[(int)(i+k)]=0;
|
||||
}
|
||||
|
||||
size_t newandstrcpy(char ** output, const char * input)
|
||||
--- 8Kingdoms-1.1.0/common/xml/xml.cpp 2007-07-22 03:32:52.000000000 +0200
|
||||
+++ kralovstvi/common/xml/xml.cpp 2007-08-16 18:26:33.000000000 +0200
|
||||
@@ -1939,12 +1939,12 @@
|
||||
}
|
||||
|
||||
|
||||
-int TXMLdata::getData(char * data2,int size,int *ids,char ** tags, int number)
|
||||
+int TXMLdata::getData(char * data2,size_t size,int *ids,char ** tags, int number)
|
||||
// getData tentokrat s argumenty pole
|
||||
{
|
||||
if (number>0) // nema smysl se ptat na koren nebo neco co by melo byt nad
|
||||
{
|
||||
- int a;
|
||||
+ size_t a;
|
||||
xmlcontainer * xc=0;// = (xmlcontainer*) KMemAlloc(sizeof(xmlcontainer));
|
||||
int result=this->getTag(&xc,ids,tags,number);
|
||||
if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) )
|
||||
@@ -1964,7 +1964,7 @@
|
||||
a=-1;
|
||||
if (size>0) // zjistim kam dat posledni 0 - tesne za vraceny retezec
|
||||
{
|
||||
- int n;
|
||||
+ size_t n;
|
||||
if (a<(size-1))
|
||||
n=a;
|
||||
else
|
||||
@@ -1976,7 +1976,7 @@
|
||||
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))
|
||||
{
|
||||
// KMemFree(xc);
|
||||
- return (a);
|
||||
+ return ((int)a);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1990,7 +1990,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-int TXMLdata::getData(char * data2,int size, char * firsttag, int firstid,...)
|
||||
+int TXMLdata::getData(char * data2,size_t size, char * firsttag, int firstid,...)
|
||||
// varci data urcena cestou
|
||||
{
|
||||
// v tuto chvili neni jeste dobre mit daTags v debug okne ;D ... neni to inicializovane
|
||||
@@ -2104,7 +2104,7 @@
|
||||
{
|
||||
break;
|
||||
}
|
||||
- if ((result)>=size) // v result neni koncova 0
|
||||
+ if ((result)>=(int)size) // v result neni koncova 0
|
||||
{
|
||||
if ((size!=0) && ((*data2)!=NULL))
|
||||
KMemFree(*data2);
|
||||
@@ -2113,7 +2113,7 @@
|
||||
done=-1;
|
||||
}
|
||||
else
|
||||
- done=size;
|
||||
+ done=(int)size;
|
||||
} while (done==-1);
|
||||
}
|
||||
|
||||
--- 8Kingdoms-1.1.0/common/xml/xml.h 2007-07-22 03:32:52.000000000 +0200
|
||||
+++ kralovstvi/common/xml/xml.h 2007-08-16 18:26:33.000000000 +0200
|
||||
@@ -124,7 +124,7 @@
|
||||
@param firstid id prvniho nekorenoveho tagu na ceste k mistu kam se vklada
|
||||
@return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size) bez koncove 0
|
||||
*/
|
||||
- int getData(char * data2,int size, char * firsttag,int firstid,...);
|
||||
+ int getData(char * data2,size_t size, char * firsttag,int firstid,...);
|
||||
|
||||
/** Ziska cely obsah tagu v podobe retezce.
|
||||
Posledni parametr musi byt NULL, strida se vzdy tag a jeho id.
|
||||
@@ -160,7 +160,7 @@
|
||||
@param number delka cesty bez korenoveho tagu (take pocet prvku pole tags a ids)
|
||||
@return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size)
|
||||
*/
|
||||
- int getData(char * data2,int size,int *ids,char ** tags, int number);
|
||||
+ int getData(char * data2,size_t size,int *ids,char ** tags, int number);
|
||||
|
||||
/** Ziska okaz primo na data ulozena v xml.
|
||||
Tato funkce se musi pouzivat s opatrnosti pouze na cteni dat. Posledni parametr musi byt NULL.
|
||||
--- 8Kingdoms-1.1.0/net/comm.h 2007-07-22 03:32:59.000000000 +0200
|
||||
+++ kralovstvi/net/comm.h 2007-08-16 18:26:57.000000000 +0200
|
||||
@@ -194,7 +194,7 @@
|
||||
int ping_time;
|
||||
|
||||
/** Maximalni doba, po kterou se neprijal ping */
|
||||
- int max_timeout;
|
||||
+ unsigned int max_timeout;
|
||||
|
||||
};
|
||||
|
||||
--- 8Kingdoms-1.1.0/net/queue.h 2007-07-22 03:32:59.000000000 +0200
|
||||
+++ kralovstvi/net/queue.h 2007-08-16 18:26:57.000000000 +0200
|
||||
@@ -32,7 +32,7 @@
|
||||
char * data; ///< Vlasni data
|
||||
mysocket to; ///< Adresat
|
||||
struct TMessageBody * next; ///< Ukazatel na dalsi zpravu v seznamu
|
||||
- int part_sent; ///< Jak velka cast byla poslana
|
||||
+ size_t part_sent; ///< Jak velka cast byla poslana
|
||||
size_t len; ///< Velikost
|
||||
};
|
||||
|
||||
--- 8Kingdoms-1.1.0/net/server.cpp 2007-07-22 03:32:59.000000000 +0200
|
||||
+++ kralovstvi/net/server.cpp 2007-08-16 18:26:58.000000000 +0200
|
||||
@@ -818,7 +818,7 @@
|
||||
mysocket fd;
|
||||
j=0;
|
||||
int set=0;
|
||||
- int msglen3;
|
||||
+ size_t msglen3;
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_port = htons(80);
|
||||
server.sin_addr = *((struct in_addr *)he->h_addr);
|
||||
--- 8Kingdoms-1.1.0/world/players/player.cpp 2007-07-22 03:33:12.000000000 +0200
|
||||
+++ kralovstvi/world/players/player.cpp 2007-08-27 07:28:48.000000000 +0200
|
||||
@@ -72,6 +72,10 @@
|
||||
if (_data->game_data.relations[i] != NULL) {
|
||||
package->setInt(_data->game_data.relations[i]->rs, "relations", 0, "relationship", i, "rs", 0, NULL);
|
||||
package->setInt(_data->game_data.relations[i]->offeredrs, "relations", 0, "relationship", i, "offeredrs", 0, NULL);
|
||||
+ // this was missing!!
|
||||
+ package->setInt(_data->game_data.relations[i]->relationship_properties.belief, "relations", 0, "relationship", i, "belief", 0, NULL);
|
||||
+ package->setInt(_data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy, "relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL);
|
||||
+ package->setInt(_data->game_data.relations[i]->relationship_properties.guess_belief, "relations", 0, "relationship", i, "guess_belief", 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +123,10 @@
|
||||
_data->game_data.relations[i] = (ai_ns::diplomacy_ns::TDipRelation *)KMemAlloc(sizeof(ai_ns::diplomacy_ns::TDipRelation));
|
||||
_data->game_data.relations[i]->rs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "rs", 0, NULL);
|
||||
_data->game_data.relations[i]->offeredrs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offeredrs", 0, NULL);
|
||||
+ // this was missing!!
|
||||
+ _data->game_data.relations[i]->relationship_properties.belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "belief", 0, NULL);
|
||||
+ _data->game_data.relations[i]->relationship_properties.guess_belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "guess_belief", 0, NULL);
|
||||
+ _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);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -204,7 +212,7 @@
|
||||
info[it->first]->stats = it->second->data().statistics;
|
||||
for (i = 1; i <= MAX_PLAYERS; i++) {
|
||||
if (it->second->data().game_data.relations[i]) {
|
||||
- *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
|
||||
+ *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
|
||||
}
|
||||
else {
|
||||
info[it->first]->relations[i] = NULL;
|
||||
--- 8Kingdoms-1.1.0/world/world_engine.cpp 2007-07-22 03:33:12.000000000 +0200
|
||||
+++ kralovstvi/world/world_engine.cpp 2007-08-03 21:22:13.000000000 +0200
|
||||
@@ -1853,14 +1853,18 @@
|
||||
// zaznamenam do statistik
|
||||
_world.players.townCaptured(town_occupied->new_player_id, town_occupied->former_player_id);
|
||||
|
||||
- // dam o tom vedet diplomacii
|
||||
- if (former_player_id != 0) {
|
||||
- TPacket_Diplomacy_ConquerCity conquerCity;
|
||||
- conquerCity.attacked_diplomat_world_id = former_player_id;
|
||||
- conquerCity.attacking_diplomat_world_id = new_player_id;
|
||||
- conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
|
||||
+ // if the player is not dead or was not neutral, inform Diplomacy
|
||||
+ if (former_player_id != 0)
|
||||
+ {
|
||||
+ if (_world.players[former_player_id]->data().game_data.state != PS_DEFEATED)
|
||||
+ {
|
||||
+ TPacket_Diplomacy_ConquerCity conquerCity;
|
||||
+ conquerCity.attacked_diplomat_world_id = former_player_id;
|
||||
+ conquerCity.attacking_diplomat_world_id = new_player_id;
|
||||
+ conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
|
||||
|
||||
- KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
|
||||
+ KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
12
8Kingdoms-1.1.0-divide-by-zero.patch
Normal file
12
8Kingdoms-1.1.0-divide-by-zero.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
diff -up ./res/xml/scripts/unit_recruit_elite.xml~ ./res/xml/scripts/unit_recruit_elite.xml
|
||||
--- ./res/xml/scripts/unit_recruit_elite.xml~ 2008-01-04 20:07:15.000000000 +0100
|
||||
+++ ./res/xml/scripts/unit_recruit_elite.xml 2008-01-04 20:07:15.000000000 +0100
|
||||
@@ -60,7 +60,7 @@
|
||||
# pomocna promenna pro uchovani poctu zbyvajicich zivotu
|
||||
set missing_lives [expr $max_lives - $unit(lives)];
|
||||
|
||||
- if {$unit_types($unit(type), cure_cost) > 0} {
|
||||
+ if {($unit_types($unit(type), cure_cost) > 0) && ($unit(level) > 0)} {
|
||||
# pomocna promenna pro uchovani maximalniho poctu zivotu, na ktere
|
||||
# ma hrac penize
|
||||
set money [expr floor($player(money) / ($unit(level) * $unit_types($unit(type), cure_cost)))];
|
||||
41
8Kingdoms-1.1.0-gcc43.patch
Normal file
41
8Kingdoms-1.1.0-gcc43.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
--- 8Kingdoms-1.1.0/common/TCL/tcl_struct.cpp~ 2008-01-03 18:45:05.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/common/TCL/tcl_struct.cpp 2008-01-03 18:45:05.000000000 +0100
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
#include "common/compatibility.h"
|
||||
#include "common/types.h"
|
||||
#include "tcl_struct.h"
|
||||
--- 8Kingdoms-1.1.0/ai/Strategizer/attacks.cpp~ 2008-01-03 18:35:41.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/ai/Strategizer/attacks.cpp 2008-01-03 18:35:41.000000000 +0100
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "ai/Strategizer/attacks.h"
|
||||
+#include <limits.h>
|
||||
|
||||
using namespace World;
|
||||
|
||||
--- 8Kingdoms-1.1.0/ai/MapAnalyzer/mapanalyzer.cpp~ 2008-01-03 18:34:48.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/ai/MapAnalyzer/mapanalyzer.cpp 2008-01-03 18:34:48.000000000 +0100
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
|
||||
#include "ai/MapAnalyzer/mapanalyzer.h"
|
||||
+#include <limits.h>
|
||||
+
|
||||
using namespace World;
|
||||
|
||||
namespace ai_ns
|
||||
--- 8Kingdoms-1.1.0/gui/engine/Effects.cpp~ 2008-02-13 18:58:10.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/gui/engine/Effects.cpp 2008-02-13 18:58:10.000000000 +0100
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <GL/gl.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
+#include <limits.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
33
8Kingdoms-1.1.0-locking.patch
Normal file
33
8Kingdoms-1.1.0-locking.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
diff -up 8Kingdoms-1.1.0/world/world_engine.cpp~ 8Kingdoms-1.1.0/world/world_engine.cpp
|
||||
--- 8Kingdoms-1.1.0/world/world_engine.cpp~ 2007-12-02 12:43:53.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/world/world_engine.cpp 2007-12-02 12:43:53.000000000 +0100
|
||||
@@ -1214,7 +1214,10 @@ int TWorldServerEngine::unitMove(int uni
|
||||
}
|
||||
|
||||
if (!can_move)
|
||||
+ {
|
||||
+ unlock();
|
||||
return ERR_NotOperational;
|
||||
+ }
|
||||
|
||||
TPacket_RCT_UNIT_MOVE * packet = new TPacket_RCT_UNIT_MOVE();
|
||||
packet->unit_id = unit_id;
|
||||
diff -up 8Kingdoms-1.1.0/world/world_client.cpp~ 8Kingdoms-1.1.0/world/world_client.cpp
|
||||
--- 8Kingdoms-1.1.0/world/world_client.cpp~ 2007-12-02 12:09:28.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/world/world_client.cpp 2007-12-02 12:09:28.000000000 +0100
|
||||
@@ -321,6 +321,7 @@ RVAL WORLD_CLIENT_MSG_HANDLER(MESSAGE_ID
|
||||
|
||||
if (world_client[i]->state == WCS_GAME_ENDED && action_type == AT_ENDGAME) {
|
||||
// zprava o ukonceni hry pro jiz ukoncenou hru - ignoruji
|
||||
+ world_client_mutex.unlock();
|
||||
break;
|
||||
}
|
||||
else if (!(((action_type == AT_GAME_START) && (world_client[i]->state >= WCS_WORLD_INITIALIZED) && (world_client[i]->state < WCS_GAME_STARTED))
|
||||
@@ -328,6 +329,7 @@ RVAL WORLD_CLIENT_MSG_HANDLER(MESSAGE_ID
|
||||
(world_client[i]->state == WCS_GAME_STARTED)
|
||||
)) {
|
||||
// zprava prisla v nevhodnou chvili - ignoruji
|
||||
+ world_client_mutex.unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
380
8Kingdoms-1.1.0-tcl-threads.patch
Normal file
380
8Kingdoms-1.1.0-tcl-threads.patch
Normal file
|
|
@ -0,0 +1,380 @@
|
|||
--- 8Kingdoms-1.1.0/common/TCL/tcl_script.cpp 2007-07-22 03:32:50.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/common/TCL/tcl_script.cpp 2008-01-08 14:33:59.000000000 +0100
|
||||
@@ -12,34 +12,96 @@
|
||||
#include "common/TCL/tcl_struct.h"
|
||||
#include "world/useful.h"
|
||||
#include "world/typedefs.h"
|
||||
+#include "world/rules.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
+/* We can get called from multiple threads, protected against reentrance
|
||||
+ through locks. But locks are not enough. Tcl is thread aware and does not
|
||||
+ allow an interpreter to be called from another thread then it is created.
|
||||
+ With Tcl-8.4 things work even when violating this Tcl thread model rule, but
|
||||
+ thats pure luck on our side.
|
||||
+
|
||||
+ However with Tcl-8.5 calling an interpreter from another thread then it is
|
||||
+ created really no longer works. Under pthread using OS we solve this by
|
||||
+ using a per thread variable for the interpreter and creating an interpreter
|
||||
+ for each thread. Under non pthread OS we keep relying on our luck, so
|
||||
+ Tcl-8.5 may not be used there! */
|
||||
+
|
||||
+#ifdef __unix__
|
||||
+/* interpreter destructor for the per thread interpreter */
|
||||
+static void interpreter_destructor(void *_interpreter)
|
||||
+{
|
||||
+ Tcl_DeleteInterp((Tcl_Interp *)_interpreter);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
TTCL_Interpreter::TTCL_Interpreter()
|
||||
{
|
||||
- _interpreter = Tcl_CreateInterp();
|
||||
+#ifdef __unix__
|
||||
+ pthread_key_create(&_interpreter_key, interpreter_destructor);
|
||||
+ _rules = NULL;
|
||||
+#else
|
||||
+ _interpreter = Tcl_CreateInterp();
|
||||
+#endif
|
||||
}
|
||||
|
||||
TTCL_Interpreter::~TTCL_Interpreter()
|
||||
{
|
||||
+#ifdef __unix__
|
||||
+ pthread_key_delete(_interpreter_key);
|
||||
+#else
|
||||
Tcl_DeleteInterp(_interpreter);
|
||||
//KMemFree(_interpreter);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+Tcl_Interp *TTCL_Interpreter::getInterpreter()
|
||||
+{
|
||||
+#ifdef __unix__
|
||||
+ Tcl_Interp *_interpreter =
|
||||
+ (Tcl_Interp *)pthread_getspecific(_interpreter_key);
|
||||
+
|
||||
+ if (!_interpreter)
|
||||
+ {
|
||||
+ _interpreter = Tcl_CreateInterp();
|
||||
+ pthread_setspecific(_interpreter_key, _interpreter);
|
||||
+
|
||||
+ if (_rules)
|
||||
+ {
|
||||
+ _rules->writeToTCL(*this);
|
||||
+ Tcl_CreateCommand(_interpreter, "KSendMessage", _TCLSendMessageProc,
|
||||
+ NULL, NULL);
|
||||
+ TTCL_Script script(this);
|
||||
+ script.loadStruct(_init_script);
|
||||
+ script.run();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ return _interpreter;
|
||||
}
|
||||
|
||||
-void TTCL_Interpreter::init(TCL_SCRIPT * init_script)
|
||||
+void TTCL_Interpreter::init(World::TRules * rules,
|
||||
+ Tcl_CmdProc * TCLSendMessageProc, TCL_SCRIPT * init_script)
|
||||
{
|
||||
+#ifdef __unix__
|
||||
+ _rules = rules;
|
||||
+ _TCLSendMessageProc = TCLSendMessageProc;
|
||||
+ _init_script = init_script;
|
||||
+#else
|
||||
+ rules->writeToTCL(*this);
|
||||
+ Tcl_CreateCommand(getInterpreter(), "KSendMessage", TCLSendMessageProc,
|
||||
+ NULL, NULL);
|
||||
TTCL_Script script(this);
|
||||
script.loadStruct(init_script);
|
||||
script.run();
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool TTCL_Interpreter::setVar(const char * name, const TCL_VAR_TYPE type, void * value)
|
||||
{
|
||||
- if (_interpreter == NULL)
|
||||
- THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
|
||||
-
|
||||
// odstraneni predchoziho vyskytu promenne
|
||||
- Tcl_UnsetVar(_interpreter, name, 0);
|
||||
+ Tcl_UnsetVar(getInterpreter(), name, 0);
|
||||
|
||||
// nastaveni nove hodnoty
|
||||
bool result;
|
||||
@@ -48,7 +110,7 @@
|
||||
switch (type) {
|
||||
case TVT_STRING:
|
||||
// STRING
|
||||
- result = (Tcl_SetVar(_interpreter, name, (const char *)value, 0) != NULL);
|
||||
+ result = (Tcl_SetVar(getInterpreter(), name, (const char *)value, 0) != NULL);
|
||||
break;
|
||||
case TVT_INT:
|
||||
// INT
|
||||
@@ -56,7 +118,7 @@
|
||||
snprintf(s, 255, "%d", *(int *)value);
|
||||
|
||||
// ulozim cislo do TCL
|
||||
- result = (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
|
||||
+ result = (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
|
||||
break;
|
||||
case TVT_FLOAT:
|
||||
// FLOAT
|
||||
@@ -64,7 +126,7 @@
|
||||
snprintf(s, 255, "%f", *(float *)value);
|
||||
|
||||
// ulozim cislo do TCL
|
||||
- result = (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
|
||||
+ result = (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
|
||||
break;
|
||||
case TVT_FLOAT_LIST:
|
||||
{
|
||||
@@ -153,11 +215,8 @@
|
||||
|
||||
bool TTCL_Interpreter::getVar(const char * name, const TCL_VAR_TYPE type, void * value)
|
||||
{
|
||||
- if (_interpreter == NULL)
|
||||
- THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
|
||||
-
|
||||
// nacteni objektu z TCL
|
||||
- Tcl_Obj * tcl_obj = Tcl_GetVar2Ex(_interpreter, name, NULL, TCL_LEAVE_ERR_MSG);
|
||||
+ Tcl_Obj * tcl_obj = Tcl_GetVar2Ex(getInterpreter(), name, NULL, TCL_LEAVE_ERR_MSG);
|
||||
|
||||
// promennou se nepodarilo nacist (a pritom to nebylo asociativni pole)
|
||||
if ((tcl_obj == NULL) && (type != TVT_INT_ARRAY) && (type != TVT_FLOAT_ARRAY) && (type != TVT_STRING_ARRAY)) {
|
||||
@@ -173,14 +232,14 @@
|
||||
return true;
|
||||
break;
|
||||
case TVT_INT:
|
||||
- if (Tcl_GetIntFromObj(_interpreter, tcl_obj, (int *)value) == TCL_OK)
|
||||
+ if (Tcl_GetIntFromObj(getInterpreter(), tcl_obj, (int *)value) == TCL_OK)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
case TVT_FLOAT:
|
||||
double _value;
|
||||
- if (Tcl_GetDoubleFromObj(_interpreter, tcl_obj, &_value) == TCL_OK) {
|
||||
+ if (Tcl_GetDoubleFromObj(getInterpreter(), tcl_obj, &_value) == TCL_OK) {
|
||||
// pretypovani na float
|
||||
*(float *)value = (float)_value;
|
||||
return true;
|
||||
@@ -415,7 +474,7 @@
|
||||
char s[MAX_STRLEN];
|
||||
|
||||
snprintf(s, MAX_STRLEN, "%d", value);
|
||||
- return (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
|
||||
+ return (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
|
||||
}
|
||||
|
||||
bool TTCL_Interpreter::setConstDouble(const char * name, const double value)
|
||||
@@ -423,29 +482,21 @@
|
||||
char s[MAX_STRLEN];
|
||||
|
||||
snprintf(s, MAX_STRLEN, "%.2f", value);
|
||||
- return (Tcl_SetVar(_interpreter, name, s, 0) != NULL);
|
||||
+ return (Tcl_SetVar(getInterpreter(), name, s, 0) != NULL);
|
||||
}
|
||||
|
||||
int TTCL_Interpreter::eval(const char * code)
|
||||
{
|
||||
- if (_interpreter == NULL)
|
||||
- THROW(E_8K_TCL_Error, "TCL interpreter has not been initialized properly");
|
||||
-
|
||||
- int result = Tcl_Eval(_interpreter, code);
|
||||
+ int result = Tcl_Eval(getInterpreter(), code);
|
||||
if (result == TCL_ERROR) {
|
||||
- THROW(E_8K_TCL_Error, Tcl_GetStringResult(_interpreter));
|
||||
+ THROW(E_8K_TCL_Error, Tcl_GetStringResult(getInterpreter()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char * TTCL_Interpreter::getError()
|
||||
{
|
||||
- return Tcl_GetStringResult(_interpreter);
|
||||
-}
|
||||
-
|
||||
-Tcl_Command TTCL_Interpreter::createCommand(const char * tclName, Tcl_CmdProc * cName, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)
|
||||
-{
|
||||
- return Tcl_CreateCommand(_interpreter, tclName, cName, clientData, deleteProc);
|
||||
+ return Tcl_GetStringResult(getInterpreter());
|
||||
}
|
||||
|
||||
void TTCL_Interpreter::setResult(TCL_VAR_TYPE type, void * value)
|
||||
@@ -455,21 +506,21 @@
|
||||
switch (type) {
|
||||
case TVT_STRING:
|
||||
// STRING
|
||||
- Tcl_SetResult(_interpreter, (char *)value, NULL);
|
||||
+ Tcl_SetResult(getInterpreter(), (char *)value, NULL);
|
||||
break;
|
||||
case TVT_INT:
|
||||
// INT
|
||||
// prevedu cislo na string
|
||||
snprintf(s, MAX_STRLEN, "%d", *(int *)value);
|
||||
|
||||
- Tcl_SetResult(_interpreter, s, NULL);
|
||||
+ Tcl_SetResult(getInterpreter(), s, NULL);
|
||||
break;
|
||||
case TVT_FLOAT:
|
||||
// FLOAT
|
||||
// prevedu cislo na string
|
||||
snprintf(s, MAX_STRLEN, "%f", *(float *)value);
|
||||
|
||||
- Tcl_SetResult(_interpreter, s, NULL);
|
||||
+ Tcl_SetResult(getInterpreter(), s, NULL);
|
||||
break;
|
||||
default:
|
||||
THROW(E_8K_TCL_UnknownType, "");
|
||||
--- 8Kingdoms-1.1.0/common/TCL/tcl_script.h 2007-07-22 03:32:50.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/common/TCL/tcl_script.h 2008-01-08 14:30:55.000000000 +0100
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
#include <map>
|
||||
#include <tcl.h>
|
||||
+#ifdef __unix__
|
||||
+#include <pthread.h>
|
||||
+#endif
|
||||
#include "common/TCL/tcl_var.h"
|
||||
|
||||
/// pocet desetinnych mist, pouzitych pri konverzi cisel do TCL
|
||||
@@ -172,6 +175,11 @@
|
||||
char * code;
|
||||
};
|
||||
|
||||
+namespace World
|
||||
+{
|
||||
+ class TRules;
|
||||
+};
|
||||
+
|
||||
/** Interpret skriptu jazyka TCL
|
||||
Objektovy "obal" puvodnich TCL struktur.
|
||||
|
||||
@@ -184,16 +192,26 @@
|
||||
class TTCL_Interpreter
|
||||
{
|
||||
private:
|
||||
+#ifdef __unix__
|
||||
+ pthread_key_t _interpreter_key;
|
||||
+ TCL_SCRIPT * _init_script;
|
||||
+ Tcl_CmdProc * _TCLSendMessageProc;
|
||||
+ World::TRules * _rules;
|
||||
+#else
|
||||
Tcl_Interp * _interpreter;
|
||||
+#endif
|
||||
+ Tcl_Interp *getInterpreter();
|
||||
+
|
||||
public:
|
||||
TTCL_Interpreter();
|
||||
~TTCL_Interpreter();
|
||||
-
|
||||
+
|
||||
/** Inicializace prostredi TCL interpreteru.
|
||||
Nastaveni globalnich promennych, inkluze knihoven a definice spolecnych
|
||||
funkci.
|
||||
*/
|
||||
- void init(TCL_SCRIPT * init_script);
|
||||
+ void init(World::TRules * rules, Tcl_CmdProc * TCLSendMessageProc,
|
||||
+ TCL_SCRIPT * init_script);
|
||||
|
||||
/** Ulozeni promenne do prostredi TCL interpretu
|
||||
@param name jmeno promenne
|
||||
@@ -256,15 +274,6 @@
|
||||
*/
|
||||
const char * getError();
|
||||
|
||||
- /** Nastaveni uzivatelske funkce.
|
||||
- Umozni asociovat volani funkce z TCL s funkci v C
|
||||
- @param tclName jmeno funkce v TCL, jejiz volani chceme obsluhovat sami
|
||||
- @param cName funkce z C, ktera bude realizovat telo funkce z TCL
|
||||
- @param clientData arbitrary one-word value to pass to proc and deleteProc.
|
||||
- @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.
|
||||
- */
|
||||
- Tcl_Command createCommand(const char * tclName, Tcl_CmdProc * cName, ClientData clientData = NULL, Tcl_CmdDeleteProc * deleteProc = NULL);
|
||||
-
|
||||
/// Nastaveni navratove hodnoty funkce
|
||||
void setResult(TCL_VAR_TYPE type, void * value);
|
||||
};
|
||||
--- 8Kingdoms-1.1.0/world/world_client.cpp 2008-01-08 14:39:20.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0.new/world/world_client.cpp 2008-01-08 14:37:05.000000000 +0100
|
||||
@@ -107,13 +107,7 @@
|
||||
world->init();
|
||||
|
||||
// inicializace negine
|
||||
- engine->init(world);
|
||||
-
|
||||
- // registrace zprav z TCL
|
||||
- engine->interpreter.createCommand("KSendMessage", (Tcl_CmdProc *)World::WorldClient_SendMessage);
|
||||
-
|
||||
- // inkluze knihoven pro TCL (spusteni inicializacniho skriptu)
|
||||
- engine->interpreter.init(world->rules->scripts[TS_INIT]);
|
||||
+ engine->init(world, (Tcl_CmdProc *)World::WorldClient_SendMessage);
|
||||
}
|
||||
|
||||
// svet je pripraven
|
||||
--- 8Kingdoms-1.1.0/world/world_engine.cpp 2008-01-08 14:39:21.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0.new/world/world_engine.cpp 2008-01-08 14:38:37.000000000 +0100
|
||||
@@ -30,11 +29,10 @@
|
||||
|
||||
}
|
||||
|
||||
-void TWorldEngine::init(TWorld * world)
|
||||
+void TWorldEngine::init(TWorld * world, Tcl_CmdProc *TCLSendMessageProc)
|
||||
{
|
||||
- // zapis pravidel do prostredi TCL interpreteru
|
||||
- if (world->rules)
|
||||
- world->rules->writeToTCL(interpreter);
|
||||
+ interpreter.init(world->rules, TCLSendMessageProc,
|
||||
+ world->rules->scripts[TS_INIT]);
|
||||
}
|
||||
|
||||
int TWorldEngine::lock()
|
||||
--- 8Kingdoms-1.1.0/world/world_engine.h 2007-07-22 03:33:12.000000000 +0200
|
||||
+++ 8Kingdoms-1.1.0.new/world/world_engine.h 2008-01-08 13:44:32.000000000 +0100
|
||||
@@ -45,7 +45,7 @@
|
||||
~TWorldEngine();
|
||||
|
||||
/** Inicializace */
|
||||
- void init(TWorld * world);
|
||||
+ void init(TWorld * world, Tcl_CmdProc *TCLSendMessageProc);
|
||||
|
||||
/// Zamceni mutexu
|
||||
int lock();
|
||||
--- 8Kingdoms-1.1.0/world/world_server.cpp 2008-01-08 14:39:20.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0.new/world/world_server.cpp 2008-01-08 14:36:44.000000000 +0100
|
||||
@@ -87,13 +87,7 @@
|
||||
world.init();
|
||||
|
||||
// inicializace world_engine
|
||||
- engine.init(&world);
|
||||
-
|
||||
- // registrace zprav z TCL
|
||||
- engine.interpreter.createCommand("KSendMessage", (Tcl_CmdProc *)WorldServer_SendMessage);
|
||||
-
|
||||
- // inkluze knihoven pro TCL (spusteni inicializacniho skriptu)
|
||||
- engine.interpreter.init(world.rules->scripts[TS_INIT]);
|
||||
+ engine.init(&world, (Tcl_CmdProc *)WorldServer_SendMessage);
|
||||
}
|
||||
|
||||
void TWorldServer::shutdown()
|
||||
--- 8Kingdoms-1.1.0/8Kingdoms.cpp~ 2008-01-08 20:31:01.000000000 +0100
|
||||
+++ 8Kingdoms-1.1.0/8Kingdoms.cpp 2008-01-08 20:31:01.000000000 +0100
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
//rozhrani
|
||||
#include <sstream>
|
||||
+#include <tcl.h>
|
||||
|
||||
#include "common/Interface.h"
|
||||
#include "common/Msg.h"
|
||||
@@ -470,6 +471,8 @@ void print_help(){
|
||||
*/
|
||||
int main(int argc, char** argv){
|
||||
|
||||
+ Tcl_FindExecutable(argv[0]);
|
||||
+
|
||||
try{
|
||||
//parametry z prikazoveho radku
|
||||
TCommandLine::parseCommandLine(argc, argv);
|
||||
7
8Kingdoms.desktop
Normal file
7
8Kingdoms.desktop
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Name=8 Kingdoms
|
||||
Comment=A 3D turn-based fantasy strategic game
|
||||
Exec=8Kingdoms-wrapper
|
||||
Icon=8Kingdoms
|
||||
Type=Application
|
||||
Categories=Game;StrategyGame;
|
||||
BIN
8Kingdoms.png
Normal file
BIN
8Kingdoms.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
141
8Kingdoms.spec
Normal file
141
8Kingdoms.spec
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
# Copyright (c) 2007 oc2pus <toni@links2linux.de>
|
||||
# Copyright (c) 2007 Hans de Goede <j.w.r.degoede@hhs.nl>
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
|
||||
Name: 8Kingdoms
|
||||
Version: 1.1.0
|
||||
Release: 6%{?dist}
|
||||
Summary: 8 Kingdoms is a 3D turn-based fantasy strategic game
|
||||
Group: Amusements/Games
|
||||
License: GPL+
|
||||
URL: http://kralovstvi.sourceforge.net/
|
||||
# This is:
|
||||
# http://downloads.sourceforge.net/kralovstvi/%{name}-%{version}.tar.gz
|
||||
# With external/extgl.h removed, as that contains parts of Windows gl.h and
|
||||
# parts of a version of glext.h which falls under the "SGI Free Software
|
||||
# License B", neither which are Free software.
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
# This is a Free replacement file with the troublesome parts replaced with
|
||||
# parts from Mesa's gl.h and from The Kronos Group glext.h .
|
||||
Source1: extgl.h
|
||||
Source2: %{name}.desktop
|
||||
Source3: %{name}.png
|
||||
Patch0: 8Kingdoms-1.1.0-64bit.patch
|
||||
Patch1: 8Kingdoms-1.1.0-locking.patch
|
||||
Patch2: 8Kingdoms-1.1.0-crash.patch
|
||||
Patch3: 8Kingdoms-1.1.0-gcc43.patch
|
||||
Patch4: 8Kingdoms-1.1.0-divide-by-zero.patch
|
||||
Patch5: 8Kingdoms-1.1.0-cvs-fixes.patch
|
||||
Patch6: 8Kingdoms-1.1.0-tcl-threads.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: expat-devel SDL_mixer-devel tcl-devel desktop-file-utils
|
||||
Requires: hicolor-icon-theme opengl-games-utils
|
||||
|
||||
%description
|
||||
8 Kingdoms is a 3D turn-based fantasy strategic game in which
|
||||
players become kings, build their empires and conquer enemy
|
||||
kingdoms.
|
||||
|
||||
Theme of the game 8 Kingdoms is inspirated by the world of fantasy.
|
||||
Players play on a fully 3D hex map. They construct buildings,
|
||||
recruit units including infantry, mounted units, mages, catapults
|
||||
and finally they attack enemy or help allies. Units gain experiences
|
||||
during the battle, each unit can get some abilities upgraded to be
|
||||
stronger. Data are stored in XML and freely accessible - from
|
||||
language versions to units' attributes, moreover map editor with
|
||||
random map generator is included for comfortable map editing.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
cp -a %{SOURCE1} external
|
||||
chmod -x doc/gui/gui_img1.png
|
||||
# configure won't recognize --datadir ...
|
||||
sed -i 's|games/8Kingdoms|share/8Kingdoms|g' configure
|
||||
|
||||
|
||||
%build
|
||||
%configure
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
# And here we must explicitly set pkgdatadir despite our earlier sed!
|
||||
make install DESTDIR=$RPM_BUILD_ROOT pkgdatadir=%{_datadir}/%{name}
|
||||
ln -s opengl-game-wrapper.sh $RPM_BUILD_ROOT%{_bindir}/%{name}-wrapper
|
||||
|
||||
# below is the desktop file and icon stuff.
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
|
||||
desktop-file-install --vendor fedora \
|
||||
--dir $RPM_BUILD_ROOT%{_datadir}/applications \
|
||||
%{SOURCE2}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/96x96/apps
|
||||
install -p -m 644 %{SOURCE3} \
|
||||
$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/96x96/apps
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%post
|
||||
touch --no-create %{_datadir}/icons/hicolor || :
|
||||
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
|
||||
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
touch --no-create %{_datadir}/icons/hicolor || :
|
||||
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
|
||||
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS ChangeLog COPYING README doc/*
|
||||
%{_bindir}/%{name}*
|
||||
%{_datadir}/%{name}
|
||||
%{_datadir}/applications/fedora-%{name}.desktop
|
||||
%{_datadir}/icons/hicolor/96x96/apps/%{name}.png
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Feb 13 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-6
|
||||
- Fix compiling with gcc 4.3 (again, newer version is even stricter)
|
||||
|
||||
* Tue Jan 8 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-5
|
||||
- Don't call a TclInterpreter from other threads then its created in, this
|
||||
violates Tcl's thread model, this fixes running with Tcl-8.5
|
||||
|
||||
* Fri Jan 4 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-4
|
||||
- Fix divide by zero abort (bz 427485)
|
||||
- Backport various fixes from CVS
|
||||
- Note this still won't work with tcl 8.5, this release is just to keep
|
||||
rawhide in sync with F-8 / F-7
|
||||
|
||||
* Thu Jan 3 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-3
|
||||
- Rebuild for new tcl, note: it builds but does not work with the new TCL!
|
||||
help fixing this asked upstream. Any help much appreciated!
|
||||
- Fix compiling with gcc 4.3
|
||||
- Fix crash undercertain conditions (bz 425799)
|
||||
|
||||
* Sun Dec 2 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-2
|
||||
- Replace BuildRequires expat with expat-devel (oops)
|
||||
- Add a patch which stops 8Kingdoms from hanging in certain cases
|
||||
- Use opengl-games-utils wrapper to show error dialog when DRI is missing
|
||||
|
||||
* Sat Nov 24 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-1
|
||||
- Adapted Packman specfile for Fedora
|
||||
|
||||
* Fri Aug 10 2007 Toni Graffy <toni@links2linux.de> - 1.1.0-0.pm.1
|
||||
- initial build 1.1.0
|
||||
|
|
@ -1 +0,0 @@
|
|||
was retired in f11
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
bf70d7d21281852250116ab6894a3c33 8Kingdoms-1.1.0.tar.gz
|
||||
Reference in a new issue