00001 extern "C" {
00002 #include "global.h"
00003 #include "libproto.h"
00004 }
00005
00006 #include <Qt>
00007 #include <QApplication>
00008 #include <QCoreApplication>
00009
00010 #include <CREMainWindow.h>
00011
00012 #include "CREPixmap.h"
00013
00014 int main(int argc, char** argv)
00015 {
00016 QCoreApplication::setOrganizationName("The Legendary Team of Ailesse");
00017 QCoreApplication::setApplicationName("CRE");
00018 QApplication app(argc, argv);
00019
00020 init_globals();
00021 init_library();
00022 read_client_images();
00023 init_artifacts();
00024 init_formulae();
00025 load_treasures();
00026
00027 CREPixmap::init();
00028
00029 CREMainWindow win;
00030 win.show();
00031
00032 return app.exec();
00033 }
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036
00037 extern "C"
00038 {
00039
00044 void draw_ext_info(int, int, const object *, uint8, uint8, const char *txt, const char *)
00045 {
00046 fprintf(logfile, "%s\n", txt);
00047 }
00048
00049 void draw_ext_info_format(
00050 int, int, const object *, uint8,
00051 uint8,
00052 const char *,
00053 const char *old_format,
00054 ...)
00055 {
00056 va_list ap;
00057 va_start(ap, old_format);
00058 vfprintf(logfile, old_format, ap);
00059 va_end(ap);
00060 }
00061
00062
00063 void ext_info_map(int, const mapstruct *, uint8, uint8, const char *, const char *str2)
00064 {
00065 fprintf(logfile, "ext_info_map: %s\n", str2);
00066 }
00067
00068 void move_firewall(object *)
00069 {
00070 }
00071
00072 void emergency_save(int)
00073 {
00074 }
00075
00076 void clean_tmp_files(void)
00077 {
00078 }
00079
00080 void esrv_send_item(object *, object *)
00081 {
00082 }
00083
00084 void dragon_ability_gain(object *, int, int)
00085 {
00086 }
00087
00088 void set_darkness_map(mapstruct *)
00089 {
00090 }
00091
00092 object *find_skill_by_number(object *, int)
00093 {
00094 return NULL;
00095 }
00096
00097 void esrv_del_item(player *, int)
00098 {
00099 }
00100
00101 void esrv_update_item(int, object *, object *)
00102 {
00103 }
00104
00105 void esrv_update_spells(player *)
00106 {
00107 }
00108
00109 void monster_check_apply(object *, object *)
00110 {
00111 }
00112
00113 void trap_adjust(object *, int)
00114 {
00115 }
00116
00117 int execute_event(object *, int , object *, object *, const char *, int )
00118 {
00119 return 0;
00120 }
00121
00122 int execute_global_event(int , ...)
00123 {
00124 return 0;
00125 }
00126
00127
00128 int auto_apply (object *op) {
00129 object *tmp = NULL, *tmp2;
00130 int i;
00131
00132 switch(op->type) {
00133 case SHOP_FLOOR:
00134 if (!HAS_RANDOM_ITEMS(op)) return 0;
00135 do {
00136 i=10;
00137 while((tmp=generate_treasure(op->randomitems,
00138 op->stats.exp?(int)op->stats.exp:MAX(op->map->difficulty, 5)))==NULL&&--i);
00139 if(tmp==NULL)
00140 return 0;
00141 if(QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED)) {
00142 free_object(tmp);
00143 tmp = NULL;
00144 }
00145 } while(!tmp);
00146 tmp->x=op->x;
00147 tmp->y=op->y;
00148 SET_FLAG(tmp,FLAG_UNPAID);
00149 insert_ob_in_map(tmp,op->map,NULL,0);
00150 CLEAR_FLAG(op,FLAG_AUTO_APPLY);
00151 identify(tmp);
00152 break;
00153
00154 case TREASURE:
00155 if (QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))
00156 return 0;
00157 while ((op->stats.hp--)>0)
00158 create_treasure(op->randomitems, op, op->map?GT_ENVIRONMENT:0,
00159 op->stats.exp ? (int)op->stats.exp :
00160 op->map == NULL ? 14: op->map->difficulty,0);
00161
00162
00163
00164
00165
00166
00167 for (tmp=op->inv; tmp; tmp=tmp2) {
00168 tmp2 = tmp->below;
00169 remove_ob(tmp);
00170 if (op->env) insert_ob_in_ob(tmp, op->env);
00171 else free_object(tmp);
00172 }
00173 remove_ob(op);
00174 free_object(op);
00175 break;
00176 }
00177 return tmp ? 1 : 0;
00178 }
00179
00180 void fix_auto_apply(mapstruct*)
00181 {
00182 }
00183
00184 }
00185 #endif