Skip to content

Commit

Permalink
fixed linux compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Soar Qin committed Jun 7, 2012
1 parent a3cd396 commit acf894d
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 15 deletions.
3 changes: 3 additions & 0 deletions gframe/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define myswprintf swprintf
#endif

#define socklen_t int

#else //_WIN32

#include <errno.h>
Expand All @@ -24,6 +26,7 @@
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>

#define SD_BOTH 2
#define SOCKET int
Expand Down
4 changes: 2 additions & 2 deletions gframe/deck_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
FILE* fp = _wfopen(deck, L"r");
#else
char deckfn[256];
DataManager::EncodeUTF8(deck, deckfn);
BufferIO::EncodeUTF8(deck, deckfn);
FILE* fp = fopen(deckfn, "r");
#endif
if(!fp)
Expand Down Expand Up @@ -213,7 +213,7 @@ void DeckManager::SaveDeck(Deck& deck, const wchar_t* name) {
FILE* fp = _wfopen(file, L"w");
#else
char filefn[256];
DataManager::EncodeUTF8(file, filefn);
BufferIO::EncodeUTF8(file, filefn);
FILE* fp = fopen(filefn, "w");
#endif
if(!fp)
Expand Down
2 changes: 1 addition & 1 deletion gframe/duelclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
mainGame->btnLanRefresh->setEnabled(true);
} else if(events & EV_READ) {
sockaddr_in bc_addr;
int sz = sizeof(sockaddr_in);
socklen_t sz = sizeof(sockaddr_in);
char buf[256];
int ret = recvfrom(fd, buf, 256, 0, (sockaddr*)&bc_addr, &sz);
unsigned int ipaddr = bc_addr.sin_addr.s_addr;
Expand Down
4 changes: 2 additions & 2 deletions gframe/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ void Game::RefreshReplay() {
continue;
wchar_t wname[256];
BufferIO::DecodeUTF8(dirp->d_name, wname);
if(lastReplay.CheckReplay(dirp->d_name));
lstReplayList->addItem(wname);
if(Replay::CheckReplay(wname))
lstReplayList->addItem(wname);
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion gframe/netserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void NetServer::StopListen() {
}
void NetServer::BroadcastEvent(evutil_socket_t fd, short events, void* arg) {
sockaddr_in bc_addr;
int sz = sizeof(sockaddr_in);
socklen_t sz = sizeof(sockaddr_in);
char buf[256];
int ret = recvfrom(fd, buf, 256, 0, (sockaddr*)&bc_addr, &sz);
if(ret == -1)
Expand Down
8 changes: 5 additions & 3 deletions gframe/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ project "gframe"
files { "**.cpp", "**.cc", "**.c", "**.h" }
excludes "lzma/**"
includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "irrlicht", "freetype", "sqlite3", "lua" , "event"}
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event"}

configuration "windows"
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
configuration {"windows", "not vs*"}
includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" }
configuration "not vs*"
buildoptions { "-std=gnu++0x" }
buildoptions { "-std=gnu++0x", "-fno-rtti" }
configuration "not windows"
links { "gl", "dl" }
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2", "/usr/include/irrlicht", "/usr/include/freetype2" }
excludes { "COSOperator.*" }
links { "event_pthreads", "GL", "dl", "pthread" }
2 changes: 1 addition & 1 deletion gframe/single_duel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "config.h"
#include "network.h"
#include "Replay.h"
#include "replay.h"

namespace ygo {

Expand Down
2 changes: 1 addition & 1 deletion gframe/tag_duel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "config.h"
#include "network.h"
#include "Replay.h"
#include "replay.h"

namespace ygo {

Expand Down
2 changes: 1 addition & 1 deletion lflist.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[2012.3.1][2011.9.1]
#[2012.3.1][2011.9.1]
!2012.3.1
#forbidden
20663556 0 --イレカエル
Expand Down
6 changes: 3 additions & 3 deletions ocgcore/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ extern "C" {
#include <lua/lauxlib.h>
#include <lua/lualib.h>
#else
#include <lua5.1/lua.h>
#include <lua5.1/lauxlib.h>
#include <lua5.1/lualib.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#endif
}
#include "common.h"
Expand Down
2 changes: 2 additions & 0 deletions ocgcore/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ project "ocgcore"
files { "**.cc", "**.cpp", "**.c", "**.h" }
configuration "not vs*"
buildoptions { "-std=gnu++0x" }
configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" }

0 comments on commit acf894d

Please sign in to comment.