* BoE scenarios password remover code uploaded.
git-svn-id: http://openexile.googlecode.com/svn/trunk@108 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
99
BoE_NP.dev
Normal file
99
BoE_NP.dev
Normal file
@@ -0,0 +1,99 @@
|
||||
[Project]
|
||||
FileName=Test_c.dev
|
||||
Name=Project1
|
||||
UnitCount=5
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=
|
||||
ObjectOutput=
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=BoE_NP.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000001000000100
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
||||
[Unit2]
|
||||
FileName=GLOBAL.CPP
|
||||
CompileCpp=1
|
||||
Folder=Project1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit3]
|
||||
FileName=GLOBAL.H
|
||||
CompileCpp=1
|
||||
Folder=Project1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit5]
|
||||
FileName=TFILEIO.CPP
|
||||
CompileCpp=1
|
||||
Folder=Project1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit4]
|
||||
FileName=TFILEIO.H
|
||||
CompileCpp=1
|
||||
Folder=Project1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
49
GLOBAL.CPP
Normal file
49
GLOBAL.CPP
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "global.h"
|
||||
#include "math.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
RECT RECT16::rect32()
|
||||
{
|
||||
RECT tmp;
|
||||
tmp.left = left;
|
||||
tmp.top = top;
|
||||
tmp.right = right;
|
||||
tmp.bottom = bottom;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
RECT16::RECT16 (const RECT & tmp)
|
||||
{
|
||||
left = tmp.left;
|
||||
top = tmp.top;
|
||||
right = tmp.right;
|
||||
bottom = tmp.bottom;
|
||||
}
|
||||
|
||||
RECT16 & RECT16::operator=(const RECT & tmp)
|
||||
{
|
||||
left = tmp.left;
|
||||
top = tmp.top;
|
||||
right = tmp.right;
|
||||
bottom = tmp.bottom;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
short get_ran (short times,short min,short max)
|
||||
{
|
||||
short store;
|
||||
short i, to_ret = 0;
|
||||
|
||||
if ((max - min + 1) == 0)
|
||||
return 0;
|
||||
for (i = 1; i < times + 1; i++) {
|
||||
store = rand() % (max - min + 1);
|
||||
to_ret = to_ret + min + store;
|
||||
}
|
||||
return to_ret;
|
||||
}
|
||||
|
||||
short s_pow(short x,short y)
|
||||
{
|
||||
return (short) pow((double) x, (double) y);
|
||||
}
|
117
GLOBAL.H
Normal file
117
GLOBAL.H
Normal file
@@ -0,0 +1,117 @@
|
||||
#ifndef _GLOBAL_H
|
||||
#define _GLOBAL_H
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
typedef char Boolean;
|
||||
|
||||
typedef struct tagRECT {
|
||||
long left;
|
||||
long top;
|
||||
long right;
|
||||
long bottom;
|
||||
} RECT;
|
||||
|
||||
struct RECT16
|
||||
{
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
|
||||
RECT rect32();
|
||||
RECT16 () {}
|
||||
RECT16 (const RECT & );
|
||||
RECT16 & operator=(const RECT &);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char x,y;
|
||||
} location;
|
||||
|
||||
typedef struct {
|
||||
short picture;
|
||||
unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over;
|
||||
unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3;
|
||||
} terrain_type_type;
|
||||
|
||||
typedef struct {
|
||||
unsigned char m_num,level,m_name[26];
|
||||
short health,m_health,mp,max_mp;
|
||||
unsigned char armor,skill;
|
||||
short a[3];
|
||||
unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison;
|
||||
short morale,m_morale;
|
||||
short corpse_item,corpse_item_chance;
|
||||
short status[15];
|
||||
unsigned char direction,immunities,x_width,y_width,radiate_1,radiate_2;
|
||||
unsigned char default_attitude,summon_type,default_facial_pic,res1,res2,res3;
|
||||
short picture_num;
|
||||
} monster_record_type;
|
||||
|
||||
typedef struct {
|
||||
short ter_type,item_num[10],item_odds[10],property;
|
||||
} item_storage_shortcut_type;
|
||||
|
||||
typedef struct {
|
||||
location horse_loc,horse_loc_in_sec,horse_sector;
|
||||
short which_town;
|
||||
Boolean exists,property;
|
||||
} horse_record_type;
|
||||
|
||||
typedef struct {
|
||||
location boat_loc,boat_loc_in_sec,boat_sector;
|
||||
short which_town;
|
||||
Boolean exists,property;
|
||||
} boat_record_type;
|
||||
|
||||
typedef struct {
|
||||
short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto;
|
||||
} special_node_type;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char flag1, flag2, flag3, flag4;
|
||||
unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns;
|
||||
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
||||
unsigned char town_size[200];
|
||||
unsigned char town_hidden[200],a;
|
||||
short flag_a;
|
||||
short intro_mess_pic,intro_mess_len;
|
||||
location where_start,out_sec_start,out_start;
|
||||
short which_town_start;
|
||||
short flag_b;
|
||||
short town_data_size[200][5];
|
||||
short town_to_add_to[10];
|
||||
short flag_to_add_to_town[10][2];
|
||||
short flag_c;
|
||||
short out_data_size[100][2];
|
||||
RECT16 store_item_rects[3];
|
||||
short store_item_towns[3];
|
||||
short flag_e;
|
||||
short special_items[50];
|
||||
short special_item_special[50];
|
||||
short rating,uses_custom_graphics;
|
||||
short flag_f;
|
||||
monster_record_type scen_monsters[256];
|
||||
boat_record_type scen_boats[30];
|
||||
horse_record_type scen_horses[30];
|
||||
short flag_g;
|
||||
terrain_type_type ter_types[256];
|
||||
short scenario_timer_times[20];
|
||||
short scenario_timer_specs[20];
|
||||
short flag_h;
|
||||
special_node_type scen_specials[256];
|
||||
item_storage_shortcut_type storage_shortcuts[10];
|
||||
short flag_d;
|
||||
unsigned char scen_str_len[300];
|
||||
short flag_i;
|
||||
location last_out_edited;
|
||||
short last_town_edited;
|
||||
|
||||
} scenario_data_type;
|
||||
|
||||
short get_ran (short times,short min,short max);
|
||||
short s_pow(short x,short y);
|
||||
#endif
|
385
TFILEIO.CPP
Normal file
385
TFILEIO.CPP
Normal file
@@ -0,0 +1,385 @@
|
||||
#include <iostream>
|
||||
#include "Global.h"
|
||||
#include "TFILEIO.h"
|
||||
|
||||
extern scenario_data_type scenario;
|
||||
short jl = 0;
|
||||
|
||||
// outdoor_record_type current_terrain;
|
||||
Boolean cur_scen_is_win = 1;
|
||||
|
||||
|
||||
|
||||
void print_write_position ();
|
||||
|
||||
short wd_to_pwd(char *str)
|
||||
{
|
||||
char pwd[8] = "aaaaaa";
|
||||
short i;
|
||||
long val = 0,pow[6] = {1,10,100,1000,9999,99999};
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (str[i] == 0)
|
||||
i = 6;
|
||||
else {
|
||||
if ((str[i] >= 65) && (str[i] <= 90))
|
||||
pwd[i] = str[i] + 32;
|
||||
else if ((str[i] >= 48) && (str[i] <= 57))
|
||||
pwd[i] = str[i] + 49;
|
||||
else if ((str[i] >= 97) && (str[i] <= 122))
|
||||
pwd[i] = str[i];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
val = val + pow[i] * (long) (pwd[i] - 97);
|
||||
val = val % 30000;
|
||||
return (short) val;
|
||||
}
|
||||
|
||||
short town_s(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
k = k * k * k;
|
||||
jl = jl * 54;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k + 51;
|
||||
k = k % 3000;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k * scenario.num_towns;
|
||||
k = k % 10000;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k + 10000;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
short init_data(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
k = k * k;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k + 51;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k % 3000;
|
||||
jl = jl * 54;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k * 82;
|
||||
k = k % 10000;
|
||||
k = k + 10000;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
short out_s(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
k = k * k * k;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k + scenario.out_data_size[0][1];
|
||||
k = k % 3000;
|
||||
k = k * 4;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
jl = jl * 54;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k % 10000;
|
||||
k = k + 4;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
short str_size_1(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
k = k * k;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k + scenario.scen_str_len[0] + scenario.scen_str_len[1] + scenario.scen_str_len[2];
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k % 3000;
|
||||
jl = jl * 54;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k * 4;
|
||||
k = k % 5000;
|
||||
k = k - 9099;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
short str_size_2(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k * k * k * k;
|
||||
jl = jl * 54;
|
||||
k = k + 80;
|
||||
k = k % 3000;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k * scenario.out_width * scenario.out_height;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k % 3124;
|
||||
k = k - 5426;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
short str_size_3(short flag)
|
||||
{
|
||||
long k = 0;
|
||||
|
||||
k = (long) flag;
|
||||
k = k * (scenario.town_data_size[0][0] + scenario.town_data_size[0][1] + scenario.town_data_size[0][2] + scenario.town_data_size[0][3]);
|
||||
k = k + 80;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k % 3000;
|
||||
jl = jl * 2 + 1234 + k;
|
||||
k = k * 45;
|
||||
jl = jl * 54;
|
||||
jl = jl * jl + 84 + k;
|
||||
k = k % 887;
|
||||
k = k + 9452;
|
||||
|
||||
return (short) k;
|
||||
}
|
||||
|
||||
Boolean save_scenario(char * argv[])
|
||||
{
|
||||
Boolean file_ok = FALSE;
|
||||
FILE *pFile;
|
||||
char error;
|
||||
|
||||
pFile = fopen(argv[1], "rb+");
|
||||
|
||||
if(pFile == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
short pass = wd_to_pwd(argv[2]); //set the password variables
|
||||
scenario.flag_a = sizeof(scenario_data_type) + get_ran(1,-1000,1000);
|
||||
scenario.flag_b=town_s(pass);
|
||||
scenario.flag_c=out_s(pass);
|
||||
scenario.flag_e=str_size_1(pass);
|
||||
scenario.flag_f=str_size_2(pass);
|
||||
scenario.flag_h=str_size_3(pass);
|
||||
scenario.flag_g = 10000 + get_ran(1,0,5000);
|
||||
scenario.flag_d=init_data(pass);
|
||||
/* printf("flag b : %d\nflag c : %d\n flag e : %d \n flag f : %d \n flag h : %d\n flag d : %d\n",town_s(pass),out_s(pass),str_size_1(pass),str_size_2(pass),str_size_3(pass),init_data(pass));*/
|
||||
|
||||
if(cur_scen_is_win == FALSE)//if Mac made scenario flip it back
|
||||
port_scenario();
|
||||
|
||||
if((error = fwrite(&scenario, sizeof(scenario_data_type),1, pFile)) != 1 )
|
||||
{
|
||||
fclose(pFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Boolean load_scenario(char * argv[])
|
||||
{
|
||||
Boolean file_ok = FALSE;
|
||||
FILE *pFile;
|
||||
char error;
|
||||
|
||||
|
||||
pFile = fopen(argv[1], "rb");
|
||||
|
||||
if(pFile == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if((error = fread(&scenario, sizeof(scenario_data_type),1, pFile)) != 1 )
|
||||
{
|
||||
fclose(pFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((scenario.flag1 == 10) && (scenario.flag2 == 20)
|
||||
&& (scenario.flag3 == 30)
|
||||
&& (scenario.flag4 == 40)) {
|
||||
cur_scen_is_win = FALSE;
|
||||
file_ok = TRUE;
|
||||
port_scenario();
|
||||
}
|
||||
if ((scenario.flag1 == 20) && (scenario.flag2 == 40)
|
||||
&& (scenario.flag3 == 60)
|
||||
&& (scenario.flag4 == 80)) {
|
||||
|
||||
cur_scen_is_win = TRUE;
|
||||
file_ok = TRUE;
|
||||
}
|
||||
if (file_ok == FALSE) {
|
||||
fclose(pFile);
|
||||
printf("This is not a legitimate Blades of Exile scenario.\n","",0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void port_scenario()
|
||||
{
|
||||
short i,j,k,l;
|
||||
|
||||
if (cur_scen_is_win == TRUE)
|
||||
return;
|
||||
|
||||
flip_short(&scenario.flag_a);
|
||||
flip_short(&scenario.flag_b);
|
||||
flip_short(&scenario.flag_c);
|
||||
flip_short(&scenario.flag_d);
|
||||
flip_short(&scenario.flag_e);
|
||||
flip_short(&scenario.flag_f);
|
||||
flip_short(&scenario.flag_g);
|
||||
flip_short(&scenario.flag_h);
|
||||
flip_short(&scenario.flag_i);
|
||||
flip_short(&scenario.intro_mess_pic);
|
||||
flip_short(&scenario.intro_mess_len);
|
||||
flip_short(&scenario.which_town_start);
|
||||
for (i = 0; i < 200; i++)
|
||||
for (j = 0; j < 5; j++)
|
||||
flip_short(&scenario.town_data_size[i][j]);
|
||||
for (i = 0; i < 10; i++)
|
||||
flip_short(&scenario.town_to_add_to[i]);
|
||||
for (i = 0; i < 10; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
flip_short(&scenario.flag_to_add_to_town[i][j]);
|
||||
for (i = 0; i < 100; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
flip_short(&scenario.out_data_size[i][j]);
|
||||
for (i = 0; i < 3; i++)
|
||||
flip_rect(&scenario.store_item_rects[i]);
|
||||
for (i = 0; i < 3; i++)
|
||||
flip_short(&scenario.store_item_towns[i]);
|
||||
for (i = 0; i < 50; i++)
|
||||
flip_short(&scenario.special_items[i]);
|
||||
for (i = 0; i < 50; i++)
|
||||
flip_short(&scenario.special_item_special[i]);
|
||||
flip_short(&scenario.rating);
|
||||
flip_short(&scenario.uses_custom_graphics);
|
||||
for (i = 0; i < 256; i++) {
|
||||
flip_short(&scenario.scen_monsters[i].health);
|
||||
flip_short(&scenario.scen_monsters[i].m_health);
|
||||
flip_short(&scenario.scen_monsters[i].max_mp);
|
||||
flip_short(&scenario.scen_monsters[i].mp);
|
||||
flip_short(&scenario.scen_monsters[i].a[1]);
|
||||
flip_short(&scenario.scen_monsters[i].a[0]);
|
||||
flip_short(&scenario.scen_monsters[i].a[2]);
|
||||
flip_short(&scenario.scen_monsters[i].morale);
|
||||
flip_short(&scenario.scen_monsters[i].m_morale);
|
||||
flip_short(&scenario.scen_monsters[i].corpse_item);
|
||||
flip_short(&scenario.scen_monsters[i].corpse_item_chance);
|
||||
flip_short(&scenario.scen_monsters[i].picture_num);
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
flip_short(&scenario.ter_types[i].picture);
|
||||
}
|
||||
for (i = 0; i < 30; i++) {
|
||||
flip_short(&scenario.scen_boats[i].which_town);
|
||||
}
|
||||
for (i = 0; i < 30; i++) {
|
||||
flip_short(&scenario.scen_horses[i].which_town);
|
||||
}
|
||||
for (i = 0; i < 20; i++)
|
||||
flip_short(&scenario.scenario_timer_times[i]);
|
||||
for (i = 0; i < 20; i++)
|
||||
flip_short(&scenario.scenario_timer_specs[i]);
|
||||
for (i = 0; i < 256; i++) {
|
||||
flip_spec_node(&scenario.scen_specials[i]);
|
||||
}
|
||||
for (i = 0; i < 10; i++) {
|
||||
flip_short(&scenario.storage_shortcuts[i].ter_type);
|
||||
flip_short(&scenario.storage_shortcuts[i].property);
|
||||
for (j = 0; j < 10; j++) {
|
||||
flip_short(&scenario.storage_shortcuts[i].item_num[j]);
|
||||
flip_short(&scenario.storage_shortcuts[i].item_odds[j]);
|
||||
}
|
||||
}
|
||||
flip_short(&scenario.last_town_edited);
|
||||
}
|
||||
|
||||
|
||||
void flip_short(short *s)
|
||||
{
|
||||
char store,*s1, *s2;
|
||||
|
||||
s1 = (char *) s;
|
||||
s2 = s1 + 1;
|
||||
store = *s1;
|
||||
*s1 = *s2;
|
||||
*s2 = store;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void flip_spec_node(special_node_type *spec)
|
||||
{
|
||||
flip_short(&(spec->type));
|
||||
flip_short(&(spec->sd1));
|
||||
flip_short(&(spec->sd2));
|
||||
flip_short(&(spec->pic));
|
||||
flip_short(&(spec->m1));
|
||||
flip_short(&(spec->m2));
|
||||
flip_short(&(spec->ex1a));
|
||||
flip_short(&(spec->ex1b));
|
||||
flip_short(&(spec->ex2a));
|
||||
flip_short(&(spec->ex2b));
|
||||
flip_short(&(spec->jumpto));
|
||||
}
|
||||
|
||||
void alter_rect(RECT *r)
|
||||
{
|
||||
short a;
|
||||
|
||||
a = r->top;
|
||||
r->top = r->left;
|
||||
r->left = a;
|
||||
a = r->bottom;
|
||||
r->bottom = r->right;
|
||||
r->right = a;
|
||||
}
|
||||
|
||||
void flip_rect(RECT *s)
|
||||
{
|
||||
flip_short((short *) &(s->top));
|
||||
flip_short((short *) &(s->bottom));
|
||||
flip_short((short *) &(s->left));
|
||||
flip_short((short *) &(s->right));
|
||||
alter_rect(s);
|
||||
}
|
||||
|
||||
void flip_rect(RECT16 *s)
|
||||
{
|
||||
flip_short((short *) &(s->top));
|
||||
flip_short((short *) &(s->bottom));
|
||||
flip_short((short *) &(s->left));
|
||||
flip_short((short *) &(s->right));
|
||||
alter_rect(s);
|
||||
}
|
||||
|
||||
void alter_rect(RECT16 *r)
|
||||
{
|
||||
short a;
|
||||
|
||||
a = r->top;
|
||||
r->top = r->left;
|
||||
r->left = a;
|
||||
a = r->bottom;
|
||||
r->bottom = r->right;
|
||||
r->right = a;
|
||||
}
|
14
TFILEIO.H
Normal file
14
TFILEIO.H
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _TFILEIO_H
|
||||
#define _TFILEIO_H
|
||||
|
||||
Boolean save_scenario(char * argv[]);
|
||||
Boolean load_scenario(char * argv[]);
|
||||
void port_scenario();
|
||||
void port_item_list();
|
||||
void flip_spec_node(special_node_type *spec);
|
||||
void flip_short(short *s);
|
||||
void alter_rect(RECT *r);
|
||||
void flip_rect(RECT *s);
|
||||
void flip_rect(RECT16 *s);
|
||||
void alter_rect(RECT16 *r);
|
||||
#endif
|
28
main.cpp
Normal file
28
main.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <iostream>
|
||||
#include "global.h"
|
||||
#include "tfileio.h"
|
||||
|
||||
scenario_data_type scenario;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
if (argc != 3){
|
||||
printf("Usage : %s scenname.exs password\nPlease enter the name of the scenario with extension, followed by the password to be set (0 for none)",argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if(load_scenario(argv)== FALSE){
|
||||
printf("Error loading the scenario.\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if(save_scenario(argv)== FALSE){
|
||||
printf("Error writing the scenario.\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if(strcmp("0",argv[2])== 0)
|
||||
printf("The %s scenario's password has been removed.\n",argv[1]);
|
||||
else
|
||||
printf("The %s scenario's password is now %s.\n",argv[1],argv[2]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user