ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/common/plugin_common.C
(Generate patch)

Comparing deliantra/server/plugins/common/plugin_common.C (file contents):
Revision 1.2 by root, Sun Sep 3 08:05:39 2006 UTC vs.
Revision 1.5 by pippijn, Mon Dec 11 19:46:46 2006 UTC

61static f_plug_api cfapiObject_merge = NULL; 61static f_plug_api cfapiObject_merge = NULL;
62static f_plug_api cfapiObject_distance = NULL; 62static f_plug_api cfapiObject_distance = NULL;
63static f_plug_api cfapiObject_update = NULL; 63static f_plug_api cfapiObject_update = NULL;
64static f_plug_api cfapiObject_clear = NULL; 64static f_plug_api cfapiObject_clear = NULL;
65static f_plug_api cfapiObject_reset = NULL; 65static f_plug_api cfapiObject_reset = NULL;
66static f_plug_api cfapiCheck_inventory = NULL; 66/* static f_plug_api cfapiCheck_inventory = NULL; */
67static f_plug_api cfapiObject_activate_rune = NULL; 67static f_plug_api cfapiObject_activate_rune = NULL;
68static f_plug_api cfapiObject_check_trigger = NULL; 68static f_plug_api cfapiObject_check_trigger = NULL;
69static f_plug_api cfapiObject_query_money = NULL; 69static f_plug_api cfapiObject_query_money = NULL;
70static f_plug_api cfapiObject_query_cost = NULL; 70static f_plug_api cfapiObject_query_cost = NULL;
71static f_plug_api cfapiObject_cast = NULL; 71static f_plug_api cfapiObject_cast = NULL;
180 GET_HOOK( cfapiRegion_get_property, "cfapi_region_get_property", z ); 180 GET_HOOK( cfapiRegion_get_property, "cfapi_region_get_property", z );
181 return 1; 181 return 1;
182} 182}
183 183
184/* Should get replaced by tons of more explicit wrappers */ 184/* Should get replaced by tons of more explicit wrappers */
185void* cf_map_get_property(mapstruct* map, int propcode) 185void* cf_map_get_property(maptile* map, int propcode)
186{ 186{
187 int val; 187 int val;
188 return cfapiMap_get_property(&val, propcode, map); 188 return cfapiMap_get_property(&val, propcode, map);
189} 189}
190/* Should get replaced by tons of more explicit wrappers */ 190/* Should get replaced by tons of more explicit wrappers */
191void* cf_map_set_int_property(mapstruct* map, int propcode, int value) 191void* cf_map_set_int_property(maptile* map, int propcode, int value)
192{ 192{
193 int val; 193 int val;
194 return cfapiMap_set_property(&val, map, propcode,value); 194 return cfapiMap_set_property(&val, map, propcode,value);
195} 195}
196/* Should get replaced by tons of more explicit wrappers */ 196/* Should get replaced by tons of more explicit wrappers */
266{ 266{
267 int val; 267 int val;
268 /* return *(int*)cfapiObject_transfer(&val,op,1,x,y,op->map);*/ 268 /* return *(int*)cfapiObject_transfer(&val,op,1,x,y,op->map);*/
269 return *(int*)cfapiObject_transfer(&val,op,0,x,y,r,orig); 269 return *(int*)cfapiObject_transfer(&val,op,0,x,y,r,orig);
270} 270}
271int cf_object_change_map(object* op, int x, int y, mapstruct* map) 271int cf_object_change_map(object* op, int x, int y, maptile* map)
272{ 272{
273 int val; 273 int val;
274 return *(int*)cfapiObject_transfer(&val,op,1,x,y,map); 274 return *(int*)cfapiObject_transfer(&val,op,1,x,y,map);
275 /*cfapiObject_transfer(&val,op,1,x,y,map); 275 /*cfapiObject_transfer(&val,op,1,x,y,map);
276 return 0;*/ 276 return 0;*/
277} 277}
278object* cf_map_get_object_at(mapstruct* m, int x, int y) 278object* cf_map_get_object_at(maptile* m, int x, int y)
279{ 279{
280 int val; 280 int val;
281 return (object*) cfapiMap_get_object_at(&val, m, x, y); 281 return (object*) cfapiMap_get_object_at(&val, m, x, y);
282} 282}
283void cf_map_message(mapstruct* m, char* msg, int color) 283void cf_map_message(maptile* m, char* msg, int color)
284{ 284{
285 int val; 285 int val;
286 cfapiMap_message(&val, m, msg, color); 286 cfapiMap_message(&val, m, msg, color);
287} 287}
288object* cf_object_clone(object* op, int clonetype) 288object* cf_object_clone(object* op, int clonetype)
361{ 361{
362 int val; 362 int val;
363 cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_PARTY, party); 363 cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_PARTY, party);
364} 364}
365 365
366mapstruct* cf_map_get_map( char* name ) 366maptile* cf_map_get_map( char* name )
367{ 367{
368 int val; 368 int val;
369 return (mapstruct*) cfapiMap_get_map( &val, 1, name, 0); 369 return (maptile*) cfapiMap_get_map( &val, 1, name, 0);
370} 370}
371mapstruct* cf_map_get_first(void) 371maptile* cf_map_get_first(void)
372{ 372{
373 int val; 373 int val;
374 return (mapstruct*) cfapiMap_get_map( &val, 3); 374 return (maptile*) cfapiMap_get_map( &val, 3);
375} 375}
376int cf_object_query_money( object* op) 376int cf_object_query_money( object* op)
377{ 377{
378 int val; 378 int val;
379 return *(int*)cfapiObject_query_money( &val, op); 379 return *(int*)cfapiObject_query_money( &val, op);
565 } 565 }
566 566
567 return (object*) cfapiObject_insert( &type, ob, 3, where ); 567 return (object*) cfapiObject_insert( &type, ob, 3, where );
568} 568}
569 569
570object* cf_map_insert_object_there(mapstruct* where, object* op, object* originator, int flags) 570object* cf_map_insert_object_there(maptile* where, object* op, object* originator, int flags)
571{ 571{
572 int val; 572 int val;
573 return (object*)cfapiObject_insert(&val, op, 1, where, originator, flags); 573 return (object*)cfapiObject_insert(&val, op, 1, where, originator, flags);
574} 574}
575object* cf_map_insert_object(mapstruct* where , object* op, int x, int y) 575object* cf_map_insert_object(maptile* where , object* op, int x, int y)
576{ 576{
577 int type; 577 int type;
578 return (object*) cfapiObject_insert( &type, op, 0, where, NULL, 0 , x, y); 578 return (object*) cfapiObject_insert( &type, op, 0, where, NULL, 0 , x, y);
579} 579}
580int cf_object_teleport( object* op, mapstruct* map, int x, int y ) 580int cf_object_teleport( object* op, maptile* map, int x, int y )
581{ 581{
582 int val; 582 int val;
583 return *( int* )cfapiObject_teleport( &val, op, map, x, y ); 583 return *( int* )cfapiObject_teleport( &val, op, map, x, y );
584} 584}
585object* cf_map_present_arch_by_name(const char* str, mapstruct* map, int nx, int ny) 585object* cf_map_present_arch_by_name(const char* str, maptile* map, int nx, int ny)
586{ 586{
587 int val; 587 int val;
588 return (object*)cfapiMap_present_arch_by_name(&val, str,map,nx,ny); 588 return (object*)cfapiMap_present_arch_by_name(&val, str,map,nx,ny);
589} 589}
590 590
591static int cf_get_map_int_property(mapstruct* map, int property) 591static int cf_get_map_int_property(maptile* map, int property)
592{ 592{
593 int type; 593 int type;
594 void* rv; 594 void* rv;
595 rv = cfapiMap_get_property(&type, property, map); 595 rv = cfapiMap_get_property(&type, property, map);
596 if ( !rv || type != CFAPI_INT ) 596 if ( !rv || type != CFAPI_INT )
597 return PLUGIN_ERROR_INT; 597 return PLUGIN_ERROR_INT;
598 return *(int*)rv; 598 return *(int*)rv;
599} 599}
600 600
601int cf_map_get_difficulty(mapstruct* map) 601int cf_map_get_difficulty(maptile* map)
602{ 602{
603 return cf_get_map_int_property(map,CFAPI_MAP_PROP_DIFFICULTY); 603 return cf_get_map_int_property(map,CFAPI_MAP_PROP_DIFFICULTY);
604} 604}
605 605
606int cf_map_get_reset_time(mapstruct* map) 606int cf_map_get_reset_time(maptile* map)
607{ 607{
608 return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIME); 608 return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIME);
609} 609}
610 610
611int cf_map_get_reset_timeout(mapstruct* map) 611int cf_map_get_reset_timeout(maptile* map)
612{ 612{
613 return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIMEOUT); 613 return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIMEOUT);
614} 614}
615 615
616int cf_map_get_players(mapstruct* map) 616int cf_map_get_players(maptile* map)
617{ 617{
618 return cf_get_map_int_property(map,CFAPI_MAP_PROP_PLAYERS); 618 return cf_get_map_int_property(map,CFAPI_MAP_PROP_PLAYERS);
619} 619}
620 620
621int cf_map_get_darkness(mapstruct* map) 621int cf_map_get_darkness(maptile* map)
622{ 622{
623 return cf_get_map_int_property(map,CFAPI_MAP_PROP_DARKNESS); 623 return cf_get_map_int_property(map,CFAPI_MAP_PROP_DARKNESS);
624} 624}
625 625
626int cf_map_get_width(mapstruct* map) 626int cf_map_get_width(maptile* map)
627{ 627{
628 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WIDTH); 628 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WIDTH);
629} 629}
630 630
631int cf_map_get_height(mapstruct* map) 631int cf_map_get_height(maptile* map)
632{ 632{
633 return cf_get_map_int_property(map,CFAPI_MAP_PROP_HEIGHT); 633 return cf_get_map_int_property(map,CFAPI_MAP_PROP_HEIGHT);
634} 634}
635 635
636int cf_map_get_enter_x(mapstruct* map) 636int cf_map_get_enter_x(maptile* map)
637{ 637{
638 return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_X); 638 return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_X);
639} 639}
640 640
641int cf_map_get_enter_y(mapstruct* map) 641int cf_map_get_enter_y(maptile* map)
642{ 642{
643 return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_Y); 643 return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_Y);
644} 644}
645 645
646int cf_map_get_temperature(mapstruct* map) 646int cf_map_get_temperature(maptile* map)
647{ 647{
648 return cf_get_map_int_property(map,CFAPI_MAP_PROP_TEMPERATURE); 648 return cf_get_map_int_property(map,CFAPI_MAP_PROP_TEMPERATURE);
649} 649}
650 650
651int cf_map_get_pressure(mapstruct* map) 651int cf_map_get_pressure(maptile* map)
652{ 652{
653 return cf_get_map_int_property(map,CFAPI_MAP_PROP_PRESSURE); 653 return cf_get_map_int_property(map,CFAPI_MAP_PROP_PRESSURE);
654} 654}
655 655
656int cf_map_get_humidity(mapstruct* map) 656int cf_map_get_humidity(maptile* map)
657{ 657{
658 return cf_get_map_int_property(map,CFAPI_MAP_PROP_HUMIDITY); 658 return cf_get_map_int_property(map,CFAPI_MAP_PROP_HUMIDITY);
659} 659}
660 660
661int cf_map_get_windspeed(mapstruct* map) 661int cf_map_get_windspeed(maptile* map)
662{ 662{
663 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDSPEED); 663 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDSPEED);
664} 664}
665 665
666int cf_map_get_winddir(mapstruct* map) 666int cf_map_get_winddir(maptile* map)
667{ 667{
668 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDDIR); 668 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDDIR);
669} 669}
670 670
671int cf_map_get_sky(mapstruct* map) 671int cf_map_get_sky(maptile* map)
672{ 672{
673 return cf_get_map_int_property(map,CFAPI_MAP_PROP_SKY); 673 return cf_get_map_int_property(map,CFAPI_MAP_PROP_SKY);
674} 674}
675 675
676int cf_map_get_wpartx(mapstruct* map) 676int cf_map_get_wpartx(maptile* map)
677{ 677{
678 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTX); 678 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTX);
679} 679}
680 680
681int cf_map_get_wparty(mapstruct* map) 681int cf_map_get_wparty(maptile* map)
682{ 682{
683 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTY); 683 return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTY);
684} 684}
685 685
686void cf_object_update( object* op, int flags) 686void cf_object_update( object* op, int flags)
696char* cf_strdup_local(char* txt) 696char* cf_strdup_local(char* txt)
697{ 697{
698 int val; 698 int val;
699 return (char*)cfapiSystem_strdup_local(&val, txt); 699 return (char*)cfapiSystem_strdup_local(&val, txt);
700} 700}
701int cf_map_get_flags( mapstruct* map, mapstruct** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny ) 701int cf_map_get_flags( maptile* map, maptile** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny )
702{ 702{
703 int val; 703 int val;
704 return *( int* )cfapiMap_get_flags(&val, map, nmap, x, y, nx, ny); 704 return *( int* )cfapiMap_get_flags(&val, map, nmap, x, y, nx, ny);
705} 705}
706int cf_find_animation(char* txt) 706int cf_find_animation(char* txt)
826const char* cf_region_get_message(region* reg) 826const char* cf_region_get_message(region* reg)
827{ 827{
828 int val; 828 int val;
829 return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_MESSAGE); 829 return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_MESSAGE);
830} 830}
831
832#ifdef WIN32
833int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
834{
835 /* Get the time, if they want it */
836 if (time_Info != NULL) {
837 time_Info->tv_sec = time(NULL);
838 time_Info->tv_usec = timeGetTime()*1000;
839 }
840 /* Get the timezone, if they want it */
841 if (timezone_Info != NULL) {
842 _tzset();
843 timezone_Info->tz_minuteswest = _timezone;
844 timezone_Info->tz_dsttime = _daylight;
845 }
846 /* And return */
847 return 0;
848}
849#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines