remove SDL_win32_main.c

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6093 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2011-02-12 17:50:14 +00:00
parent cca954a06c
commit 1cc07e6b96
5 changed files with 40 additions and 456 deletions
+1 -6
View File
@@ -83,9 +83,7 @@ CLIENT_OBJS= \
bot/bot_waypoint.o \
bot/ac_bot.o \
bot/ac_bot_ai.o
ifneq (,$(findstring MINGW,$(PLATFORM)))
CLIENT_OBJS+= ../vcpp/SDL_win32_main.o
endif
CLIENT_PCH= cube.h.gch
ifneq (,$(findstring MINGW,$(PLATFORM)))
@@ -146,9 +144,6 @@ $(SERVER_OBJS): CXXFLAGS += $(SERVER_INCLUDES)
$(filter-out $(SERVER_OBJS),$(MASTER_OBJS)): CXXFLAGS += $(SERVER_INCLUDES)
ifneq (,$(findstring MINGW,$(PLATFORM)))
../vcpp/%.o:
$(CXX) $(CXXFLAGS) -c -o $@ $(subst .o,.c,$@)
client: $(CLIENT_OBJS)
$(WINDRES) -I ../vcpp -i ../vcpp/cube.rc -J rc -o ../vcpp/cube.res -O coff
$(CXX) $(CXXFLAGS) -o ../../bin_win32/ac_client.exe ../vcpp/cube.res $(CLIENT_OBJS) $(CLIENT_LIBS)
+39
View File
@@ -1049,6 +1049,45 @@ void connectprotocol(char *protocolstring, string &servername, string &serverpor
} while(*c && *c=='&' && *c!='/');
}
#ifdef WIN32
static char *parsecommandline(const char *src, vector<char *> &args)
{
char *buf = new char[strlen(src) + 1], *dst = buf;
for(;;)
{
while(isspace(*src)) src++;
if(!*src) break;
args.add(dst);
do
{
while(*src && *src != '"' && !isspace(*src)) *dst++ = *src++;
if(*src == '"') for(;;)
{
for(++src; *src && *src != '"';) *dst++ = *src++;
if(!*src) break;
if(src[-1] != '\\') { src++; break; }
dst[-1] = '"';
}
} while(*src && *src != '"' && !isspace(*src));
*dst++ = '\0';
}
args.add(NULL);
return buf;
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
vector<char *> args;
char *buf = parsecommandline(GetCommandLine(), args);
SDL_SetModuleHandle(hInst);
int status = SDL_main(args.length()-1, args.getbuf());
delete[] buf;
exit(status);
return 0;
}
#endif
int main(int argc, char **argv)
{
extern struct servercommandline scl;