Added linkage to libdl, fix for mode.

develop
Petr Mrázek 2012-02-01 04:12:15 +01:00
parent e5b1433d44
commit 22aeb6e2ac
2 changed files with 8 additions and 3 deletions

@ -164,7 +164,7 @@ IF(UNIX)
ENDIF() ENDIF()
IF(UNIX) IF(UNIX)
SET(PROJECT_LIBS rt ) SET(PROJECT_LIBS rt dl)
ELSE(WIN32) ELSE(WIN32)
#FIXME: do we really need this? #FIXME: do we really need this?
SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib) SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib)

@ -113,7 +113,7 @@ DFhackCExport command_result mode (Core * c, vector <string> & parameters)
printCurrentModes(gm, c->con); printCurrentModes(gm, c->con);
if(set) if(set)
{ {
if(gm.g_mode == GAMEMODE_NONE || gm.g_type == GAMETYPE_VIEW_LEGENDS || gm.g_type == GAMETYPE_DWARF_RECLAIM) if( gm.g_mode == GAMEMODE_NONE || gm.g_type == GAMETYPE_VIEW_LEGENDS )
{ {
c->con.printerr("It is not safe to set modes in menus.\n"); c->con.printerr("It is not safe to set modes in menus.\n");
return CR_FAILURE; return CR_FAILURE;
@ -123,6 +123,7 @@ DFhackCExport command_result mode (Core * c, vector <string> & parameters)
<< "1 = Adventurer Mode" << endl << "1 = Adventurer Mode" << endl
<< "2 = Arena Mode" << endl << "2 = Arena Mode" << endl
<< "3 = Arena, controlling creature" << endl << "3 = Arena, controlling creature" << endl
<< "4 = Reclaim Fortress Mode" << endl
<< "c = cancel/do nothing" << endl; << "c = cancel/do nothing" << endl;
uint32_t select=99; uint32_t select=99;
@ -135,7 +136,7 @@ DFhackCExport command_result mode (Core * c, vector <string> & parameters)
const char * start = selected.c_str(); const char * start = selected.c_str();
char * end = 0; char * end = 0;
select = strtol(start, &end, 10); select = strtol(start, &end, 10);
if(!end || end==start || select > 3) if(!end || end==start || select > 4)
{ {
c->con.printerr("This is not a valid selection.\n"); c->con.printerr("This is not a valid selection.\n");
goto input_again; goto input_again;
@ -159,6 +160,10 @@ DFhackCExport command_result mode (Core * c, vector <string> & parameters)
gm.g_mode = GAMEMODE_ADVENTURE; gm.g_mode = GAMEMODE_ADVENTURE;
gm.g_type = GAMETYPE_ADVENTURE_ARENA; gm.g_type = GAMETYPE_ADVENTURE_ARENA;
break; break;
case 4:
gm.g_mode = GAMEMODE_DWARF;
gm.g_type = GAMETYPE_DWARF_RECLAIM;
break;
} }
c->Suspend(); c->Suspend();
world->WriteGameMode(gm); world->WriteGameMode(gm);